Commit 6976245f by HlQ

[add]

1.项目交付日志提醒添加提醒日期字段
2.合同列表支持按合同编号模糊查询
[fix] 修复项目交付日志关联合同销售人不正确的 bug
1 parent 6d41ca8e
...@@ -54,8 +54,10 @@ public class DeliverLogController { ...@@ -54,8 +54,10 @@ public class DeliverLogController {
@GetMapping("/notify") @GetMapping("/notify")
@SaCheckPermission(value = "deliverLog:notify", orRole = "admin") @SaCheckPermission(value = "deliverLog:notify", orRole = "admin")
public String logNotify(String[] userIdStr) { public String logNotify(String[] userIdStr, String dateStr) {
return deliverLogService.logNotify(userIdStr) ? "钉钉提醒成功" : "钉钉提醒失败"; Assert.notEmpty(userIdStr, "未选择提醒人");
Assert.notBlank(dateStr, "未选择提醒日期");
return deliverLogService.logNotify(userIdStr, dateStr) ? "钉钉提醒成功" : "钉钉提醒失败";
} }
} }
...@@ -32,7 +32,7 @@ public class Contract { ...@@ -32,7 +32,7 @@ public class Contract {
/** /**
* 合同编号 * 合同编号
*/ */
@TableField(value = "contract_no") @TableField(value = "contract_no", condition = SqlCondition.LIKE)
private String contractNo; private String contractNo;
/** /**
......
...@@ -19,6 +19,6 @@ public interface IDeliverLogService extends MPJBaseService<DeliverLog> { ...@@ -19,6 +19,6 @@ public interface IDeliverLogService extends MPJBaseService<DeliverLog> {
String update(DeliverLogDTO dto); String update(DeliverLogDTO dto);
Boolean logNotify(String[] userIdStr); Boolean logNotify(String[] userIdStr, String dateStr);
} }
...@@ -44,15 +44,20 @@ public class DeliverLogServiceImpl extends MPJBaseServiceImpl<DeliverLogMapper, ...@@ -44,15 +44,20 @@ public class DeliverLogServiceImpl extends MPJBaseServiceImpl<DeliverLogMapper,
.selectAll(DeliverLog.class) .selectAll(DeliverLog.class)
.selectAs(Store::getName, DeliverLogVO::getStoreName) .selectAs(Store::getName, DeliverLogVO::getStoreName)
.selectAs(RStoreConfederate::getName, DeliverLogVO::getConfederateName) .selectAs(RStoreConfederate::getName, DeliverLogVO::getConfederateName)
.selectAs(User::getUsername, DeliverLogVO::getUserName) .selectAs(User::getUsername, DeliverLogVO::getUsername)
.selectAs(Contract::getSaleName, DeliverLogVO::getContractSaleName) .selectCollection(RContractUser.class, DeliverLogVO::getContractUserList,
map -> map.result(RContractUser::getUsername).result(RContractUser::getEnterDate))
.leftJoin(Store.class, Store::getId, DeliverLog::getStoreId) .leftJoin(Store.class, Store::getId, DeliverLog::getStoreId)
.leftJoin(RStoreConfederate.class, RStoreConfederate::getId, DeliverLog::getConfederateId) .leftJoin(RStoreConfederate.class, RStoreConfederate::getId, DeliverLog::getConfederateId)
.leftJoin(User.class, User::getId, DeliverLog::getUserId) .leftJoin(User.class, User::getId, DeliverLog::getUserId)
.leftJoin(Contract.class, Contract::getContractNo, DeliverLog::getContractNo) .leftJoin(RContractUser.class, RContractUser::getContractNo, DeliverLog::getContractNo)
.between(DeliverLog::getLogDate, dto.getLogDateStart(), dto.getLogDateEnd()); .between(DeliverLog::getLogDate, dto.getLogDateStart(), dto.getLogDateEnd());
var deliverLogList = this.selectJoinList(DeliverLogVO.class, wrapper); var deliverLogList = this.selectJoinList(DeliverLogVO.class, wrapper);
return deliverLogList.stream().collect(Collectors.groupingBy(DeliverLogVO::getUserName, deliverLogList.forEach(log -> log.getContractUserList().stream()
.max(Comparator.comparing(RContractUser::getEnterDate))
.ifPresent(rContractUser -> log.setContractSaleName(rContractUser.getUsername()))
);
return deliverLogList.stream().collect(Collectors.groupingBy(DeliverLogVO::getUsername,
Collectors.groupingBy(v -> DateUtil.formatDate(v.getLogDate()), () -> new TreeMap<String, Collectors.groupingBy(v -> DateUtil.formatDate(v.getLogDate()), () -> new TreeMap<String,
List<DeliverLogVO>>(Comparator.reverseOrder()), Collectors.toList()))); List<DeliverLogVO>>(Comparator.reverseOrder()), Collectors.toList())));
} }
...@@ -63,7 +68,7 @@ public class DeliverLogServiceImpl extends MPJBaseServiceImpl<DeliverLogMapper, ...@@ -63,7 +68,7 @@ public class DeliverLogServiceImpl extends MPJBaseServiceImpl<DeliverLogMapper,
.selectAll(DeliverLog.class) .selectAll(DeliverLog.class)
.selectAs(Store::getName, DeliverLogVO::getStoreName) .selectAs(Store::getName, DeliverLogVO::getStoreName)
.selectAs(RStoreConfederate::getName, DeliverLogVO::getConfederateName) .selectAs(RStoreConfederate::getName, DeliverLogVO::getConfederateName)
.selectAs(User::getUsername, DeliverLogVO::getUserName) .selectAs(User::getUsername, DeliverLogVO::getUsername)
.selectAs(Contract::getSaleName, DeliverLogVO::getContractSaleName) .selectAs(Contract::getSaleName, DeliverLogVO::getContractSaleName)
.leftJoin(Store.class, Store::getId, DeliverLog::getStoreId) .leftJoin(Store.class, Store::getId, DeliverLog::getStoreId)
.leftJoin(RStoreConfederate.class, RStoreConfederate::getId, DeliverLog::getConfederateId) .leftJoin(RStoreConfederate.class, RStoreConfederate::getId, DeliverLog::getConfederateId)
...@@ -114,8 +119,8 @@ public class DeliverLogServiceImpl extends MPJBaseServiceImpl<DeliverLogMapper, ...@@ -114,8 +119,8 @@ public class DeliverLogServiceImpl extends MPJBaseServiceImpl<DeliverLogMapper,
} }
@Override @Override
public Boolean logNotify(String[] userIdStr) { public Boolean logNotify(String[] userIdStr, String dateStr) {
var pushRes = dingMod.workMsg(buildMsg1(userIdStr)); var pushRes = dingMod.workMsg(buildMsg1(userIdStr, dateStr));
return StrUtil.containsIgnoreCase(pushRes, "ok"); return StrUtil.containsIgnoreCase(pushRes, "ok");
} }
...@@ -147,7 +152,7 @@ public class DeliverLogServiceImpl extends MPJBaseServiceImpl<DeliverLogMapper, ...@@ -147,7 +152,7 @@ public class DeliverLogServiceImpl extends MPJBaseServiceImpl<DeliverLogMapper,
return jsonObj; return jsonObj;
} }
JSONObject buildMsg1(String[] userIdStr) { JSONObject buildMsg1(String[] userIdStr, String dateStr) {
var jsonObj = JSONUtil.ofObj() var jsonObj = JSONUtil.ofObj()
.set("agent_id", 2358374016L) .set("agent_id", 2358374016L)
.set("userid_list", String.join(",", userIdStr)); .set("userid_list", String.join(",", userIdStr));
...@@ -156,8 +161,9 @@ public class DeliverLogServiceImpl extends MPJBaseServiceImpl<DeliverLogMapper, ...@@ -156,8 +161,9 @@ public class DeliverLogServiceImpl extends MPJBaseServiceImpl<DeliverLogMapper,
var content = new JSONObject(); var content = new JSONObject();
content.set("title", "项目交付日志提醒") content.set("title", "项目交付日志提醒")
.set("text", StrUtil.format(""" .set("text", StrUtil.format("""
#### 您的日志还未提交,请尽快提交! #### 您的日志还未提交,请尽快提交!
#### 发送时间:{}""", DateUtil.now())); #### 未提交日志日期:{}
#### 发送时间:{}""", dateStr, DateUtil.now()));
msg.set("msgtype", "markdown").set("markdown", content); msg.set("msgtype", "markdown").set("markdown", content);
jsonObj.set("msg", msg); jsonObj.set("msg", msg);
......
...@@ -3,8 +3,10 @@ package vion.vo; ...@@ -3,8 +3,10 @@ package vion.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import vion.model.RContractUser;
import java.util.Date; import java.util.Date;
import java.util.List;
@Getter @Getter
@Setter @Setter
...@@ -27,12 +29,13 @@ public class DeliverLogVO { ...@@ -27,12 +29,13 @@ public class DeliverLogVO {
*/ */
private String contractNo; private String contractNo;
private String contractSaleName; private String contractSaleName;
private List<RContractUser> contractUserList;
/** /**
* 日志人 * 日志人
*/ */
private Long userId; private Long userId;
private String userName; private String username;
/** /**
* 日志日期 * 日志日期
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!