package cn.gistack.sm.sjztmd.service.impl;
|
|
|
import cn.gistack.sm.sjztmd.entity.AttResDangerManageSpecial;
|
import cn.gistack.sm.sjztmd.entity.AttResFlseLim;
|
import cn.gistack.sm.sjztmd.entity.AttResStagChar;
|
import cn.gistack.sm.sjztmd.entity.AttResWaterBlock;
|
import cn.gistack.sm.sjztmd.mapper.AttResFlseLimMapper;
|
import cn.gistack.sm.sjztmd.service.IAttResDangerManageSpecialService;
|
import cn.gistack.sm.sjztmd.service.IAttResFlseLimService;
|
import cn.gistack.sm.sjztmd.service.IAttResStagCharService;
|
import cn.gistack.sm.sjztmd.service.IAttResWaterBlockService;
|
import cn.gistack.sm.sjztmd.vo.EditResInfoVO;
|
import cn.gistack.system.user.feign.IUserClient;
|
import com.alibaba.fastjson.JSONObject;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
|
import org.springblade.core.secure.utils.AuthUtil;
|
import org.springblade.core.tool.utils.DateUtil;
|
import org.springblade.core.tool.utils.StringUtil;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import java.util.Date;
|
|
/**
|
* @PROJECT_NAME: skjcmanager
|
* @DESCRIPTION:
|
* @USER: aix
|
* @DATE: 2023/5/22 21:26
|
*/
|
@Service
|
@DS("zt")
|
public class AttResFlseLimServiceImpl extends ServiceImpl<AttResFlseLimMapper, AttResFlseLim> implements IAttResFlseLimService {
|
|
@Autowired
|
private IAttResStagCharService attResStagCharService;
|
|
@Autowired
|
private IAttResWaterBlockService attResWaterBlockService;
|
|
@Autowired
|
private IAttResDangerManageSpecialService attResDangerManageSpecialService;
|
|
@Autowired
|
private IUserClient userClient;
|
|
@Override
|
@Transactional
|
public Boolean updateAttResFlseLimByGuid(EditResInfoVO editResInfoVO) {
|
editResInfoVO.setUpdateTime(DateUtil.now());
|
|
// 修改汛期水位
|
if (null != editResInfoVO.getXqswObjQ() && StringUtil.isNotBlank(String.valueOf(editResInfoVO.getXqswObjQ().getTbFlseLimStag()))) {
|
AttResFlseLim attResFlseLimQ = editResInfoVO.getXqswObjQ();
|
attResFlseLimQ.setResGuid(editResInfoVO.getResGuid());
|
attResFlseLimQ.setUpdateTime(DateUtil.now());
|
|
JSONObject paramJson = new JSONObject();
|
paramJson.put("time", DateUtil.format(new Date(),"yyyy-MM-dd"));
|
String editPar = "tb_flse_lim_stag:修改值为" + editResInfoVO.getXqswObjQ().getTbFlseLimStag();
|
if (StringUtil.isNotBlank(editResInfoVO.getXqswObjQ().getTbFloodSeasonStart()))
|
editPar += ",tb_flood_season_start:修改值为" + editResInfoVO.getXqswObjQ().getTbFloodSeasonStart();
|
if (StringUtil.isNotBlank(editResInfoVO.getXqswObjQ().getTbFloodSeasonEnd()))
|
editPar += ",tb_flood_season_end:修改值为" + editResInfoVO.getXqswObjQ().getTbFloodSeasonEnd();
|
paramJson.put("editPar", editPar);
|
paramJson.put("ly", "ywxt");
|
paramJson.put("user_id", AuthUtil.getUserId());
|
paramJson.put("user_name", AuthUtil.getUserName());
|
paramJson.put("phone", userClient.userInfoById(AuthUtil.getUserId()).getData().getPhone());
|
attResFlseLimQ.setUpdateBy(paramJson.toJSONString());
|
|
Integer ret = baseMapper.updateAttResFlseLimByGuid(attResFlseLimQ,"前汛期");
|
if (ret == 0) {
|
baseMapper.addAttResFlseLim(attResFlseLimQ,"前汛期");
|
}
|
}
|
if (null != editResInfoVO.getXqswObjZ() && StringUtil.isNotBlank(String.valueOf(editResInfoVO.getXqswObjZ().getTbFlseLimStag()))) {
|
AttResFlseLim attResFlseLimZ = editResInfoVO.getXqswObjZ();
|
attResFlseLimZ.setResGuid(editResInfoVO.getResGuid());
|
attResFlseLimZ.setUpdateTime(DateUtil.now());
|
|
JSONObject paramJson = new JSONObject();
|
paramJson.put("time", DateUtil.format(new Date(),"yyyy-MM-dd"));
|
String editPar = "tb_flse_lim_stag:修改值为" + editResInfoVO.getXqswObjZ().getTbFlseLimStag();
|
if (StringUtil.isNotBlank(editResInfoVO.getXqswObjQ().getTbFloodSeasonStart()))
|
editPar += ",tb_flood_season_start:修改值为" + editResInfoVO.getXqswObjQ().getTbFloodSeasonStart();
|
if (StringUtil.isNotBlank(editResInfoVO.getXqswObjQ().getTbFloodSeasonEnd()))
|
editPar += ",tb_flood_season_end:修改值为" + editResInfoVO.getXqswObjQ().getTbFloodSeasonEnd();
|
paramJson.put("editPar", editPar);
|
paramJson.put("ly", "ywxt");
|
paramJson.put("user_id", AuthUtil.getUserId());
|
paramJson.put("user_name", AuthUtil.getUserName());
|
paramJson.put("phone", userClient.userInfoById(AuthUtil.getUserId()).getData().getPhone());
|
attResFlseLimZ.setUpdateBy(paramJson.toJSONString());
|
|
Integer ret = baseMapper.updateAttResFlseLimByGuid(attResFlseLimZ,"中汛期");
|
|
if (ret == 0) {
|
baseMapper.addAttResFlseLim(attResFlseLimZ,"中汛期");
|
}
|
}
|
if (null != editResInfoVO.getXqswObjH() && StringUtil.isNotBlank(String.valueOf(editResInfoVO.getXqswObjH().getTbFlseLimStag()))) {
|
AttResFlseLim attResFlseLimH = editResInfoVO.getXqswObjH();
|
attResFlseLimH.setResGuid(editResInfoVO.getResGuid());
|
attResFlseLimH.setUpdateTime(DateUtil.now());
|
|
JSONObject paramJson = new JSONObject();
|
paramJson.put("time", DateUtil.format(new Date(),"yyyy-MM-dd"));
|
String editPar = "tb_flse_lim_stag:修改值为" + editResInfoVO.getXqswObjH().getTbFlseLimStag();
|
if (StringUtil.isNotBlank(editResInfoVO.getXqswObjQ().getTbFloodSeasonStart()))
|
editPar += ",tb_flood_season_start:修改值为" + editResInfoVO.getXqswObjQ().getTbFloodSeasonStart();
|
if (StringUtil.isNotBlank(editResInfoVO.getXqswObjQ().getTbFloodSeasonEnd()))
|
editPar += ",tb_flood_season_end:修改值为" + editResInfoVO.getXqswObjQ().getTbFloodSeasonEnd();
|
paramJson.put("editPar", editPar);
|
paramJson.put("ly", "ywxt");
|
paramJson.put("user_id", AuthUtil.getUserId());
|
paramJson.put("user_name", AuthUtil.getUserName());
|
paramJson.put("phone", userClient.userInfoById(AuthUtil.getUserId()).getData().getPhone());
|
attResFlseLimH.setUpdateBy(paramJson.toJSONString());
|
|
Integer ret = baseMapper.updateAttResFlseLimByGuid(attResFlseLimH,"后汛期");
|
if (ret == 0) {
|
baseMapper.addAttResFlseLim(attResFlseLimH,"后汛期");
|
}
|
}
|
|
// 修改水位特征参数
|
AttResStagChar attResStagChar = new AttResStagChar();
|
attResStagChar.setResGuid(editResInfoVO.getResGuid());
|
if (StringUtil.isNotBlank(editResInfoVO.getChecFlStag()))
|
attResStagChar.setTbChecFlStag(editResInfoVO.getChecFlStag());
|
if (StringUtil.isNotBlank(editResInfoVO.getDeadCap()))
|
attResStagChar.setTbDeadCap(editResInfoVO.getDeadCap());
|
if (StringUtil.isNotBlank(editResInfoVO.getDeadStag()))
|
attResStagChar.setTbDeadStag(editResInfoVO.getDeadStag());
|
if (StringUtil.isNotBlank(editResInfoVO.getFlprHighStag()))
|
attResStagChar.setTbFlprHighStag(editResInfoVO.getFlprHighStag());
|
if (StringUtil.isNotBlank(editResInfoVO.getNormPoolStag()))
|
attResStagChar.setTbNormPoolStag(editResInfoVO.getNormPoolStag());
|
if (StringUtil.isNotBlank(editResInfoVO.getDesFlStag()))
|
attResStagChar.setTbDesFlStag(editResInfoVO.getDesFlStag());
|
if (StringUtil.isNotBlank(editResInfoVO.getTotCap()))
|
attResStagChar.setTbTotCap(editResInfoVO.getTotCap());
|
if (StringUtil.isNotBlank(editResInfoVO.getWatShedArea()))
|
attResStagChar.setWatShedArea(editResInfoVO.getWatShedArea());
|
|
// 修改坝顶高程
|
if (StringUtil.isNotBlank(editResInfoVO.getTbDamTopElevation())) {
|
AttResWaterBlock resWaterBlock = new AttResWaterBlock();
|
resWaterBlock.setResGuid(editResInfoVO.getResGuid());
|
resWaterBlock.setTbDamTopElevation(editResInfoVO.getTbDamTopElevation());
|
attResWaterBlockService.updateAttResWaterBlockByResId(resWaterBlock);
|
}
|
|
// 修改控制运行水位
|
if (StringUtil.isNotBlank(editResInfoVO.getTbControlZ())) {
|
AttResDangerManageSpecial attResDangerManageSpecial = new AttResDangerManageSpecial();
|
attResDangerManageSpecial.setResGuid(editResInfoVO.getResGuid());
|
attResDangerManageSpecial.setTbControlZ(editResInfoVO.getTbControlZ());
|
attResDangerManageSpecialService.updateAttResDangerManageSpecialByResId(attResDangerManageSpecial);
|
}
|
|
return attResStagCharService.customizeUpdateByGuid(attResStagChar);
|
}
|
}
|