Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
bobol 11 months ago
parent
commit
956ac6ff98
  1. 11
      lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiParamBillMasterController.java
  2. 222
      lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamDraftDay.java
  3. 2
      lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiParamDraftDayMapper.java
  4. 78
      lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiParamDraftDayService.java
  5. 96
      lzbi-module/src/main/java/com/lzbi/task/TaskParamDfratProcess.java
  6. 19
      lzbi-module/src/main/resources/mapper/asset/DcBusiParamDraftDayMapper.xml

11
lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiParamBillMasterController.java

@ -15,11 +15,13 @@ import com.lzbi.common.utils.StringUtils;
import com.lzbi.draft.domain.DcBusiParamBillSub;
import com.lzbi.draft.service.DcBusiParamBillSubService;
import com.lzbi.draft.service.DcBusiParamDraftDayService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@ -46,6 +48,8 @@ public class DcBusiParamBillMasterController extends BaseController
private DcBusiParamBillMasterService dcBusiParamBillMasterService;
@Autowired
private DcBusiParamBillSubService dcBusiParamBillSubService;
@Autowired
private DcBusiParamDraftDayService dcBusiParamDraftDayService;
/**
* 查询参数采集录入单据主列表
*/
@ -127,13 +131,16 @@ public class DcBusiParamBillMasterController extends BaseController
@ApiImplicitParam(name = "billNo", value = "", dataType = "String", dataTypeClass = String.class),
})
@GetMapping("/check/{billNo}")
@Transactional
public AjaxResult checkParamInBill(@PathVariable String billNo){
DcBusiParamBillMaster master=new DcBusiParamBillMaster();
DcBusiParamBillMaster master = dcBusiParamBillMasterService.selectDcBusiParamBillMasterDaoByNo(billNo);
master.setUpdatedBy(SecurityUtils.getUsername());
master.setCreatedTime(DateUtils.getNowDate());
master.setBillNo(billNo);
master.setCheckStatus("2");
return AjaxResult.success(dcBusiParamBillMasterService.checkBill(master));
dcBusiParamBillMasterService.checkBill(master);
dcBusiParamDraftDayService.updateParamCollectBilltoDraft(master);
return AjaxResult.success(master);
}
@ApiOperation("采集单反审核")
@ApiImplicitParams({

222
lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamDraftDay.java

@ -21,14 +21,14 @@ public class DcBusiParamDraftDay extends BaseModuleEntity
/** 公司编码 */
private Integer companyId;
private Long companyId;
/** 生产组织机构名称 */
@Excel(name = "生产组织机构名称")
private String organizeName;
/** 生产组织机构编号 */
private Integer organizeId;
private Long organizeId;
/** 公司名称 */
@Excel(name = "公司名称")
@ -61,130 +61,286 @@ public class DcBusiParamDraftDay extends BaseModuleEntity
/** 均值 */
@Excel(name = "均值")
private double valAvg;
private Double valAvg;
/** 当日最大值 */
@Excel(name = "当日最大值")
private double valMax;
private Double valMax;
/** 和值 */
@Excel(name = "和值")
private String valSum;
private Double valSum;
/** 当日最小值 */
@Excel(name = "当日最小值")
private double valMin;
private Double valMin;
/** 积算值 */
@Excel(name = "积算值")
private double valIntegrating;
private Double valIntegrating;
/** 上限 */
@Excel(name = "上限")
private double valLimitUp;
private Double valLimitUp;
/** 下限 */
@Excel(name = "下限")
private double valLimitDown;
private Double valLimitDown;
/** 非空列总数 */
private Integer valTotal;
/** 1时 */
@Excel(name = "1时")
private double val01;
private Double val01;
/** 2时;[01:00:00,01:59:59] */
@Excel(name = "2时;[01:00:00,01:59:59]")
private double val02;
private Double val02;
/** 3时;[02:00:00,02:59:59] */
@Excel(name = "3时;[02:00:00,02:59:59]")
private double val03;
private Double val03;
/** 4时 */
@Excel(name = "4时")
private double val04;
private Double val04;
/** 5时 */
@Excel(name = "5时")
private double val05;
private Double val05;
/** 6时 */
@Excel(name = "6时")
private double val06;
private Double val06;
/** 7时 */
@Excel(name = "7时")
private double val07;
private Double val07;
/** 8时 */
@Excel(name = "8时")
private double val08;
private Double val08;
/** 9时 */
@Excel(name = "9时")
private double val09;
private Double val09;
/** 10时 */
@Excel(name = "10时")
private double val10;
private Double val10;
/** 11时 */
@Excel(name = "11时")
private double val11;
private Double val11;
/** 12时 */
@Excel(name = "12时")
private double val12;
private Double val12;
/** 13时 */
@Excel(name = "13时")
private double val13;
private Double val13;
/** 14时 */
@Excel(name = "14时")
private double val14;
private Double val14;
/** 15时 */
@Excel(name = "15时")
private double val15;
private Double val15;
/** 16时 */
@Excel(name = "16时")
private double val16;
private Double val16;
/** 17时 */
@Excel(name = "17时")
private double val17;
private Double val17;
/** 18时 */
@Excel(name = "18时")
private double val18;
private Double val18;
/** 18时 */
@Excel(name = "18时")
private double val19;
private Double val19;
/** 20时 */
@Excel(name = "20时")
private double val20;
private Double val20;
/** 21时 */
@Excel(name = "21时")
private double val21;
private Double val21;
/** 22时 */
@Excel(name = "22时")
private double val22;
private Double val22;
/** 23时 */
@Excel(name = "23时")
private double val23;
private Double val23;
/** 24时 */
@Excel(name = "24时")
private double val24;
private Double val24;
/** 统计单元名称 */
@Excel(name = "统计单元名称")
private String assetName;
public void setValForSeq(int key,Double value){
switch (key){
case 0:
setVal01(value);
break;
case 1:
setVal02(value);
break;
case 2:
setVal03(value);
break;
case 3:
setVal04(value);
break;
case 4:
setVal05(value);
break;
case 5:
setVal06(value);
break;
case 6:
setVal07(value);
break;
case 7:
setVal08(value);
break;
case 8:
setVal09(value);
break;
case 9:
setVal10(value);
break;
case 10:
setVal11(value);
break;
case 11:
setVal12(value);
break;
case 12:
setVal13(value);
break;
case 13:
setVal14(value);
break;
case 14:
setVal15(value);
break;
case 15:
setVal16(value);
break;
case 16:
setVal17(value);
break;
case 17:
setVal18(value);
break;
case 18:
setVal19(value);
break;
case 19:
setVal20(value);
break;
case 20:
setVal21(value);
break;
case 21:
setVal22(value);
break;
case 22:
setVal23(value);
break;
case 23:
setVal24(value);
break;
}
}
public Double getValForSeq(int key){
Double value=null;
switch (key){
case 0:
value=getVal01();
break;
case 1:
value=getVal02();
break;
case 2:
value=getVal03();
break;
case 3:
value=getVal04();
break;
case 4:
value=getVal05();
break;
case 5:
value=getVal06();
break;
case 6:
value=getVal07();
break;
case 7:
value=getVal08();
break;
case 8:
value=getVal09();
break;
case 9:
value=getVal10();
break;
case 10:
value=getVal11();
break;
case 11:
value=getVal12();
break;
case 12:
value=getVal13();
break;
case 13:
value=getVal14();
break;
case 14:
value=getVal15();
break;
case 15:
value=getVal16();
break;
case 16:
value=getVal17();
break;
case 17:
value=getVal18();
break;
case 18:
value=getVal19();
break;
case 19:
value=getVal20();
break;
case 20:
value=getVal21();
break;
case 21:
value=getVal22();
break;
case 22:
value=getVal23();
break;
case 23:
value=getVal24();
break;
}
return value;
}
}

2
lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiParamDraftDayMapper.java

@ -21,7 +21,7 @@ public interface DcBusiParamDraftDayMapper extends BaseMapper<DcBusiParamDraftDa
* @return 参数数据底稿
*/
public DcBusiParamDraftDay selectDcBusiParamDraftDayById(String id);
public DcBusiParamDraftDay selectOneByParam(ParamDraftQueryVo queryVo);
public DcBusiParamDraftDay selectOneByParam(DcBusiParamDraftDay queryVo);
/**
* 查询参数数据底稿列表

78
lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiParamDraftDayService.java

@ -1,8 +1,20 @@
package com.lzbi.draft.service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import com.alibaba.fastjson2.JSONObject;
import com.lzbi.common.utils.DateUtils;
import com.lzbi.common.utils.SecurityUtils;
import com.lzbi.common.utils.StringUtils;
import com.lzbi.draft.domain.DcBusiParamBillMaster;
import com.lzbi.draft.domain.DcBusiParamBillSub;
import com.lzbi.draft.domain.ParamDraftQueryVo;
import com.sun.jna.platform.unix.X11;
import org.springframework.stereotype.Service;
import com.lzbi.draft.domain.DcBusiParamDraftDay;
import com.lzbi.draft.mapper.DcBusiParamDraftDayMapper;
@ -28,7 +40,7 @@ public class DcBusiParamDraftDayService extends ServiceImpl<DcBusiParamDraftDayM
{
return baseMapper.selectDcBusiParamDraftDayById(id);
}
public DcBusiParamDraftDay selectOneByParam(ParamDraftQueryVo queryVo)
public DcBusiParamDraftDay selectOneByParam(DcBusiParamDraftDay queryVo)
{
return baseMapper.selectOneByParam(queryVo);
}
@ -93,4 +105,68 @@ public class DcBusiParamDraftDayService extends ServiceImpl<DcBusiParamDraftDayM
{
return baseMapper.deleteDcBusiParamDraftDayById(id);
}
/**
* 处理审核后的采集单更新到参数底稿表
* 2023-12-22
* add by zhousq
* */
public int updateParamCollectBilltoDraft(DcBusiParamBillMaster dcBusiParamBillMaster){
// 根据把单据转换成底稿格式
if(StringUtils.isNull(dcBusiParamBillMaster)){
return -1;
}
if(StringUtils.isNull(dcBusiParamBillMaster.getDcBusiParamBillSubList())){
return -1;
}
AtomicInteger ret=new AtomicInteger();
Map<String, List<DcBusiParamBillSub>> map = dcBusiParamBillMaster.getDcBusiParamBillSubList().stream().collect(Collectors.groupingBy(p->p.getCountDate()+"-"+p.getFieldCode()+"-"+p.getAssetCode()+"-"+p.getParamCode()));
map.keySet().stream().forEach(key->{
List<DcBusiParamBillSub> sub=map.get(key);
DcBusiParamDraftDay draftDay=new DcBusiParamDraftDay();
draftDay.setCompanyName(dcBusiParamBillMaster.getCompanyName());
draftDay.setCompanyId(dcBusiParamBillMaster.getCompanyId());
draftDay.setOrganizeName(dcBusiParamBillMaster.getOrganizeName());
draftDay.setOrganizeId(dcBusiParamBillMaster.getOragnizeId());
draftDay.setParamCode(sub.get(0).getParamCode());
draftDay.setParamName(sub.get(0).getParamName());
draftDay.setAssetCode(sub.get(0).getAssetCode());
draftDay.setAssetName(sub.get(0).getAssetName());
draftDay.setTargetUint(sub.get(0).getParamUint());
draftDay.setCountDate(sub.get(0).getCountDate());
draftDay.setParamFieldCode(sub.get(0).getFieldCode());
draftDay.setParamFieldName(sub.get(0).getFieldName());
DcBusiParamDraftDay target =Optional.ofNullable(baseMapper.selectOneByParam(draftDay)).orElse(draftDay);
for(int i=0;i<sub.size();i++){
target.setValForSeq(sub.get(i).getCountHour(),sub.get(i).getParamValue());
}
//完成参数的初步计算
int totalCount=0;
double sum=0.0;
double max=0.0;
double min=0.0;
for(int i=1;i<25;i++){
Double value=target.getValForSeq(i);
if(StringUtils.isNotNull(value)){
totalCount+=1;
sum+=value;
if(Double.compare(max,value)<=0){
max=value;
}
if(Double.compare(min,value)>0){
min=value;
}
}
}
target.setValTotal(totalCount);
target.setValSum(sum);
target.setValMax(max);
target.setValMin(min);
if(StringUtils.isNull(target.getId())){
ret.set(baseMapper.insertDcBusiParamDraftDay(target));
}else{
ret.set(baseMapper.updateDcBusiParamDraftDay(target));
}
});
return ret.get();
}
}

