| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- 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.AttSdBaseParam;
- 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 14:02
- */
- @Service
- @Transactional
- public class BisInspOffLineSdProcess extends BisInspOffLineProcess {
- @Autowired
- AttSdBaseDao attSdBaseDao;
- @Autowired
- BisInspSdRgstrDao bisInspSdRgstrDao;
- @Autowired
- BisInspAllObjDao bisInspAllObjDao;
- @Autowired
- BisInspPblmDao bisInspPblmDao;//督查问题
- @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);
- //解析淤堤坝填报信息
- if (bisInspOffLineObj.getRegister() != null) {
- BisInspOffLineSdRgeister bisInspOffLineSdRgeister = om.readValue(bisInspOffLineObj.getRegister(), BisInspOffLineSdRgeister.class);
- }
- //解析淤堤坝基本信息对象
- if (bisInspOffLineObj.getBase() != null) {
- /* if (null == bisInspOffLineObj.getReplace() || bisInspOffLineObj.getReplace()) {
- delRgstrData(bisInspOffLineObj);
- }*/
- //添加到督查任务bisInspOffLineSdRgeister
- String objId = UuidUtil.uuid();
- String groupId = bisInspOffLineObj.getGroupId();
- BisInspSdRgstr bisInspSdRgstr = new BisInspSdRgstr();
- String regId = objId;
- String persId = bisInspOffLineObj.getPersId();
- AttSdBase attSdBase = om.readValue(bisInspOffLineObj.getBase(), AttSdBase.class);
- insertBisInspAllObj(bisInspOffLineObj, groupId, objId, attSdBase);
- insertAttSdRgstr(attSdBase, groupId, objId, persId, regId, bisInspSdRgstr);
- //更新督查 字表状态
- bisInspSdRgstrDao.update(bisInspSdRgstr);
- 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.SD.getValue(), bisInspAllObj.getObjId());
- }
- }
- /**
- * 添加到督查任务
- *
- * @param groupId
- * @param objId
- * @param attSdBase
- */
- public void insertBisInspAllObj(BisInspOffLineObj bisInspOffLineObj, String groupId, String objId, AttSdBase attSdBase) {
- BisInspAllObj bisInspAllObj = new BisInspAllObj();
- bisInspAllObj.setId(groupId);
- bisInspAllObj.setObjId(objId);
- bisInspAllObj.setNm(attSdBase.getSdName());
- bisInspAllObj.setCode(attSdBase.getSdCode());
- bisInspAllObj.setPtype("11");
- bisInspAllObj.setOrgId(bisInspOffLineObj.getOrgId());
- bisInspAllObj.setAdCode(bisInspOffLineObj.getProvince());
- bisInspAllObj.setLgtd(attSdBase.getCenterX());
- bisInspAllObj.setLttd(attSdBase.getCenterY());
- bisInspAllObj.setLgtdpc(attSdBase.getGdX());
- bisInspAllObj.setLttdpc(attSdBase.getGdY());
- bisInspAllObjDao.insert(bisInspAllObj);
- }
- /**
- * 插入登记表信息
- *
- * @param bisInspOffLineObj
- * @param objId
- * @param om
- * @param regId
- * @param bisInspSdRgstr
- * @throws IOException
- */
- public void insertAttSdRgstr(AttSdBase attSdBase, String groupId, String objId, String persId, String regId, BisInspSdRgstr bisInspSdRgstr) throws IOException {
- bisInspSdRgstr.setId(regId);
- bisInspSdRgstr.setObjId(objId);
- bisInspSdRgstr.setSdCode(attSdBase.getSdCode());
- bisInspSdRgstr.setSdName(attSdBase.getSdName());
- bisInspSdRgstr.setSdType(attSdBase.getSdType());
- bisInspSdRgstr.setSdTypeStr(attSdBase.getSdTypeStr());
- bisInspSdRgstr.setAdCode(attSdBase.getAdCode());
- bisInspSdRgstr.setConArea(attSdBase.getConArea());
- bisInspSdRgstr.setTotCap(attSdBase.getTotCap());
- bisInspSdRgstr.setFlcoCap(attSdBase.getFlcoCap());
- bisInspSdRgstr.setSdrCap(attSdBase.getSdrCap());
- bisInspSdRgstr.setFlcoYear(attSdBase.getFlcoYear());
- bisInspSdRgstr.setWarpCap(attSdBase.getWarpCap());
- bisInspSdRgstr.setDamSizeHig(attSdBase.getDamSizeHig());
- bisInspSdRgstr.setDamTopLen(attSdBase.getDamTopLen());
- bisInspSdRgstr.setAdName(attSdBase.getAdFullName());
- bisInspSdRgstr.setSdLoc(attSdBase.getSdLoc());
- bisInspSdRgstr.setAsinttds(attSdBase.getAsinttds());
- bisInspSdRgstr.setNoSpway(attSdBase.getNoSpway());
- bisInspSdRgstr.setDamTear(attSdBase.getDamTear());
- bisInspSdRgstr.setDamLandSubSide(attSdBase.getDamLandSubSide());
- bisInspSdRgstr.setDamRsog(attSdBase.getDamRsog());
- bisInspSdRgstr.setDamLopc(attSdBase.getDamLopc());
- bisInspSdRgstr.setDsLts(attSdBase.getDsLts());
- bisInspSdRgstr.setDsCc(attSdBase.getDsCc());
- bisInspSdRgstr.setDsOc(attSdBase.getDsOc());
- bisInspSdRgstr.setFrsMar(attSdBase.getFrsMar());
- bisInspSdRgstr.setFrsTbd(attSdBase.getFrsTbd());
- bisInspSdRgstr.setFrsOth(attSdBase.getFrsOth());
- bisInspSdRgstr.setNote(attSdBase.getNote());
- bisInspSdRgstr.setState("1");
- bisInspSdRgstr.setDataStat("0");
- bisInspSdRgstr.setPersId(persId);
- bisInspSdRgstr.setGroupId(groupId);
- bisInspSdRgstr.setCenterX(attSdBase.getCenterX());
- bisInspSdRgstr.setCenterY(attSdBase.getCenterY());
- bisInspSdRgstr.setGdX(attSdBase.getGdX());
- bisInspSdRgstr.setGdY(attSdBase.getGdY());
- bisInspSdRgstr.setInTm(new Date());
- bisInspSdRgstr.setUpTm(new Date());
- bisInspSdRgstrDao.insert(bisInspSdRgstr);
- }
- @Override
- public BisInspOffLineRetBase getBaseInfo(BisInspOffLine bisInspOffLine) {
- BisInspOffLineRetBase bisInspOffLineRetBase = new BisInspOffLineRetBase();
- AttSdBaseParam attSdBaseParam = new AttSdBaseParam();
- attSdBaseParam.setSdName(bisInspOffLine.getName());
- attSdBaseParam.setSdCode(bisInspOffLine.getCode());
- bisInspOffLineRetBase.setBase(attSdBaseDao.findList(attSdBaseParam));
- return bisInspOffLineRetBase;
- }
- }
|