Browse Source

10.23 修改地区映射

milestone-20251016-现金管理
huangqizhen 1 month ago
parent
commit
2ea09c0f11
  1. 25
      src/main/java/com/example/demo/controller/cash/CashRefundController.java
  2. 6
      src/main/java/com/example/demo/service/cash/RefundService.java
  3. 16
      src/main/java/com/example/demo/serviceImpl/cash/CashRefundServiceImpl.java

25
src/main/java/com/example/demo/controller/cash/CashRefundController.java

@ -88,7 +88,7 @@ public class CashRefundController {
} }
@PostMapping("/add") @PostMapping("/add")
public Result add(@RequestBody CashRecordDone cashRecordDone) {
public Result add(@RequestBody CashRecordDone cashRecordDone) throws Exception {
try { try {
return Result.success(refundService.add(cashRecordDone)); return Result.success(refundService.add(cashRecordDone));
} catch (Exception e) { } catch (Exception e) {
@ -112,27 +112,44 @@ public class CashRefundController {
return Result.success(refundService.select(page.getPageNum(), page.getPageSize(), page.getCashRecordDone())); return Result.success(refundService.select(page.getPageNum(), page.getPageSize(), page.getCashRecordDone()));
} }
@PostMapping("/update") @PostMapping("/update")
public Result update(@RequestBody CashRecordDone cashRecordDone) {
public Result update(@RequestBody CashRecordDone cashRecordDone)throws Exception {
if (cashRecordDone.getStatus() == null) {
return Result.error("状态为空");
}
if (cashRecordDone.getStatus() == 10) { if (cashRecordDone.getStatus() == 10) {
return Result.success(refundService.withdraw(cashRecordDone)); return Result.success(refundService.withdraw(cashRecordDone));
} }
else if (cashRecordDone.getStatus() == 11) { else if (cashRecordDone.getStatus() == 11) {
try {
return Result.success(refundService.update(cashRecordDone)); return Result.success(refundService.update(cashRecordDone));
} catch (Exception e) {
return Result.error(e.getMessage());
}
} }
else return Result.error("该订单状态无法支持此操作"); else return Result.error("该订单状态无法支持此操作");
} }
@PostMapping("/review") @PostMapping("/review")
public Result review(@RequestBody CashRecordDone cashRecordDone) {
public Result review(@RequestBody CashRecordDone cashRecordDone){
try {
return Result.success(refundService.review(cashRecordDone)); return Result.success(refundService.review(cashRecordDone));
} catch (Exception e) {
return Result.error(e.getMessage());
}
} }
@PostMapping("/finalReview") @PostMapping("/finalReview")
public Result finalReview(@RequestBody CashRecordDone cashRecordDone) { public Result finalReview(@RequestBody CashRecordDone cashRecordDone) {
return Result.success(refundService.finalreview(cashRecordDone)); return Result.success(refundService.finalreview(cashRecordDone));
} }
@PostMapping("/executor") @PostMapping("/executor")
public Result executor(@RequestBody CashRecordDone cashRecordDone) {
public Result executor(@RequestBody CashRecordDone cashRecordDone) throws Exception {
try {
return Result.success(refundService.executor(cashRecordDone)); return Result.success(refundService.executor(cashRecordDone));
} }
catch (Exception e) {
return Result.error(e.getMessage());
}
}
} }

6
src/main/java/com/example/demo/service/cash/RefundService.java

@ -17,13 +17,13 @@ public interface RefundService {
//添加 //添加
int add(CashRecordDone cashRecordDone) throws Exception; int add(CashRecordDone cashRecordDone) throws Exception;
//修改 //修改
int update(CashRecordDone cashRecordDone);
int update(CashRecordDone cashRecordDone) throws Exception;
// //
int withdraw(CashRecordDone cashRecordDone); int withdraw(CashRecordDone cashRecordDone);
//审核 //审核
int review(CashRecordDone cashRecordDone);
int review(CashRecordDone cashRecordDone) throws Exception;
// 执行 // 执行
int executor(CashRecordDone cashRecordDone);
int executor(CashRecordDone cashRecordDone) throws Exception;
//修改原数据状态 //修改原数据状态
int updateStatus(CashRecordDone cashRecordDone); int updateStatus(CashRecordDone cashRecordDone);

16
src/main/java/com/example/demo/serviceImpl/cash/CashRefundServiceImpl.java

@ -6,6 +6,7 @@ import com.example.demo.domain.vo.cash.CashRecordDone;
import com.example.demo.domain.vo.coin.Result; import com.example.demo.domain.vo.coin.Result;
import com.example.demo.mapper.cash.CashRefundMapper; import com.example.demo.mapper.cash.CashRefundMapper;
import com.example.demo.mapper.coin.AuditMapper; import com.example.demo.mapper.coin.AuditMapper;
import com.example.demo.mapper.coin.MarketMapper;
import com.example.demo.mapper.coin.RefundMapper; import com.example.demo.mapper.coin.RefundMapper;
import com.example.demo.service.cash.RefundService; import com.example.demo.service.cash.RefundService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
@ -37,6 +38,8 @@ public class CashRefundServiceImpl implements RefundService {
private RefundMapper refundMapper; private RefundMapper refundMapper;
@Autowired @Autowired
private AuditMapper auditMapper; private AuditMapper auditMapper;
@Autowired
private MarketMapper marketMapper;
@Override @Override
public PageInfo<CashRecordDone> select(Integer pageNum, Integer pageSize, CashRecordDone cashRecordDone) { public PageInfo<CashRecordDone> select(Integer pageNum, Integer pageSize, CashRecordDone cashRecordDone) {
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
@ -75,7 +78,9 @@ public class CashRefundServiceImpl implements RefundService {
//生成订单号后半部分 //生成订单号后半部分
String orderNumber = cashRecordDone.getOrderCode(); String orderNumber = cashRecordDone.getOrderCode();
//构建订单信息 //构建订单信息
cashRecordDone.setOrderCode("TK_" + orderNumber); //订单号
cashRecordDone.setOrderCode("TK" + orderNumber); //订单号
cashRecordDone.setMarket(marketMapper.getMarketId(cashRecordDone.getMarket()));
cashRecordDone.setReceivedMarket(marketMapper.getMarketId(cashRecordDone.getReceivedMarket()));
cashRefundMapper.insert(cashRecordDone); cashRefundMapper.insert(cashRecordDone);
CashRecordDone cashRecordDone1 = new CashRecordDone(); CashRecordDone cashRecordDone1 = new CashRecordDone();
cashRecordDone1.setId(cashRecordDone.getId()); cashRecordDone1.setId(cashRecordDone.getId());
@ -86,7 +91,7 @@ public class CashRefundServiceImpl implements RefundService {
} }
@Override @Override
public int update(CashRecordDone cashRecordDone) {
public int update(CashRecordDone cashRecordDone) throws Exception {
if (cashRecordDone.getJwcode()== null) { if (cashRecordDone.getJwcode()== null) {
throw new RuntimeException("未输入精网号"); throw new RuntimeException("未输入精网号");
} }
@ -112,8 +117,11 @@ public class CashRefundServiceImpl implements RefundService {
} }
@Override @Override
public int review(CashRecordDone cashRecordDone) {
public int review(CashRecordDone cashRecordDone) throws Exception {
if(cashRecordDone.getStatus()== 12|| cashRecordDone.getStatus()== 22){ if(cashRecordDone.getStatus()== 12|| cashRecordDone.getStatus()== 22){
if(cashRecordDone.getOrderCode()== null){
throw new RuntimeException("未输入订单号");
}
CashRecordDone cashRecordDone1 = new CashRecordDone(); CashRecordDone cashRecordDone1 = new CashRecordDone();
cashRecordDone1.setOrderCode(cashRecordDone.getOrderCode().substring(2)); cashRecordDone1.setOrderCode(cashRecordDone.getOrderCode().substring(2));
cashRecordDone1.setStatus(4); cashRecordDone1.setStatus(4);
@ -126,7 +134,7 @@ CashRecordDone cashRecordDone1 = new CashRecordDone();
} }
@Override @Override
public int executor(CashRecordDone cashRecordDone) {
public int executor(CashRecordDone cashRecordDone) throws Exception {
if(cashRecordDone.getRefundVoucher()== null){ if(cashRecordDone.getRefundVoucher()== null){
throw new RuntimeException("未输入退款凭证"); throw new RuntimeException("未输入退款凭证");
} }

Loading…
Cancel
Save