diff --git a/lzbi-admin/src/main/resources/application-dev.yml b/lzbi-admin/src/main/resources/application-dev.yml index f1554fb..feb45d1 100644 --- a/lzbi-admin/src/main/resources/application-dev.yml +++ b/lzbi-admin/src/main/resources/application-dev.yml @@ -48,6 +48,8 @@ spring: minEvictableIdleTimeMillis: 300000 # 配置一个连接在池中最大生存的时间,单位是毫秒 maxEvictableIdleTimeMillis: 900000 + # 查询等待时间 + # query-timeout: 60000 # 配置检测连接是否有效 validationQuery: SELECT 1 testWhileIdle: true @@ -97,7 +99,7 @@ spring: workDB: driverClassName: org.postgresql.Driver type: com.alibaba.druid.pool.DruidDataSource - url: jdbc:postgresql://10.10.10.56:5432/dctestdb?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai + url: jdbc:postgresql://10.10.10.56:5432/dctestdb?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai&Read_Timeout=120000 username: postgres password: 123456 primary: master @@ -146,12 +148,18 @@ wechat: # 外部服务 goal-server: # iot平台服务地址 - iot: http://127.0.0.1:9010 + iot: http://10.10.10.56:9010 + magic: http://localhost:9012/magic/api # 外部服务接口 -goal-server-api: +iot-server-api: # 获取组织资产参数树形结构 - getOrgAssetParamsTree: ${goal-server.iot}/biz/common/orgAssetParamsTree + orgAssetParamsTree: ${goal-server.iot}/biz/common/orgAssetParamsTree # 获取组织资产参数树形结构 - getParamsValue: ${goal-server.iot}/biz/common/paramsValue + paramsValue: ${goal-server.iot}/biz/common/paramsValue + +# magic api +magic-server-api: + # 获取收费系统参数 + chargeSystemParams: ${goal-server.magic}/charge/sqaure diff --git a/lzbi-admin/src/main/resources/application-test.yml b/lzbi-admin/src/main/resources/application-test.yml index 2e56abc..81f14b7 100644 --- a/lzbi-admin/src/main/resources/application-test.yml +++ b/lzbi-admin/src/main/resources/application-test.yml @@ -146,11 +146,18 @@ wechat: # 外部服务 goal-server: # iot平台服务地址 - iot: http://127.0.0.1:9010 + iot: http://10.10.10.56:9010 + magic: http://localhost:9012/magic/api -# 外部服务接口 -goal-server-api: +# IOT服务接口 +iot-server-api: # 获取组织资产参数树形结构 - getOrgAssetParamsTree: ${goal-server.iot}/biz/common/orgAssetParamsTree + orgAssetParamsTree: ${goal-server.iot}/biz/common/orgAssetParamsTree # 获取组织资产参数树形结构 - getParamsValue: ${goal-server.iot}/biz/common/paramsValue + paramsValue: ${goal-server.iot}/biz/common/paramsValue + +# magic api +magic-server-api: + # 获取收费系统参数 + chargeSystemParams: ${goal-server.magic}/charge/sqaure + diff --git a/lzbi-common/src/main/java/com/lzbi/common/config/GoalServerApiConfig.java b/lzbi-common/src/main/java/com/lzbi/common/config/IotServerApiConfig.java similarity index 64% rename from lzbi-common/src/main/java/com/lzbi/common/config/GoalServerApiConfig.java rename to lzbi-common/src/main/java/com/lzbi/common/config/IotServerApiConfig.java index 081dbe9..8142837 100644 --- a/lzbi-common/src/main/java/com/lzbi/common/config/GoalServerApiConfig.java +++ b/lzbi-common/src/main/java/com/lzbi/common/config/IotServerApiConfig.java @@ -6,15 +6,15 @@ import org.springframework.stereotype.Component; @Data @Component -@ConfigurationProperties(prefix = "goal-server-api") -public class GoalServerApiConfig { +@ConfigurationProperties(prefix = "iot-server-api") +public class IotServerApiConfig { /** * 获取组织资产参数树形结构 */ - private String getOrgAssetParamsTree; + private String orgAssetParamsTree; /** * 获取参数值 */ - private String getParamsValue; + private String paramsValue; } diff --git a/lzbi-common/src/main/java/com/lzbi/common/config/MagicServerApiConfig.java b/lzbi-common/src/main/java/com/lzbi/common/config/MagicServerApiConfig.java new file mode 100644 index 0000000..481964e --- /dev/null +++ b/lzbi-common/src/main/java/com/lzbi/common/config/MagicServerApiConfig.java @@ -0,0 +1,16 @@ +package com.lzbi.common.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Data +@Component +@ConfigurationProperties(prefix = "magic-server-api") +public class MagicServerApiConfig { + + /** + * 获取收费系统参数 + */ + private String chargeSystemParams; +} diff --git a/lzbi-common/src/main/java/com/lzbi/common/constant/BizConstants.java b/lzbi-common/src/main/java/com/lzbi/common/constant/BizConstants.java index 0c94884..20a3930 100644 --- a/lzbi-common/src/main/java/com/lzbi/common/constant/BizConstants.java +++ b/lzbi-common/src/main/java/com/lzbi/common/constant/BizConstants.java @@ -5,6 +5,17 @@ package com.lzbi.common.constant; */ public interface BizConstants { + /** + * 数据来源;生产IOT:work;计费:charge;Erp:erp + */ + interface GoalSource { + String WORK = "work"; + + String CHARGE = "charge"; + + String ERP = "erp"; + } + /** * 指标类别 */ diff --git a/lzbi-common/src/main/java/com/lzbi/common/constant/ParamsModelCodeConstants.java b/lzbi-common/src/main/java/com/lzbi/common/constant/ParamsModelCodeConstants.java new file mode 100644 index 0000000..5e6e5f9 --- /dev/null +++ b/lzbi-common/src/main/java/com/lzbi/common/constant/ParamsModelCodeConstants.java @@ -0,0 +1,74 @@ +package com.lzbi.common.constant; + +public class ParamsModelCodeConstants { + + public static final String 二次网供温设定 = "005"; + public static final String 一次网供温 = "011"; + public static final String 一次网回温 = "012"; + public static final String 瞬时热量 = "008"; + public static final String 累计热量 = "009"; + public static final String 水箱水位计 = "015"; + public static final String 瞬时流量 = "007"; + public static final String 热量累计清零 = "010"; + public static final String 地面水面报警器 = "016"; + public static final String 一次网供压 = "013"; + public static final String 一次网回压 = "014"; + public static final String 总电表 = "017"; + public static final String 一次网管道泵远控就地 = "018"; + public static final String 电调阀远控就地 = "003"; + public static final String 电调阀开度给定 = "001"; + public static final String 电调阀开度反馈 = "002"; + public static final String 二次网供回水平均温设定 = "006"; + public static final String 水表累计补水量 = "031"; + public static final String 一次网管道泵频率给定 = "023"; + public static final String 一次网混水电调阀开度给定 = "028"; + public static final String 一次网混水电调阀开度反馈 = "029"; + public static final String 补水泵1号故障状态 = "035"; + public static final String 水表累计补水量清零 = "032"; + public static final String 供水焓值 = "053"; + public static final String 回水热量 = "057"; + public static final String 补水泵2号故障状态 = "036"; + public static final String 循环泵远控就地选择 = "037"; + public static final String 一次网管道泵频率反馈 = "024"; + public static final String 循环泵1号或2号泵选择 = "038"; + public static final String 一次网管道泵下电 = "020"; + public static final String 一次网管道泵启动 = "021"; + public static final String 循环泵控制模式选择 = "039"; + public static final String 一次网管道泵运行或停止状态 = "025"; + public static final String 一次网管道泵故障状态 = "026"; + public static final String 一次网混水电调阀远控或就地 = "027"; + public static final String 补水泵1号运行或停止状态 = "033"; + public static final String 补水泵2号运行或停止状态 = "034"; + public static final String 循环泵变频上电 = "040"; + public static final String 循环泵变频下电 = "041"; + public static final String 循环泵变频启动 = "042"; + public static final String 循环泵变频停止 = "043"; + public static final String 二次网压差设定 = "044"; + public static final String 二次网供水温 = "045"; + public static final String 二次网回水温 = "046"; + public static final String 供水流量 = "049"; + public static final String 供水流量累计 = "051"; + public static final String 供水流量信号 = "050"; + public static final String 回水流量 = "054"; + public static final String 回水流量信号 = "055"; + public static final String 回水流量累计 = "056"; + public static final String 回水焓值 = "058"; + public static final String 耗流瞬时 = "059"; + public static final String 耗流累计 = "060"; + public static final String 耗热累计 = "062"; + public static final String 能耗焓值 = "063"; + public static final String 耗热瞬时 = "061"; + public static final String 电调阀控制模式选择 = "004"; + public static final String 一次网管道泵停止 = "022"; + public static final String 水表瞬时补水量 = "030"; + public static final String 供水热量 = "052"; + public static final String 二次网供水压力 = "047"; + public static final String 二次网回水压力 = "048"; + public static final String 循环泵频率反馈 = "064"; + public static final String 循环泵频率给定 = "065"; + public static final String 一次网管道泵启或停 = "066"; + public static final String 一次网管道泵上电 = "019"; + public static final String 供暖面积 = "P00001"; + public static final String 开栓已执行 = "P00002"; + +} diff --git a/lzbi-module/src/main/java/com/lzbi/asset/domain/ChargeSystemParamsDTO.java b/lzbi-module/src/main/java/com/lzbi/asset/domain/ChargeSystemParamsDTO.java new file mode 100644 index 0000000..170ec57 --- /dev/null +++ b/lzbi-module/src/main/java/com/lzbi/asset/domain/ChargeSystemParamsDTO.java @@ -0,0 +1,69 @@ +package com.lzbi.asset.domain; + +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 收费系统参数 + */ +@Data +public class ChargeSystemParamsDTO { + + /** + * 目标资产编码 + */ + private String goalAssetCode; + /** + * 统计单元编码 + */ + private String assetCode; + + /** 统计单元ID */ + private Long assetId; + + /** 指标模型编码 */ + private String targetModelCode; + + /** 指标名称 */ + private String targetName; + + /** 指标别名 */ + private String targetNameAlias; + + /** 指标编码 */ + private String targetCode; + + /** 所属专业 */ + private String fieldCode; + + /** 上限 */ + private BigDecimal limitUp; + + /** 下限 */ + private BigDecimal limitDown; + + /** 值 */ + private BigDecimal valueBase; + + /** 是否均值 */ + private String flagAvg; + + /** 是否汇总 */ + private String flagSum; + + /** 是否积算 */ + private String flagCompute; + + /** */ + private String sort; + + /** 所属专业名称 */ + private String fieldName; + + /** T指标P参数 */ + private String columnType; + + /** 单位 */ + private String fieldUnit; +} diff --git a/lzbi-module/src/main/java/com/lzbi/asset/domain/DcBaseAssetContrastConfig.java b/lzbi-module/src/main/java/com/lzbi/asset/domain/DcBaseAssetContrastConfig.java new file mode 100644 index 0000000..c30d94d --- /dev/null +++ b/lzbi-module/src/main/java/com/lzbi/asset/domain/DcBaseAssetContrastConfig.java @@ -0,0 +1,65 @@ +package com.lzbi.asset.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import lombok.Data; +import io.swagger.annotations.ApiModelProperty; +import lombok.experimental.Accessors; +import com.lzbi.common.annotation.Excel; +import com.lzbi.module.base.BaseModuleEntity; + +/** + * 统计单元与外部资产对照配置对象 dc_base_asset_contrast_config + * + * @author lienbo + * @date 2024-02-05 + */ +@Data +@Accessors(chain = true) +public class DcBaseAssetContrastConfig extends BaseModuleEntity +{ + private static final long serialVersionUID = 1L; + + /** 统计单元ID */ + private Long id; + + /** 统计单元编码 */ + @Excel(name = "统计单元编码") + @ApiModelProperty(name = "统计单元编码",notes = "assetCode") + private String assetCode; + + /** 统计单元名称 */ + @Excel(name = "统计单元名称") + @ApiModelProperty(name = "统计单元名称",notes = "assetName") + private String assetName; + + /** 目标资产编码 */ + @Excel(name = "目标资产编码") + @ApiModelProperty(name = "目标资产编码",notes = "goalAssetCode") + private String goalAssetCode; + + /** 目标资产名称 */ + @Excel(name = "目标资产名称") + @ApiModelProperty(name = "目标资产名称",notes = "goalAssetName") + private String goalAssetName; + + /** 数据来源;生产IOT:work;计费:charge;Erp:erp */ + @Excel(name = "数据来源;生产IOT:work;计费:charge;Erp:erp") + @ApiModelProperty(name = "数据来源;生产IOT:work;计费:charge;Erp:erp",notes = "goalSource") + private String goalSource; + + /** 创建人 */ + private String createdBy; + + /** 创建时间 */ + private Date createdTime; + + /** 更新人 */ + private String updatedBy; + + /** 更新时间 */ + private Date updatedTime; + +} diff --git a/lzbi-module/src/main/java/com/lzbi/asset/mapper/DcBaseAssetContrastConfigMapper.java b/lzbi-module/src/main/java/com/lzbi/asset/mapper/DcBaseAssetContrastConfigMapper.java new file mode 100644 index 0000000..82a1d80 --- /dev/null +++ b/lzbi-module/src/main/java/com/lzbi/asset/mapper/DcBaseAssetContrastConfigMapper.java @@ -0,0 +1,62 @@ +package com.lzbi.asset.mapper; + +import java.util.List; +import com.lzbi.asset.domain.DcBaseAssetContrastConfig; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * 统计单元与外部资产对照配置Mapper接口 + * + * @author lienbo + * @date 2024-02-05 + */ + +public interface DcBaseAssetContrastConfigMapper extends BaseMapper +{ + /** + * 查询统计单元与外部资产对照配置 + * + * @param id 统计单元与外部资产对照配置主键 + * @return 统计单元与外部资产对照配置 + */ + public DcBaseAssetContrastConfig selectDcBaseAssetContrastConfigById(Long id); + + /** + * 查询统计单元与外部资产对照配置列表 + * + * @return 统计单元与外部资产对照配置集合 + */ + public List selectDcBaseAssetContrastConfigList(); + + /** + * 新增统计单元与外部资产对照配置 + * + * @param dcBaseAssetContrastConfig 统计单元与外部资产对照配置 + * @return 结果 + */ + public int insertDcBaseAssetContrastConfig(DcBaseAssetContrastConfig dcBaseAssetContrastConfig); + + /** + * 修改统计单元与外部资产对照配置 + * + * @param dcBaseAssetContrastConfig 统计单元与外部资产对照配置 + * @return 结果 + */ + public int updateDcBaseAssetContrastConfig(DcBaseAssetContrastConfig dcBaseAssetContrastConfig); + + /** + * 删除统计单元与外部资产对照配置 + * + * @param id 统计单元与外部资产对照配置主键 + * @return 结果 + */ + public int deleteDcBaseAssetContrastConfigById(Long id); + + /** + * 批量删除统计单元与外部资产对照配置 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDcBaseAssetContrastConfigByIds(Long[] ids); +} diff --git a/lzbi-module/src/main/java/com/lzbi/asset/service/ChargeSystemService.java b/lzbi-module/src/main/java/com/lzbi/asset/service/ChargeSystemService.java new file mode 100644 index 0000000..c716888 --- /dev/null +++ b/lzbi-module/src/main/java/com/lzbi/asset/service/ChargeSystemService.java @@ -0,0 +1,162 @@ +package com.lzbi.asset.service; + +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import com.lzbi.asset.domain.ChargeSystemParamsDTO; +import com.lzbi.asset.domain.DcBaseAssetContrastConfig; +import com.lzbi.asset.mapper.DcBaseAssetContrastConfigMapper; +import com.lzbi.code.domain.DcBaseCoderuleDefineDao; +import com.lzbi.code.domain.DcBusiCoderuleConfigDao; +import com.lzbi.code.service.CodeNoGenerater; +import com.lzbi.code.service.DcBaseCoderuleDefineService; +import com.lzbi.common.config.MagicServerApiConfig; +import com.lzbi.common.constant.BizConstants; +import com.lzbi.common.constant.ParamsModelCodeConstants; +import com.lzbi.draft.domain.DcBusiParamBillMaster; +import com.lzbi.draft.domain.DcBusiParamBillSub; +import com.lzbi.draft.service.DcBusiParamBillMasterService; +import com.lzbi.targetFolder.mapper.DcBaseAssetTargetMapper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.web.client.RestTemplate; + +import javax.annotation.Resource; +import java.time.Duration; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 收费系统业务逻辑层 + */ +@Slf4j +@Service +public class ChargeSystemService { + + /** + * 创建参数采集但 + * inComeDate 采集的目标时间 格式为yyyy-MM-dd + */ + private final String BUSICODE = "param_bill_adjust"; + + @Autowired + private MagicServerApiConfig magicServerApiConfig; + + @Autowired + private DcBaseCoderuleDefineService dcBaseCoderuleDefineService; + + @Autowired + private CodeNoGenerater codeNoGenerater; + + @Autowired + private DcBusiParamBillMasterService dcBusiParamBillMasterService; + + @Resource + private DcBaseAssetContrastConfigMapper dcBaseAssetContrastConfigMapper; + + @Resource + private DcBaseAssetTargetMapper dcBaseAssetTargetMapper; + + @Transactional(rollbackFor = Exception.class) + public void syncChargeSystemParams() { + DcBaseAssetContrastConfig params = new DcBaseAssetContrastConfig(); + params.setGoalSource(BizConstants.GoalSource.CHARGE); + List dcBaseAssetContrastConfigs = dcBaseAssetContrastConfigMapper.selectDcBaseAssetContrastConfigList(); + if (CollectionUtils.isEmpty(dcBaseAssetContrastConfigs)) { + log.warn("系统中未配置统计单元与外部资产对照关系"); + return; + } + + RestTemplate restTemplate = new RestTemplateBuilder() + .setConnectTimeout(Duration.ofMinutes(5)) + .setReadTimeout(Duration.ofMinutes(5)) + .build(); + String str = restTemplate.getForObject(magicServerApiConfig.getChargeSystemParams(), String.class); + + if (StringUtils.isNotBlank(str)) { + JSONObject jsonObject = JSONObject.parseObject(str); + Integer code = jsonObject.getInteger("code"); + if (1 == code) { + JSONArray jsonArray = jsonObject.getJSONArray("data"); + if (null != jsonArray && !jsonArray.isEmpty()) { + log.info("收费系统换热站参数:{}", jsonArray.toJSONString()); + this.createParamBill(jsonArray); + } + } + + } + } + + private void createParamBill(JSONArray jsonArray) { + LocalDateTime localDateTime = LocalDateTime.now(); + int hour = localDateTime.getHour(); + LocalDate localDate = localDateTime.toLocalDate(); + DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN); + String dateStr = localDate.format(dateTimeFormatter); + DcBusiCoderuleConfigDao ruleIdByBusicode = dcBaseCoderuleDefineService.getRuleIdByBusicode(BUSICODE); + DcBaseCoderuleDefineDao ruleDao = dcBaseCoderuleDefineService.selectDcBaseCoderuleDefineDaoById(ruleIdByBusicode.getRuleId()); + DcBusiParamBillMaster billm = new DcBusiParamBillMaster(); + String billNo = codeNoGenerater.getCode(ruleDao); + if (com.lzbi.common.utils.StringUtils.isNull(billNo)) { + billNo = "AD_" + System.currentTimeMillis(); + } + billm.setBillNo(billNo); + billm.setCreatedBy("robot"); + billm.setCreatedTime(DateUtil.date()); + billm.setBillIncomeDate(dateStr); + billm.setBillType("2"); + billm.setCheckType("1"); + billm.setCheckStatus("1"); + List billSub = new ArrayList<>(); + List paramsModelCodeList = new ArrayList<>(); + paramsModelCodeList.add(ParamsModelCodeConstants.供暖面积); + paramsModelCodeList.add(ParamsModelCodeConstants.开栓已执行); + List targetList = dcBaseAssetTargetMapper.selectChargeAssetContrastParams(paramsModelCodeList); + Map> goalAssetCodeMap = targetList.stream().collect(Collectors.groupingBy(ChargeSystemParamsDTO::getGoalAssetCode)); + Iterator iterator = jsonArray.iterator(); + + while(iterator.hasNext()) { + JSONObject next = (JSONObject) iterator.next(); + String huanrezhanid = next.getString("HUANREZHANID"); + List chargeSystemParamsDTOS = goalAssetCodeMap.get(huanrezhanid); + if (!CollectionUtils.isEmpty(chargeSystemParamsDTOS)) { + for (ChargeSystemParamsDTO chargeSystemParamsDTO : chargeSystemParamsDTOS) { + DcBusiParamBillSub subDao = new DcBusiParamBillSub(); + subDao.setCreatedBy("robot"); + subDao.setAssetCode(chargeSystemParamsDTO.getAssetCode()); + subDao.setBillNo(billNo); + subDao.setParamCode(chargeSystemParamsDTO.getTargetCode()); + subDao.setFieldCode(chargeSystemParamsDTO.getFieldCode()); + subDao.setCountDate(dateStr); + subDao.setCountHour(hour); + if (ParamsModelCodeConstants.供暖面积.equals(chargeSystemParamsDTO.getTargetModelCode())) { + subDao.setParamValue(next.getDouble("GONGNUANMIANJI")); + billSub.add(subDao); + } else if (ParamsModelCodeConstants.开栓已执行.equals(chargeSystemParamsDTO.getTargetModelCode())){ + subDao.setParamValue(next.getDouble("KAISHUANYIZHIXING")); + billSub.add(subDao); + } else { + subDao = null; + } + } + } + } + billm.setDcBusiParamBillSubList(billSub); + log.info("参数采集单:{}", JSONObject.toJSONString(billm)); + dcBusiParamBillMasterService.insertDcBusiParamBillMasterDao(billm); + } + +} diff --git a/lzbi-module/src/main/java/com/lzbi/asset/service/DcBaseAssetContrastConfigService.java b/lzbi-module/src/main/java/com/lzbi/asset/service/DcBaseAssetContrastConfigService.java new file mode 100644 index 0000000..453370d --- /dev/null +++ b/lzbi-module/src/main/java/com/lzbi/asset/service/DcBaseAssetContrastConfigService.java @@ -0,0 +1,91 @@ +package com.lzbi.asset.service; + +import java.util.List; +import com.lzbi.common.utils.DateUtils; +import org.springframework.stereotype.Service; +import com.lzbi.asset.domain.DcBaseAssetContrastConfig; +import com.lzbi.asset.mapper.DcBaseAssetContrastConfigMapper; +import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +/** + * 统计单元与外部资产对照配置Service业务层处理 + * + * @author lienbo + * @date 2024-02-05 + */ +@Service +public class DcBaseAssetContrastConfigService extends ServiceImpl implements IService +{ + + /** + * 查询统计单元与外部资产对照配置 + * + * @param id 统计单元与外部资产对照配置主键 + * @return 统计单元与外部资产对照配置 + */ + public DcBaseAssetContrastConfig selectDcBaseAssetContrastConfigById(Long id) + { + return baseMapper.selectDcBaseAssetContrastConfigById(id); + } + + /** + * 查询统计单元与外部资产对照配置列表 + * + * @param dcBaseAssetContrastConfig 统计单元与外部资产对照配置 + * @return 统计单元与外部资产对照配置 + */ + public List selectDcBaseAssetContrastConfigList(DcBaseAssetContrastConfig dcBaseAssetContrastConfig) + { + return baseMapper.selectDcBaseAssetContrastConfigList(); + } + + /** + * 新增统计单元与外部资产对照配置 + * + * @param dcBaseAssetContrastConfig 统计单元与外部资产对照配置 + * @return 结果 + */ + + public int insertDcBaseAssetContrastConfig(DcBaseAssetContrastConfig dcBaseAssetContrastConfig) + { + dcBaseAssetContrastConfig.setCreatedTime(DateUtils.getNowDate()); + return baseMapper.insertDcBaseAssetContrastConfig(dcBaseAssetContrastConfig); + } + + /** + * 修改统计单元与外部资产对照配置 + * + * @param dcBaseAssetContrastConfig 统计单元与外部资产对照配置 + * @return 结果 + */ + + public int updateDcBaseAssetContrastConfig(DcBaseAssetContrastConfig dcBaseAssetContrastConfig) + { + dcBaseAssetContrastConfig.setUpdatedTime(DateUtils.getNowDate()); + return baseMapper.updateDcBaseAssetContrastConfig(dcBaseAssetContrastConfig); + } + + /** + * 批量删除统计单元与外部资产对照配置 + * + * @param ids 需要删除的统计单元与外部资产对照配置主键 + * @return 结果 + */ + + public int deleteDcBaseAssetContrastConfigByIds(Long[] ids) + { + return baseMapper.deleteDcBaseAssetContrastConfigByIds(ids); + } + + /** + * 删除统计单元与外部资产对照配置信息 + * + * @param id 统计单元与外部资产对照配置主键 + * @return 结果 + */ + + public int deleteDcBaseAssetContrastConfigById(Long id) + { + return baseMapper.deleteDcBaseAssetContrastConfigById(id); + } +} diff --git a/lzbi-module/src/main/java/com/lzbi/asset/service/DcBusiParamSourceService.java b/lzbi-module/src/main/java/com/lzbi/asset/service/DcBusiParamSourceService.java index bc1bc61..f7daa8b 100644 --- a/lzbi-module/src/main/java/com/lzbi/asset/service/DcBusiParamSourceService.java +++ b/lzbi-module/src/main/java/com/lzbi/asset/service/DcBusiParamSourceService.java @@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.lzbi.asset.domain.DcBusiParamSource; import com.lzbi.asset.domain.ElementTreeVO; import com.lzbi.asset.mapper.DcBusiParamSourceMapper; -import com.lzbi.common.config.GoalServerApiConfig; +import com.lzbi.common.config.IotServerApiConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; @@ -26,7 +26,7 @@ public class DcBusiParamSourceService extends ServiceImpl selectByVo( DcBusiParamSource dcBusiParamSource){ return baseMapper.selectByVo(dcBusiParamSource); @@ -40,7 +40,7 @@ public class DcBusiParamSourceService extends ServiceImpl elementTreeVOS = JSONArray.parseArray(result, ElementTreeVO.class); elementTreeVO.setIsLeaf(Boolean.TRUE); diff --git a/lzbi-module/src/main/java/com/lzbi/module/base/BaseModuleEntity.java b/lzbi-module/src/main/java/com/lzbi/module/base/BaseModuleEntity.java index 46f7df6..801302e 100644 --- a/lzbi-module/src/main/java/com/lzbi/module/base/BaseModuleEntity.java +++ b/lzbi-module/src/main/java/com/lzbi/module/base/BaseModuleEntity.java @@ -1,6 +1,7 @@ package com.lzbi.module.base; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -65,18 +66,24 @@ public class BaseModuleEntity implements Serializable, Cloneable { */ @ApiModelProperty(name = "删除时间", notes = "") private Date deleteTime; + + @TableField(exist = false) @ApiModelProperty("分页") private Integer pageNum; + + @TableField(exist = false) @ApiModelProperty("分页大小") private Integer pageSize; /** * 部门id */ + @TableField(exist = false) @ApiModelProperty(name = "部门id", notes = "") private Long deptId; /** * 用户id */ + @TableField(exist = false) @ApiModelProperty(name = "用户id", notes = "") private Long userId; diff --git a/lzbi-module/src/main/java/com/lzbi/targetFolder/mapper/DcBaseAssetTargetMapper.java b/lzbi-module/src/main/java/com/lzbi/targetFolder/mapper/DcBaseAssetTargetMapper.java index 519bb3c..2d96b97 100644 --- a/lzbi-module/src/main/java/com/lzbi/targetFolder/mapper/DcBaseAssetTargetMapper.java +++ b/lzbi-module/src/main/java/com/lzbi/targetFolder/mapper/DcBaseAssetTargetMapper.java @@ -2,6 +2,7 @@ package com.lzbi.targetFolder.mapper; import java.util.List; +import com.lzbi.asset.domain.ChargeSystemParamsDTO; import com.lzbi.asset.domain.DcBaseAssetInfo; import com.lzbi.targetFolder.domain.DcBaseAssetTarget; import com.baomidou.mybatisplus.core.mapper.BaseMapper; @@ -35,6 +36,13 @@ public interface DcBaseAssetTargetMapper extends BaseMapper */ public DcBaseAssetTarget selectDcBaseAssetTargetByTargetCodeAndAssetCode(@Param("targetCode") String targetCode, @Param("assetCode") String assetCode); + /** + * 查询收费的参数 + * + * @return + */ + List selectChargeAssetContrastParams(@Param("paramsModelCodeList") List paramsModelCodeList); + /** * 查询资产指标配置列表 * @@ -47,6 +55,8 @@ public interface DcBaseAssetTargetMapper extends BaseMapper List selectDcBaseAssetTargetByTargetModelCodeListAndAsset(@Param("targetModelCodeList") List targetModelCodeList, @Param("dcBaseAssetInfo") DcBaseAssetInfo dcBaseAssetInfo); + List selectDcBaseAssetTargetByTargetModelCodeListAndAssetList(@Param("targetModelCodeList") List targetModelCodeList, @Param("dcBaseAssetInfo") DcBaseAssetInfo dcBaseAssetInfo); + /** * 新增资产指标配置 * diff --git a/lzbi-module/src/main/java/com/lzbi/task/TaskParamDfratProcess.java b/lzbi-module/src/main/java/com/lzbi/task/TaskParamDfratProcess.java index affff96..eef1b29 100644 --- a/lzbi-module/src/main/java/com/lzbi/task/TaskParamDfratProcess.java +++ b/lzbi-module/src/main/java/com/lzbi/task/TaskParamDfratProcess.java @@ -27,27 +27,28 @@ import java.util.stream.Collectors; @Component public class TaskParamDfratProcess { - DcBusiParamBillMasterService dcBusiParamBillMasterService=SpringUtils.getBean(DcBusiParamBillMasterService.class); + DcBusiParamBillMasterService dcBusiParamBillMasterService = SpringUtils.getBean(DcBusiParamBillMasterService.class); - DcBusiParamBillSubService dcBusiParamBillSubService= SpringUtils.getBean(DcBusiParamBillSubService.class); + DcBusiParamBillSubService dcBusiParamBillSubService = SpringUtils.getBean(DcBusiParamBillSubService.class); - DcBusiParamDraftDayService dBusiParamDraftDayService=SpringUtils.getBean(DcBusiParamDraftDayService.class); - public void doBill(DcBusiParamBillMaster billMasterDao){ - DcBusiParamBillSub billSub=new DcBusiParamBillSub(); + DcBusiParamDraftDayService dBusiParamDraftDayService = SpringUtils.getBean(DcBusiParamDraftDayService.class); + + public void doBill(DcBusiParamBillMaster billMasterDao) { + DcBusiParamBillSub billSub = new DcBusiParamBillSub(); billSub.setBillNo(billMasterDao.getBillNo()); List dcBusiParamBillSubs = dcBusiParamBillSubService.selectByVo(billSub); Map> collect = dcBusiParamBillSubs.stream().collect(Collectors.groupingBy(gp -> gp.getAssetCode() + ":" + gp.getParamCode() + ":" + gp.getFieldCode() + ":" + gp.getCountDate())); - collect.forEach((key,value)->{ - String[] s=key.split(":"); - DcBusiParamDraftDay queryVo=new DcBusiParamDraftDay(); + collect.forEach((key, value) -> { + String[] s = key.split(":"); + DcBusiParamDraftDay queryVo = new DcBusiParamDraftDay(); queryVo.setAssetCode(s[0]); queryVo.setParamCode(s[1]); queryVo.setParamFieldCode(s[2]); queryVo.setCountDate(s[3]); DcBusiParamDraftDay dcBusiParamDraftDay = Optional.ofNullable(dBusiParamDraftDayService.selectOneByParam(queryVo)).orElse(new DcBusiParamDraftDay()); List subs = value.stream().sorted(Comparator.comparing(DcBusiParamBillSub::getCountHour)).collect(Collectors.toList()); - subs.forEach(val->{ - if(StringUtils.isNull(dcBusiParamDraftDay.getId())){ + subs.forEach(val -> { + if (StringUtils.isNull(dcBusiParamDraftDay.getId())) { dcBusiParamDraftDay.setCreatedTime(DateUtil.date()); dcBusiParamDraftDay.setCreatedBy("task"); dcBusiParamDraftDay.setParamFieldCode(val.getFieldCode()); @@ -62,22 +63,24 @@ public class TaskParamDfratProcess { dcBusiParamDraftDay.setAssetName(val.getAssetName()); dcBusiParamDraftDay.setCompanyId(billMasterDao.getCompanyId()); dcBusiParamDraftDay.setCompanyName(billMasterDao.getCompanyName()); + dcBusiParamDraftDay.setValLast(val.getParamValue()); } dcBusiParamDraftDay.setUpdatedBy("task"); dcBusiParamDraftDay.setUpdatedTime(DateUtil.date()); - dcBusiParamDraftDay.setValForSeq(val.getCountHour(),val.getParamValue()); + dcBusiParamDraftDay.setValForSeq(val.getCountHour(), val.getParamValue()); + dcBusiParamDraftDay.setValLast(val.getParamValue()); }); dBusiParamDraftDayService.saveOrUpdate(dcBusiParamDraftDay); }); } - public void doBills(String billNo){ - DcBusiParamBillMaster dcBusiParamBillMasterDao=new DcBusiParamBillMaster(); + + public void doBills() { + DcBusiParamBillMaster dcBusiParamBillMasterDao = new DcBusiParamBillMaster(); dcBusiParamBillMasterDao.setCheckStatus("1"); - dcBusiParamBillMasterDao.setBillNo(billNo); List dcBusiParamBillMasterDaos = dcBusiParamBillMasterService.selectDcBusiParamBillMasterDaoList(dcBusiParamBillMasterDao); - dcBusiParamBillMasterDaos.forEach(item->{ + dcBusiParamBillMasterDaos.forEach(item -> { doBill(item); }); } diff --git a/lzbi-module/src/main/java/com/lzbi/task/TaskWorkParamRead.java b/lzbi-module/src/main/java/com/lzbi/task/TaskWorkParamRead.java index 0d06c93..bdb8854 100644 --- a/lzbi-module/src/main/java/com/lzbi/task/TaskWorkParamRead.java +++ b/lzbi-module/src/main/java/com/lzbi/task/TaskWorkParamRead.java @@ -18,6 +18,7 @@ import com.lzbi.task.domain.DcBusiWorkReadLog; import com.lzbi.task.domain.ReadQueryParams; import com.lzbi.task.service.DcBusiWorkReadLogService; import com.lzbi.task.service.WorkParamReadService; +import org.apache.commons.lang3.ObjectUtils; import org.springframework.stereotype.Component; import java.util.ArrayList; @@ -41,38 +42,43 @@ import java.util.stream.Collectors; public class TaskWorkParamRead { DcBaseCoderuleDefineService dcBaseCoderuleDefineService = SpringUtils.getBean(DcBaseCoderuleDefineService.class); CodeNoGenerater codeNoGenerater = SpringUtils.getBean(CodeNoGenerater.class); - DcBusiWorkReadConfigService dcBusiWorkReadConfigService= SpringUtils.getBean(DcBusiWorkReadConfigService.class); - WorkParamReadService workParamReadService=SpringUtils.getBean(WorkParamReadService.class); - DcBusiWorkReadLogService dcBusiWorkReadLogService=SpringUtils.getBean(DcBusiWorkReadLogService.class); - DcBusiParamBillMasterService dcBusiParamBillMasterService=SpringUtils.getBean(DcBusiParamBillMasterService.class); - boolean ifLog=false; - public void runTask(Boolean ifLog){ - this.ifLog=ifLog; - String inDate=DateUtil.format(DateUtil.offsetDay(DateUtil.date(),-1), DatePattern.NORM_DATE_PATTERN); + DcBusiWorkReadConfigService dcBusiWorkReadConfigService = SpringUtils.getBean(DcBusiWorkReadConfigService.class); + WorkParamReadService workParamReadService = SpringUtils.getBean(WorkParamReadService.class); + DcBusiWorkReadLogService dcBusiWorkReadLogService = SpringUtils.getBean(DcBusiWorkReadLogService.class); + DcBusiParamBillMasterService dcBusiParamBillMasterService = SpringUtils.getBean(DcBusiParamBillMasterService.class); + boolean ifLog = false; + + public void runTask(Boolean ifLog) { + this.ifLog = ifLog; + String inDate = DateUtil.format(DateUtil.offsetDay(DateUtil.date(), -1), DatePattern.NORM_DATE_PATTERN); createParamBill(inDate); } - public void runTask(){ - String inDate=DateUtil.format(DateUtil.offsetDay(DateUtil.date(),-1), DatePattern.NORM_DATE_PATTERN); + + public void runTask() { + String inDate = DateUtil.format(DateUtil.offsetDay(DateUtil.date(), -1), DatePattern.NORM_DATE_PATTERN); createParamBill(inDate); } - /**从生产数据库获取配置的参数的值 + + /** + * 从生产数据库获取配置的参数的值 * 按小时及性能分区统计"work" - * */ - public List getWorkReadVo(String inComeDate,List pcl,List dcl){ - ReadQueryParams readQueryParams=new ReadQueryParams(); - readQueryParams.setBeginTime(inComeDate+" 00:00:00"); - readQueryParams.setEndTime(inComeDate+" 23:59:59"); + */ + public List getWorkReadVo(String inComeDate, List pcl, List dcl) { + ReadQueryParams readQueryParams = new ReadQueryParams(); + readQueryParams.setBeginTime(inComeDate + " 00:00:00"); + readQueryParams.setEndTime(inComeDate + " 23:59:59"); readQueryParams.setParamCodes(pcl); readQueryParams.setDeviceCodes(dcl); List dcBusiWorkReadLogs = workParamReadService.readWorkValue(readQueryParams); - if(ifLog){ + if (ifLog) { readQueryParams.setBeginTime(inComeDate); - saveRealLog(dcBusiWorkReadLogs,readQueryParams); + saveRealLog(dcBusiWorkReadLogs, readQueryParams); } return dcBusiWorkReadLogs; } + /*存入日志*/ - public boolean saveRealLog(List listlog,ReadQueryParams readQueryParams){ + public boolean saveRealLog(List listlog, ReadQueryParams readQueryParams) { dcBusiWorkReadLogService.deleteByParams(readQueryParams); return dcBusiWorkReadLogService.saveBatch(listlog); //return true; @@ -81,48 +87,57 @@ public class TaskWorkParamRead { /** * 创建参数采集但 * inComeDate 采集的目标时间 格式为yyyy-MM-dd - * */ - private final String BUSICODE="param_bill_adjust"; - private final String SOURCE="work"; - public int createParamBill(String inComeDate){ + */ + private final String BUSICODE = "param_bill_adjust"; + private final String SOURCE = "work"; + + public int createParamBill(String inComeDate) { //String inComeDate="2023-11-29"; DcBusiCoderuleConfigDao ruleIdByBusicode = dcBaseCoderuleDefineService.getRuleIdByBusicode(BUSICODE); DcBaseCoderuleDefineDao ruleDao = dcBaseCoderuleDefineService.selectDcBaseCoderuleDefineDaoById(ruleIdByBusicode.getRuleId()); - DcBusiParamBillMaster billm=new DcBusiParamBillMaster(); - String billNo=codeNoGenerater.getCode(ruleDao); - if(StringUtils.isNull(billNo)){ - billNo= "AD_"+String.valueOf(System.currentTimeMillis()); + DcBusiParamBillMaster billm = new DcBusiParamBillMaster(); + String billNo = codeNoGenerater.getCode(ruleDao); + if (StringUtils.isNull(billNo)) { + billNo = "AD_" + String.valueOf(System.currentTimeMillis()); } billm.setBillNo(billNo); billm.setCreatedBy("robot"); billm.setCreatedTime(DateUtil.date()); billm.setBillIncomeDate(inComeDate); - billm.setBillType("auto"); + billm.setBillType("2"); billm.setCheckType("1"); billm.setCheckStatus("1"); - List billSub=new ArrayList<>(); - DcBusiWorkReadConfig dwrc=new DcBusiWorkReadConfig(); + List billSub = new ArrayList<>(); + DcBusiWorkReadConfig dwrc = new DcBusiWorkReadConfig(); //dwrc.setAssetCode(assetCode); dwrc.setGoalSource(SOURCE); List dcBusiWorkReadConfigs = dcBusiWorkReadConfigService.selectDcBusiWorkReadConfigList(dwrc); - List pcl=dcBusiWorkReadConfigs.parallelStream().map(DcBusiWorkReadConfig::getGoalParamCode).collect(Collectors.toList()); - List dcl=dcBusiWorkReadConfigs.parallelStream().map(DcBusiWorkReadConfig::getGoalParamExt1).collect(Collectors.toList()); - List listRow=getWorkReadVo(inComeDate,pcl,dcl); - final String billNo_c=billNo; - listRow.parallelStream().forEach(item->{ - Optional find = dcBusiWorkReadConfigs.parallelStream().filter(info -> info.getGoalParamCode().equals(item.getParamCode()) && info.getGoalParamExt1().equals(item.getDeviceCode())).findFirst(); - if(find.isPresent()){ - DcBusiParamBillSub subDao=new DcBusiParamBillSub(); + List pcl = dcBusiWorkReadConfigs.parallelStream().filter(o -> StringUtils.isNotEmpty(o.getGoalParamCode())).map(DcBusiWorkReadConfig::getGoalParamCode).collect(Collectors.toList()); + List dcl = dcBusiWorkReadConfigs.parallelStream().filter(o -> StringUtils.isNotEmpty(o.getGoalParamExt1())).map(DcBusiWorkReadConfig::getGoalParamExt1).collect(Collectors.toList()); + List listRow = getWorkReadVo(inComeDate, pcl, dcl); + final String billNo_c = billNo; + listRow.stream().forEach(item -> { + Optional find = dcBusiWorkReadConfigs.parallelStream().filter(info -> { + if (info.getGoalParamCode().equals(item.getParamCode())) { // && info.getGoalParamExt1().equals(item.getDeviceCode()) + return true; + } else { + return false; + } + }).findFirst(); + if (find.isPresent() && StringUtils.isNotEmpty(find.get().getGoalParamType())) { + DcBusiParamBillSub subDao = new DcBusiParamBillSub(); subDao.setCreatedBy("robot"); subDao.setAssetCode(find.get().getAssetCode()); subDao.setBillNo(billNo_c); - Double va=item.getValueByType(find.get().getGoalParamType()); + Double va = item.getValueByType(find.get().getGoalParamType()); subDao.setParamValue(va); subDao.setParamCode(find.get().getAssetParamCode()); subDao.setFieldCode(find.get().getAssetFieldCode()); subDao.setCountDate(item.getDateCount()); subDao.setCountHour(item.getHourCount()); - billSub.add(subDao); + if (ObjectUtils.isNotEmpty(subDao)) { + billSub.add(subDao); + } } }); billm.setDcBusiParamBillSubList(billSub); diff --git a/lzbi-module/src/main/java/com/lzbi/wechat/service/DeptService.java b/lzbi-module/src/main/java/com/lzbi/wechat/service/DeptService.java index 30fb058..cda3348 100644 --- a/lzbi-module/src/main/java/com/lzbi/wechat/service/DeptService.java +++ b/lzbi-module/src/main/java/com/lzbi/wechat/service/DeptService.java @@ -1,11 +1,9 @@ package com.lzbi.wechat.service; import com.lzbi.asset.domain.DcBaseAssetInfo; -import com.lzbi.asset.domain.DcBusiWorkReadConfig; import com.lzbi.asset.mapper.DcBaseAssetInfoMapper; import com.lzbi.asset.mapper.DcBusiWorkReadConfigMapper; -import com.lzbi.common.config.GoalServerApiConfig; -import com.lzbi.common.config.GoalServerConfig; +import com.lzbi.common.config.IotServerApiConfig; import com.lzbi.common.constant.BizConstants; import com.lzbi.common.core.domain.entity.SysDept; import com.lzbi.common.core.domain.entity.SysRole; @@ -13,8 +11,6 @@ import com.lzbi.common.core.domain.entity.SysUser; import com.lzbi.common.core.domain.model.LoginUser; import com.lzbi.common.utils.SecurityUtils; import com.lzbi.system.service.ISysDeptService; -import com.lzbi.targetFolder.domain.DcBaseAssetTarget; -import com.lzbi.targetFolder.mapper.DcBaseAssetTargetMapper; import com.lzbi.wechat.domain.dto.ParamsContrastDTO; import com.lzbi.wechat.domain.vo.ChildDeptVO; import com.lzbi.wechat.domain.vo.DeptVO; @@ -48,7 +44,7 @@ public class DeptService { private RestTemplate restTemplate; @Autowired - private GoalServerApiConfig goalServerApiConfig; + private IotServerApiConfig iotServerApiConfig; public List getSelfDeptList() { List list = new ArrayList<>(); @@ -134,7 +130,7 @@ public class DeptService { Map> deptMap = new HashMap<>(); deptMap.put(deptId, paramsCodeList); req.put(userId, deptMap); - String resp = restTemplate.postForObject(goalServerApiConfig.getGetParamsValue(), req, String.class); + String resp = restTemplate.postForObject(iotServerApiConfig.getParamsValue(), req, String.class); log.info("参数值:{}", resp); } diff --git a/lzbi-module/src/main/resources/mapper/asset/DcBaseAssetContrastConfigMapper.xml b/lzbi-module/src/main/resources/mapper/asset/DcBaseAssetContrastConfigMapper.xml new file mode 100644 index 0000000..b4bd1e6 --- /dev/null +++ b/lzbi-module/src/main/resources/mapper/asset/DcBaseAssetContrastConfigMapper.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + select id, asset_code, asset_name, goal_asset_code, goal_asset_name, goal_source, tenant_id, revision, created_by, created_time, updated_by, updated_time, delete_by, delete_time from dc_base_asset_contrast_config + + + + + + + + insert into dc_base_asset_contrast_config + + asset_code, + asset_name, + goal_asset_code, + goal_asset_name, + goal_source, + tenant_id, + revision, + created_by, + created_time, + updated_by, + updated_time, + delete_by, + delete_time, + + + #{assetCode}, + #{assetName}, + #{goalAssetCode}, + #{goalAssetName}, + #{goalSource}, + #{tenantId}, + #{revision}, + #{createdBy}, + #{createdTime}, + #{updatedBy}, + #{updatedTime}, + #{deleteBy}, + #{deleteTime}, + + + + + update dc_base_asset_contrast_config + + asset_code = #{assetCode}, + asset_name = #{assetName}, + goal_asset_code = #{goalAssetCode}, + goal_asset_name = #{goalAssetName}, + goal_source = #{goalSource}, + tenant_id = #{tenantId}, + revision = #{revision}, + created_by = #{createdBy}, + created_time = #{createdTime}, + updated_by = #{updatedBy}, + updated_time = #{updatedTime}, + delete_by = #{deleteBy}, + delete_time = #{deleteTime}, + + where id = #{id} + + + + delete from dc_base_asset_contrast_config where id = #{id} + + + + delete from dc_base_asset_contrast_config where id in + + #{id} + + + \ No newline at end of file diff --git a/lzbi-module/src/main/resources/mapper/asset/DcBusiWorkReadLogMapper.xml b/lzbi-module/src/main/resources/mapper/asset/DcBusiWorkReadLogMapper.xml index 99f59d1..681cd9f 100644 --- a/lzbi-module/src/main/resources/mapper/asset/DcBusiWorkReadLogMapper.xml +++ b/lzbi-module/src/main/resources/mapper/asset/DcBusiWorkReadLogMapper.xml @@ -120,13 +120,17 @@ delete from dc_busi_work_read_log where date_count=#{beginTime} - and device_code in - - #{item} - - and param_code in - - #{item} - + + and device_uuid in + + #{item} + + + + and param_code in + + #{item} + + \ No newline at end of file diff --git a/lzbi-module/src/main/resources/mapper/asset/WorkParamReadMapper.xml b/lzbi-module/src/main/resources/mapper/asset/WorkParamReadMapper.xml index 1dd5413..9e497f1 100644 --- a/lzbi-module/src/main/resources/mapper/asset/WorkParamReadMapper.xml +++ b/lzbi-module/src/main/resources/mapper/asset/WorkParamReadMapper.xml @@ -18,24 +18,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/lzbi-module/src/main/resources/mapper/targetFolder/DcBaseAssetTargetMapper.xml b/lzbi-module/src/main/resources/mapper/targetFolder/DcBaseAssetTargetMapper.xml index 572910f..845ee93 100644 --- a/lzbi-module/src/main/resources/mapper/targetFolder/DcBaseAssetTargetMapper.xml +++ b/lzbi-module/src/main/resources/mapper/targetFolder/DcBaseAssetTargetMapper.xml @@ -146,6 +146,35 @@ where target_code = #{targetCode} and asset_code = #{assetCode} + + insert into dc_base_asset_target diff --git a/lzbi-quartz/pom.xml b/lzbi-quartz/pom.xml index 2efa9d7..c0d6353 100644 --- a/lzbi-quartz/pom.xml +++ b/lzbi-quartz/pom.xml @@ -35,6 +35,11 @@ lzbi-common + + com.lzbi + lzbi-module + + \ No newline at end of file diff --git a/lzbi-quartz/src/main/java/com/lzbi/quartz/task/AutoAuditTask.java b/lzbi-quartz/src/main/java/com/lzbi/quartz/task/AutoAuditTask.java new file mode 100644 index 0000000..1c8cd45 --- /dev/null +++ b/lzbi-quartz/src/main/java/com/lzbi/quartz/task/AutoAuditTask.java @@ -0,0 +1,23 @@ +package com.lzbi.quartz.task; + +import com.lzbi.task.TaskParamDfratProcess; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 自动审批任务 + */ +@Slf4j +@Component("autoAuditTask") +public class AutoAuditTask { + + @Autowired + private TaskParamDfratProcess taskParamDfratProcess; + + public void auditParamsBill() { + log.info("===========自动审核参数单据开始============"); + taskParamDfratProcess.doBills(); + log.info("===========自动审核参数单据结束============"); + } +} diff --git a/lzbi-quartz/src/main/java/com/lzbi/quartz/task/SyncChargeSystemTask.java b/lzbi-quartz/src/main/java/com/lzbi/quartz/task/SyncChargeSystemTask.java new file mode 100644 index 0000000..91e17ef --- /dev/null +++ b/lzbi-quartz/src/main/java/com/lzbi/quartz/task/SyncChargeSystemTask.java @@ -0,0 +1,24 @@ +package com.lzbi.quartz.task; + +import com.lzbi.asset.service.ChargeSystemService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 同步收费系统任务 + */ +@Slf4j +@Component("syncChargeSystemTask") +public class SyncChargeSystemTask { + + @Autowired + private ChargeSystemService chargeSystemService; + + public void syncChargeSystemParams() { + log.info("===========同步收费系统参数开始============"); + chargeSystemService.syncChargeSystemParams(); + log.info("===========同步收费系统参数结束============"); + } + +} diff --git a/lzbi-quartz/src/main/java/com/lzbi/quartz/task/SyncIotSystemTask.java b/lzbi-quartz/src/main/java/com/lzbi/quartz/task/SyncIotSystemTask.java new file mode 100644 index 0000000..f0ebb09 --- /dev/null +++ b/lzbi-quartz/src/main/java/com/lzbi/quartz/task/SyncIotSystemTask.java @@ -0,0 +1,27 @@ +package com.lzbi.quartz.task; + +import com.lzbi.task.TaskWorkParamRead; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 同步IOT系统任务 + */ +@Slf4j +@Component("syncIotSystemTask") +public class SyncIotSystemTask { + + @Autowired + private TaskWorkParamRead taskWorkParamRead; + + /** + * 同步参数 + * @param ifLog 是否存入日志 + */ + public void syncIotParams(Boolean ifLog) { + log.info("===========同步IOT参数开始,是否存入日志:{}============", ifLog); + taskWorkParamRead.runTask(ifLog); + log.info("===========同步IOT参数结束,是否存入日志:{}============", ifLog); + } +}