Browse Source

定时任务

develop
bobol 10 months ago
parent
commit
b45756d882
  1. 18
      lzbi-admin/src/main/resources/application-dev.yml
  2. 17
      lzbi-admin/src/main/resources/application-test.yml
  3. 8
      lzbi-common/src/main/java/com/lzbi/common/config/IotServerApiConfig.java
  4. 16
      lzbi-common/src/main/java/com/lzbi/common/config/MagicServerApiConfig.java
  5. 11
      lzbi-common/src/main/java/com/lzbi/common/constant/BizConstants.java
  6. 74
      lzbi-common/src/main/java/com/lzbi/common/constant/ParamsModelCodeConstants.java
  7. 69
      lzbi-module/src/main/java/com/lzbi/asset/domain/ChargeSystemParamsDTO.java
  8. 65
      lzbi-module/src/main/java/com/lzbi/asset/domain/DcBaseAssetContrastConfig.java
  9. 62
      lzbi-module/src/main/java/com/lzbi/asset/mapper/DcBaseAssetContrastConfigMapper.java
  10. 162
      lzbi-module/src/main/java/com/lzbi/asset/service/ChargeSystemService.java
  11. 91
      lzbi-module/src/main/java/com/lzbi/asset/service/DcBaseAssetContrastConfigService.java
  12. 6
      lzbi-module/src/main/java/com/lzbi/asset/service/DcBusiParamSourceService.java
  13. 7
      lzbi-module/src/main/java/com/lzbi/module/base/BaseModuleEntity.java
  14. 10
      lzbi-module/src/main/java/com/lzbi/targetFolder/mapper/DcBaseAssetTargetMapper.java
  15. 33
      lzbi-module/src/main/java/com/lzbi/task/TaskParamDfratProcess.java
  16. 93
      lzbi-module/src/main/java/com/lzbi/task/TaskWorkParamRead.java
  17. 10
      lzbi-module/src/main/java/com/lzbi/wechat/service/DeptService.java
  18. 108
      lzbi-module/src/main/resources/mapper/asset/DcBaseAssetContrastConfigMapper.xml
  19. 6
      lzbi-module/src/main/resources/mapper/asset/DcBusiWorkReadLogMapper.xml
  20. 9
      lzbi-module/src/main/resources/mapper/asset/WorkParamReadMapper.xml
  21. 29
      lzbi-module/src/main/resources/mapper/targetFolder/DcBaseAssetTargetMapper.xml
  22. 5
      lzbi-quartz/pom.xml
  23. 23
      lzbi-quartz/src/main/java/com/lzbi/quartz/task/AutoAuditTask.java
  24. 24
      lzbi-quartz/src/main/java/com/lzbi/quartz/task/SyncChargeSystemTask.java
  25. 27
      lzbi-quartz/src/main/java/com/lzbi/quartz/task/SyncIotSystemTask.java

18
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

17
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

8
lzbi-common/src/main/java/com/lzbi/common/config/GoalServerApiConfig.java → 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;
}

16
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;
}

11
lzbi-common/src/main/java/com/lzbi/common/constant/BizConstants.java

@ -5,6 +5,17 @@ package com.lzbi.common.constant;
*/
public interface BizConstants {
/**
* 数据来源;生产IOTwork;计费chargeErperp
*/
interface GoalSource {
String WORK = "work";
String CHARGE = "charge";
String ERP = "erp";
}
/**
* 指标类别
*/

74
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";
}

69
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;
}

65
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;
}

62
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<DcBaseAssetContrastConfig>
{
/**
* 查询统计单元与外部资产对照配置
*
* @param id 统计单元与外部资产对照配置主键
* @return 统计单元与外部资产对照配置
*/
public DcBaseAssetContrastConfig selectDcBaseAssetContrastConfigById(Long id);
/**
* 查询统计单元与外部资产对照配置列表
*
* @return 统计单元与外部资产对照配置集合
*/
public List<DcBaseAssetContrastConfig> 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);
}

