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 46442bc..7854687 100644 --- a/src/main/java/com/example/demo/controller/cash/CashCollectionController.java +++ b/src/main/java/com/example/demo/controller/cash/CashCollectionController.java @@ -79,7 +79,7 @@ public class CashCollectionController { @PostMapping("/reSubmit") public Result reSubmit(@RequestBody CashRecord cashRecord) { try { - return cashCollectionService.reSubmit(cashRecord); + return Result.success(cashCollectionService.reSubmit(cashRecord)); }catch (Exception e){ return Result.error(e.getMessage()); } @@ -114,7 +114,7 @@ public class CashCollectionController { @PostMapping("/complete") public Result complete(@RequestBody CashRecord cashRecord) { try { - return cashCollectionService.complete(cashRecord); + return Result.success(cashCollectionService.complete(cashRecord)); }catch (Exception e){ return Result.error(e.getMessage()); } 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 5b45e35..451bba9 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 @@ -66,6 +66,8 @@ public class CashCollection implements Serializable { private LocalDateTime createTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") private LocalDateTime updateTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") + private LocalDateTime auditTime; //搜索筛条件 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") 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 089c902..c7fc487 100644 --- a/src/main/java/com/example/demo/service/cash/CashCollectionService.java +++ b/src/main/java/com/example/demo/service/cash/CashCollectionService.java @@ -19,15 +19,15 @@ import java.util.List; public interface CashCollectionService { //新增收款订单 - Result add(CashCollection cashCollection); + String add(CashCollection cashCollection); //撤回未审核的收款订单 - Result cancel(String orderCode); + String cancel(String orderCode); //编辑并重新提交收款订单 - Result reSubmit(CashRecord cashRecord); + String reSubmit(CashRecord cashRecord); //多条件查询收款订单列表 PageInfo selectCollection(Integer pageNum, Integer pageSize, CashCollection cashCollection); //补全手续费等 - Result complete(CashRecord cashRecord); + String complete(CashRecord cashRecord); //根据精网号获取姓名和地区 User getNameAndMarket(Integer jwcode); //获取活动列表 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 836e03f..4836dbb 100644 --- a/src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java +++ b/src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java @@ -33,45 +33,45 @@ public class CashCollectionServiceImpl implements CashCollectionService { //新增收款订单 @Override - public Result add(CashCollection cashCollection) { + public String add(CashCollection cashCollection) { if (cashCollection.getJwcode()==null){ - return Result.error("精网号不能为空"); + throw new IllegalArgumentException("精网号不能为空"); } if(cashCollection.getJwcode()<10000000||cashCollection.getJwcode()>99999999){ - return Result.error("精网号必须为8位"); + throw new IllegalArgumentException("精网号必须为8位"); } if(cashCollection.getName()== null){ - return Result.error("客户姓名不能为空"); + throw new IllegalArgumentException("客户姓名不能为空"); } if(cashCollection.getActivity()== null){ - return Result.error("活动不能为空"); + throw new IllegalArgumentException("活动不能为空"); } if(cashCollection.getGoodsName()== null){ - return Result.error("商品名不能为空"); + throw new IllegalArgumentException("商品名不能为空"); } if(cashCollection.getGoodNum()== null && cashCollection.getPermanentGold()== null && cashCollection.getFreeGold()== null){ - return Result.error("商品数量或金币数量不能为空"); + throw new IllegalArgumentException("商品数量或金币数量不能为空"); } if(cashCollection.getPaymentCurrency()== null){ - return Result.error("支付币种不能为空"); + throw new IllegalArgumentException("支付币种不能为空"); } if(cashCollection.getPaymentAmount()== null){ - return Result.error("支付金额不能为空"); + throw new IllegalArgumentException("支付金额不能为空"); } if (cashCollection.getPayType()== null){ - return Result.error("支付方式不能为空"); + throw new IllegalArgumentException("支付方式不能为空"); } if (cashCollection.getReceivedMarket()== null){ - return Result.error("到账地区不能为空"); + throw new IllegalArgumentException("到账地区不能为空"); } if(cashCollection.getPayTime()== null){ - return Result.error("付款时间不能为空"); + throw new IllegalArgumentException("付款时间不能为空"); } if (cashCollection.getVoucher()== null){ - return Result.error("转账凭证不能为空"); + throw new IllegalArgumentException("转账凭证不能为空"); } if (cashCollection.getRemark()==null){ - return Result.error("备注不能为空"); + throw new IllegalArgumentException("备注不能为空"); } //生成订单号后半部分 String orderNumber = UUID.randomUUID().toString().replaceAll("-", ""); @@ -101,73 +101,73 @@ public class CashCollectionServiceImpl implements CashCollectionService { //插入新收款订单 cashCollectionMapper.add(cashRecord); - return Result.success("添加成功"); + return "添加成功"; } //撤回未审核的订单 @Override - public Result cancel(String orderCode) { + public String cancel(String orderCode) { CashRecord cashRecord = cashCollectionMapper.selectByOrderCode(orderCode); if (cashRecord == null) { - return Result.error("订单不存在"); + throw new IllegalArgumentException("订单不存在"); } if (cashRecord.getStatus() != 0){ - return Result.error("订单状态不符合条件"); + throw new IllegalArgumentException("订单状态不符合条件"); } //修改订单状态 int rows = cashCollectionMapper.updateStatus(orderCode, 5); - return rows > 0 ? Result.success("撤回成功") : Result.error("撤回失败"); + return rows > 0 ? "撤回成功" : "撤回失败"; } //编辑并重新提交收款订单 @Override - public Result reSubmit(CashRecord cashRecord) { + public String reSubmit(CashRecord cashRecord) { if (cashRecord.getJwcode()==null){ - return Result.error("精网号不能为空"); + throw new IllegalArgumentException("精网号不能为空"); } if(cashRecord.getJwcode()<10000000||cashRecord.getJwcode()>99999999){ - return Result.error("精网号必须为8位"); + throw new IllegalArgumentException("精网号必须为8位"); } if(cashRecord.getName()== null){ - return Result.error("客户姓名不能为空"); + throw new IllegalArgumentException("客户姓名不能为空"); } if(cashRecord.getActivity()== null){ - return Result.error("活动不能为空"); + throw new IllegalArgumentException("活动不能为空"); } if(cashRecord.getGoodsName()== null){ - return Result.error("商品名不能为空"); + throw new IllegalArgumentException("商品名不能为空"); } if(cashRecord.getGoodNum()== null){ - return Result.error("商品数量不能为空"); + throw new IllegalArgumentException("商品数量不能为空"); } if(cashRecord.getPaymentCurrency()== null){ - return Result.error("支付币种不能为空"); + throw new IllegalArgumentException("支付币种不能为空"); } if(cashRecord.getPaymentAmount()== null){ - return Result.error("支付金额不能为空"); + throw new IllegalArgumentException("支付金额不能为空"); } if (cashRecord.getPayType()== null){ - return Result.error("支付方式不能为空"); + throw new IllegalArgumentException("支付方式不能为空"); } if (cashRecord.getReceivedMarket()== null){ - return Result.error("到账地区不能为空"); + throw new IllegalArgumentException("到账地区不能为空"); } if(cashRecord.getPayTime()== null){ - return Result.error("付款时间不能为空"); + throw new IllegalArgumentException("付款时间不能为空"); } if (cashRecord.getVoucher()== null){ - return Result.error("转账凭证不能为空"); + throw new IllegalArgumentException("转账凭证不能为空"); } if (cashRecord.getRemark()==null){ - return Result.error("备注不能为空"); + throw new IllegalArgumentException("备注不能为空"); } CashRecord status=cashCollectionMapper.selectByOrderCode(cashRecord.getOrderCode()); if (!status.getStatus().equals(5)){ - return Result.error("只允许编辑已撤回订单"); + throw new IllegalArgumentException("只允许编辑已撤回订单"); } //地区,根据jwcode插入(弃用,插入前调用接口获取地区和姓名,之后前端传入) //cashRecord.setMarket(cashCollectionMapper.getMarketByJwcode(cashRecord.getJwcode())); int rows = cashCollectionMapper.updateByOrderCode(cashRecord); - return rows > 0 ? Result.success("重新提交成功") : Result.error("重新提交失败"); + return rows > 0 ? "重新提交成功" : "重新提交失败"; } //多条件查询收款订单列表 @Override @@ -204,10 +204,11 @@ public class CashCollectionServiceImpl implements CashCollectionService { } //补全手续费等内容 @Override - public Result complete(CashRecord cashRecord) { + public String complete(CashRecord cashRecord) { + int rows = cashCollectionMapper.complete(cashRecord); - return rows > 0 ? Result.success("编辑成功") : Result.error("编辑失败"); + return rows > 0 ? "编辑成功" : "编辑失败"; } //根据精网号查询姓名和地区 @Override