From 8388a81a93567c40a4cdb148f4ce3528f3123bf6 Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Mon, 19 Feb 2024 10:36:02 +0800 Subject: [PATCH 1/8] update --- .../netty/handler/ConfirmStartChargingRequestHandler.java | 1 + .../netty/handler/TransactionRecordsRequestHandler.java | 4 ++-- .../pile/service/programlogic/DelayMerchantProgramLogic.java | 2 +- .../main/resources/mapper/pile/PileBillingTemplateMapper.xml | 2 +- jsowell-ui/vue.config.js | 4 ++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/jsowell-netty/src/main/java/com/jsowell/netty/handler/ConfirmStartChargingRequestHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/handler/ConfirmStartChargingRequestHandler.java index 82746a594..fad9fe837 100644 --- a/jsowell-netty/src/main/java/com/jsowell/netty/handler/ConfirmStartChargingRequestHandler.java +++ b/jsowell-netty/src/main/java/com/jsowell/netty/handler/ConfirmStartChargingRequestHandler.java @@ -96,6 +96,7 @@ public class ConfirmStartChargingRequestHandler extends AbstractHandler{ startIndex += length; length = 8; byte[] cardNumByteArr = BytesUtil.copyBytes(msgBody, startIndex, length); + log.info("充电桩主动申请启动充电cardNumByteArr:{}", cardNumByteArr); String physicsCard = BytesUtil.binary(cardNumByteArr, 16); // 输入密码 对用户输入的密码进行16 位MD5 加密,采用小写上传 diff --git a/jsowell-netty/src/main/java/com/jsowell/netty/handler/TransactionRecordsRequestHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/handler/TransactionRecordsRequestHandler.java index a651d1ec7..8c860e2b4 100644 --- a/jsowell-netty/src/main/java/com/jsowell/netty/handler/TransactionRecordsRequestHandler.java +++ b/jsowell-netty/src/main/java/com/jsowell/netty/handler/TransactionRecordsRequestHandler.java @@ -500,7 +500,7 @@ public class TransactionRecordsRequestHandler extends AbstractHandler { startIndex += length; length = 8; byte[] cardNumByteArr = BytesUtil.copyBytes(msgBody, startIndex, length); - // byte[] logicCardNum = BytesUtil.checkLengthAndBehindAppendZero(cardNumByteArr, 16); + log.info("交易记录确认cardNumByteArr:{}", cardNumByteArr); String logicCard = BytesUtil.binary(cardNumByteArr, 16); log.info("桩号:{}, 发送交易记录物理卡号:{}", pileSn, logicCard); @@ -622,7 +622,7 @@ public class TransactionRecordsRequestHandler extends AbstractHandler { AbstractProgramLogic orderLogic = ProgramLogicFactory.getProgramLogic(mode); orderLogic.settleOrder(data, orderBasicInfo); } catch (Exception e) { - log.error("结算订单发生异常", e); + log.error("结算订单发生异常 orderCode:{}", orderBasicInfo.getOrderCode(), e); } // 异步绑定第三方平台优惠券 diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/programlogic/DelayMerchantProgramLogic.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/programlogic/DelayMerchantProgramLogic.java index 46faa38e3..97b9a3838 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/programlogic/DelayMerchantProgramLogic.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/programlogic/DelayMerchantProgramLogic.java @@ -374,7 +374,7 @@ public class DelayMerchantProgramLogic extends AbstractProgramLogic { OrderDetail orderDetail = returnUpdateOrderDetail(orderBasicInfo, data); // 计算订单折扣 calculateOrderDiscounts // calculateOrderDiscounts(orderBasicInfo, orderDetail); - // calculateOrderDiscountsV2(orderBasicInfo, orderDetail); + calculateOrderDiscountsV2(orderBasicInfo, orderDetail); // 更新数据库 OrderTransactionDTO dto = new OrderTransactionDTO(); diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileBillingTemplateMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileBillingTemplateMapper.xml index 7e7002413..2264f177a 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileBillingTemplateMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileBillingTemplateMapper.xml @@ -389,7 +389,7 @@ t6.apply_time AS valleyApplyDate FROM pile_basic_info t1 - JOIN pile_billing_template t2 ON t1.station_id = t2.station_id and t2.status = '1' + JOIN pile_billing_template t2 ON t1.station_id = t2.station_id and t2.status = '1' and t2.member_flag = '0' JOIN pile_billing_detail t3 ON t3.template_code = t2.template_code AND t3.time_type = '1' JOIN pile_billing_detail t4 ON t4.template_code = t2.template_code AND t4.time_type = '2' JOIN pile_billing_detail t5 ON t5.template_code = t2.template_code AND t5.time_type = '3' diff --git a/jsowell-ui/vue.config.js b/jsowell-ui/vue.config.js index 2ec66f69b..89f2d999f 100644 --- a/jsowell-ui/vue.config.js +++ b/jsowell-ui/vue.config.js @@ -35,10 +35,10 @@ module.exports = { proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { - // target: `http://localhost:8080`, + target: `http://localhost:8080`, // 更改代理为本地地址 // target: `http://192.168.2.6:8080`, - target: `https://api.jsowellcloud.com`, + // target: `https://api.jsowellcloud.com`, changeOrigin: true, pathRewrite: { ["^" + process.env.VUE_APP_BASE_API]: "", From 5aed246b6947b9bdc5909b67a267b57fb87e6a17 Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Mon, 19 Feb 2024 11:05:59 +0800 Subject: [PATCH 2/8] =?UTF-8?q?update=E6=9C=AA=E8=AE=BE=E7=BD=AE=E4=BB=B7?= =?UTF-8?q?=E6=A0=BC=E9=BB=98=E8=AE=A40=E5=85=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pile/service/impl/PileBillingTemplateServiceImpl.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java index 895ebe30f..3ee26302f 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java @@ -837,6 +837,13 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic servicePrice = dto.getServicePriceD(); } Map resultMap = Maps.newHashMap(); + + if (electricityPrice == null) { + electricityPrice = BigDecimal.ZERO; + } + if (servicePrice == null) { + servicePrice = BigDecimal.ZERO; + } resultMap.put("electricityPrice", electricityPrice); resultMap.put("servicePrice", servicePrice); return resultMap; From 092111bf9117f5b41dc83cef5e04fde99cdc14f1 Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Mon, 19 Feb 2024 11:36:55 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E9=87=91=E9=A2=9D=E4=B8=BA0=EF=BC=8C=E5=87=8F=E5=8E=BB?= =?UTF-8?q?=E4=BC=98=E6=83=A0=E9=87=91=E9=A2=9D=E5=90=8E=E4=B8=BA=E8=B4=9F?= =?UTF-8?q?=E6=95=B0=EF=BC=8C=E8=BF=98=E8=AE=BE=E7=BD=AE=E4=B8=BA0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...BillingTemplateValidateRequestHandler.java | 19 ------------------- .../programlogic/AbstractProgramLogic.java | 4 ++++ 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/jsowell-netty/src/main/java/com/jsowell/netty/handler/BillingTemplateValidateRequestHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/handler/BillingTemplateValidateRequestHandler.java index 539bf3afc..1cbfae482 100644 --- a/jsowell-netty/src/main/java/com/jsowell/netty/handler/BillingTemplateValidateRequestHandler.java +++ b/jsowell-netty/src/main/java/com/jsowell/netty/handler/BillingTemplateValidateRequestHandler.java @@ -59,25 +59,6 @@ public class BillingTemplateValidateRequestHandler extends AbstractHandler{ byte[] billingTemplateCodeByte = BytesUtil.copyBytes(msgBody, startIndex, length); String billingTemplateCode = BytesUtil.binary(billingTemplateCodeByte, 16); - // 根据桩号查询计费模板 - // BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn); - // String templateCode = null; - // if (billingTemplateVO != null) { - // templateCode = billingTemplateVO.getTemplateCode(); - // } - - - // log.info("桩传的计费模型编码:{}, 根据桩号:{} 查询到的计费模型编码:{}", billingTemplateCode, pileSn, templateCode); - // log.info("桩传的计费模型编码:{}", billingTemplateCode); - - /** - * 应答 0x00 桩计费模型与平台一致 0x01 桩计费模型与平台不一致 - */ - // byte[] flag; - // if (StringUtils.equals(billingTemplateCode, "100")){ - // flag = Constants.zeroByteArray; - // }else { - // } byte[] flag = Constants.oneByteArray; // 消息体 byte[] messageBody = Bytes.concat(pileSnByte, billingTemplateCodeByte, flag); diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/programlogic/AbstractProgramLogic.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/programlogic/AbstractProgramLogic.java index bbbb172fa..4dc08daea 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/programlogic/AbstractProgramLogic.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/programlogic/AbstractProgramLogic.java @@ -895,6 +895,10 @@ public abstract class AbstractProgramLogic implements InitializingBean { // 更新结算金额 结算金额 = 消费金额 - 虚拟金额 - 优惠金额 BigDecimal newSettleAmount = orderBasicInfo.getSettleAmount().subtract(discountAmount); + if (newSettleAmount.compareTo(BigDecimal.ZERO) < 0) { + // 如果结算金额为0,减去优惠金额后为负数,还设置为0 + newSettleAmount = BigDecimal.ZERO; + } orderBasicInfo.setSettleAmount(newSettleAmount); // 优惠后总消费金额 = 折扣后电费 + 折扣后服务费 From b89901aa8daf7614c971d97a33927ce4055a5877 Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Mon, 19 Feb 2024 15:25:56 +0800 Subject: [PATCH 4/8] =?UTF-8?q?update=20=E5=8A=A0=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/jsowell/service/OrderService.java | 5 +++++ .../java/com/jsowell/pile/vo/uniapp/UniAppOrderVO.java | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/jsowell-admin/src/main/java/com/jsowell/service/OrderService.java b/jsowell-admin/src/main/java/com/jsowell/service/OrderService.java index 8c59ce495..7b8e0329e 100644 --- a/jsowell-admin/src/main/java/com/jsowell/service/OrderService.java +++ b/jsowell-admin/src/main/java/com/jsowell/service/OrderService.java @@ -567,6 +567,11 @@ public class OrderService { vo.setPileConnectorStatus(pileConnectorDetailVO.getConnectorStatus()); } + // 优惠金额 + vo.setDiscountAmount(String.valueOf(orderBasicInfo.getDiscountAmount())); + // 实付金额 + vo.setActualAmount(String.valueOf(orderBasicInfo.getOrderAmount().subtract(orderBasicInfo.getDiscountAmount()))); + // 获取订单充电数据 List monitorDataList = orderBasicInfoService.getChargingRealTimeData(orderBasicInfo.getTransactionCode()); if (CollectionUtils.isNotEmpty(monitorDataList)) { diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/UniAppOrderVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/UniAppOrderVO.java index f6c8df5ee..474cd6bbd 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/UniAppOrderVO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/UniAppOrderVO.java @@ -69,6 +69,16 @@ public class UniAppOrderVO { */ private String orderAmount; + /** + * 优惠金额 + */ + private String discountAmount; + + /** + * 实付金额 + */ + private String actualAmount; + /** * 当前SOC */ From ba6305e64229b5d771a74be9d84958cdcb9f488d Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Mon, 19 Feb 2024 15:48:27 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E7=BB=84=E7=9A=84=E7=AB=99=E7=82=B9=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/pile/MemberGroupController.java | 12 ++++++++---- .../com/jsowell/pile/mapper/MemberGroupMapper.java | 3 +++ .../jsowell/pile/service/MemberGroupService.java | 8 ++++++++ .../pile/service/impl/MemberGroupServiceImpl.java | 6 ++++++ .../jsowell/pile/vo/base/MemberGroupStationVO.java | 14 ++++++++++++++ .../resources/mapper/pile/MemberGroupMapper.xml | 12 ++++++++++++ 6 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 jsowell-pile/src/main/java/com/jsowell/pile/vo/base/MemberGroupStationVO.java diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/MemberGroupController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/MemberGroupController.java index 51e93c1f8..7a1a845ea 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/MemberGroupController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/MemberGroupController.java @@ -97,10 +97,6 @@ public class MemberGroupController extends BaseController { return ajaxResult; } - /** - * 会员组添加站点 - */ - /** * 修改会员组 */ @@ -138,4 +134,12 @@ public class MemberGroupController extends BaseController { return getDataTable(memberGroupService.queryMemberList(dto)); } + /** + * 查询会员组/集团 的站点列表 + */ + @PostMapping("/queryStationList") + public TableDataInfo queryStationList(@RequestBody MemberGroupDTO dto) { + startPage(); + return getDataTable(memberGroupService.queryStationList(dto)); + } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/MemberGroupMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/MemberGroupMapper.java index 059fe4348..a3f30e834 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/MemberGroupMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/MemberGroupMapper.java @@ -2,6 +2,7 @@ package com.jsowell.pile.mapper; import com.jsowell.pile.domain.MemberGroup; import com.jsowell.pile.dto.MemberGroupDTO; +import com.jsowell.pile.vo.base.MemberGroupStationVO; import com.jsowell.pile.vo.uniapp.MemberVO; import com.jsowell.pile.vo.web.MemberDiscountVO; import com.jsowell.pile.vo.web.MemberGroupVO; @@ -95,4 +96,6 @@ public interface MemberGroupMapper { * @return */ String queryMemberGroupCode(@Param("merchantId") String merchantId, @Param("stationId") String stationId, @Param("memberId") String memberId); + + List queryStationList(MemberGroupDTO dto); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/MemberGroupService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/MemberGroupService.java index fff875ac2..a32ca9224 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/MemberGroupService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/MemberGroupService.java @@ -2,6 +2,7 @@ package com.jsowell.pile.service; import com.jsowell.pile.domain.MemberGroup; import com.jsowell.pile.dto.MemberGroupDTO; +import com.jsowell.pile.vo.base.MemberGroupStationVO; import com.jsowell.pile.vo.uniapp.MemberVO; import com.jsowell.pile.vo.web.MemberDiscountVO; import com.jsowell.pile.vo.web.MemberGroupVO; @@ -92,4 +93,11 @@ public interface MemberGroupService { * @return */ int addMember2MemberGroup(String memberId, String stationId); + + /** + * 查询会员组/集团站点列表 + * @param dto + * @return + */ + List queryStationList(MemberGroupDTO dto); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberGroupServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberGroupServiceImpl.java index 9f7726c34..198ce7ba9 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberGroupServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberGroupServiceImpl.java @@ -13,6 +13,7 @@ import com.jsowell.pile.domain.MemberGroupRelation; import com.jsowell.pile.dto.MemberGroupDTO; import com.jsowell.pile.mapper.MemberGroupMapper; import com.jsowell.pile.service.*; +import com.jsowell.pile.vo.base.MemberGroupStationVO; import com.jsowell.pile.vo.uniapp.MemberVO; import com.jsowell.pile.vo.web.BillingTemplateVO; import com.jsowell.pile.vo.web.MemberDiscountVO; @@ -257,6 +258,11 @@ public class MemberGroupServiceImpl implements MemberGroupService { return 0; } + @Override + public List queryStationList(MemberGroupDTO dto) { + return memberGroupMapper.queryStationList(dto); + } + /** * 会员与集团的关系保存到数据库 * @param memberId 会员id diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/MemberGroupStationVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/MemberGroupStationVO.java new file mode 100644 index 000000000..5605b36db --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/MemberGroupStationVO.java @@ -0,0 +1,14 @@ +package com.jsowell.pile.vo.base; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class MemberGroupStationVO { + private String stationId; + + private String stationName; + + private String remark; +} diff --git a/jsowell-pile/src/main/resources/mapper/pile/MemberGroupMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/MemberGroupMapper.xml index 4118c8293..326458b45 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/MemberGroupMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/MemberGroupMapper.xml @@ -227,4 +227,16 @@ and t1.merchant_id = #{merchantId,jdbcType=VARCHAR} and find_in_set(#{stationId,jdbcType=VARCHAR}, t1.station_id) + + \ No newline at end of file From 982424cf13eea6ab4702a1626b3f1ad8a1c5f4dc Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Mon, 19 Feb 2024 16:05:28 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90?= =?UTF-8?q?=E8=AE=A1=E8=B4=B9=E6=A8=A1=E6=9D=BF=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...TimeEnum.java => BillingTimeTypeEnum.java} | 13 +++++- .../pile/domain/PileBillingDetail.java | 2 +- .../impl/OrderBasicInfoServiceImpl.java | 8 ++-- .../impl/PileBillingTemplateServiceImpl.java | 46 ++++++++++++++----- .../pile/vo/uniapp/BillingPriceVO.java | 4 +- .../mapper/pile/MemberGroupMapper.xml | 2 +- 6 files changed, 54 insertions(+), 21 deletions(-) rename jsowell-common/src/main/java/com/jsowell/common/enums/ykc/{BillingTimeEnum.java => BillingTimeTypeEnum.java} (62%) diff --git a/jsowell-common/src/main/java/com/jsowell/common/enums/ykc/BillingTimeEnum.java b/jsowell-common/src/main/java/com/jsowell/common/enums/ykc/BillingTimeTypeEnum.java similarity index 62% rename from jsowell-common/src/main/java/com/jsowell/common/enums/ykc/BillingTimeEnum.java rename to jsowell-common/src/main/java/com/jsowell/common/enums/ykc/BillingTimeTypeEnum.java index 581502f9b..dd6c5d299 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/enums/ykc/BillingTimeEnum.java +++ b/jsowell-common/src/main/java/com/jsowell/common/enums/ykc/BillingTimeTypeEnum.java @@ -4,7 +4,7 @@ package com.jsowell.common.enums.ykc; * 计费模板 时间类型 * (1-尖时;2-峰时;3-平时;4-谷时) */ -public enum BillingTimeEnum { +public enum BillingTimeTypeEnum { SHARP("1", "尖时"), PEAK("2", "峰时"), FLAT("3", "平时"), @@ -30,8 +30,17 @@ public enum BillingTimeEnum { this.label = label; } - BillingTimeEnum(String value, String label) { + BillingTimeTypeEnum(String value, String label) { this.value = value; this.label = label; } + + public static String getLabelByValue(String value) { + for (BillingTimeTypeEnum billingTimeEnum : BillingTimeTypeEnum.values()) { + if (billingTimeEnum.getValue().equals(value)) { + return billingTimeEnum.getLabel(); + } + } + return ""; + } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/domain/PileBillingDetail.java b/jsowell-pile/src/main/java/com/jsowell/pile/domain/PileBillingDetail.java index 4571e5b80..b862746fe 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/domain/PileBillingDetail.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/domain/PileBillingDetail.java @@ -30,7 +30,7 @@ public class PileBillingDetail extends BaseEntity { /** * 时段类型(1-尖时;2-峰时;3-平时;4-谷时) */ - @Excel(name = "时段类型", readConverterExp = "1=-尖时;2-峰时;3-平时;4-谷时") + @Excel(name = "时段类型", readConverterExp = "1-尖时;2-峰时;3-平时;4-谷时") private String timeType; /** diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java index 052f93b4e..b0d758d25 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java @@ -2632,7 +2632,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { public List transformPeriodAmountByOrderDetail(OrderDetail orderDetail) { // 尖时段 OrderPeriodAmountVO sharp = new OrderPeriodAmountVO(); - sharp.setPeriodType(BillingTimeEnum.SHARP.getLabel()); + sharp.setPeriodType(BillingTimeTypeEnum.SHARP.getLabel()); sharp.setElectricityPrice(orderDetail.getSharpElectricityPrice()); sharp.setServicePrice(orderDetail.getSharpServicePrice()); BigDecimal sharpUsedElectricity = orderDetail.getSharpUsedElectricity() == null ? BigDecimal.ZERO : orderDetail.getSharpUsedElectricity(); @@ -2642,7 +2642,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { // 峰时段 OrderPeriodAmountVO peak = new OrderPeriodAmountVO(); - peak.setPeriodType(BillingTimeEnum.PEAK.getLabel()); + peak.setPeriodType(BillingTimeTypeEnum.PEAK.getLabel()); peak.setElectricityPrice(orderDetail.getPeakElectricityPrice()); peak.setServicePrice(orderDetail.getPeakServicePrice()); BigDecimal peakUsedElectricity = orderDetail.getPeakUsedElectricity() == null ? BigDecimal.ZERO : orderDetail.getPeakUsedElectricity(); @@ -2652,7 +2652,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { // 平时段 OrderPeriodAmountVO flat = new OrderPeriodAmountVO(); - flat.setPeriodType(BillingTimeEnum.FLAT.getLabel()); + flat.setPeriodType(BillingTimeTypeEnum.FLAT.getLabel()); flat.setElectricityPrice(orderDetail.getFlatElectricityPrice()); flat.setServicePrice(orderDetail.getFlatServicePrice()); BigDecimal flatUsedElectricity = orderDetail.getFlatUsedElectricity() == null ? BigDecimal.ZERO : orderDetail.getFlatUsedElectricity(); @@ -2662,7 +2662,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { // 谷时段 OrderPeriodAmountVO valley = new OrderPeriodAmountVO(); - valley.setPeriodType(BillingTimeEnum.VALLEY.getLabel()); + valley.setPeriodType(BillingTimeTypeEnum.VALLEY.getLabel()); valley.setElectricityPrice(orderDetail.getValleyElectricityPrice()); valley.setServicePrice(orderDetail.getValleyServicePrice()); BigDecimal valleyUsedElectricity = orderDetail.getValleyUsedElectricity() == null ? BigDecimal.ZERO : orderDetail.getValleyUsedElectricity(); diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java index 3ee26302f..aa98b485c 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java @@ -9,7 +9,7 @@ import com.jsowell.common.constant.Constants; import com.jsowell.common.core.domain.vo.AuthorizedDeptVO; import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.enums.DelFlagEnum; -import com.jsowell.common.enums.ykc.BillingTimeEnum; +import com.jsowell.common.enums.ykc.BillingTimeTypeEnum; import com.jsowell.common.util.*; import com.jsowell.common.util.id.Seq; import com.jsowell.pile.domain.PileBillingDetail; @@ -188,7 +188,7 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic // 计费模板详情 List detailList = Lists.newArrayList(); PileBillingDetail detail = null; - for (BillingTimeEnum billingTimeEnum : BillingTimeEnum.values()) { + for (BillingTimeTypeEnum billingTimeEnum : BillingTimeTypeEnum.values()) { detail = new PileBillingDetail(); detail.setTemplateCode(templateCode); String type = billingTimeEnum.getValue(); // 时段类型 @@ -208,6 +208,9 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic detailList.add(detail); } + // 生成备注 + billingTemplate.setRemark(generateRemark(detailList)); + BillingTemplateTransactionDTO build = BillingTemplateTransactionDTO.builder() .billingTemplate(billingTemplate) .detailList(detailList) @@ -248,6 +251,9 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic // 生成计费详情list List pileBillingDetails = generateBillingDetailList(billingTemplate.getTemplateCode(), dto); + // 生成备注 + billingTemplate.setRemark(generateRemark(pileBillingDetails)); + BillingTemplateTransactionDTO build = BillingTemplateTransactionDTO.builder() .billingTemplate(billingTemplate) .detailList(pileBillingDetails) @@ -269,7 +275,7 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic // 计费模板详情 List detailList = Lists.newArrayList(); PileBillingDetail detail = null; - for (BillingTimeEnum billingTimeEnum : BillingTimeEnum.values()) { + for (BillingTimeTypeEnum billingTimeEnum : BillingTimeTypeEnum.values()) { detail = new PileBillingDetail(); detail.setTemplateCode(templateCode); String type = billingTimeEnum.getValue(); // 时段类型 @@ -316,16 +322,16 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic String type = billingDetail.getTimeType(); BigDecimal electricityPrice = billingDetail.getElectricityPrice(); BigDecimal servicePrice = billingDetail.getServicePrice(); - if (StringUtils.equals(type, BillingTimeEnum.SHARP.getValue())) { + if (StringUtils.equals(type, BillingTimeTypeEnum.SHARP.getValue())) { result.setElectricityPriceA(electricityPrice); result.setServicePriceA(servicePrice); - } else if (StringUtils.equals(type, BillingTimeEnum.PEAK.getValue())) { + } else if (StringUtils.equals(type, BillingTimeTypeEnum.PEAK.getValue())) { result.setElectricityPriceB(electricityPrice); result.setServicePriceB(servicePrice); - } else if (StringUtils.equals(type, BillingTimeEnum.FLAT.getValue())) { + } else if (StringUtils.equals(type, BillingTimeTypeEnum.FLAT.getValue())) { result.setElectricityPriceC(electricityPrice); result.setServicePriceC(servicePrice); - } else if (StringUtils.equals(type, BillingTimeEnum.VALLEY.getValue())) { + } else if (StringUtils.equals(type, BillingTimeTypeEnum.VALLEY.getValue())) { result.setElectricityPriceD(electricityPrice); result.setServicePriceD(servicePrice); } @@ -457,6 +463,9 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic // 计费模板收费详情 List stationBillingDetailList = generateBillingDetailList(templateCode, dto); + // 生成备注 + stationBillingTemplate.setRemark(generateRemark(stationBillingDetailList)); + // 入库 BillingTemplateTransactionDTO billingTemplateTransactionDTO = new BillingTemplateTransactionDTO(); billingTemplateTransactionDTO.setBillingTemplate(stationBillingTemplate); @@ -615,16 +624,16 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic for (BillingTimeDTO billingTimeDTO : timeArray) { BillingPriceVO vo = new BillingPriceVO(); String type = billingTimeDTO.getType(); - if (StringUtils.equals(type, BillingTimeEnum.SHARP.getValue())) { + if (StringUtils.equals(type, BillingTimeTypeEnum.SHARP.getValue())) { vo.setElectricityPrice(billingTemplateVO.getSharpElectricityPrice().toString()); vo.setServicePrice(billingTemplateVO.getSharpServicePrice().toString()); - } else if (StringUtils.equals(type, BillingTimeEnum.PEAK.getValue())) { + } else if (StringUtils.equals(type, BillingTimeTypeEnum.PEAK.getValue())) { vo.setElectricityPrice(billingTemplateVO.getPeakElectricityPrice().toString()); vo.setServicePrice(billingTemplateVO.getPeakServicePrice().toString()); - } else if (StringUtils.equals(type, BillingTimeEnum.FLAT.getValue())) { + } else if (StringUtils.equals(type, BillingTimeTypeEnum.FLAT.getValue())) { vo.setElectricityPrice(billingTemplateVO.getFlatElectricityPrice().toString()); vo.setServicePrice(billingTemplateVO.getFlatServicePrice().toString()); - } else if (StringUtils.equals(type, BillingTimeEnum.VALLEY.getValue())) { + } else if (StringUtils.equals(type, BillingTimeTypeEnum.VALLEY.getValue())) { vo.setElectricityPrice(billingTemplateVO.getValleyElectricityPrice().toString()); vo.setServicePrice(billingTemplateVO.getValleyServicePrice().toString()); } @@ -707,6 +716,8 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic pileBillingDetail.setDelFlag(DelFlagEnum.NORMAL.getValue()); stationBillingDetailList.add(pileBillingDetail); } + // 生成备注 + stationBillingTemplate.setRemark(generateRemark(stationBillingDetailList)); // 入库 BillingTemplateTransactionDTO billingTemplateTransactionDTO = new BillingTemplateTransactionDTO(); billingTemplateTransactionDTO.setBillingTemplate(stationBillingTemplate); @@ -715,6 +726,19 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic return true; } + // 根据设置的价格自动生成计费模板 + private String generateRemark(List list) { + StringBuilder remark = new StringBuilder(); + for (PileBillingDetail pileBillingDetail : list) { + String timeType = pileBillingDetail.getTimeType(); + String label = BillingTimeTypeEnum.getLabelByValue(timeType); + remark.append(label).append("-"); + remark.append(pileBillingDetail.getServicePrice().add(pileBillingDetail.getServicePrice())); + remark.append("元; "); + } + return remark.toString(); + } + @Override public byte[] generateBillingTemplateMsgBody(String pileSn, BillingTemplateVO billingTemplateVO) { if (StringUtils.isBlank(pileSn) || billingTemplateVO == null) { diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/BillingPriceVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/BillingPriceVO.java index fee58ec53..c96ca2804 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/BillingPriceVO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/BillingPriceVO.java @@ -1,6 +1,6 @@ package com.jsowell.pile.vo.uniapp; -import com.jsowell.common.enums.ykc.BillingTimeEnum; +import com.jsowell.common.enums.ykc.BillingTimeTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -44,7 +44,7 @@ public class BillingPriceVO { /** * 时段类型(1-尖时;2-峰时;3-平时;4-谷时) - * @see BillingTimeEnum + * @see BillingTimeTypeEnum */ private String timeType; diff --git a/jsowell-pile/src/main/resources/mapper/pile/MemberGroupMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/MemberGroupMapper.xml index 326458b45..4c88d854b 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/MemberGroupMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/MemberGroupMapper.xml @@ -235,7 +235,7 @@ t2.remark FROM pile_station_info t1 - JOIN pile_billing_template t2 ON t2.station_id = t1.id AND t2.del_flag = '0' AND t2.member_flag = '1' + JOIN pile_billing_template t2 ON t2.station_id = t1.id AND t2.del_flag = '0' AND t2.member_flag = '1' WHERE FIND_IN_SET(t1.id, (SELECT station_id FROM member_group WHERE group_code = #{groupCode,jdbcType=VARCHAR})) From 3ec69693b92c4e647fb15517246cddf9a4508f8d Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Mon, 19 Feb 2024 16:08:34 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90?= =?UTF-8?q?=E8=AE=A1=E8=B4=B9=E6=A8=A1=E6=9D=BF=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pile/service/impl/PileBillingTemplateServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java index aa98b485c..3c5b9fc70 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBillingTemplateServiceImpl.java @@ -733,7 +733,7 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic String timeType = pileBillingDetail.getTimeType(); String label = BillingTimeTypeEnum.getLabelByValue(timeType); remark.append(label).append("-"); - remark.append(pileBillingDetail.getServicePrice().add(pileBillingDetail.getServicePrice())); + remark.append(pileBillingDetail.getElectricityPrice().add(pileBillingDetail.getServicePrice())); remark.append("元; "); } return remark.toString(); From 845975913a6179f236382f80465c1984da0ae512 Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Mon, 19 Feb 2024 16:10:08 +0800 Subject: [PATCH 8/8] =?UTF-8?q?update=20=E4=BF=AE=E6=94=B9=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jsowell-ui/src/views/pile/station/components/amend.vue | 2 +- jsowell-ui/src/views/pile/station/components/billing.vue | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jsowell-ui/src/views/pile/station/components/amend.vue b/jsowell-ui/src/views/pile/station/components/amend.vue index a0b75c631..8ce62ac03 100644 --- a/jsowell-ui/src/views/pile/station/components/amend.vue +++ b/jsowell-ui/src/views/pile/station/components/amend.vue @@ -1,5 +1,5 @@ @@ -141,7 +141,7 @@