96
lzbi-module/src/main/java/com/lzbi/task/TaskParamDfratProcess.java

@ -39,10 +39,10 @@ public class TaskParamDfratProcess {
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(":");
ParamDraftQueryVo queryVo=new ParamDraftQueryVo();
DcBusiParamDraftDay queryVo=new DcBusiParamDraftDay();
queryVo.setAssetCode(s[0]);
queryVo.setAssetParamCode(s[1]);
queryVo.setSpecialCode(s[2]);
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());
@ -55,91 +55,17 @@ public class TaskParamDfratProcess {
dcBusiParamDraftDay.setCountDate(val.getCountDate());
dcBusiParamDraftDay.setAssetCode(val.getAssetCode());
//------------设置 统计单元的其他信息
// dcBusiParamDraftDay.setOrganizeCode();
// dcBusiParamDraftDay.setOrganizeName();
// dcBusiParamDraftDay.setParamName();
// dcBusiParamDraftDay.setTargetUint();
// dcBusiParamDraftDay.setAssetName();
// dcBusiParamDraftDay.setCompanyCode();
// dcBusiParamDraftDay.setCompanyName();
dcBusiParamDraftDay.setOrganizeId(billMasterDao.getOragnizeId());
dcBusiParamDraftDay.setOrganizeName(billMasterDao.getOrganizeName());
dcBusiParamDraftDay.setParamName(val.getParamName());
dcBusiParamDraftDay.setTargetUint(val.getParamUint());
dcBusiParamDraftDay.setAssetName(val.getAssetName());
dcBusiParamDraftDay.setCompanyId(billMasterDao.getCompanyId());
dcBusiParamDraftDay.setCompanyName(billMasterDao.getCompanyName());
}
dcBusiParamDraftDay.setUpdatedBy("task");
dcBusiParamDraftDay.setUpdatedTime(DateUtil.date());
switch (val.getCountHour()){
case 0:
dcBusiParamDraftDay.setVal01(val.getParamValue());
break;
case 1:
dcBusiParamDraftDay.setVal02(val.getParamValue());
break;
case 2:
dcBusiParamDraftDay.setVal03(val.getParamValue());
break;
case 3:
dcBusiParamDraftDay.setVal04(val.getParamValue());
break;
case 4:
dcBusiParamDraftDay.setVal05(val.getParamValue());
break;
case 5:
dcBusiParamDraftDay.setVal06(val.getParamValue());
break;
case 6:
dcBusiParamDraftDay.setVal07(val.getParamValue());
break;
case 7:
dcBusiParamDraftDay.setVal08(val.getParamValue());
break;
case 8:
dcBusiParamDraftDay.setVal09(val.getParamValue());
break;
case 9:
dcBusiParamDraftDay.setVal10(val.getParamValue());
break;
case 10:
dcBusiParamDraftDay.setVal11(val.getParamValue());
break;
case 11:
dcBusiParamDraftDay.setVal12(val.getParamValue());
break;
case 12:
dcBusiParamDraftDay.setVal13(val.getParamValue());
break;
case 13:
dcBusiParamDraftDay.setVal14(val.getParamValue());
break;
case 14:
dcBusiParamDraftDay.setVal15(val.getParamValue());
break;
case 15:
dcBusiParamDraftDay.setVal16(val.getParamValue());
break;
case 16:
dcBusiParamDraftDay.setVal17(val.getParamValue());
break;
case 17:
dcBusiParamDraftDay.setVal18(val.getParamValue());
break;
case 18:
dcBusiParamDraftDay.setVal19(val.getParamValue());
break;
case 19:
dcBusiParamDraftDay.setVal20(val.getParamValue());
break;
case 20:
dcBusiParamDraftDay.setVal21(val.getParamValue());
break;
case 21:
dcBusiParamDraftDay.setVal22(val.getParamValue());
break;
case 22:
dcBusiParamDraftDay.setVal23(val.getParamValue());
break;
case 23:
dcBusiParamDraftDay.setVal24(val.getParamValue());
break;
}
dcBusiParamDraftDay.setValForSeq(val.getCountHour(),val.getParamValue());
});
dBusiParamDraftDayService.saveOrUpdate(dcBusiParamDraftDay);

