| File was renamed from skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztdw/service/impl/DbPersonReportServiceImpl.java |
| | |
| | | package cn.gistack.sm.sjztdw.service.impl; |
| | | |
| | | import cn.gistack.sm.sjztdw.entity.DwsRainResDi; |
| | | import cn.gistack.sm.sjztdw.entity.DwsResPressDi; |
| | | import cn.gistack.sm.sjztdw.entity.DwsResSlDi; |
| | | import cn.gistack.sm.sjztdw.entity.DwsWaterResZEightDetailAll; |
| | | import cn.gistack.sm.sjztdw.entity.*; |
| | | import cn.gistack.sm.sjztdw.excel.DbExcel; |
| | | import cn.gistack.sm.sjztdw.mapper.DwsResFormDiMapper; |
| | | import cn.gistack.sm.sjztdw.service.*; |
| | | import cn.gistack.sm.sjztdw.vo.DbExcelVO; |
| | | import cn.gistack.sm.sjztmd.service.IAttResBaseService; |
| | | import cn.gistack.sm.sjztmd.vo.AttResAdVO; |
| | | import cn.gistack.sm.sjztods.entity.DsmSpgSpprmp; |
| | |
| | | import cn.gistack.sm.sjztods.service.IDsmSpgSpprmpService; |
| | | import cn.gistack.sm.sjztods.service.IDsmSpgSpqnmpService; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | @Service |
| | | @AllArgsConstructor |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class DbPersonReportServiceImpl implements IDbPersonReportService { |
| | | @DS("ztdw") |
| | | public class DwsResFormDiServiceImpl extends ServiceImpl<DwsResFormDiMapper, DwsResFormDi> implements IDwsResFormDiService { |
| | | private IAttResBaseService attResBaseService; |
| | | |
| | | //日数据监测 |
| | | private IDwsRainResDiService dwsRainResDiService; |
| | | private IDwsWaterResZEightDetailAllService dwsWaterResZEightDetailAllService; |
| | | private IDwsResPressDiService dwsResPressDiService; |
| | | private IDwsResSlDiService dwsResSlDiService; |
| | | |
| | | |
| | | //测点表 |
| | | private IDsmSpgSpqnmpService dsmSpgSpqnmpService; |
| | | private IDsmSpgSpprmpService dsmSpgSpprmpService; |
| | | |
| | |
| | | |
| | | data.forEach(dbExcel->{ |
| | | |
| | | //存雨情数据 |
| | | saveDayRainFall(dbExcel,resAd); |
| | | if (StringUtil.isBlank(dbExcel.getRz())){ |
| | | dbExcel.setRz(""); |
| | | } |
| | | if (StringUtil.isBlank(dbExcel.getDrp())){ |
| | | dbExcel.setDrp(""); |
| | | } |
| | | if (StringUtil.isBlank(dbExcel.getLowZ())){ |
| | | dbExcel.setLowZ(""); |
| | | } |
| | | if (StringUtil.isBlank(dbExcel.getAvgValue())){ |
| | | dbExcel.setAvgValue(""); |
| | | } |
| | | if (StringUtil.isBlank(dbExcel.getAvgSpqnValue())){ |
| | | dbExcel.setAvgSpqnValue(""); |
| | | } |
| | | |
| | | //存水位数据 |
| | | saveWaterLevel(dbExcel,resAd); |
| | | //存总表数据 |
| | | Integer i = baseMapper.updateCustomize(dbExcel,resAd,ch); |
| | | if (i<=0){ |
| | | baseMapper.save(dbExcel,resAd,ch); |
| | | } |
| | | |
| | | //存渗压数据 |
| | | saveSy(dbExcel,resAd,dsmSpgSpprmpList); |
| | | if (StringUtil.isNotBlank(dbExcel.getDrp())){ |
| | | //存雨情数据 |
| | | saveDayRainFall(dbExcel,resAd); |
| | | } |
| | | |
| | | if (StringUtil.isNotBlank(dbExcel.getRz()) || StringUtil.isNotBlank(dbExcel.getLowZ())){ |
| | | //存水位数据 |
| | | saveWaterLevel(dbExcel,resAd); |
| | | } |
| | | |
| | | //存渗流数据 |
| | | saveSl(dbExcel,resAd,dsmSpgSpqnmpList); |
| | | if (StringUtil.isNotBlank(dbExcel.getAvgValue())){ |
| | | //存渗压数据 |
| | | saveSy(dbExcel,resAd,dsmSpgSpprmpList); |
| | | } |
| | | |
| | | if (StringUtil.isNotBlank(dbExcel.getAvgSpqnValue())){ |
| | | //存渗流数据 |
| | | saveSl(dbExcel,resAd,dsmSpgSpqnmpList); |
| | | } |
| | | |
| | | |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean update(DbExcelVO dbExcel) { |
| | | |
| | | |
| | | baseMapper.edit(dbExcel); |
| | | |
| | | //根据日期更新数据 |
| | | if (StringUtil.isNotBlank(dbExcel.getMonitorDate())){ |
| | | |
| | | |
| | | |
| | | Integer a = dwsRainResDiService.updateByBasic(dbExcel); |
| | | Integer b = dwsWaterResZEightDetailAllService.updateByBasic(dbExcel); |
| | | |
| | | Integer c = dwsResPressDiService.updateByBasic(dbExcel); |
| | | Integer d = dwsResSlDiService.updateByBasic(dbExcel); |
| | | |
| | | boolean b1 = a > 0; |
| | | boolean b2 = b > 0; |
| | | boolean b3 = c > 0; |
| | | boolean b4 = d > 0; |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean remove(DbExcelVO dbExcelVO) { |
| | | |
| | | baseMapper.remove(dbExcelVO); |
| | | |
| | | //根据日期删除数据 |
| | | if (StringUtil.isNotBlank(dbExcelVO.getMonitorDate())){ |
| | | Integer a = dwsRainResDiService.removeByBasic(dbExcelVO); |
| | | Integer b = dwsWaterResZEightDetailAllService.removeByBasic(dbExcelVO); |
| | | Integer c = dwsResPressDiService.removeByBasic(dbExcelVO); |
| | | Integer d = dwsResSlDiService.removeByBasic(dbExcelVO); |
| | | |
| | | boolean b1 = a > 0; |
| | | boolean b2 = b > 0; |
| | | boolean b3 = c > 0; |
| | | boolean b4 = d > 0; |
| | | |
| | | return b1&&b2&&b3&&b4; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean removeBatch(List<DbExcelVO> list) { |
| | | |
| | | list.forEach(e->{ |
| | | remove(e); |
| | | }); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | private void saveSy(DbExcel dbExcel, AttResAdVO resAd,List<DsmSpgSpprmp> list) { |
| | | try { |
| | | //excel数据应是按测压管从小到大 |
| | | List<String> avgValueList = Arrays.asList(dbExcel.getAvgValue().split(",")); |
| | | |
| | | //excel数据应是按测压管从小到大 |
| | | List<String> avgValueList = Arrays.asList(dbExcel.getAvgValue().split(",")); |
| | | //有渗压站才添加 |
| | | if (list !=null && list.size()>0){ |
| | | for (int i = 0; i < avgValueList.size(); i++) { |
| | | String avgValue = avgValueList.get(i); |
| | | DsmSpgSpprmp dsmSpgSpprmp = list.get(i); |
| | | |
| | | //有渗压站才添加 |
| | | if (list !=null && list.size()>0){ |
| | | for (int i = 0; i < avgValueList.size(); i++) { |
| | | String avgValue = avgValueList.get(i); |
| | | DsmSpgSpprmp dsmSpgSpprmp = list.get(i); |
| | | DwsResPressDi dwsResPressDi = new DwsResPressDi(); |
| | | //站点编码 |
| | | dwsResPressDi.setCd(dsmSpgSpprmp.getMpcd()); |
| | | //站点名称 |
| | | dwsResPressDi.setCdNm(dsmSpgSpprmp.getMpcd()); |
| | | |
| | | DwsResPressDi dwsResPressDi = new DwsResPressDi(); |
| | | //站点编码 |
| | | dwsResPressDi.setCd(dsmSpgSpprmp.getMpcd()); |
| | | //站点名称 |
| | | dwsResPressDi.setCdNm(dsmSpgSpprmp.getMpcd()); |
| | | dwsResPressDi.setResCd(resAd.getResGuid()); |
| | | dwsResPressDi.setResNm(resAd.getResName()); |
| | | dwsResPressDi.setAvgValue(avgValue); |
| | | |
| | | dwsResPressDi.setResCd(resAd.getResGuid()); |
| | | dwsResPressDi.setResNm(resAd.getResName()); |
| | | dwsResPressDi.setAvgValue(avgValue); |
| | | Date date = dateFormatString(dbExcel.getMonitorDate(), "yyyy-MM-dd"); |
| | | dwsResPressDi.setDt(date); |
| | | dwsResPressDi.setIsTb("y"); |
| | | |
| | | Date date = dateFormatString(dbExcel.getMonitorDate(), "yyyy-MM-dd"); |
| | | dwsResPressDi.setDt(date); |
| | | dwsResPressDi.setIsTb("y"); |
| | | |
| | | Integer result = dwsResPressDiService.updateCustomize(dwsResPressDi); |
| | | if (result<=0){ |
| | | dwsResPressDiService.save(dwsResPressDi); |
| | | Integer result = dwsResPressDiService.updateCustomize(dwsResPressDi); |
| | | if (result<=0){ |
| | | dwsResPressDiService.save(dwsResPressDi); |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | throw new RuntimeException("表格渗压数据个数超过当前水库断面测点个数"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | dwsWaterResZEightDetailAll.setResourceFlag("人工"); |
| | | dwsWaterResZEightDetailAll.setIsTb("y"); |
| | | |
| | | Date date = dateFormatString(dbExcel.getMonitorDate(), "yyyy-MM-dd 08:00:00"); |
| | | Date date = dateFormatString(dbExcel.getMonitorDate() + " 08:00:00", "yyyy-MM-dd 08:00:00"); |
| | | dwsWaterResZEightDetailAll.setDt(date); |
| | | dwsWaterResZEightDetailAll.setTm(date); |
| | | dwsWaterResZEightDetailAll.setCollectDt(date); |