|
@@ -53,6 +53,8 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
|
|
|
ProjectApproveMapper projectApproveMapper;
|
|
|
@Resource
|
|
|
CustomCompanyMapper customCompanyMapper;
|
|
|
+ @Resource
|
|
|
+ CompanyMapper companyMapper;
|
|
|
|
|
|
@Override
|
|
|
public HttpRespMsg addAndUpdateMould(Mould mould, User user) {
|
|
@@ -61,6 +63,8 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
|
|
|
//修改
|
|
|
Mould m = mouldMapper.selectOne(new QueryWrapper<Mould>().eq("model_no", mould.getModelNo()));
|
|
|
if ((m != null && m.getId() == mould.getId()) || m == null) {
|
|
|
+ Company company = companyMapper.selectById(mould.getProduceCompanyId());
|
|
|
+ mould.setArea(company.getCompanyAddress());
|
|
|
mouldMapper.updateById(mould);
|
|
|
} else {
|
|
|
msg.setError("当前模具编号已存在,请重新输入其他模具编号");
|
|
@@ -148,6 +152,29 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg maintenanceReminder() throws Exception {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ //查询所有被分配到项目的模具
|
|
|
+ List<Mould> moulds = mouldMapper.selectList(new QueryWrapper<Mould>().isNotNull("project_id"));
|
|
|
+ for (Mould mould : moulds) {
|
|
|
+ if(mould.getInitialModulus()<mould.getRunTimes()){
|
|
|
+ //提示保养,向模具资产方人员公众号推送消息
|
|
|
+ User user = userMapper.selectOne(new QueryWrapper<User>().eq("parent_id", Constant.SYS_ID).eq("company_id", mould.getCompanyId()));
|
|
|
+ MouldEquipmentVO mouldEquipmentVO = new MouldEquipmentVO();
|
|
|
+ mouldEquipmentVO.setPlanType(Constant.PLAN_TYPE);
|
|
|
+ mouldEquipmentVO.setArea(mould.getArea());
|
|
|
+ mouldEquipmentVO.setName(mould.getModelName());
|
|
|
+ msg = sendMaintainTemplateMessage(Constant.MAINTAIN_NOTICE_TEMPLATE_ID,user.getOpenid(),Constant.WECHAT_APPID,Constant.WECHAT_SECRET,mouldEquipmentVO);
|
|
|
+ //添加通知消息
|
|
|
+ Project project = projectMapper.selectById(mould.getProjectId());
|
|
|
+ //查询到参与该项目的人
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
//告警模板推送通用接口
|
|
|
|
|
|
/**
|
|
@@ -245,9 +272,9 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
|
|
|
data.put("keyword2", value2);
|
|
|
value3.put("value", sdf.format(new Date()));
|
|
|
data.put("keyword3", value3);
|
|
|
- value4.put("value", mouldEquipmentVO.getEmergencyContent());
|
|
|
+ value4.put("value", mouldEquipmentVO.getPlanType());
|
|
|
data.put("keyword4", value4);
|
|
|
- remark.put("value", "给水泵内燃力不足");
|
|
|
+ remark.put("value", "模具初始模次不满足运行了");
|
|
|
data.put("remark", remark);
|
|
|
wechat.setData(data);
|
|
|
String jsonString = JSONObject.toJSONString(wechat);
|