diff --git a/lzbi-admin/src/main/resources/application-dev.yml b/lzbi-admin/src/main/resources/application-dev.yml index c57a77c..207b039 100644 --- a/lzbi-admin/src/main/resources/application-dev.yml +++ b/lzbi-admin/src/main/resources/application-dev.yml @@ -79,6 +79,9 @@ spring: url: jdbc:mysql://10.10.10.56:13306/lzdc_bi_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true username: luenmei password: 123456 + #url: jdbc:mysql://localhost:3306/lmlz_dcdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true + #username: root + #password: root123456 # # 计费数据库 # charge: # driverClassName: oracle.jdbc.OracleDriver @@ -93,7 +96,7 @@ spring: password: 123456 workDB: driverClassName: org.postgresql.Driver - #type: com.alibaba.druid.pool.DruidDataSource + 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 username: postgres password: 123456 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 4108948..c874314 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 @@ -1,15 +1,24 @@ package com.lzbi.draft.controller; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateUtil; +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.DcBusiParamBillSub; + import com.lzbi.draft.service.DcBusiParamBillSubService; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; -import org.springframework.security.access.prepost.PreAuthorize; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -64,6 +73,41 @@ public class DcBusiParamBillMasterController extends BaseController List list = dcBusiParamBillSubService.selectByVo(sub); return AjaxResult.success(list); } + @ApiOperation("参数采集单主从详情") + @ApiImplicitParams({ + @ApiImplicitParam(name = "billNo", value = "", dataType = "String", dataTypeClass = String.class), + }) + @GetMapping("/info/{billNo}") + public AjaxResult getParamInBillInfo(@PathVariable String billNo){ + DcBusiParamBillMaster master = dcBusiParamBillMasterService.selectDcBusiParamBillMasterDaoByNo(billNo); + Map> map = master.getDcBusiParamBillSubList().stream().collect(Collectors.groupingBy(DcBusiParamBillSub::getCountHourString)); + master.setCountTimes(map.keySet().stream().collect(Collectors.joining(","))); + master.setCountDate(master.getBillIncomeDate()); + Map mapRow=new HashMap<>(); + map.keySet().stream().forEach(key->{ + List sub=map.get(key); + sub.forEach(subItem->{ + JSONObject jsb=mapRow.get(subItem.getAssetCode()+subItem.getParamCode()); + if(StringUtils.isNull(jsb)){ + jsb=new JSONObject(); + jsb.put("assetName",subItem.getAssetName()); + jsb.put("assetCode",subItem.getAssetCode()); + jsb.put("paramCode",subItem.getParamCode()); + jsb.put("paramName",subItem.getParamName()); + jsb.put("paramUint",subItem.getParamUint()); + jsb.put("val_"+key,subItem.getParamValue()); + mapRow.put(subItem.getAssetCode()+subItem.getParamCode(),jsb); + master.setFieldCode(subItem.getFieldCode()); + master.setFieldName(subItem.getFieldName()); + }else{ + jsb.put("val_"+key,subItem.getParamValue()); + } + }); + }); + + master.setSubRecord(mapRow.values().stream().collect(Collectors.toList())); + return AjaxResult.success(master); + } @ApiOperation("采集单驳回") @ApiImplicitParams({ @ApiImplicitParam(name = "billNo", value = "", dataType = "String", dataTypeClass = String.class), @@ -88,7 +132,20 @@ public class DcBusiParamBillMasterController extends BaseController master.setUpdatedBy(SecurityUtils.getUsername()); master.setCreatedTime(DateUtils.getNowDate()); master.setBillNo(billNo); - master.setCheckStatus("1"); + master.setCheckStatus("2"); + return AjaxResult.success(dcBusiParamBillMasterService.checkBill(master)); + } + @ApiOperation("采集单反审核") + @ApiImplicitParams({ + @ApiImplicitParam(name = "billNo", value = "", dataType = "String", dataTypeClass = String.class), + }) + @GetMapping("/checkRevert/{billNo}") + public AjaxResult checkParamInBillRevert(@PathVariable String billNo){ + DcBusiParamBillMaster master=new DcBusiParamBillMaster(); + master.setUpdatedBy(SecurityUtils.getUsername()); + master.setCreatedTime(DateUtils.getNowDate()); + master.setBillNo(billNo); + master.setCheckStatus("0"); return AjaxResult.success(dcBusiParamBillMasterService.checkBill(master)); } diff --git a/lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiParamCollectBill.java b/lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiParamCollectBill.java index 5d6d897..4f076dd 100644 --- a/lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiParamCollectBill.java +++ b/lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiParamCollectBill.java @@ -276,6 +276,51 @@ public class DcBusiParamCollectBill extends BaseController dcBusiParamBillMaster.setDcBusiParamBillSubList(dcBusiParamBillSubList); return AjaxResult.success(dcBusiParamBillMasterService.insertDcBusiParamBillMasterDao(dcBusiParamBillMaster)); } + @ApiOperation("更新参数采集数据-subDatas数组方式") + @ApiImplicitParams({ + @ApiImplicitParam(name = "dcBusiParamBillMaster", value = "", dataType = "DcBusiParamBillMaster", dataTypeClass = DcBusiParamBillMaster.class), + }) + @PostMapping("/updateBillCollectArray") + /*subDatas为动态数据列,值是分开的索要对每个列值进行处理*/ + public AjaxResult updateBillCollectBy(@RequestBody DcBusiParamBillMaster dcBusiParamBillMaster){ + List dcBusiParamBillSubList =new ArrayList<>(); + dcBusiParamBillMaster.setUpdatedBy(SecurityUtils.getUsername()); + JSONObject datasets=Optional.ofNullable(dcBusiParamBillMaster.getSubDatas()).orElse(new JSONObject()); + JSONArray dataArray=new JSONArray(); + dataArray.addAll(datasets.getJSONArray("insertRecords")); + //dataArray.addAll(datasets.getJSONArray("updateRecords")); + //dataArray.addAll(datasets.getJSONArray("removeRecords")); + String billNo=dcBusiParamBillMaster.getBillNo(); + dataArray.forEach(item->{ + JSONObject jsb = JSONObject.from(item); + for(int i=1;i<25;i++){ + String fname="val_"+String.valueOf(i); + Double value=jsb.getDouble(fname); + if(StringUtils.isNotNull(value)){ + DcBusiParamBillSub dcBusiParamBillSub=new DcBusiParamBillSub(); + //基本数据 + dcBusiParamBillSub.setBillNo(billNo); + dcBusiParamBillSub.setId(null); + dcBusiParamBillSub.setParamCode(jsb.getString("paramCode")); + dcBusiParamBillSub.setAssetCode(jsb.getString("assetCode")); + dcBusiParamBillSub.setAssetName(jsb.getString("assetName")); + //dcBusiParamBillSub.setCountDate(jsb.getString("countDate")); + dcBusiParamBillSub.setCountDate(dcBusiParamBillMaster.getBillIncomeDate()); + dcBusiParamBillSub.setParamUint(jsb.getString("paramUint")); + dcBusiParamBillSub.setParamName(jsb.getString("paramName")); + dcBusiParamBillSub.setFieldCode(jsb.getString("fieldCode")); + dcBusiParamBillSub.setFieldName(jsb.getString("fieldName")); + dcBusiParamBillSub.setCountHour(i); + dcBusiParamBillSub.setParamValue(value); + dcBusiParamBillSubList.add(dcBusiParamBillSub); + } + } + + + }); + dcBusiParamBillMaster.setDcBusiParamBillSubList(dcBusiParamBillSubList); + return AjaxResult.success(dcBusiParamBillMasterService.updateDcBusiParamBillMasterDao(dcBusiParamBillMaster)); + } private String getBillModelNo(){ DcBusiCoderuleConfigDao ruleIdByBusicode =Optional.ofNullable(dcBaseCoderuleDefineService.getRuleIdByBusicode("BILL_MODEL_NO")).orElse(new DcBusiCoderuleConfigDao()) ; diff --git a/lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamBillMaster.java b/lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamBillMaster.java index 49d45c8..24012df 100644 --- a/lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamBillMaster.java +++ b/lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamBillMaster.java @@ -84,7 +84,7 @@ public class DcBusiParamBillMaster extends BaseModuleEntity private List dcBusiParamBillSubList; @ApiModelProperty(name = "data数组数据未转换",notes = "") private JSONObject subDatas; - + private List subRecord; } diff --git a/lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamBillSub.java b/lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamBillSub.java index c5eeac2..47e0f68 100644 --- a/lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamBillSub.java +++ b/lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamBillSub.java @@ -1,6 +1,7 @@ package com.lzbi.draft.domain; import com.baomidou.mybatisplus.annotation.IdType; +import com.lzbi.common.utils.StringUtils; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import com.baomidou.mybatisplus.annotation.TableName; @@ -52,6 +53,9 @@ public class DcBusiParamBillSub extends BaseModuleEntity{ /** 指标编码 */ @ApiModelProperty(name = "指标编码",notes = "") private String paramCode ; + /** 指标编码 */ + @ApiModelProperty(name = "指标别名",notes = "") + private String assetAlialsName ; /** 指标单位 */ @ApiModelProperty(name = "指标单位",notes = "") private String paramUint ; @@ -76,4 +80,10 @@ public class DcBusiParamBillSub extends BaseModuleEntity{ public String getFieldCode(){ return Optional.ofNullable(this.fieldCode).orElse(""); } + public String getCountHourString(){ + return String.valueOf(countHour); + } + public String getCountHourStringPad(){ + return StringUtils.leftPad(getCountHourString(),2,'0'); + } } \ No newline at end of file diff --git a/lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiParamBillMasterMapper.java b/lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiParamBillMasterMapper.java index 40c56e7..1c3652e 100644 --- a/lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiParamBillMasterMapper.java +++ b/lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiParamBillMasterMapper.java @@ -22,6 +22,7 @@ public interface DcBusiParamBillMasterMapper extends BaseMapper + @@ -73,13 +74,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + insert into dc_busi_param_bill_master @@ -138,6 +146,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" bill_type = #{billType}, check_type = #{checkType}, check_status = #{checkStatus}, + company_id=#{companyId}, + company_name=#{companyName}, + organize_name=#{organizeName}, + oragnize_id=#{oragnizeId}, where id = #{id} @@ -156,6 +168,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" bill_type = #{billType}, check_type = #{checkType}, check_status = #{checkStatus}, + company_id=#{companyId}, + company_name=#{companyName}, + organize_name=#{organizeName}, + oragnize_id=#{oragnizeId}, where bill_no = #{billNo} @@ -182,9 +198,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - insert into dc_busi_param_bill_sub( TENANT_ID, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, DELETE_BY, DELETE_TIME, id, bill_no, asset_code,asset_name, field_code, field_name, param_code, param_value,count_date,count_hour,param_name) values + insert into dc_busi_param_bill_sub( TENANT_ID, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, DELETE_BY, DELETE_TIME, id, bill_no, asset_code,asset_name, field_code, field_name, param_code, param_value,count_date,count_hour,param_name,param_uint) values - ( #{item.tenantId}, #{item.createdBy}, #{item.createdTime}, #{item.updatedBy}, #{item.updatedTime}, #{item.deleteBy}, #{item.deleteTime}, #{item.id}, #{item.billNo}, #{item.assetCode}, #{item.assetName}, #{item.fieldCode}, #{item.fieldName},#{item.paramCode}, #{item.paramValue}, #{item.countDate}, #{item.countHour},#{item.paramName}) + ( #{item.tenantId}, #{item.createdBy}, #{item.createdTime}, #{item.updatedBy}, #{item.updatedTime}, #{item.deleteBy}, #{item.deleteTime}, #{item.id}, #{item.billNo}, #{item.assetCode}, #{item.assetName}, #{item.fieldCode}, #{item.fieldName},#{item.paramCode}, #{item.paramValue}, #{item.countDate}, #{item.countHour},#{item.paramName},#{item.paramUint}) \ No newline at end of file