19
lzbi-module/src/main/resources/mapper/asset/DcBusiParamDraftDayMapper.xml

@ -57,10 +57,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="val23" column="val23" />
<result property="val24" column="val24" />
<result property="assetName" column="asset_name" />
<result property="valTotal" column="val_total" />
</resultMap>
<sql id="selectDcBusiParamDraftDayVo">
select tenant_id, revision, created_by, created_time, updated_by, updated_time, delete_by, delete_time, id, company_id, organize_name, organize_id, company_name, asset_code, param_code, param_name, param_field_code,param_field_name, target_uint, count_date, val_avg, val_max, val_sum, val_min, val_integrating, val_limit_up, val_limit_down, val01, val02, val03, val04, val05, val06, val07, val08, val09, val10, val11, val12, val13, val14, val15, val16, val17, val18, val19, val20, val21, val22, val23, val24, asset_name from dc_busi_param_draft_day
select tenant_id, revision, created_by, created_time, updated_by, updated_time, delete_by, delete_time, id, company_id, organize_name, organize_id, company_name, asset_code, param_code, param_name, param_field_code,param_field_name, target_uint, count_date, val_avg, val_max, val_sum, val_min, val_integrating, val_limit_up, val_limit_down, val01, val02, val03, val04, val05, val06, val07, val08, val09, val10, val11, val12, val13, val14, val15, val16, val17, val18, val19, val20, val21, val22, val23, val24, asset_name,val_total from dc_busi_param_draft_day
</sql>
<select id="selectDcBusiParamDraftDayList" parameterType="DcBusiParamDraftDay" resultMap="DcBusiParamDraftDayResult">
@ -82,12 +84,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectDcBusiParamDraftDayVo"/>
where id = #{id}
</select>
<select id="selectOneByParam" parameterType="ParamDraftQueryVo" resultMap="DcBusiParamDraftDayResult">
<select id="selectOneByParam" parameterType="DcBusiParamDraftDay" resultMap="DcBusiParamDraftDayResult">
<include refid="selectDcBusiParamDraftDayVo"/>
where id = #{id}
<where>
<if test="id != null "> and id = #{id}</if>
<if test="companyId != null "> and company_id = #{companyId}</if>
<if test="organizeId != null "> and organize_id = #{organizeId}</if>
<if test="assetCode != null and assetCode != ''"> and asset_code = #{assetCode}</if>
<if test="paramFieldCode != null and paramFieldCode != ''"> and param_field_code = #{paramFieldCode}</if>
<if test="paramCode != null and paramCode != ''"> and param_code = #{paramCode}</if>
<if test="countDate != null and countDate != ''"> and count_date = #{countDate}</if>
</where>
</select>
<insert id="insertDcBusiParamDraftDay" parameterType="DcBusiParamDraftDay" useGeneratedKeys="true" keyProperty="id">
@ -144,6 +151,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="val23 != null">val23,</if>
<if test="val24 != null">val24,</if>
<if test="assetName != null">asset_name,</if>
<if test="valTotal != null">val_total,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tenantId != null">#{tenantId},</if>
@ -161,7 +169,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="assetCode != null">#{assetCode},</if>
<if test="paramCode != null">#{paramCode},</if>
<if test="paramName != null">#{paramName},</if>
<if test="paramField != null">#{paramField},</if>
<if test="paramFieldCode != null">#{paramFieldCode},</if>
<if test="paramFieldName != null">#{paramFieldName},</if>
<if test="targetUint != null">#{targetUint},</if>
<if test="countDate != null">#{countDate},</if>
<if test="valAvg != null">#{valAvg},</if>
@ -196,6 +205,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="val23 != null">#{val23},</if>
<if test="val24 != null">#{val24},</if>
<if test="assetName != null">#{assetName},</if>
<if test="valTotal != null">#{valTotal},</if>
</trim>
</insert>
@ -253,6 +263,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="val23 != null">val23 = #{val23},</if>
<if test="val24 != null">val24 = #{val24},</if>
<if test="assetName != null">asset_name = #{assetName},</if>
<if test="valTotal != null">val_total=#{valTotal},</if>
</trim>
where id = #{id}
</update>

Loading…
Cancel
Save