From d8adebdef26328de9b5f3965648c984fd0b3f683 Mon Sep 17 00:00:00 2001 From: bobol Date: Tue, 30 Jan 2024 15:03:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1=E3=80=81=E8=A7=A3=E6=9E=90=E6=97=A5?= =?UTF-8?q?=E6=8A=A5excel=E6=97=B6=EF=BC=8C=E9=81=87=E5=88=B0=E5=85=AC?= =?UTF-8?q?=E5=BC=8F=E7=95=A5=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-test.yml | 25 +++++++++++++++++++ .../DcBusiTargetInputMasterService.java | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/lzbi-admin/src/main/resources/application-test.yml b/lzbi-admin/src/main/resources/application-test.yml index 059b2e5..2e56abc 100644 --- a/lzbi-admin/src/main/resources/application-test.yml +++ b/lzbi-admin/src/main/resources/application-test.yml @@ -129,3 +129,28 @@ target-model: outputOfPlant: TM000FDL # 发电量 provideWaterAverageTemperature: TM000GSJW # 供水均温 answerWaterAverageTemperature: TM000HSJW # 回水均温 + +# 微信相关配置 +wechat: + # 小程序ID + appId: wx4c96b81e6331fefa + # 小程序密钥 + appSecret: b7258ba1e7db304d086cb83f034b3b60 + # 小程序登录接口 + code2Session: https://api.weixin.qq.com/sns/jscode2session?appid={appid}&secret={secret}&js_code={js_code}&grant_type={grant_type} + # 获取接口调用凭据 + accessToken: https://api.weixin.qq.com/cgi-bin/token?appid={appid}&secret={secret}&grant_type={grant_type} + # 获取手机号 + phoneNumber: https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token={access_token} + +# 外部服务 +goal-server: + # iot平台服务地址 + iot: http://127.0.0.1:9010 + +# 外部服务接口 +goal-server-api: + # 获取组织资产参数树形结构 + getOrgAssetParamsTree: ${goal-server.iot}/biz/common/orgAssetParamsTree + # 获取组织资产参数树形结构 + getParamsValue: ${goal-server.iot}/biz/common/paramsValue diff --git a/lzbi-module/src/main/java/com/lzbi/bill/service/DcBusiTargetInputMasterService.java b/lzbi-module/src/main/java/com/lzbi/bill/service/DcBusiTargetInputMasterService.java index 9ba13dd..c0811a1 100644 --- a/lzbi-module/src/main/java/com/lzbi/bill/service/DcBusiTargetInputMasterService.java +++ b/lzbi-module/src/main/java/com/lzbi/bill/service/DcBusiTargetInputMasterService.java @@ -180,7 +180,8 @@ public class DcBusiTargetInputMasterService extends ServiceImpl Date: Wed, 31 Jan 2024 11:13:09 +0800 Subject: [PATCH 2/2] =?UTF-8?q?1=E3=80=81=E8=A7=A3=E6=9E=90=E6=97=A5?= =?UTF-8?q?=E6=8A=A5excel=E6=97=B6=EF=BC=8C=E9=81=87=E5=88=B0=E7=89=B9?= =?UTF-8?q?=E6=AE=8A=E7=AC=A6=E5=8F=B7=E7=95=A5=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constant/TargetModelCodeConstants.java | 38 +---------- .../DcBusiTargetInputMasterService.java | 64 ++++++++++++++----- .../asset/DcBusiTargetDraftDaynewMapper.xml | 7 +- 3 files changed, 51 insertions(+), 58 deletions(-) diff --git a/lzbi-common/src/main/java/com/lzbi/common/constant/TargetModelCodeConstants.java b/lzbi-common/src/main/java/com/lzbi/common/constant/TargetModelCodeConstants.java index 6450840..e8a1edf 100644 --- a/lzbi-common/src/main/java/com/lzbi/common/constant/TargetModelCodeConstants.java +++ b/lzbi-common/src/main/java/com/lzbi/common/constant/TargetModelCodeConstants.java @@ -86,41 +86,5 @@ public class TargetModelCodeConstants { public static final String 中水电动热泵耗电量 = "00083"; public static final String 中水电动热泵产热量 = "00084"; public static final String 燃气锅炉产热量 = "00085"; - public static final String 一次网水耗 = "ycwsh"; - public static final String 一次网电耗 = "ycwdh"; - public static final String 一次网煤耗 = "ycwmh"; - public static final String 总产汽量 = "zcql"; - public static final String 总发电量 = "zfdl"; - public static final String 二次网水耗 = "ecwsh"; - public static final String 二次网电耗 = "ecwdh"; - public static final String 循环流量 = "xhll"; - public static final String 一次网供温 = "ycwgw"; - public static final String 一次网回温 = "ycwhw"; - public static final String 一次网水单耗 = "ycwsdh"; - public static final String 一次网电单耗 = "ycwddh"; - public static final String 一次网煤单耗 = "ycwmdh"; - public static final String 单产热量 = "dcrl"; - public static final String 单产汽量 = "dcql"; - public static final String 单发电量 = "dfdl"; - public static final String 二次网水单耗 = "ecwsdh"; - public static final String 二次网电单耗 = "ecwddh"; - public static final String 一次网水耗累计 = "ycwshlj"; - public static final String 一次网电耗累计 = "ycwdhlj"; - public static final String 一次网煤耗累计 = "ycwmhlj"; - public static final String 总产热量累计 = "zcrllj"; - public static final String 总产汽量累计 = "zcqllj"; - public static final String 总发电量累计 = "zfdllj"; - public static final String 二次网水耗累计 = "ecwshlj"; - public static final String 二次网电耗累计 = "ecwdhlj"; - public static final String 循环流量累计 = "xhlllj"; - public static final String 一次网供温累计 = "ycwgwlj"; - public static final String 一次网回温累计 = "ycwhwlj"; - public static final String 一次网水单耗累计 = "ycwsdhlj"; - public static final String 一次网电单耗累计 = "ycwddhlj"; - public static final String 一次网煤单耗累计 = "ycwmdhlj"; - public static final String 单产热量累计 = "dcrllj"; - public static final String 单产汽量累计 = "dcqllj"; - public static final String 单发电量累计 = "dfdllj"; - public static final String 二次网水单耗累计 = "ecwsdhlj"; - public static final String 二次网电单耗累计 = "ecwddhlj"; + } diff --git a/lzbi-module/src/main/java/com/lzbi/bill/service/DcBusiTargetInputMasterService.java b/lzbi-module/src/main/java/com/lzbi/bill/service/DcBusiTargetInputMasterService.java index c0811a1..e57f88b 100644 --- a/lzbi-module/src/main/java/com/lzbi/bill/service/DcBusiTargetInputMasterService.java +++ b/lzbi-module/src/main/java/com/lzbi/bill/service/DcBusiTargetInputMasterService.java @@ -21,10 +21,15 @@ import com.lzbi.draft.mapper.DcBusiTargetDraftMonthMapper; import com.lzbi.targetFolder.domain.DcBaseAssetTarget; import com.lzbi.targetFolder.mapper.DcBaseAssetTargetMapper; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.IteratorUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.poi.ss.usermodel.*; -import org.apache.poi.xssf.usermodel.*; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellType; +import org.apache.poi.ss.usermodel.DataFormatter; +import org.apache.poi.ss.usermodel.FormulaEvaluator; +import org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -35,10 +40,7 @@ import javax.annotation.Resource; import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.regex.Pattern; @@ -219,6 +221,7 @@ public class DcBusiTargetInputMasterService extends ServiceImpl> targetMap = new HashMap<>(); for (ProductionDailySheetReq productionDailySheetReq : list) { String name = productionDailySheetReq.getName(); + name = name.trim(); DcBaseAssetInfo dcBaseAssetInfo = dcBaseAssetInfoMapper.selectDcBaseAssetInfoByAliasName(name); if (ObjectUtils.isEmpty(dcBaseAssetInfo)) { return AjaxResult.error(name + "sheet页没有对应的统计单元"); @@ -236,6 +239,7 @@ public class DcBusiTargetInputMasterService extends ServiceImpl dcBaseAssetTargetMap = targetMap.get(name); List> data = productionDailySheetReq.getData(); @@ -260,6 +264,15 @@ public class DcBusiTargetInputMasterService extends ServiceImpl confirmReq.getDays()) { + continue; + } + if (dayMap.containsKey(day)) { + break; + } + dayMap.put(day, j); } } sign = true; @@ -274,7 +287,13 @@ public class DcBusiTargetInputMasterService extends ServiceImpl { String v = row.get(index); - if (StringUtils.isNotBlank(v) && !v.contains("-")) { + if (Pattern.matches(".*[-!@#$%^&*()_+={}\\[\\]\"<>/;':\\\\|`~].*", v)) { + return; + } + if (v.contains(",")) { + v = v.replaceAll(",", ""); + } + if (StringUtils.isNotBlank(v)) { DcBusiTargetInputSub dcBusiTargetInputSub = new DcBusiTargetInputSub(); dcBusiTargetInputSub.setTargetCode(dcBaseAssetTarget.getTargetCode()); dcBusiTargetInputSub.setTargetName(dcBaseAssetTarget.getTargetName()); @@ -291,14 +310,13 @@ public class DcBusiTargetInputMasterService extends ServiceImpl dcBusiTargetDraftDaynews = dcBusiTargetDraftDaynewMapper.selectDcBusiTargetDraftDaynewByTargetInput(master); if (!CollectionUtils.isEmpty(dcBusiTargetDraftDaynews)) { DcBusiTargetDraftDaynew dcBusiTargetDraftDaynew = dcBusiTargetDraftDaynews.get(0); - String msg = "%s中,%s(指标)%s年%s月%s日,已存在"; - throw new RuntimeException(String.format(msg, dcBusiTargetDraftDaynew.getAssetNameAlias(), dcBusiTargetDraftDaynew.getTagetName(), dcBusiTargetDraftDaynew.getDateYear(), dcBusiTargetDraftDaynew.getDateMonth(), dcBusiTargetDraftDaynew.getDateDay())); + String format = "%s(sheet页)中,%s(指标)%s年%s月%s日,已存在"; + String msg = String.format(format, dcBusiTargetDraftDaynew.getAssetNameAlias(), dcBusiTargetDraftDaynew.getTagetName(), dcBusiTargetDraftDaynew.getDateYear(), dcBusiTargetDraftDaynew.getDateMonth(), dcBusiTargetDraftDaynew.getDateDay()); + log.error(msg); + throw new RuntimeException(msg); } DcBusiTargetInputSub subParams = new DcBusiTargetInputSub(); @@ -462,7 +482,19 @@ public class DcBusiTargetInputMasterService extends ServiceImpl idList = dateNewList.stream().map(dcBusiTargetDraftDaynew -> String.valueOf(dcBusiTargetDraftDaynew.getId())).collect(Collectors.toList()); String[] ids = idList.toArray(new String[]{}); - dcBusiTargetDraftDaynewMapper.deleteDcBusiTargetDraftDaynewByIds(ids); + int len = ids.length; + int range = 1000; + int remainder = len % range; + int count = len / range; + String[] idsNew; + for (int i = 0; i < count; i++) { + idsNew = Arrays.copyOfRange(ids, i * range, (i + 1) * range); + dcBusiTargetDraftDaynewMapper.deleteDcBusiTargetDraftDaynewByIds(idsNew); + } + if (remainder > 0) { + idsNew = Arrays.copyOfRange(ids, count * range, len); + dcBusiTargetDraftDaynewMapper.deleteDcBusiTargetDraftDaynewByIds(idsNew); + } } DcBusiTargetInputSub subParams = new DcBusiTargetInputSub(); subParams.setBillNoMaster(billNo); diff --git a/lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftDaynewMapper.xml b/lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftDaynewMapper.xml index bac5199..94f3546 100644 --- a/lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftDaynewMapper.xml +++ b/lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftDaynewMapper.xml @@ -76,11 +76,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" t1.* FROM dc_busi_target_draft_daynew t1 - INNER JOIN dc_busi_target_input_sub t2 ON t1.company_id = t2.company_id - AND t1.organize_id = t2.oragnize_id - AND t1.asset_code = t2.asset_code - AND t1.target_code = t2.target_code - AND t1.date_day = LPAD( t2.`day`, 2, '0' ) + INNER JOIN dc_busi_target_input_sub t2 + ON t1.target_code = t2.target_code AND t1.date_day = LPAD( t2.`day`, 2, '0' ) WHERE t2.bill_no_master = #{billSerial} AND t1.date_year = #{year}