Browse Source

储罐

git-svn-id: https://192.168.57.71/svn/lyggkj@70 1a6f6e3a-4066-fe46-b609-79c204482ece
ld_liufl 9 years ago
parent
commit
0172a909f9

+ 3 - 0
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/common/Constants.java

@@ -864,4 +864,7 @@ public class Constants {
 	public final static String QRCODE_CG = "CG|";// 储罐
 	public final static String QRCODE_RYJBXX = "RY|";// 人员
 	
+	//************************储罐状态************************
+	public final static String CGZT_ZC = "1";
+	public final static String CGZT_YC = "2";
 }

+ 2 - 131
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/controller/yjgl/zdwxyfb/CgController.java

@@ -616,8 +616,8 @@ public class CgController extends BaseController {
 			entity.setUpdateUser(Utils.getCurrentUser());
 		}
 		entity = cgztService.save(entity);
-		if (entity.getCg() != null && entity.getZt().equals("2")) {
-			saveGztx(entity);
+		if (entity.getCg() != null && entity.getZt().equals(Constants.CGZT_YC)) {
+			cgService.saveGztx(entity);
 		}
 		return createBusinessContext(entity);
 	}
@@ -647,135 +647,6 @@ public class CgController extends BaseController {
 		return createBusinessContext(entity);
 	}
 
-	/**
-	 * 保存
-	 * 
-	 * @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);
-		}
-	}
-	/**
-	 * 发工作提醒
-	 */
-	public 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);
-	}
 
 }

+ 149 - 1
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/service/impl/yjgl/zdwxyfb/CgServiceImp.java

@@ -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);
+	}
 
 }

+ 3 - 0
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/service/yjgl/zdwxyfb/CgService.java

@@ -13,6 +13,7 @@ import com.jtgh.yjpt.entity.common.CodeEntity;
 import com.jtgh.yjpt.entity.jyr.JyrEntity;
 import com.jtgh.yjpt.entity.yjgl.zdwxyfb.CgCountEntity;
 import com.jtgh.yjpt.entity.yjgl.zdwxyfb.CgEntity;
+import com.jtgh.yjpt.entity.yjgl.zdwxyfb.CgztEntity;
 import com.jtgh.yjpt.entity.yjgl.zdwxyfb.ZbhjjbqkEntity;
 
 public interface CgService {
@@ -83,5 +84,7 @@ public interface CgService {
 	public List<CgEntity> findValid();
 
 	public List<CgEntity> findByJyrAndName(JyrEntity jyr, String name);
+	
+	public void saveGztx(CgztEntity entity);
 
 }