|
@@ -6,6 +6,7 @@ import com.rongwe.zhsw.system.domain.*;
|
|
|
import com.rongwe.zhsw.system.dto.PaymentRequestDTO;
|
|
|
import com.rongwei.rwadmincommon.system.vo.SysUserVo;
|
|
|
import com.rongwei.rwcommon.base.R;
|
|
|
+import com.rongwei.rwcommon.base.exception.CustomException;
|
|
|
import com.rongwei.rwcommon.utils.SecurityUtil;
|
|
|
import com.rongwei.zhsw.system.dao.SwBillManagementUnpaidDao;
|
|
|
import com.rongwei.zhsw.system.dao.SwBillingRecordDao;
|
|
@@ -70,29 +71,20 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public R windowPayment(PaymentRequestDTO paymentRequestDTO) throws Exception {
|
|
|
-
|
|
|
try {
|
|
|
-
|
|
|
log.info("窗口缴费开始");
|
|
|
-
|
|
|
- if (paymentRequestDTO.getIds()==null){
|
|
|
-
|
|
|
- log.info("无账单缴费");
|
|
|
+ if (paymentRequestDTO.getIds()==null || paymentRequestDTO.getIds().isEmpty()){
|
|
|
+ log.debug("无账单缴费");
|
|
|
windowPaymentNoBill(paymentRequestDTO);
|
|
|
}else {
|
|
|
-
|
|
|
- log.info("有账单缴费");
|
|
|
+ log.debug("有账单缴费");
|
|
|
windowPaymentHasBill(paymentRequestDTO);
|
|
|
}
|
|
|
-
|
|
|
log.info("窗口缴费结束");
|
|
|
-
|
|
|
}catch (Exception e ){
|
|
|
log.error("缴费失败 {}",e.getMessage());
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return R.error(e.getMessage());
|
|
|
+ return R.error("缴费失败!");
|
|
|
}
|
|
|
-
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
@@ -104,6 +96,9 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
|
|
|
private void windowPaymentHasBill(PaymentRequestDTO paymentRequestDTO) {
|
|
|
|
|
|
List<String> ids = paymentRequestDTO.getIds();
|
|
|
+ if(ids==null || ids.isEmpty()){
|
|
|
+ throw new CustomException("参数异常");
|
|
|
+ }
|
|
|
// 查询待缴费账单
|
|
|
List<SwBillManagementUnpaidDo> unpaidBills = queryUnpaidBills(paymentRequestDTO.getIds());
|
|
|
|
|
@@ -119,11 +114,8 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
|
|
|
|
|
|
*/
|
|
|
private void windowPaymentNoBill(PaymentRequestDTO paymentRequestDTO) {
|
|
|
-
|
|
|
-
|
|
|
//生成缴费记录
|
|
|
addNewBillRecord(paymentRequestDTO,null);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -173,7 +165,7 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
|
|
|
.setModifyuserid(currentUser.getId())
|
|
|
.setTenantid(currentUser.getTenantid())
|
|
|
.setDatasource(paymentRequestDTO.getDatasource())
|
|
|
- .setPaidin(paymentRequestDTO.getPaidin())
|
|
|
+ .setPaidin(paymentRequestDTO.getPaidin())
|
|
|
.setModifyusername(currentUser.getName());
|
|
|
}
|
|
|
|
|
@@ -193,7 +185,9 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
|
|
|
//根据户号获取 用户记录
|
|
|
SwUserManagementDo user = swUserManagementService.getBaseMapper().
|
|
|
selectOne(new LambdaQueryWrapper<SwUserManagementDo>().eq(SwUserManagementDo::getUsernumber, paymentRequestDTO.getUsernumber()));
|
|
|
-
|
|
|
+ if(user==null){
|
|
|
+ throw new CustomException("户号不存在");
|
|
|
+ }
|
|
|
|
|
|
SwBillingRecordDo add = buildBaseBillingRecord(paymentRequestDTO,currentUser,user);
|
|
|
|
|
@@ -220,24 +214,16 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
|
|
|
|
|
|
private void createBills(List<SwBillManagementUnpaidDo> list, SwBillingRecordDo add, SysUserVo currentUser) {
|
|
|
List<SwBillManagementPaidDo> paidList = new ArrayList<>();
|
|
|
-
|
|
|
+ SwBillManagementPaidDo paid;
|
|
|
for (SwBillManagementUnpaidDo unpaid : list) {
|
|
|
-
|
|
|
-
|
|
|
- SwBillManagementPaidDo paid = new SwBillManagementPaidDo();
|
|
|
+ paid = new SwBillManagementPaidDo();
|
|
|
BeanUtils.copyProperties(unpaid, paid);
|
|
|
// 新生成的 已缴费账单
|
|
|
paid.setStatus(PAIDINSTATUS)
|
|
|
//缴费记录ID
|
|
|
- .setPaymentrecordid(add.getId())
|
|
|
- .setCreateuserid(currentUser.getId())
|
|
|
- .setCreateusername(currentUser.getName())
|
|
|
- .setCreatedate(new Date())
|
|
|
- .setModifydate(new Date())
|
|
|
- .setModifyuserid(currentUser.getId())
|
|
|
- .setModifyusername(currentUser.getName());
|
|
|
+ .setPaymentrecordid(add.getId());
|
|
|
+ ZHSWCommonUtils.initModelGeneralParameters(paid,currentUser);
|
|
|
paidList.add(paid);
|
|
|
-
|
|
|
}
|
|
|
// 保存已缴费账单
|
|
|
swBillManagementPaidService.saveBatch(paidList);
|
|
@@ -325,6 +311,7 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
|
|
|
String randomStr = String.format("%03d", randomNumber);
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
add.setBillingnumber(now.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) + randomStr);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|