162
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<DcBaseAssetContrastConfig> 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<DcBusiParamBillSub> billSub = new ArrayList<>();
List<String> paramsModelCodeList = new ArrayList<>();
paramsModelCodeList.add(ParamsModelCodeConstants.供暖面积);
paramsModelCodeList.add(ParamsModelCodeConstants.开栓已执行);
List<ChargeSystemParamsDTO> targetList = dcBaseAssetTargetMapper.selectChargeAssetContrastParams(paramsModelCodeList);
Map<String, List<ChargeSystemParamsDTO>> 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<ChargeSystemParamsDTO> 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);
}
}

91
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<DcBaseAssetContrastConfigMapper, DcBaseAssetContrastConfig> implements IService<DcBaseAssetContrastConfig>
{
/**
* 查询统计单元与外部资产对照配置
*
* @param id 统计单元与外部资产对照配置主键
* @return 统计单元与外部资产对照配置
*/
public DcBaseAssetContrastConfig selectDcBaseAssetContrastConfigById(Long id)
{
return baseMapper.selectDcBaseAssetContrastConfigById(id);
}
/**
* 查询统计单元与外部资产对照配置列表
*
* @param dcBaseAssetContrastConfig 统计单元与外部资产对照配置
* @return 统计单元与外部资产对照配置
*/
public List<DcBaseAssetContrastConfig> 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);
}
}

