Browse Source

10-18 收款:审核时间展示状态码嵌套修复

lijianlin/feature-202509231533026-现金管理-收款管理
lijianlin 1 month ago
parent
commit
6062cca3c6
  1. 4
      src/main/java/com/example/demo/controller/cash/CashCollectionController.java
  2. 2
      src/main/java/com/example/demo/domain/vo/cash/CashCollection.java
  3. 8
      src/main/java/com/example/demo/service/cash/CashCollectionService.java
  4. 75
      src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java

4
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());
}

2
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")

8
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<CashCollection> selectCollection(Integer pageNum, Integer pageSize, CashCollection cashCollection);
//补全手续费等
Result complete(CashRecord cashRecord);
String complete(CashRecord cashRecord);
//根据精网号获取姓名和地区
User getNameAndMarket(Integer jwcode);
//获取活动列表

75
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

Loading…
Cancel
Save