| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- 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.AttSwhsBaseParam;
- 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 16:40
- */
- @Service
- @Transactional
- public class BisInspOffLineSwhsProcess extends BisInspOffLineProcess {
- @Autowired
- BisInspAllObjDao bisInspAllObjDao;
- @Autowired
- BisInspPblmDao bisInspPblmDao;//督查问题
- @Autowired
- BisInspSwhsRgstrMeasuresDao bisInspSwhsRgstrMeasuresDao;
- @Autowired
- BisInspSwhsRgstrDao bisInspSwhsRgstrDao;
- @Autowired
- AttSwhsBaseDao attSwhsBaseDao;
- @Autowired
- private GwComFileService gwComFileService;//文件操作
- @Value("${getFile.prefix}")
- public String prefix;
- @Autowired
- SupervisionPlanService supervisionPlanService;
- @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);
- //解析水源地填报信息
- BisInspOffLineSwhsRgeister bisInspOffLineSwhsRgeister = om.readValue(bisInspOffLineObj.getRegister(), BisInspOffLineSwhsRgeister.class);
- //解析水源地对象
- if (bisInspOffLineObj.getBase() != null) {
- /* if (null == bisInspOffLineObj.getReplace() || bisInspOffLineObj.getReplace()) {
- delRgstrData(bisInspOffLineObj);
- }*/
- //添加到督查任务
- String objId = UuidUtil.uuid();
- String groupId = bisInspOffLineObj.getGroupId();
- BisInspSwhsRgstr bisInspSwhsRgstr = new BisInspSwhsRgstr();
- String regId = UuidUtil.uuid();
- String persId = bisInspOffLineObj.getPersId();
- AttSwhsBase attSwhsBase = om.readValue(bisInspOffLineObj.getBase(), AttSwhsBase.class);
- insertBisInspAllObj(bisInspOffLineObj, groupId, objId, attSwhsBase);
- insertSwhsRgstr(attSwhsBase, groupId, objId, persId, regId, bisInspSwhsRgstr);
- //重要饮用水水源管理情况
- insertSwhsMeasuresInfo(bisInspOffLineSwhsRgeister, regId, persId, bisInspSwhsRgstr);
- //更新督查 字表状态
- bisInspSwhsRgstrDao.update(bisInspSwhsRgstr);
- bisInspOffLineRet.setObjId(objId);
- bisInspOffLineRet.setRegId(regId);
- }
- 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.SWHS.getValue(), bisInspAllObj.getObjId());
- }
- }
- /**
- * 添加到督查任务
- *
- * @param groupId
- * @param objId
- * @param attSwhsBase
- */
- public void insertBisInspAllObj(BisInspOffLineObj bisInspOffLineObj, String groupId, String objId, AttSwhsBase attSwhsBase) {
- BisInspAllObj bisInspAllObj = new BisInspAllObj();
- bisInspAllObj.setId(groupId);
- bisInspAllObj.setObjId(objId);
- bisInspAllObj.setNm(attSwhsBase.getSwhsName());
- bisInspAllObj.setCode(attSwhsBase.getSwhsCode());//非空字段
- bisInspAllObj.setPtype("13");
- bisInspAllObj.setOrgId(bisInspOffLineObj.getOrgId());
- bisInspAllObj.setAdCode(bisInspOffLineObj.getProvince());
- bisInspAllObj.setLgtd(attSwhsBase.getSwhsLong());
- bisInspAllObj.setLttd(attSwhsBase.getSwhsLat());
- bisInspAllObj.setLgtdpc(attSwhsBase.getSwhsLongGd());
- bisInspAllObj.setLttdpc(attSwhsBase.getSwhsLatGd());
- bisInspAllObjDao.insert(bisInspAllObj);
- }
- /**
- * 插入登记表信息
- *
- * @param bisInspOffLineObj
- * @param objId
- * @param om
- * @param regId
- * @param bisInspSwhsRgstr
- * @throws IOException
- */
- public void insertSwhsRgstr(AttSwhsBase attSwhsBase, String groupId, String objId, String persId, String regId, BisInspSwhsRgstr bisInspSwhsRgstr) throws IOException {
- bisInspSwhsRgstr.setId(regId);
- bisInspSwhsRgstr.setObjId(objId);
- bisInspSwhsRgstr.setSwhsId(attSwhsBase.getId());
- bisInspSwhsRgstr.setSwhsCode(attSwhsBase.getSwhsCode());
- bisInspSwhsRgstr.setSwhsName(attSwhsBase.getSwhsName());
- bisInspSwhsRgstr.setInsName(attSwhsBase.getInsName());
- bisInspSwhsRgstr.setAdCode(attSwhsBase.getAdCode());
- bisInspSwhsRgstr.setSwhsLoc(attSwhsBase.getSwhsLoc());
- bisInspSwhsRgstr.setCenterX(attSwhsBase.getSwhsLong());
- bisInspSwhsRgstr.setCenterY(attSwhsBase.getSwhsLat());
- bisInspSwhsRgstr.setGdX(attSwhsBase.getSwhsLongGd());
- bisInspSwhsRgstr.setGdY(attSwhsBase.getSwhsLatGd());
- bisInspSwhsRgstr.setWainWasoType(attSwhsBase.getWainWasoType());
- bisInspSwhsRgstr.setWatArea(attSwhsBase.getWatArea());
- bisInspSwhsRgstr.setWainNum(attSwhsBase.getWainNum());
- bisInspSwhsRgstr.setWainUse(attSwhsBase.getWainUse());
- bisInspSwhsRgstr.setWasuObjType(attSwhsBase.getWasuObjType());
- bisInspSwhsRgstr.setDesAnnWain(attSwhsBase.getDesAnnWain());
- bisInspSwhsRgstr.setDesAnnWasuPop(attSwhsBase.getDesAnnWasuPop());
- bisInspSwhsRgstr.setWaquGoal(attSwhsBase.getWaquGoal());
- bisInspSwhsRgstr.setIfMonWqua(attSwhsBase.getIfMonWqua());
- bisInspSwhsRgstr.setWquaCat(attSwhsBase.getWquaCat());
- bisInspSwhsRgstr.setIfWquaUptoSta(attSwhsBase.getIfWquaUptoSta());
- bisInspSwhsRgstr.setNote(attSwhsBase.getNote());
- bisInspSwhsRgstr.setState("1");
- bisInspSwhsRgstr.setDataStat("0");
- bisInspSwhsRgstr.setPersId(persId);
- bisInspSwhsRgstr.setGroupId(groupId);
- bisInspSwhsRgstr.setInTm(new Date());
- bisInspSwhsRgstr.setUpTm(new Date());
- bisInspSwhsRgstrDao.insert(bisInspSwhsRgstr);
- }
- /**
- * 重要饮用水水源管理情况
- *
- * @param bisInspOffLineSwhsRgeister
- * @param regId
- * @param bisInspOffLineObj
- * @param bisInspSwhsRgstr
- */
- public void insertSwhsMeasuresInfo(BisInspOffLineSwhsRgeister bisInspOffLineSwhsRgeister, String regId, String persId, BisInspSwhsRgstr bisInspSwhsRgstr) {
- //节水评价情况检查表
- BisInspSwhsRgstrMeasures bisInspSwhsRgstrMeasures = new BisInspSwhsRgstrMeasures();
- if (bisInspOffLineSwhsRgeister.getBisInspSwhsRgstrMeasures() != null) {
- bisInspSwhsRgstrMeasures = bisInspOffLineSwhsRgeister.getBisInspSwhsRgstrMeasures();
- bisInspSwhsRgstrMeasures.setId(UuidUtil.uuid());
- bisInspSwhsRgstrMeasures.setRgstrId(regId);
- bisInspSwhsRgstrMeasures.setInTm(new Date());
- bisInspSwhsRgstrMeasures.setUpTm(new Date());
- bisInspSwhsRgstrMeasures.setDataStat("0");
- bisInspSwhsRgstrMeasures.setRecPersId(persId);
- bisInspSwhsRgstrMeasuresDao.insert(bisInspSwhsRgstrMeasures);
- bisInspSwhsRgstr.setMeasuresStat("2");
- } else {
- bisInspSwhsRgstrMeasures.setId(UuidUtil.uuid());
- bisInspSwhsRgstrMeasures.setRgstrId(regId);
- bisInspSwhsRgstrMeasures.setInTm(new Date());
- bisInspSwhsRgstrMeasures.setUpTm(new Date());
- bisInspSwhsRgstrMeasures.setDataStat("0");
- bisInspSwhsRgstrMeasures.setRecPersId(persId);
- bisInspSwhsRgstrMeasuresDao.insert(bisInspSwhsRgstrMeasures);
- bisInspSwhsRgstr.setMeasuresStat("1");
- }
- }
- @Override
- public BisInspOffLineRetBase getBaseInfo(BisInspOffLine bisInspOffLine) {
- BisInspOffLineRetBase bisInspOffLineRetBase = new BisInspOffLineRetBase();
- AttSwhsBaseParam attSwhsBaseParam = new AttSwhsBaseParam();
- attSwhsBaseParam.setSwhsName(bisInspOffLine.getName());
- attSwhsBaseParam.setSwhsCode(bisInspOffLine.getCode());
- bisInspOffLineRetBase.setBase(attSwhsBaseDao.findList(attSwhsBaseParam));
- return bisInspOffLineRetBase;
- }
- }
|