|
|
|
@ -17,7 +17,10 @@ import com.op.common.security.utils.SecurityUtils;
|
|
|
|
|
import com.op.quality.domain.*;
|
|
|
|
|
import com.op.quality.mapper.*;
|
|
|
|
|
import com.op.quality.service.*;
|
|
|
|
|
import com.op.system.api.RemoteOpenService;
|
|
|
|
|
import com.op.system.api.domain.SysNoticeGroup;
|
|
|
|
|
import com.op.system.api.domain.SysUser;
|
|
|
|
|
import com.op.system.api.domain.dto.WechartDTO;
|
|
|
|
|
import com.op.system.api.domain.quality.QcUserMaterialDTO;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
@ -66,8 +69,8 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
|
|
|
|
|
@Autowired
|
|
|
|
|
private IQcCheckTaskUserService qcCheckTaskUserService;
|
|
|
|
|
|
|
|
|
|
// @Autowired
|
|
|
|
|
// private RemoteOpenService remoteOpenService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private RemoteOpenService remoteOpenService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private QMSFileMapper qmsFileMapper;
|
|
|
|
@ -192,6 +195,7 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
|
|
|
|
|
//String typeCode = qcCheckTaskIncomeMapper.getTypeCode(qcCheckTaskIncome.getCheckType());
|
|
|
|
|
qcCheckTaskIncome.setTypeCode("material");//大检验节点
|
|
|
|
|
/**qc_task_user start**/
|
|
|
|
|
List<QcUserMaterialDTO> users = null;
|
|
|
|
|
if(StringUtils.isNotBlank(qcCheckTaskIncome.getCheckManName())){//管理系统创建任务
|
|
|
|
|
String checkManName = qcCheckTaskIncome.getCheckManName();
|
|
|
|
|
String checkManCode = qcCheckTaskIncome.getCheckManCode();
|
|
|
|
@ -216,7 +220,7 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
|
|
|
|
|
qcCheckTaskIncome.setCheckManName("");
|
|
|
|
|
qcCheckTaskIncome.setCheckManCode("");
|
|
|
|
|
/**qc_user_material取默认检查人**/
|
|
|
|
|
List<QcUserMaterialDTO> users = qcCheckTaskIncomeMapper.getCheckUser(qcCheckTaskIncome);
|
|
|
|
|
users = qcCheckTaskIncomeMapper.getCheckUser(qcCheckTaskIncome);
|
|
|
|
|
if(CollectionUtils.isEmpty(users)){
|
|
|
|
|
QcUserMaterialDTO dto0 = new QcUserMaterialDTO();
|
|
|
|
|
dto0.setId(IdUtils.fastSimpleUUID());
|
|
|
|
@ -264,7 +268,37 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
|
|
|
|
|
item.setFactoryCode(factoryCode);
|
|
|
|
|
item.setStatus("N");
|
|
|
|
|
}
|
|
|
|
|
return qcCheckTaskDetailMapper.addBatch(items);
|
|
|
|
|
int s = qcCheckTaskDetailMapper.addBatch(items);
|
|
|
|
|
|
|
|
|
|
//发企业微信--------------------开始(跟班组无关)
|
|
|
|
|
SysNoticeGroup noticeQo = new SysNoticeGroup();
|
|
|
|
|
noticeQo.setNoticeId(6L);
|
|
|
|
|
List<SysNoticeGroup> notices = qcCheckTaskIncomeMapper.getNotices(noticeQo);
|
|
|
|
|
if(!CollectionUtils.isEmpty(notices)) {
|
|
|
|
|
List<WechartDTO> wecharts = new ArrayList<>();
|
|
|
|
|
//去主库查微信id
|
|
|
|
|
DynamicDataSourceContextHolder.push("master");// 这是数据源的key
|
|
|
|
|
List<String> userCodes = users.stream()
|
|
|
|
|
.map(QcUserMaterialDTO::getUserCode)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
List<String> wxids = qcCheckTaskIncomeMapper.getWxId(userCodes);
|
|
|
|
|
for (String wxid : wxids) {
|
|
|
|
|
WechartDTO wechart0 = new WechartDTO();
|
|
|
|
|
wechart0.setUserId(wxid);
|
|
|
|
|
wechart0.setText(notices.get(0).getNoticeContent());
|
|
|
|
|
wecharts.add(wechart0);
|
|
|
|
|
}
|
|
|
|
|
logger.info("来料检验企业微信提醒请求:" + JSONObject.toJSONString(wecharts));
|
|
|
|
|
if (!CollectionUtils.isEmpty(wecharts)) {
|
|
|
|
|
new Thread(() -> {
|
|
|
|
|
AjaxResult result = remoteOpenService.sendWeChartMessage(wecharts);
|
|
|
|
|
logger.info("来料检验企业微信提醒结果:" + JSONObject.toJSONString(result));
|
|
|
|
|
|
|
|
|
|
}).start();
|
|
|
|
|
}
|
|
|
|
|
//发企业微信--------------------结束
|
|
|
|
|
}
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -583,7 +617,7 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
//@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public int commitCheckResults(QcCheckTaskIncome qcCheckTaskIncome) {
|
|
|
|
|
List<QcCheckTaskDetail> details = qcCheckTaskIncome.getQcCheckTaskDetails();
|
|
|
|
|
|
|
|
|
@ -780,6 +814,45 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
|
|
|
|
|
unqualified.setUser("999999");
|
|
|
|
|
qcCheckUnqualifiedService.updateQcCheckUnqualified(unqualified);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//发企业微信--------------------开始(跟班组有关)
|
|
|
|
|
SysNoticeGroup noticeQo = new SysNoticeGroup();
|
|
|
|
|
noticeQo.setNoticeId(9L);
|
|
|
|
|
List<SysNoticeGroup> notices = qcCheckTaskIncomeMapper.getNoticesGroup(noticeQo);
|
|
|
|
|
if(!CollectionUtils.isEmpty(notices)) {
|
|
|
|
|
List<WechartDTO> wecharts = new ArrayList<>();
|
|
|
|
|
//去主库查微信id
|
|
|
|
|
DynamicDataSourceContextHolder.push("master");// 这是数据源的key
|
|
|
|
|
List<String> userCodes = notices.stream()
|
|
|
|
|
.map(SysNoticeGroup::getUserCode)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
//Map<String, SysUser> wxidsMap = qcCheckTaskIncomeMapper.getWxIdMap(userCodes);
|
|
|
|
|
for (SysNoticeGroup noticedto : notices) {
|
|
|
|
|
// SysUser sysUser = wxidsMap.get(noticedto.getUserCode());
|
|
|
|
|
// if (sysUser != null) {
|
|
|
|
|
WechartDTO wechart0 = new WechartDTO();
|
|
|
|
|
wechart0.setUserId(noticedto.getWxId());
|
|
|
|
|
String contentInfo = noticedto.getNoticeContent();
|
|
|
|
|
contentInfo = contentInfo.replace("${materialCode}", qcCheckTaskIncome.getMaterialCode())
|
|
|
|
|
.replace("${materialName}", qcCheckTaskIncome.getMaterialName())
|
|
|
|
|
//.replace("${incomeBatchNo}", qcCheckTaskIncome.getIncomeBatchNo())
|
|
|
|
|
//.replace("${orderNo}", qcCheckTaskIncome.getOrderNo())
|
|
|
|
|
;
|
|
|
|
|
wechart0.setText(contentInfo);
|
|
|
|
|
wecharts.add(wechart0);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
logger.info("来料检验企业微信提醒请求:" + JSONObject.toJSONString(wecharts));
|
|
|
|
|
if (!CollectionUtils.isEmpty(wecharts)) {
|
|
|
|
|
new Thread(() -> {
|
|
|
|
|
AjaxResult wxresult = remoteOpenService.sendWeChartMessage(wecharts);
|
|
|
|
|
logger.info("来料检验企业微信提醒结果:" + JSONObject.toJSONString(wxresult));
|
|
|
|
|
|
|
|
|
|
}).start();
|
|
|
|
|
}
|
|
|
|
|
//发企业微信--------------------结束
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 1 ;
|
|
|
|
|
}
|
|
|
|
|