|
@@ -5,21 +5,30 @@ import com.zjugis.business.bean.dto.ContractMessageDto;
|
|
|
import com.zjugis.business.bean.entity.Contract;
|
|
|
import com.zjugis.business.bean.entity.ContractMessage;
|
|
|
import com.zjugis.business.bean.entity.ContractReturnMoney;
|
|
|
+import com.zjugis.business.bean.entity.Project;
|
|
|
import com.zjugis.business.bean.response.ContractMessageResponse;
|
|
|
import com.zjugis.business.constants.ContractMessageContants;
|
|
|
import com.zjugis.business.mapper.ContractMessageMapper;
|
|
|
+import com.zjugis.business.mapper.ProjectMapper;
|
|
|
import com.zjugis.business.service.ContractMessageService;
|
|
|
import com.zjugis.business.service.ContractService;
|
|
|
+import com.zjugis.framework.common.pojo.CommonResult;
|
|
|
import com.zjugis.module.infra.api.ding.DingApi;
|
|
|
import com.zjugis.module.infra.api.ding.dto.DingMessageDto;
|
|
|
+import com.zjugis.module.system.api.dept.DeptApi;
|
|
|
+import com.zjugis.module.system.api.dept.dto.DeptRespDTO;
|
|
|
+import com.zjugis.module.system.api.user.AdminUserApi;
|
|
|
+import com.zjugis.module.system.api.user.dto.AdminUserRespDTO;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -36,9 +45,21 @@ public class ContractMessageServiceImpl implements ContractMessageService {
|
|
|
@Autowired
|
|
|
private ContractService contractService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ProjectMapper projectMapper;
|
|
|
+
|
|
|
@Autowired
|
|
|
private DingApi dingApi;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private DeptApi deptApi;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AdminUserApi adminUserApi;
|
|
|
+
|
|
|
+ @Value("managerDeptId")
|
|
|
+ private String managerDeptId;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public Page<ContractMessageResponse> page(ContractMessageDto contractMessageDto) {
|
|
@@ -113,8 +134,45 @@ public class ContractMessageServiceImpl implements ContractMessageService {
|
|
|
message.setMessageContent(content);
|
|
|
int insert = contractMessageMapper.insert(message);
|
|
|
if(insert> 0){
|
|
|
- dingApi.sendMessage(new DingMessageDto(contract.getAreaManagerId(),content));
|
|
|
+ sendMsg(contract,content);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void sendMsg(Contract contract,String content) {
|
|
|
+ Project project = projectMapper.selectById(contract.getProjectId());
|
|
|
+ if(StringUtils.isNotBlank(project.getXmjlId())) {
|
|
|
+ dingApi.sendMessage(new DingMessageDto(project.getXmjlId(), content));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(project.getZrbmId())) {
|
|
|
+ CommonResult<DeptRespDTO> result = deptApi.getDept(project.getZrbmId());
|
|
|
+ DeptRespDTO dept = result.getCheckedData();
|
|
|
+ if (dept != null && StringUtils.isNotBlank(dept.getLeaderUserId())) {
|
|
|
+ dingApi.sendMessage(new DingMessageDto(dept.getLeaderUserId(), content));
|
|
|
+ CommonResult<AdminUserRespDTO> userRes = adminUserApi.getUserLeader(dept.getLeaderUserId());
|
|
|
+ AdminUserRespDTO userLeader = userRes.getCheckedData();
|
|
|
+ if(userLeader != null){
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ DeptRespDTO deptRespDTO = deptApi.getSecondDeptByDeptId(project.getZrbmId()).getCheckedData();
|
|
|
+ if (deptRespDTO != null && StringUtils.isNotBlank(deptRespDTO.getLeaderUserId())) {
|
|
|
+ dingApi.sendMessage(new DingMessageDto(deptRespDTO.getLeaderUserId(), content));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(project.getXsryId())) {
|
|
|
+ dingApi.sendMessage(new DingMessageDto(project.getXsryId(), content));
|
|
|
+ CommonResult<DeptRespDTO> xsDeptRes = deptApi.getDept(project.getXsryId());
|
|
|
+ DeptRespDTO xsDept = xsDeptRes.getCheckedData();
|
|
|
+ if (xsDept != null && StringUtils.isNotBlank(xsDept.getLeaderUserId())) {
|
|
|
+ dingApi.sendMessage(new DingMessageDto(xsDept.getLeaderUserId(), content));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ CommonResult<List<AdminUserRespDTO>> userListRes = adminUserApi.getUserListByDeptIds(Collections.singletonList(managerDeptId));
|
|
|
+ List<AdminUserRespDTO> list = userListRes.getCheckedData();
|
|
|
+ for (AdminUserRespDTO user : list) {
|
|
|
+ dingApi.sendMessage(new DingMessageDto(user.getId(), content));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|