| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- package cn.com.goldenwater.dcproj.service.impl.offline;
- import cn.com.goldenwater.dcproj.constValue.BisInspEnum;
- import cn.com.goldenwater.dcproj.dao.*;
- import cn.com.goldenwater.dcproj.model.*;
- import cn.com.goldenwater.dcproj.param.AttWuntBaseParam;
- import cn.com.goldenwater.dcproj.param.BisInspAllObjParam;
- import cn.com.goldenwater.dcproj.service.GwComFileService;
- import cn.com.goldenwater.dcproj.service.SupervisionPlanService;
- import cn.com.goldenwater.id.util.UuidUtil;
- import com.fasterxml.jackson.databind.DeserializationFeature;
- import com.fasterxml.jackson.databind.ObjectMapper;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import java.io.IOException;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import java.util.List;
- /**
- * 用水单位离线填报
- *
- * @author zhangcheng
- * @date 2019/11/26 17:54
- */
- @Service
- @Transactional
- public class BisInspOffLineWuntProcess extends BisInspOffLineProcess {
- @Autowired
- BisInspAllObjDao bisInspAllObjDao;
- @Autowired
- BisInspPblmDao bisInspPblmDao;//督查问题
- @Autowired
- BisInspSvwtWuntRgstrWsuswDao bisInspSvwtWuntRgstrWsuswDao;
- @Autowired
- BisInspSvwtWuntRgstrWuuswDao bisInspSvwtWuntRgstrWuuswDao;
- @Autowired
- BisInspSvwtWuntRgstrDao bisInspSvwtWuntRgstrDao;
- @Autowired
- AttWuntBaseDao attWuntBaseDao;
- @Autowired
- SupervisionPlanService supervisionPlanService;
- @Autowired
- private GwComFileService gwComFileService;//文件操作
- @Value("${getFile.prefix}")
- public String prefix;
- @Override
- public BisInspOffLineRet process(BisInspOffLineObj bisInspOffLineObj, String fileDir) throws IOException {
- BisInspOffLineRet bisInspOffLineRet = new BisInspOffLineRet();
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- ObjectMapper om = new ObjectMapper();
- om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- //解析用水单位填报信息
- BisInspOffLineWuntRgeister bisInspOffLineWuntRgeister = om.readValue(bisInspOffLineObj.getRegister(), BisInspOffLineWuntRgeister.class);
- //解析用水单位基本信息对象c
- if (bisInspOffLineObj.getBase() != null) {
- /* if (null == bisInspOffLineObj.getReplace() || bisInspOffLineObj.getReplace()) {
- delRgstrData(bisInspOffLineObj);
- }*/
- //添加到督查任务
- String objId = UuidUtil.uuid();
- String groupId = bisInspOffLineObj.getGroupId();
- BisInspSvwtWuntRgstr bisInspSvwtWuntRgstr = new BisInspSvwtWuntRgstr();
- String regId = objId;
- String persId = bisInspOffLineObj.getPersId();
- AttWuntBase attWuntBase = om.readValue(bisInspOffLineObj.getBase(), AttWuntBase.class);
- if (attWuntBase.getId() != null && !"".equals(attWuntBase.getId()) && attWuntBaseDao.get(attWuntBase.getId()) != null) {
- attWuntBaseDao.update(attWuntBase);
- } else {
- attWuntBase.setId(UuidUtil.uuid());
- attWuntBase.setUtCode(UuidUtil.uuid());
- attWuntBaseDao.insert(attWuntBase);
- }
- insertBisInspAllObj(bisInspOffLineObj, groupId, objId, attWuntBase);
- insertWuntRgstr(attWuntBase, groupId, objId, persId, regId, bisInspSvwtWuntRgstr);
- //用水单位节约用水情况
- insertWuntWuuswInfo(bisInspOffLineWuntRgeister, regId, persId, bisInspSvwtWuntRgstr);
- //节水型单位节约用水情况
- insertWuntWsuswInfo(bisInspOffLineWuntRgeister, regId, persId, bisInspSvwtWuntRgstr);
- //更新督查 字表状态
- bisInspSvwtWuntRgstrDao.update(bisInspSvwtWuntRgstr);
- bisInspOffLineRet.setRegId(regId);
- bisInspOffLineRet.setObjId(objId);
- }
- return bisInspOffLineRet;
- }
- /**
- * 删除任务及登记表信息
- *
- * @param groupId
- * @param nm
- */
- public void delRgstrData(BisInspOffLineObj bisInspOffLineObj) {
- //登记表查找重复数据,然后删除
- BisInspAllObjParam bisInspAllObjParam = new BisInspAllObjParam();
- bisInspAllObjParam.setId(bisInspOffLineObj.getGroupId());
- bisInspAllObjParam.setNm(bisInspOffLineObj.getNm());
- List<BisInspAllObj> bisInspAllObjs = bisInspAllObjDao.findList(bisInspAllObjParam);
- for (BisInspAllObj bisInspAllObj : bisInspAllObjs) {
- //删除登记表
- //删除登记表关联的各个填报表数据
- supervisionPlanService.cleanObjDataByObjId(BisInspEnum.WUNT.getValue(), bisInspAllObj.getObjId());
- }
- }
- /**
- * 添加到督查任务
- *
- * @param groupId
- * @param objId
- * @param attAdBase
- */
- public void insertBisInspAllObj(BisInspOffLineObj bisInspOffLineObj, String groupId, String objId, AttWuntBase attWuntBase) {
- BisInspAllObj bisInspAllObj = new BisInspAllObj();
- bisInspAllObj.setId(groupId);
- bisInspAllObj.setObjId(objId);
- bisInspAllObj.setNm(attWuntBase.getUtName());
- bisInspAllObj.setCode(attWuntBase.getUtCode());//非空字段
- bisInspAllObj.setPtype("16");
- bisInspAllObj.setOrgId(bisInspOffLineObj.getOrgId());
- bisInspAllObj.setAdCode(bisInspOffLineObj.getProvince());
- bisInspAllObj.setLgtd(attWuntBase.getPcX());
- bisInspAllObj.setLttd(attWuntBase.getPcY());
- bisInspAllObj.setLgtdpc(attWuntBase.getGdX());
- bisInspAllObj.setLttdpc(attWuntBase.getGdY());
- bisInspAllObjDao.insert(bisInspAllObj);
- }
- /**
- * 插入登记表信息
- *
- * @param bisInspOffLineObj
- * @param objId
- * @param om
- * @param regId
- * @param bisInspSvwtWuntRgstr
- * @throws IOException
- */
- public void insertWuntRgstr(AttWuntBase attWuntBase, String groupId, String objId, String persId, String regId, BisInspSvwtWuntRgstr bisInspSvwtWuntRgstr) throws IOException {
- bisInspSvwtWuntRgstr.setId(regId);
- bisInspSvwtWuntRgstr.setObjId(objId);
- bisInspSvwtWuntRgstr.setUtName(attWuntBase.getUtName());
- bisInspSvwtWuntRgstr.setUtCode(attWuntBase.getUtCode());
- bisInspSvwtWuntRgstr.setUtType(attWuntBase.getUtType());
- bisInspSvwtWuntRgstr.setUtPpt(attWuntBase.getUtPpt());
- bisInspSvwtWuntRgstr.setOpenName(attWuntBase.getOpenName());
- bisInspSvwtWuntRgstr.setUtCont(attWuntBase.getUtCont());
- bisInspSvwtWuntRgstr.setSignAddr(attWuntBase.getSignAddr());
- bisInspSvwtWuntRgstr.setUtAddr(attWuntBase.getUtAddr());
- bisInspSvwtWuntRgstr.setTrdType(attWuntBase.getTrdType());
- bisInspSvwtWuntRgstr.setGreenArea(attWuntBase.getGreenArea());
- bisInspSvwtWuntRgstr.setWsTw(attWuntBase.getWsTw());
- bisInspSvwtWuntRgstr.setWsBw(attWuntBase.getWsBw());
- bisInspSvwtWuntRgstr.setWsOth(attWuntBase.getWsOth());
- bisInspSvwtWuntRgstr.setPayWb(attWuntBase.getPayWb());
- bisInspSvwtWuntRgstr.setWbPer(attWuntBase.getWbPer());
- bisInspSvwtWuntRgstr.setHotlLev(attWuntBase.getHotlLev());
- bisInspSvwtWuntRgstr.setBedNum(attWuntBase.getBedNum() == null || "".equals(attWuntBase.getBedNum()) ? null : attWuntBase.getBedNum().longValue());
- bisInspSvwtWuntRgstr.setOccRate(attWuntBase.getOccRate());
- bisInspSvwtWuntRgstr.setWuUnit(attWuntBase.getWuUnit());
- bisInspSvwtWuntRgstr.setWuUnitOut(attWuntBase.getWuUnitOut());
- bisInspSvwtWuntRgstr.setMainPrd(attWuntBase.getMainPrd());
- bisInspSvwtWuntRgstr.setWipaa(attWuntBase.getWipaa());
- bisInspSvwtWuntRgstr.setHasWrmrms(attWuntBase.getHasWrmrms());
- bisInspSvwtWuntRgstr.setIsKmwuul(attWuntBase.getIsKmwuul());
- bisInspSvwtWuntRgstr.setKmwuulLev(attWuntBase.getKmwuulLev());
- bisInspSvwtWuntRgstr.setWuUt(attWuntBase.getWuUt());
- bisInspSvwtWuntRgstr.setWuUtAttn(attWuntBase.getWuUtAttn());
- bisInspSvwtWuntRgstr.setWuUtCont(attWuntBase.getWuUtCont());
- bisInspSvwtWuntRgstr.setUtPersNum(attWuntBase.getUtPersNum() == null || "".equals(attWuntBase.getUtPersNum()) ? null : attWuntBase.getUtPersNum().longValue());
- bisInspSvwtWuntRgstr.setWorkNum(attWuntBase.getWorkNum() == null || "".equals(attWuntBase.getWorkNum()) ? null : attWuntBase.getWorkNum().longValue());
- bisInspSvwtWuntRgstr.setWorkNotNum(attWuntBase.getWorkNotNum() == null || "".equals(attWuntBase.getWorkNotNum()) ? null : attWuntBase.getWorkNotNum().longValue());
- bisInspSvwtWuntRgstr.setTotArea(attWuntBase.getTotArea());
- bisInspSvwtWuntRgstr.setBuldArea(attWuntBase.getBuldArea());
- bisInspSvwtWuntRgstr.setSchCla(attWuntBase.getSchCla());
- bisInspSvwtWuntRgstr.setUniCla(attWuntBase.getUniCla());
- bisInspSvwtWuntRgstr.setTeachNum(attWuntBase.getTeachNum() == null || "".equals(attWuntBase.getTeachNum()) ? null : attWuntBase.getTeachNum().longValue());
- bisInspSvwtWuntRgstr.setTeachLvNum(attWuntBase.getTeachLvNum() == null || "".equals(attWuntBase.getTeachLvNum()) ? null : attWuntBase.getTeachLvNum().longValue());
- bisInspSvwtWuntRgstr.setStuNum(attWuntBase.getStuNum() == null || "".equals(attWuntBase.getStuNum()) ? null : attWuntBase.getStuNum().longValue());
- bisInspSvwtWuntRgstr.setStuLvNum(attWuntBase.getStuLvNum() == null || "".equals(attWuntBase.getStuLvNum()) ? null : attWuntBase.getStuLvNum().longValue());
- bisInspSvwtWuntRgstr.setIsLchCwsm(attWuntBase.getIsLchCwsm());
- bisInspSvwtWuntRgstr.setState("1");
- bisInspSvwtWuntRgstr.setDataStat("0");
- bisInspSvwtWuntRgstr.setPersId(persId);
- bisInspSvwtWuntRgstr.setGroupId(groupId);
- bisInspSvwtWuntRgstr.setGdX(attWuntBase.getGdX());
- bisInspSvwtWuntRgstr.setGdY(attWuntBase.getGdY());
- bisInspSvwtWuntRgstr.setPcX(attWuntBase.getPcX());
- bisInspSvwtWuntRgstr.setPcY(attWuntBase.getPcY());
- bisInspSvwtWuntRgstr.setInTm(new Date());
- bisInspSvwtWuntRgstr.setUpTm(new Date());
- bisInspSvwtWuntRgstr.setChkTm(new Date());
- bisInspSvwtWuntRgstrDao.insert(bisInspSvwtWuntRgstr);
- }
- /**
- * 插入用水单位节约用水情况
- *
- * @param bisInspOffLineWuntRgeister
- * @param regId
- * @param bisInspOffLineObj
- * @param bisInspSvwtWuntRgstr
- */
- public void insertWuntWuuswInfo(BisInspOffLineWuntRgeister bisInspOffLineWuntRgeister, String regId, String persId, BisInspSvwtWuntRgstr bisInspSvwtWuntRgstr) {
- //用水单位节约用水情况
- BisInspSvwtWuntRgstrWuusw bisInspSvwtWuntRgstrWuusw = new BisInspSvwtWuntRgstrWuusw();
- if (bisInspOffLineWuntRgeister.getBisInspSvwtWuntRgstrWuusw() != null) {
- bisInspSvwtWuntRgstrWuusw = bisInspOffLineWuntRgeister.getBisInspSvwtWuntRgstrWuusw();
- bisInspSvwtWuntRgstrWuusw.setId(UuidUtil.uuid());
- bisInspSvwtWuntRgstrWuusw.setRgstrId(regId);
- bisInspSvwtWuntRgstrWuusw.setInTm(new Date());
- bisInspSvwtWuntRgstrWuusw.setUpTm(new Date());
- bisInspSvwtWuntRgstrWuusw.setDataStat("0");
- bisInspSvwtWuntRgstrWuusw.setPersId(persId);
- bisInspSvwtWuntRgstrWuuswDao.insert(bisInspSvwtWuntRgstrWuusw);
- bisInspSvwtWuntRgstr.setWuuswInfoStat("2");
- } else {
- bisInspSvwtWuntRgstrWuusw.setId(UuidUtil.uuid());
- bisInspSvwtWuntRgstrWuusw.setRgstrId(regId);
- bisInspSvwtWuntRgstrWuusw.setInTm(new Date());
- bisInspSvwtWuntRgstrWuusw.setUpTm(new Date());
- bisInspSvwtWuntRgstrWuusw.setDataStat("0");
- bisInspSvwtWuntRgstrWuusw.setPersId(persId);
- bisInspSvwtWuntRgstrWuuswDao.insert(bisInspSvwtWuntRgstrWuusw);
- bisInspSvwtWuntRgstr.setWuuswInfoStat("1");
- }
- }
- /**
- * 插入节水型单位节约用水情况
- *
- * @param bisInspOffLineWuntRgeister
- * @param regId
- * @param bisInspOffLineObj
- * @param bisInspSvwtWuntRgstr
- */
- public void insertWuntWsuswInfo(BisInspOffLineWuntRgeister bisInspOffLineWuntRgeister, String regId, String persId, BisInspSvwtWuntRgstr bisInspSvwtWuntRgstr) {
- //节水型单位节约用水情况
- BisInspSvwtWuntRgstrWsusw bisInspSvwtWuntRgstrWsusw = new BisInspSvwtWuntRgstrWsusw();
- if (bisInspOffLineWuntRgeister.getBisInspSvwtWuntRgstrWsusw() != null) {
- bisInspSvwtWuntRgstrWsusw = bisInspOffLineWuntRgeister.getBisInspSvwtWuntRgstrWsusw();
- bisInspSvwtWuntRgstrWsusw.setId(UuidUtil.uuid());
- bisInspSvwtWuntRgstrWsusw.setRgstrId(regId);
- bisInspSvwtWuntRgstrWsusw.setInTm(new Date());
- bisInspSvwtWuntRgstrWsusw.setUpTm(new Date());
- bisInspSvwtWuntRgstrWsusw.setDataStat("0");
- bisInspSvwtWuntRgstrWsusw.setPersId(persId);
- bisInspSvwtWuntRgstrWsuswDao.insert(bisInspSvwtWuntRgstrWsusw);
- bisInspSvwtWuntRgstr.setWsuswInfoStat("2");
- } else {
- bisInspSvwtWuntRgstrWsusw.setId(UuidUtil.uuid());
- bisInspSvwtWuntRgstrWsusw.setRgstrId(regId);
- bisInspSvwtWuntRgstrWsusw.setInTm(new Date());
- bisInspSvwtWuntRgstrWsusw.setUpTm(new Date());
- bisInspSvwtWuntRgstrWsusw.setDataStat("0");
- bisInspSvwtWuntRgstrWsusw.setPersId(persId);
- bisInspSvwtWuntRgstrWsuswDao.insert(bisInspSvwtWuntRgstrWsusw);
- bisInspSvwtWuntRgstr.setWsuswInfoStat("1");
- }
- }
- @Override
- public BisInspOffLineRetBase getBaseInfo(BisInspOffLine bisInspOffLine) {
- BisInspOffLineRetBase bisInspOffLineRetBase = new BisInspOffLineRetBase();
- AttWuntBaseParam attWuntBaseParam = new AttWuntBaseParam();
- attWuntBaseParam.setUtName(bisInspOffLine.getName());
- attWuntBaseParam.setUtCode(bisInspOffLine.getCode());
- bisInspOffLineRetBase.setBase(attWuntBaseDao.findList(attWuntBaseParam));
- return bisInspOffLineRetBase;
- }
- }
|