6
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<DcBusiParamSourceMapp
private RestTemplate restTemplate;
@Autowired
private GoalServerApiConfig goalServerApiConfig;
private IotServerApiConfig iotServerApiConfig;
public List<DcBusiParamSource> selectByVo( DcBusiParamSource dcBusiParamSource){
return baseMapper.selectByVo(dcBusiParamSource);
@ -40,7 +40,7 @@ public class DcBusiParamSourceService extends ServiceImpl<DcBusiParamSourceMapp
ElementTreeVO elementTreeVO = new ElementTreeVO();
elementTreeVO.setValue("IOT");
elementTreeVO.setLabel("IOT平台");
String result = restTemplate.getForObject(goalServerApiConfig.getGetOrgAssetParamsTree(), String.class);
String result = restTemplate.getForObject(iotServerApiConfig.getOrgAssetParamsTree(), String.class);
if (null != result) {
List<ElementTreeVO> elementTreeVOS = JSONArray.parseArray(result, ElementTreeVO.class);
elementTreeVO.setIsLeaf(Boolean.TRUE);

7
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;

10
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<DcBaseAssetTarget>
*/
public DcBaseAssetTarget selectDcBaseAssetTargetByTargetCodeAndAssetCode(@Param("targetCode") String targetCode, @Param("assetCode") String assetCode);
/**
* 查询收费的参数
*
* @return
*/
List<ChargeSystemParamsDTO> selectChargeAssetContrastParams(@Param("paramsModelCodeList") List<String> paramsModelCodeList);
/**
* 查询资产指标配置列表
*
@ -47,6 +55,8 @@ public interface DcBaseAssetTargetMapper extends BaseMapper<DcBaseAssetTarget>
List<DcBaseAssetTarget> selectDcBaseAssetTargetByTargetModelCodeListAndAsset(@Param("targetModelCodeList") List<String> targetModelCodeList, @Param("dcBaseAssetInfo") DcBaseAssetInfo dcBaseAssetInfo);
List<DcBaseAssetTarget> selectDcBaseAssetTargetByTargetModelCodeListAndAssetList(@Param("targetModelCodeList") List<String> targetModelCodeList, @Param("dcBaseAssetInfo") DcBaseAssetInfo dcBaseAssetInfo);
/**
* 新增资产指标配置
*

33
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<DcBusiParamBillSub> dcBusiParamBillSubs = dcBusiParamBillSubService.selectByVo(billSub);
Map<String, List<DcBusiParamBillSub>> 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<DcBusiParamBillSub> 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<DcBusiParamBillMaster> dcBusiParamBillMasterDaos = dcBusiParamBillMasterService.selectDcBusiParamBillMasterDaoList(dcBusiParamBillMasterDao);
dcBusiParamBillMasterDaos.forEach(item->{
dcBusiParamBillMasterDaos.forEach(item -> {
doBill(item);
});
}

93
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<DcBusiWorkReadLog> getWorkReadVo(String inComeDate,List<String> pcl,List<String> dcl){
ReadQueryParams readQueryParams=new ReadQueryParams();
readQueryParams.setBeginTime(inComeDate+" 00:00:00");
readQueryParams.setEndTime(inComeDate+" 23:59:59");
*/
public List<DcBusiWorkReadLog> getWorkReadVo(String inComeDate, List<String> pcl, List<String> dcl) {
ReadQueryParams readQueryParams = new ReadQueryParams();
readQueryParams.setBeginTime(inComeDate + " 00:00:00");
readQueryParams.setEndTime(inComeDate + " 23:59:59");
readQueryParams.setParamCodes(pcl);
readQueryParams.setDeviceCodes(dcl);
List<DcBusiWorkReadLog> dcBusiWorkReadLogs = workParamReadService.readWorkValue(readQueryParams);
if(ifLog){
if (ifLog) {
readQueryParams.setBeginTime(inComeDate);
saveRealLog(dcBusiWorkReadLogs,readQueryParams);
saveRealLog(dcBusiWorkReadLogs, readQueryParams);
}
return dcBusiWorkReadLogs;
}
/*存入日志*/
public boolean saveRealLog(List<DcBusiWorkReadLog> listlog,ReadQueryParams readQueryParams){
public boolean saveRealLog(List<DcBusiWorkReadLog> listlog, ReadQueryParams readQueryParams) {
dcBusiWorkReadLogService.deleteByParams(readQueryParams);
return dcBusiWorkReadLogService.saveBatch(listlog);
//return true;
@ -81,49 +87,58 @@ 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<DcBusiParamBillSub> billSub=new ArrayList<>();
DcBusiWorkReadConfig dwrc=new DcBusiWorkReadConfig();
List<DcBusiParamBillSub> billSub = new ArrayList<>();
DcBusiWorkReadConfig dwrc = new DcBusiWorkReadConfig();
//dwrc.setAssetCode(assetCode);
dwrc.setGoalSource(SOURCE);
List<DcBusiWorkReadConfig> dcBusiWorkReadConfigs = dcBusiWorkReadConfigService.selectDcBusiWorkReadConfigList(dwrc);
List<String> pcl=dcBusiWorkReadConfigs.parallelStream().map(DcBusiWorkReadConfig::getGoalParamCode).collect(Collectors.toList());
List<String> dcl=dcBusiWorkReadConfigs.parallelStream().map(DcBusiWorkReadConfig::getGoalParamExt1).collect(Collectors.toList());
List<DcBusiWorkReadLog> listRow=getWorkReadVo(inComeDate,pcl,dcl);
final String billNo_c=billNo;
listRow.parallelStream().forEach(item->{
Optional<DcBusiWorkReadConfig> find = dcBusiWorkReadConfigs.parallelStream().filter(info -> info.getGoalParamCode().equals(item.getParamCode()) && info.getGoalParamExt1().equals(item.getDeviceCode())).findFirst();
if(find.isPresent()){
DcBusiParamBillSub subDao=new DcBusiParamBillSub();
List<String> pcl = dcBusiWorkReadConfigs.parallelStream().filter(o -> StringUtils.isNotEmpty(o.getGoalParamCode())).map(DcBusiWorkReadConfig::getGoalParamCode).collect(Collectors.toList());
List<String> dcl = dcBusiWorkReadConfigs.parallelStream().filter(o -> StringUtils.isNotEmpty(o.getGoalParamExt1())).map(DcBusiWorkReadConfig::getGoalParamExt1).collect(Collectors.toList());
List<DcBusiWorkReadLog> listRow = getWorkReadVo(inComeDate, pcl, dcl);
final String billNo_c = billNo;
listRow.stream().forEach(item -> {
Optional<DcBusiWorkReadConfig> 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());
if (ObjectUtils.isNotEmpty(subDao)) {
billSub.add(subDao);
}
}
});
billm.setDcBusiParamBillSubList(billSub);
return dcBusiParamBillMasterService.insertDcBusiParamBillMasterDao(billm);

10
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<DeptVO> getSelfDeptList() {
List<DeptVO> list = new ArrayList<>();
@ -134,7 +130,7 @@ public class DeptService {
Map<Object, List<String>> 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);
}

108
lzbi-module/src/main/resources/mapper/asset/DcBaseAssetContrastConfigMapper.xml

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.lzbi.asset.mapper.DcBaseAssetContrastConfigMapper">
<resultMap type="com.lzbi.asset.domain.DcBaseAssetContrastConfig" id="DcBaseAssetContrastConfigResult">
<result property="id" column="id" />
<result property="assetCode" column="asset_code" />
<result property="assetName" column="asset_name" />
<result property="goalAssetCode" column="goal_asset_code" />
<result property="goalAssetName" column="goal_asset_name" />
<result property="goalSource" column="goal_source" />
<result property="tenantId" column="tenant_id" />
<result property="revision" column="revision" />
<result property="createdBy" column="created_by" />
<result property="createdTime" column="created_time" />
<result property="updatedBy" column="updated_by" />
<result property="updatedTime" column="updated_time" />
<result property="deleteBy" column="delete_by" />
<result property="deleteTime" column="delete_time" />
</resultMap>
<sql id="selectDcBaseAssetContrastConfigVo">
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
</sql>
<select id="selectDcBaseAssetContrastConfigList" parameterType="DcBaseAssetContrastConfig" resultMap="DcBaseAssetContrastConfigResult">
<include refid="selectDcBaseAssetContrastConfigVo"/>
<where>
<if test="assetCode != null and assetCode != ''"> and asset_code = #{assetCode}</if>
<if test="assetName != null and assetName != ''"> and asset_name like concat('%', #{assetName}, '%')</if>
<if test="goalAssetCode != null and goalAssetCode != ''"> and goal_asset_code = #{goalAssetCode}</if>
<if test="goalAssetName != null and goalAssetName != ''"> and goal_asset_name like concat('%', #{goalAssetName}, '%')</if>
<if test="goalSource != null and goalSource != ''"> and goal_source = #{goalSource}</if>
</where>
</select>
<select id="selectDcBaseAssetContrastConfigById" parameterType="Long" resultMap="DcBaseAssetContrastConfigResult">
<include refid="selectDcBaseAssetContrastConfigVo"/>
where id = #{id}
</select>
<insert id="insertDcBaseAssetContrastConfig" parameterType="DcBaseAssetContrastConfig" useGeneratedKeys="true" keyProperty="id">
insert into dc_base_asset_contrast_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="assetCode != null and assetCode != ''">asset_code,</if>
<if test="assetName != null and assetName != ''">asset_name,</if>
<if test="goalAssetCode != null and goalAssetCode != ''">goal_asset_code,</if>
<if test="goalAssetName != null and goalAssetName != ''">goal_asset_name,</if>
<if test="goalSource != null">goal_source,</if>
<if test="tenantId != null">tenant_id,</if>
<if test="revision != null">revision,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdTime != null">created_time,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedTime != null">updated_time,</if>
<if test="deleteBy != null">delete_by,</if>
<if test="deleteTime != null">delete_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="assetCode != null and assetCode != ''">#{assetCode},</if>
<if test="assetName != null and assetName != ''">#{assetName},</if>
<if test="goalAssetCode != null and goalAssetCode != ''">#{goalAssetCode},</if>
<if test="goalAssetName != null and goalAssetName != ''">#{goalAssetName},</if>
<if test="goalSource != null">#{goalSource},</if>
<if test="tenantId != null">#{tenantId},</if>
<if test="revision != null">#{revision},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedTime != null">#{updatedTime},</if>
<if test="deleteBy != null">#{deleteBy},</if>
<if test="deleteTime != null">#{deleteTime},</if>
</trim>
</insert>
<update id="updateDcBaseAssetContrastConfig" parameterType="DcBaseAssetContrastConfig">
update dc_base_asset_contrast_config
<trim prefix="SET" suffixOverrides=",">
<if test="assetCode != null and assetCode != ''">asset_code = #{assetCode},</if>
<if test="assetName != null and assetName != ''">asset_name = #{assetName},</if>
<if test="goalAssetCode != null and goalAssetCode != ''">goal_asset_code = #{goalAssetCode},</if>
<if test="goalAssetName != null and goalAssetName != ''">goal_asset_name = #{goalAssetName},</if>
<if test="goalSource != null">goal_source = #{goalSource},</if>
<if test="tenantId != null">tenant_id = #{tenantId},</if>
<if test="revision != null">revision = #{revision},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
<if test="deleteBy != null">delete_by = #{deleteBy},</if>
<if test="deleteTime != null">delete_time = #{deleteTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDcBaseAssetContrastConfigById" parameterType="Long">
delete from dc_base_asset_contrast_config where id = #{id}
</delete>
<delete id="deleteDcBaseAssetContrastConfigByIds" parameterType="String">
delete from dc_base_asset_contrast_config where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

6
lzbi-module/src/main/resources/mapper/asset/DcBusiWorkReadLogMapper.xml

@ -120,13 +120,17 @@
</insert>
<delete id="deleteByParams" parameterType="com.lzbi.task.domain.ReadQueryParams">
delete from dc_busi_work_read_log where date_count=#{beginTime}
and device_code in
<if test="deviceCodes != null and deviceCodes.size() > 0">
and device_uuid in
<foreach item="item" index="index" collection="deviceCodes" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="paramCodes != null and paramCodes.size() > 0">
and param_code in
<foreach item="item" index="index" collection="paramCodes" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</delete>
</mapper>

9
lzbi-module/src/main/resources/mapper/asset/WorkParamReadMapper.xml

@ -27,15 +27,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
last(param_value_num,timestamp_key) AS lastVal,
min(param_value_num) AS minVal
FROM dc_base_log_history_level1 AS his
where timestamp_key BETWEEN to_timestamp(#{beginTime},'yyyy-MM-dd hh24:mi:ss') and to_timestamp(#{endTime},'yyyy-MM-dd hh24:mi:ss')
<where>
timestamp_key BETWEEN to_timestamp(#{beginTime},'yyyy-MM-dd hh24:mi:ss') and
to_timestamp(#{endTime},'yyyy-MM-dd hh24:mi:ss')
<if test="deviceCodes != null and deviceCodes.size() > 0">
and device_uuid in
<foreach item="item" index="index" collection="deviceCodes" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="paramCodes != null and paramCodes.size() > 0">
and param_code in
<foreach item="item" index="index" collection="paramCodes" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
GROUP BY thour, param_code,device_uuid
ORDER BY thour asc
</select>

29
lzbi-module/src/main/resources/mapper/targetFolder/DcBaseAssetTargetMapper.xml

@ -147,6 +147,35 @@
and asset_code = #{assetCode}
</select>
<select id="selectChargeAssetContrastParams" resultType="com.lzbi.asset.domain.ChargeSystemParamsDTO">
select
t1.id,
t1.asset_code,
t1.asset_id,
t1.target_model_code,
t1.target_name,
t1.target_name_alias,
t1.target_code,
t1.field_code,
t1.field_name,
t1.column_type,
t1.field_unit,
t3.goal_asset_code
from
dc_base_asset_target t1
INNER JOIN dc_base_asset_info t2 ON t1.asset_code = t2.asset_code
INNER JOIN dc_base_asset_contrast_config t3 ON t2.asset_code = t3.asset_code
WHERE
t1.column_type = 'P'
AND t2.asset_level = '30'
AND t2.asset_type = '1'
AND t3.goal_source = 'charge'
AND t1.target_model_code in
<foreach item="paramsModelCode" collection="paramsModelCodeList" open="(" separator="," close=")">
#{paramsModelCode}
</foreach>
</select>
<insert id="insertDcBaseAssetTarget" parameterType="DcBaseAssetTarget" useGeneratedKeys="true" keyProperty="id">
insert into dc_base_asset_target
<trim prefix="(" suffix=")" suffixOverrides=",">

5
lzbi-quartz/pom.xml

@ -35,6 +35,11 @@
<artifactId>lzbi-common</artifactId>
</dependency>
<dependency>
<groupId>com.lzbi</groupId>
<artifactId>lzbi-module</artifactId>
</dependency>
</dependencies>
</project>

23
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("===========自动审核参数单据结束============");
}
}

24
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("===========同步收费系统参数结束============");
}
}

27
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);
}
}
Loading…
Cancel
Save