From 1a7a1aae8b91043dd6d65e6f8e441fe6dc44dbbc Mon Sep 17 00:00:00 2001 From: lijianlin Date: Tue, 4 Nov 2025 14:04:48 +0800 Subject: [PATCH] =?UTF-8?q?11-04=20=E6=B4=BB=E5=8A=A8=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E7=B1=BB=E5=88=9B=E5=BB=BA=20=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E5=8D=95=E4=BD=8D=EF=BC=8C=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E8=81=94=E6=9F=A5=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/cash/CashCollectionController.java | 3 +- .../com/example/demo/domain/entity/CashRecord.java | 1 + .../demo/domain/entity/RechargeActivity.java | 35 ++++++++++++++++++++++ .../demo/domain/vo/cash/CashCollection.java | 1 + .../demo/mapper/cash/CashCollectionMapper.java | 4 ++- .../demo/service/cash/CashCollectionService.java | 3 +- .../cash/CashCollectionServiceImpl.java | 27 ++++++++--------- .../resources/cashMapper/CashCollectionMapper.xml | 23 +++++++++----- 8 files changed, 73 insertions(+), 24 deletions(-) create mode 100644 src/main/java/com/example/demo/domain/entity/RechargeActivity.java diff --git a/src/main/java/com/example/demo/controller/cash/CashCollectionController.java b/src/main/java/com/example/demo/controller/cash/CashCollectionController.java index 34f80b8..4af9d05 100644 --- a/src/main/java/com/example/demo/controller/cash/CashCollectionController.java +++ b/src/main/java/com/example/demo/controller/cash/CashCollectionController.java @@ -3,6 +3,7 @@ package com.example.demo.controller.cash; import com.example.demo.Util.JWTUtil; import com.example.demo.domain.entity.Admin; import com.example.demo.domain.entity.CashRecord; +import com.example.demo.domain.entity.RechargeActivity; import com.example.demo.domain.entity.User; import com.example.demo.domain.vo.cash.CashCollection; import com.example.demo.domain.vo.coin.Page; @@ -52,7 +53,7 @@ public class CashCollectionController { @PostMapping("/getActivityList") public Result getActivityList() { - List list = cashCollectionService.getActivityList(); + List list = cashCollectionService.getActivityList(); return Result.success(list); } //新增收款订单 diff --git a/src/main/java/com/example/demo/domain/entity/CashRecord.java b/src/main/java/com/example/demo/domain/entity/CashRecord.java index 958f5bb..d570bea 100644 --- a/src/main/java/com/example/demo/domain/entity/CashRecord.java +++ b/src/main/java/com/example/demo/domain/entity/CashRecord.java @@ -35,6 +35,7 @@ public class CashRecord implements Serializable { private String bankCode; // 银行流水订单号 private String goodsName; // 商品名称 private Integer goodNum; // 产品数量 + private String NumUnit; // 数量单位 个/月/年 private Integer permanentGold; // 永久金币数量 private Integer freeGold; // 免费金币数量 diff --git a/src/main/java/com/example/demo/domain/entity/RechargeActivity.java b/src/main/java/com/example/demo/domain/entity/RechargeActivity.java new file mode 100644 index 0000000..32e76b7 --- /dev/null +++ b/src/main/java/com/example/demo/domain/entity/RechargeActivity.java @@ -0,0 +1,35 @@ +package com.example.demo.domain.entity; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * @program: gold-java + * @ClassName RechargeActivity + * @description: + * @author: Ethan + * @create: 2025−11-04 11:48 + * @Version 1.0 + **/ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class RechargeActivity { + private Integer id; //活动id + private String activityName; //活动名称 + private String businessBelong; //业绩归属地 + private Integer status; //状态 0未开始 1进行中 2已结束(不是实时更新的,仅展示,不要拿这个做校验) + private Integer creator; //添加人 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") + private LocalDateTime startTime; // 开始时间(到秒) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") + private LocalDateTime endTime; // 结束时间(到秒) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") + private LocalDateTime createTime; // 创建日期(到秒) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") + private LocalDateTime updateTime; // 更新日期(到秒) +} diff --git a/src/main/java/com/example/demo/domain/vo/cash/CashCollection.java b/src/main/java/com/example/demo/domain/vo/cash/CashCollection.java index bfdccd3..b25d472 100644 --- a/src/main/java/com/example/demo/domain/vo/cash/CashCollection.java +++ b/src/main/java/com/example/demo/domain/vo/cash/CashCollection.java @@ -36,6 +36,7 @@ public class CashCollection implements Serializable { private String bankCode; // 银行流水订单号 private String goodsName; // 商品名称 private Integer goodNum; // 商品数量 + private String numUnit; //数量单位 个/月/年 private Integer permanentGold; // 永久金币数量 private Integer freeGold; // 免费金币数量 //金额信息 diff --git a/src/main/java/com/example/demo/mapper/cash/CashCollectionMapper.java b/src/main/java/com/example/demo/mapper/cash/CashCollectionMapper.java index 7c598fb..5d952f6 100644 --- a/src/main/java/com/example/demo/mapper/cash/CashCollectionMapper.java +++ b/src/main/java/com/example/demo/mapper/cash/CashCollectionMapper.java @@ -2,10 +2,12 @@ package com.example.demo.mapper.cash; import com.example.demo.domain.entity.CashRecord; import com.example.demo.domain.entity.GOrder; +import com.example.demo.domain.entity.RechargeActivity; import com.example.demo.domain.vo.cash.CashCollection; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.time.LocalDateTime; import java.util.List; /** @@ -45,7 +47,7 @@ public interface CashCollectionMapper { //根据精网号获取市场名 String getMarketNameByJwcode(Integer jwcode); //获取收款活动列表 - List getActivityList(); + List getActivityList(@Param("now")LocalDateTime now); //查找未同步的订单 ListgetUnSync(@Param("size")int size); //给同步过去的gOrder设置同步状态 diff --git a/src/main/java/com/example/demo/service/cash/CashCollectionService.java b/src/main/java/com/example/demo/service/cash/CashCollectionService.java index 1401499..1caff87 100644 --- a/src/main/java/com/example/demo/service/cash/CashCollectionService.java +++ b/src/main/java/com/example/demo/service/cash/CashCollectionService.java @@ -1,6 +1,7 @@ package com.example.demo.service.cash; import com.example.demo.domain.entity.CashRecord; +import com.example.demo.domain.entity.RechargeActivity; import com.example.demo.domain.entity.User; import com.example.demo.domain.vo.cash.CashCollection; import com.example.demo.domain.vo.coin.Result; @@ -31,7 +32,7 @@ public interface CashCollectionService { //根据精网号获取姓名和地区 User getNameAndMarket(Integer jwcode); //获取活动列表 - List getActivityList(); + List getActivityList(); //同步g_order订单到cash_record表 Object syncToCashRecord(); } diff --git a/src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java b/src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java index 5ab58b9..57d4652 100644 --- a/src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java +++ b/src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java @@ -2,6 +2,7 @@ package com.example.demo.serviceImpl.cash; import com.example.demo.domain.entity.CashRecord; import com.example.demo.domain.entity.GOrder; +import com.example.demo.domain.entity.RechargeActivity; import com.example.demo.domain.entity.User; import com.example.demo.domain.vo.cash.CashCollection; import com.example.demo.domain.vo.coin.Result; @@ -64,6 +65,9 @@ public class CashCollectionServiceImpl implements CashCollectionService { if (!cashCollection.getGoodsName().equals("金币充值")){ if( cashCollection.getGoodNum()== 0 ){ throw new IllegalArgumentException("产品数量不能为空");} + if(cashCollection.getNumUnit()== null){ + throw new IllegalArgumentException("数量单位不能为空"); + } } if(cashCollection.getPaymentCurrency()== null){ throw new IllegalArgumentException("支付币种不能为空"); @@ -80,12 +84,6 @@ public class CashCollectionServiceImpl implements CashCollectionService { if(cashCollection.getPayTime()== null){ throw new IllegalArgumentException("付款时间不能为空"); } - if (cashCollection.getVoucher()== null){ - throw new IllegalArgumentException("转账凭证不能为空"); - } - if (cashCollection.getRemark()==null){ - throw new IllegalArgumentException("备注不能为空"); - } //生成订单号后半部分 String orderNumber = UUID.randomUUID().toString().replaceAll("-", ""); CashRecord cashRecord = new CashRecord(); @@ -96,6 +94,7 @@ public class CashCollectionServiceImpl implements CashCollectionService { cashRecord.setActivity(cashCollection.getActivity()); // 活动 cashRecord.setGoodsName(cashCollection.getGoodsName()); //商品名称 cashRecord.setGoodNum(cashCollection.getGoodNum()); //商品数量 + cashRecord.setNumUnit(cashCollection.getNumUnit()); //数量单位 cashRecord.setPermanentGold(cashCollection.getPermanentGold()); //永久金币 cashRecord.setFreeGold(cashCollection.getFreeGold()); //免费金币 cashRecord.setPaymentCurrency(cashCollection.getPaymentCurrency()); //付款币种 @@ -153,10 +152,14 @@ public class CashCollectionServiceImpl implements CashCollectionService { if (cashRecord.getGoodsName().equals("金币充值")){ if( cashRecord.getPermanentGold()== 0 && cashRecord.getFreeGold()== 0){ throw new IllegalArgumentException("金币数量不能为空");} + } if (!cashRecord.getGoodsName().equals("金币充值")){ if( cashRecord.getGoodNum()== 0 ){ throw new IllegalArgumentException("产品数量不能为空");} + if(cashRecord.getNumUnit()== null){ + throw new IllegalArgumentException("数量单位不能为空"); + } } if(cashRecord.getPaymentCurrency()== null){ throw new IllegalArgumentException("支付币种不能为空"); @@ -173,12 +176,7 @@ public class CashCollectionServiceImpl implements CashCollectionService { if(cashRecord.getPayTime()== null){ throw new IllegalArgumentException("付款时间不能为空"); } - if (cashRecord.getVoucher()== null){ - throw new IllegalArgumentException("转账凭证不能为空"); - } - if (cashRecord.getRemark()==null){ - throw new IllegalArgumentException("备注不能为空"); - } + CashRecord status=cashCollectionMapper.selectByOrderCode(cashRecord.getOrderCode()); if (!status.getStatus().equals(5)){ throw new IllegalArgumentException("只允许编辑已撤回订单"); @@ -253,8 +251,9 @@ public class CashCollectionServiceImpl implements CashCollectionService { } //获取收款活动列表 @Override - public List getActivityList() { - return cashCollectionMapper.getActivityList(); + public List getActivityList() { + LocalDateTime now = LocalDateTime.now(); + return cashCollectionMapper.getActivityList(now); } //同步g_order订单到cash_record表 @Override diff --git a/src/main/resources/cashMapper/CashCollectionMapper.xml b/src/main/resources/cashMapper/CashCollectionMapper.xml index 144833f..1fcc5d8 100644 --- a/src/main/resources/cashMapper/CashCollectionMapper.xml +++ b/src/main/resources/cashMapper/CashCollectionMapper.xml @@ -7,12 +7,12 @@ useGeneratedKeys="true" keyProperty="id"> insert into cash_record(order_type,jwcode,name,market,activity, - order_code,goods_name,good_num,permanent_gold,free_gold, + order_code,goods_name,good_num,num_unit,permanent_gold,free_gold, payment_currency,payment_amount,received_market, pay_type,pay_time,status,submitter_id,submitter_market, voucher,remark) values(#{orderType},#{jwcode},#{name},#{market},#{activity}, - #{orderCode},#{goodsName},#{goodNum},#{permanentGold},#{freeGold},#{paymentCurrency}, + #{orderCode},#{goodsName},#{goodNum},#{NumUnit},#{permanentGold},#{freeGold},#{paymentCurrency}, #{paymentAmount},#{receivedMarket},#{payType},#{payTime}, #{status},#{submitterId},#{submitterMarket},#{voucher},#{remark}) @@ -43,6 +43,9 @@ activity = #{cashRecord.activity}, goods_name = #{cashRecord.goodsName}, good_num = #{cashRecord.goodNum}, + permanent_gold = #{cashRecord.permanentGold}, + free_gold = #{cashRecord.freeGold}, + Num_unit = #{cashRecord.NumUnit}, payment_currency = #{cashRecord.paymentCurrency}, payment_amount = #{cashRecord.paymentAmount}, received_market = #{cashRecord.receivedMarket}, @@ -114,7 +117,7 @@ select m.name from user u left join market m on u.market=m.id where u.jwcode=#{jwcode} - + select id,activity_name,business_belong,status + from recharge_activity + where #{now} between start_time and end_time