xieb
2023-05-29 65edb8fdfce98c62c357fc51dc5ec7119e8b5e8e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package cn.gistack.sm.sjztmd.service.impl;
 
 
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.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.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;
 
/**
 * @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 IUserClient userClient;
 
    @Override
    @Transactional
    public Boolean updateAttResFlseLimByGuid(EditResInfoVO editResInfoVO) {
        editResInfoVO.setUpdateTime(DateUtil.now());
 
        // 修改汛期水位
        if (null != editResInfoVO.getXqswObjQ()) {
            AttResFlseLim attResFlseLimQ = editResInfoVO.getXqswObjQ();
            attResFlseLimQ.setResGuid(editResInfoVO.getResGuid());
            attResFlseLimQ.setUpdateTime(DateUtil.now());
            attResFlseLimQ.setUpdateBy(AuthUtil.getUserName() + "-" + userClient.userInfoById(AuthUtil.getUserId()).getData().getPhone());
            baseMapper.updateAttResFlseLimByGuid(attResFlseLimQ,"前汛期");
        }
        if (null != editResInfoVO.getXqswObjZ()) {
            AttResFlseLim attResFlseLimZ = editResInfoVO.getXqswObjZ();
            attResFlseLimZ.setResGuid(editResInfoVO.getResGuid());
            attResFlseLimZ.setUpdateTime(DateUtil.now());
            attResFlseLimZ.setUpdateBy(AuthUtil.getUserName() + "-" + userClient.userInfoById(AuthUtil.getUserId()).getData().getPhone());
            baseMapper.updateAttResFlseLimByGuid(attResFlseLimZ,"中汛期");
        }
        if (null != editResInfoVO.getXqswObjH()) {
            AttResFlseLim attResFlseLimH = editResInfoVO.getXqswObjH();
            attResFlseLimH.setResGuid(editResInfoVO.getResGuid());
            attResFlseLimH.setUpdateTime(DateUtil.now());
            attResFlseLimH.setUpdateBy(AuthUtil.getUserName() + "-" + userClient.userInfoById(AuthUtil.getUserId()).getData().getPhone());
            baseMapper.updateAttResFlseLimByGuid(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.getTopDamTopElevation())) {
            AttResWaterBlock resWaterBlock = new AttResWaterBlock();
            resWaterBlock.setResGuid(editResInfoVO.getResGuid());
            resWaterBlock.setTopDamTopElevation(editResInfoVO.getTopDamTopElevation());
            attResWaterBlockService.updateAttResWaterBlockByResId(resWaterBlock);
        }
 
        return attResStagCharService.customizeUpdateByGuid(attResStagChar);
    }
}