From 58541d89b3cc638376c45a1c8a4d3076629ae35b Mon Sep 17 00:00:00 2001 From: zhousq Date: Fri, 22 Dec 2023 14:27:57 +0800 Subject: [PATCH] =?UTF-8?q?2023-12-22=20=E4=BF=AE=E6=94=B9=E8=AF=A5?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=BA=95=E7=A8=BF=E8=A1=A8=E7=9A=84=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=8C=E5=A4=84=E7=90=86=E5=8F=82=E6=95=B0=E5=BD=95?= =?UTF-8?q?=E5=85=A5=E5=8D=95=E5=AE=A1=E6=A0=B8=E5=90=8E=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DcBusiDataScreenMainController.java | 2 +- .../DcBusiParamBillMasterController.java | 11 +- .../draft/domain/DcBusiParamDraftDay.java | 224 +++++++++++++++--- .../mapper/DcBusiParamDraftDayMapper.java | 2 +- .../service/DcBusiParamDraftDayService.java | 78 +++++- .../com/lzbi/task/TaskParamDfratProcess.java | 96 +------- .../asset/DcBusiParamDraftDayMapper.xml | 19 +- 7 files changed, 304 insertions(+), 128 deletions(-) diff --git a/lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiDataScreenMainController.java b/lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiDataScreenMainController.java index 5c8e03a..dd6b8f3 100644 --- a/lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiDataScreenMainController.java +++ b/lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiDataScreenMainController.java @@ -188,7 +188,7 @@ public class DcBusiDataScreenMainController extends BaseController{ String yikeapiAppsecret; @GetMapping("/weather/{areaCode}") public AjaxResult getWeather(@PathVariable String areaCode){ - String url=StrUtil.format("https://v0.yiketianqi.com/free/week?city=沈阳&unescape=1&appid={}&appsecret={}",yikeapiAppid,yikeapiAppsecret); + String url=StrUtil.format("https://v1.yiketianqi.com/free/week?city=沈阳&unescape=1&appid={}&appsecret={}",yikeapiAppid,yikeapiAppsecret); JSONObject weather=JSONObject.parseObject(HttpUtil.get(url)); JSONArray weatherInfo=Optional.ofNullable(weather.getJSONArray("data")).orElse(new JSONArray()); JSONArray we_date=new JSONArray(); diff --git a/lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiParamBillMasterController.java b/lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiParamBillMasterController.java index c874314..3ef9ae6 100644 --- a/lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiParamBillMasterController.java +++ b/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({ diff --git a/lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamDraftDay.java b/lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamDraftDay.java index e2f2404..ab2585e 100644 --- a/lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamDraftDay.java +++ b/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; + } } diff --git a/lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiParamDraftDayMapper.java b/lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiParamDraftDayMapper.java index 253f2e3..1bc3aa8 100644 --- a/lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiParamDraftDayMapper.java +++ b/lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiParamDraftDayMapper.java @@ -21,7 +21,7 @@ public interface DcBusiParamDraftDayMapper extends BaseMapper> map = dcBusiParamBillMaster.getDcBusiParamBillSubList().stream().collect(Collectors.groupingBy(p->p.getCountDate()+"-"+p.getFieldCode()+"-"+p.getAssetCode()+"-"+p.getParamCode())); + map.keySet().stream().forEach(key->{ + List 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;i0){ + 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(); + } } 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 faa2b42..affff96 100644 --- a/lzbi-module/src/main/java/com/lzbi/task/TaskParamDfratProcess.java +++ b/lzbi-module/src/main/java/com/lzbi/task/TaskParamDfratProcess.java @@ -39,10 +39,10 @@ public class TaskParamDfratProcess { Map> 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 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); diff --git a/lzbi-module/src/main/resources/mapper/asset/DcBusiParamDraftDayMapper.xml b/lzbi-module/src/main/resources/mapper/asset/DcBusiParamDraftDayMapper.xml index 108f350..b417d65 100644 --- a/lzbi-module/src/main/resources/mapper/asset/DcBusiParamDraftDayMapper.xml +++ b/lzbi-module/src/main/resources/mapper/asset/DcBusiParamDraftDayMapper.xml @@ -57,10 +57,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + - 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 - - where id = #{id} + + and id = #{id} and company_id = #{companyId} and organize_id = #{organizeId} and asset_code = #{assetCode} + and param_field_code = #{paramFieldCode} + and param_code = #{paramCode} + and count_date = #{countDate} + @@ -144,6 +151,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" val23, val24, asset_name, + val_total, #{tenantId}, @@ -161,7 +169,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{assetCode}, #{paramCode}, #{paramName}, - #{paramField}, + #{paramFieldCode}, + #{paramFieldName}, #{targetUint}, #{countDate}, #{valAvg}, @@ -196,6 +205,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{val23}, #{val24}, #{assetName}, + #{valTotal}, @@ -253,6 +263,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" val23 = #{val23}, val24 = #{val24}, asset_name = #{assetName}, + val_total=#{valTotal}, where id = #{id}