|
@@ -2,6 +2,7 @@ package com.jtgh.yjpt.service.impl.yjgl.zdwxyfb;
|
|
|
|
|
|
import java.net.URL;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Iterator;
|
|
|
import java.util.List;
|
|
@@ -21,17 +22,25 @@ import com.jtgh.yjpt.dao.common.CodeDao;
|
|
|
import com.jtgh.yjpt.dao.common.MyRepository;
|
|
|
import com.jtgh.yjpt.dao.gkgq.GqDao;
|
|
|
import com.jtgh.yjpt.dao.sgalgl.SgalglDao;
|
|
|
+import com.jtgh.yjpt.dao.task.GztxDao;
|
|
|
import com.jtgh.yjpt.dao.yjgl.zdwxyfb.CgDao;
|
|
|
+import com.jtgh.yjpt.entity.auth.UserEntity;
|
|
|
import com.jtgh.yjpt.entity.common.AccessoryEntity;
|
|
|
import com.jtgh.yjpt.entity.common.CodeEntity;
|
|
|
import com.jtgh.yjpt.entity.jyr.JyrEntity;
|
|
|
+import com.jtgh.yjpt.entity.task.Gztx;
|
|
|
import com.jtgh.yjpt.entity.yjgl.zdwxyfb.CgCountEntity;
|
|
|
import com.jtgh.yjpt.entity.yjgl.zdwxyfb.CgEntity;
|
|
|
+import com.jtgh.yjpt.entity.yjgl.zdwxyfb.CgsyEntity;
|
|
|
+import com.jtgh.yjpt.entity.yjgl.zdwxyfb.CgztEntity;
|
|
|
import com.jtgh.yjpt.entity.yjgl.zdwxyfb.ZbhjjbqkEntity;
|
|
|
import com.jtgh.yjpt.service.BaseService;
|
|
|
+import com.jtgh.yjpt.service.auth.UserService;
|
|
|
import com.jtgh.yjpt.service.common.AccessoryService;
|
|
|
import com.jtgh.yjpt.service.jyr.JyrService;
|
|
|
+import com.jtgh.yjpt.service.task.TaskService;
|
|
|
import com.jtgh.yjpt.service.yjgl.zdwxyfb.CgService;
|
|
|
+import com.jtgh.yjpt.service.yjgl.zdwxyfb.CgsyService;
|
|
|
import com.jtgh.yjpt.service.yjgl.zdwxyfb.ZbhjjbqkService;
|
|
|
|
|
|
@Service
|
|
@@ -52,6 +61,15 @@ public class CgServiceImp extends BaseService<CgEntity, Long> implements
|
|
|
private JyrService jyrService;
|
|
|
@Autowired
|
|
|
private ZbhjjbqkService zbhjjbqkService;
|
|
|
+ @Autowired
|
|
|
+ private CgsyService cgsyService;
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
+ @Autowired
|
|
|
+ private TaskService taskService;
|
|
|
+ @Autowired
|
|
|
+ private GztxDao gztxDao;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
protected MyRepository<CgEntity, Long> getDao() {
|
|
@@ -251,7 +269,6 @@ public class CgServiceImp extends BaseService<CgEntity, Long> implements
|
|
|
|
|
|
@Override
|
|
|
public List<CgEntity> synTimerdelete() {
|
|
|
- // TODO Auto-generated method stub
|
|
|
return cgDao.synTimerdelete();
|
|
|
}
|
|
|
|
|
@@ -377,5 +394,136 @@ public class CgServiceImp extends BaseService<CgEntity, Long> implements
|
|
|
public List<CgEntity> findByJyrAndName(JyrEntity jyr, String name) {
|
|
|
return cgDao.findByJyrAndName(jyr, name);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存
|
|
|
+ *
|
|
|
+ * @param entity
|
|
|
+ * @param jsUser
|
|
|
+ */
|
|
|
+ public void saveGztx(CgztEntity entity) {
|
|
|
+ CgsyEntity cgsy = cgsyService.findByCg(entity.getCg());
|
|
|
+ String txnr1 = "";
|
|
|
+ String txnr2 = "";
|
|
|
+ if (cgsy != null) {
|
|
|
+ if (null != cgsy.getZdwd()
|
|
|
+ && !"".equals(cgsy.getZdwd().trim())
|
|
|
+ && null != entity.getWd()
|
|
|
+ && !"".equals(cgsy.getZdwd().trim())
|
|
|
+ && Double.parseDouble(entity.getWd()) > Double
|
|
|
+ .parseDouble(cgsy.getZdwd())) {
|
|
|
+ txnr1 = (entity.getCg().getDwmc() == null ? "" : (entity
|
|
|
+ .getCg().getDwmc().getGkjyr() + "的"))
|
|
|
+ + entity.getCg().getCgmc() + "高于最高温度!";
|
|
|
+ txnr2 = "你单位的"
|
|
|
+ + entity.getCg().getCgmc() + "高于最高温度!";
|
|
|
+ }
|
|
|
+ if (null != cgsy.getZxwd()
|
|
|
+ && !"".equals(cgsy.getZxwd().trim())
|
|
|
+ && null != entity.getWd()
|
|
|
+ && !"".equals(cgsy.getZxwd().trim())
|
|
|
+ && Double.parseDouble(entity.getWd()) < Double
|
|
|
+ .parseDouble(cgsy.getZxwd())) {
|
|
|
+ txnr1 = (entity.getCg().getDwmc() == null ? "" : (entity
|
|
|
+ .getCg().getDwmc().getGkjyr() + "的"))
|
|
|
+ + entity.getCg().getCgmc() + "低于最低温度!";
|
|
|
+ txnr2 = "你单位的"
|
|
|
+ + entity.getCg().getCgmc() + "低于最低温度!";
|
|
|
+ }
|
|
|
+ if (null != cgsy.getZdyl()
|
|
|
+ && !"".equals(cgsy.getZdyl().trim())
|
|
|
+ && null != entity.getYl()
|
|
|
+ && !"".equals(cgsy.getZdyl().trim())
|
|
|
+ && Double.parseDouble(entity.getYl()) > Double
|
|
|
+ .parseDouble(cgsy.getZdyl())) {
|
|
|
+ txnr1 = (entity.getCg().getDwmc() == null ? "" : (entity
|
|
|
+ .getCg().getDwmc().getGkjyr() + "的"))
|
|
|
+ + entity.getCg().getCgmc() + "高于最高压力!";
|
|
|
+ txnr2 = "你单位的"
|
|
|
+ + entity.getCg().getCgmc() + "高于最高压力!";
|
|
|
+ }
|
|
|
+ if (null != cgsy.getZxyl()
|
|
|
+ && !"".equals(cgsy.getZxyl().trim())
|
|
|
+ && null != entity.getYl()
|
|
|
+ && !"".equals(cgsy.getZxyl().trim())
|
|
|
+ && Double.parseDouble(entity.getYl()) < Double
|
|
|
+ .parseDouble(cgsy.getZxyl())) {
|
|
|
+ txnr1 = (entity.getCg().getDwmc() == null ? "" : (entity
|
|
|
+ .getCg().getDwmc().getGkjyr() + "的"))
|
|
|
+ + entity.getCg().getCgmc() + "低于最低液位!";
|
|
|
+ txnr2 = "你单位的"
|
|
|
+ + entity.getCg().getCgmc() + "低于最低液位!";
|
|
|
+ }
|
|
|
+ if (null != cgsy.getZdyw()
|
|
|
+ && !"".equals(cgsy.getZdyw().trim())
|
|
|
+ && null != entity.getYw()
|
|
|
+ && !"".equals(cgsy.getZdyw().trim())
|
|
|
+ && Double.parseDouble(entity.getYw()) > Double
|
|
|
+ .parseDouble(cgsy.getZdyw())) {
|
|
|
+ txnr1 = (entity.getCg().getDwmc() == null ? "" : (entity
|
|
|
+ .getCg().getDwmc().getGkjyr() + "的"))
|
|
|
+ + entity.getCg().getCgmc() + "高于最高液位!";
|
|
|
+ txnr2 = "你单位的"
|
|
|
+ + entity.getCg().getCgmc() + "高于最高液位!";
|
|
|
+ }
|
|
|
+ if (null != cgsy.getZxyw()
|
|
|
+ && !"".equals(cgsy.getZxyw().trim())
|
|
|
+ && null != entity.getYw()
|
|
|
+ && !"".equals(cgsy.getZxyw().trim())
|
|
|
+ && Double.parseDouble(entity.getYw()) < Double
|
|
|
+ .parseDouble(cgsy.getZxyw())) {
|
|
|
+ txnr1 = (entity.getCg().getDwmc() == null ? "" : (entity
|
|
|
+ .getCg().getDwmc().getGkjyr() + "的"))
|
|
|
+ + entity.getCg().getCgmc() + "低于最低液位!";
|
|
|
+ txnr2 = "你单位的"
|
|
|
+ + entity.getCg().getCgmc() + "低于最低液位!";
|
|
|
+ }
|
|
|
+ if("".equals(txnr1)) {
|
|
|
+ deleteGztx(entity.getId().toString(),
|
|
|
+ entity.getAddUser(),
|
|
|
+ Constants.BUSTYPE_ZT_CG);
|
|
|
+ setGztx(entity.getId().toString(),txnr1,entity.getAddUser());
|
|
|
+ List<UserEntity> adminList = userService.findPAdminBySzd(entity.getCg().getId());
|
|
|
+ for (UserEntity userEntity : adminList) {
|
|
|
+ deleteGztx(entity.getId().toString(), userEntity,
|
|
|
+ Constants.BUSTYPE_ZT_CG);
|
|
|
+ setGztx(entity.getId().toString(),txnr2,userEntity);
|
|
|
+ }
|
|
|
+ List<UserEntity> qyadminList = userService
|
|
|
+ .findUserForTx(entity.getAddUser().getId());
|
|
|
+ for (UserEntity userEntity : qyadminList) {
|
|
|
+ deleteGztx(entity.getId().toString(), userEntity,
|
|
|
+ Constants.BUSTYPE_ZT_CG);
|
|
|
+ setGztx(entity.getId().toString(),txnr2,userEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除已有工作提醒
|
|
|
+ */
|
|
|
+ private void deleteGztx(String id, UserEntity adduser, String busType) {
|
|
|
+ List<Gztx> list = taskService
|
|
|
+ .findBybdidAndBustype(id, busType, adduser);
|
|
|
+ for (Gztx gztx : list) {
|
|
|
+ taskService.deleteGztx(gztx);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 发工作提醒
|
|
|
+ */
|
|
|
+ private void setGztx(String bdid, String txnr, UserEntity jsUser) {
|
|
|
+ Gztx gztx = new Gztx();
|
|
|
+ gztx.setTxsj(new Date());
|
|
|
+ gztx.setTxzt(Constants.YES);
|
|
|
+ gztx.setBdid(bdid);
|
|
|
+ gztx.setTxnr(txnr);
|
|
|
+ gztx.setBustype(Constants.BUSTYPE_ZT_CG);
|
|
|
+ gztx.setFsUser(Utils.getCurrentUser());
|
|
|
+ gztx.setAddDate(new Date());
|
|
|
+ gztx.setJsUser(jsUser);
|
|
|
+ gztxDao.save(gztx);
|
|
|
+ }
|
|
|
|
|
|
}
|