|
|
|
@ -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 |
|
|
|
|