guoshilong
2024-02-22 9a1fc806b7cd4e4e11778f9d3bf51987f8b7908b
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
package cn.gistack.sm.sjztmd.service.impl;
 
import cn.gistack.sm.sjztmd.entity.AttResStagChar;
import cn.gistack.sm.sjztmd.mapper.AttResStagCharMapper;
import cn.gistack.sm.sjztmd.service.IAttResStagCharService;
import cn.gistack.system.user.feign.IUserClient;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.shaded.com.google.gson.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 java.util.Date;
 
/**
 * @ClassName AttResStagCharServiceImpl
 * @Description TODO
 * @Author aix
 * @Date 2023/4/21 20:01
 * @Version 1.0
 */
@Service
@DS("zt")
public class AttResStagCharServiceImpl extends ServiceImpl<AttResStagCharMapper, AttResStagChar> implements IAttResStagCharService {
 
    @Autowired
    private IUserClient userClient;
 
    @Override
    public AttResStagChar getByResGuid(String resGuid) {
        return baseMapper.getByResGuid(resGuid);
    }
 
    @Override
    public Boolean customizeUpdateByGuid(AttResStagChar attResStagChar) {
        attResStagChar.setUpdateTime(DateUtil.now());
        JSONObject paramJson = new JSONObject();
        paramJson.put("time", DateUtil.format(new Date(),"yyyy-MM-dd"));
        String editPar = "";
        if (StringUtil.isNotBlank(attResStagChar.getTbChecFlStag()))
            editPar += ",tb_chec_fl_stag:修改值为" + attResStagChar.getTbChecFlStag();
        if (StringUtil.isNotBlank(attResStagChar.getTbDeadStag()))
            editPar += ",tb_dead_stag:修改值为" + attResStagChar.getTbDeadStag();
        if (StringUtil.isNotBlank(attResStagChar.getTbDesFlStag()))
            editPar += ",tb_des_fl_stag:修改值为" + attResStagChar.getTbDesFlStag();
        if (StringUtil.isNotBlank(attResStagChar.getTbFlprHighStag()))
            editPar += ",tb_flpr_high_stag:修改值为" + attResStagChar.getTbFlprHighStag();
        if (StringUtil.isNotBlank(attResStagChar.getTbNormPoolStag()))
            editPar += ",tb_norm_pool_stag:修改值为" + attResStagChar.getTbNormPoolStag();
        if (StringUtil.isNotBlank(attResStagChar.getTbDeadCap()))
            editPar += ",tb_dead_cap:修改值为" + attResStagChar.getTbDeadCap();
        if (StringUtil.isNotBlank(attResStagChar.getTbTotCap()))
            editPar += ",tb_tot_cap:修改值为" + attResStagChar.getTbTotCap();
        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());
 
        attResStagChar.setUpdateBy(paramJson.toJSONString());
        Integer ret = baseMapper.customizeUpdateByGuid(attResStagChar);
 
        if (ret == 0) {
            ret = baseMapper.addattResStagChar(attResStagChar);
        }
        return SqlHelper.retBool(ret);
    }
}