|
@@ -7,7 +7,6 @@ import com.rongwe.zhsw.system.domain.SwBillManagementUnpaidDo;
|
|
|
import com.rongwe.zhsw.system.domain.SwBillingRecordDo;
|
|
|
import com.rongwe.zhsw.system.domain.SwUserManagementDo;
|
|
|
import com.rongwe.zhsw.system.dto.PaymentRequestDTO;
|
|
|
-import com.rongwei.commonservice.service.impl.RedisServiceImpl;
|
|
|
import com.rongwei.rwadmincommon.system.vo.SysUserVo;
|
|
|
import com.rongwei.rwcommon.base.R;
|
|
|
import com.rongwei.rwcommon.base.exception.CustomException;
|
|
@@ -122,7 +121,7 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
|
|
|
}
|
|
|
|
|
|
// 提取公共字段设置
|
|
|
- public SwBillingRecordDo buildBaseBillingRecord( SysUserVo currentUser, SwUserManagementDo user) {
|
|
|
+ public SwBillingRecordDo buildBaseBillingRecord(SysUserVo currentUser, SwUserManagementDo user) {
|
|
|
SwBillingRecordDo record = new SwBillingRecordDo();
|
|
|
//缴费编号
|
|
|
generateBillingNumber(record);
|
|
@@ -174,7 +173,7 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
|
|
|
|
|
|
String id = SecurityUtil.getUUID(); // 批次唯一ID
|
|
|
|
|
|
- SwBillingRecordDo add = buildBaseBillingRecord(currentUser,user);
|
|
|
+ SwBillingRecordDo add = buildBaseBillingRecord(currentUser, user);
|
|
|
add.setId(id);
|
|
|
add.setDatasource(paymentRequestDTO.getDatasource());
|
|
|
add.setPaidin(paymentRequestDTO.getPaidin());
|
|
@@ -182,22 +181,20 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
|
|
|
// 计算费用
|
|
|
calculateFees(list, add, user);
|
|
|
|
|
|
- if (list != null) {
|
|
|
+ if (list != null && !list.isEmpty()) {
|
|
|
//生成已缴费账单
|
|
|
bills = createBills(list, add);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// 保存处理结果
|
|
|
try {
|
|
|
- swBillingRecordService.saveProcessedData(add,user,bills,paymentRequestDTO.getIds());
|
|
|
- }catch (Exception e){
|
|
|
- log.error("生成缴费记录 失败 {}",e.getMessage());
|
|
|
+ swBillingRecordService.saveProcessedData(add, user, bills, paymentRequestDTO.getIds());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("生成缴费记录 失败 {}", e.getMessage());
|
|
|
throw new Exception(e.getMessage());
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -208,9 +205,9 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
|
|
|
* @param bills
|
|
|
* @param ids
|
|
|
*/
|
|
|
- @Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public void saveProcessedData(SwBillingRecordDo add, SwUserManagementDo user, List<SwBillManagementPaidDo> bills, List<String> ids){
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void saveProcessedData(SwBillingRecordDo add, SwUserManagementDo user, List<SwBillManagementPaidDo> bills, List<String> ids) {
|
|
|
//账单缴费记录生成
|
|
|
this.baseMapper.insert(add);
|
|
|
//已缴费账单生成
|
|
@@ -228,6 +225,9 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
|
|
|
}
|
|
|
|
|
|
public List<SwBillManagementPaidDo> createBills(List<SwBillManagementUnpaidDo> list, SwBillingRecordDo add) {
|
|
|
+ if (list == null || list.isEmpty()) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
List<SwBillManagementPaidDo> paidList = new ArrayList<>();
|
|
|
SwBillManagementPaidDo paid;
|
|
|
for (SwBillManagementUnpaidDo unpaid : list) {
|
|
@@ -258,6 +258,7 @@ public class SwBillingRecordServiceImpl extends ServiceImpl<SwBillingRecordDao,
|
|
|
|
|
|
/**
|
|
|
* 设置减免金额 原应缴 滞纳金 账户余额 原余额 余额抵扣 实际应缴 缴费后余额
|
|
|
+ *
|
|
|
* @param list
|
|
|
* @param add
|
|
|
* @param user
|