|
|
@@ -464,6 +464,7 @@ public class HlgPaymentServiceImpl extends ServiceImpl<HlgPaymentMapper, HlgPaym
|
|
|
hlgAccountDetail.setType(1);
|
|
|
hlgAccountDetail.setAmount(hlgPayment.getTotalPayment());
|
|
|
hlgAccountDetail.setIsDisplay(1);
|
|
|
+ hlgAccountDetail.setIsDrawback(0);
|
|
|
hlgAccountDetail.setGenerateTime(new Date());
|
|
|
hlgAccountDetail.setGenerateBy(sysUser.getUsername());
|
|
|
hlgAccountDetailService.save(hlgAccountDetail);
|
|
|
@@ -1080,9 +1081,30 @@ public class HlgPaymentServiceImpl extends ServiceImpl<HlgPaymentMapper, HlgPaym
|
|
|
hlgPaymentDetailService.updateById(hlgPaymentDetail);
|
|
|
//付款实体
|
|
|
HlgPayment hlgPayment = getById(hlgPaymentDetail.getPaymentId());
|
|
|
+ /**
|
|
|
+ * 是否通过平台
|
|
|
+ */
|
|
|
+ if (hlgPayment.getIsThroughPlatform() == 0) {
|
|
|
+ noSupplementUpdateAccount(hlgPayment, hlgPaymentDetail);
|
|
|
+ } else {
|
|
|
+ noSupplementUpdateAccountA_B(hlgPayment, hlgPaymentDetail);
|
|
|
+ }
|
|
|
+ result.success("金额返还成功");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 不补发更新账户信息
|
|
|
+ *
|
|
|
+ * @param hlgPayment
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void noSupplementUpdateAccount(HlgPayment hlgPayment, HlgPaymentDetail hlgPaymentDetail) {
|
|
|
//获取当前登录用户
|
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
- //2、账户表
|
|
|
+ /**
|
|
|
+ * account表(更新)
|
|
|
+ */
|
|
|
QueryWrapper<HlgAccount> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("company_id", hlgPayment.getCompanyId());
|
|
|
queryWrapper.eq("subcontractor_id", hlgPayment.getSubcontractorId());
|
|
|
@@ -1092,7 +1114,9 @@ public class HlgPaymentServiceImpl extends ServiceImpl<HlgPaymentMapper, HlgPaym
|
|
|
hlgAccount.setTotalPayment(businessAccountUtils.sub(hlgAccount.getTotalPayment(), hlgPaymentDetail.getPayment()));
|
|
|
hlgAccount.setBalance(businessAccountUtils.add(hlgAccount.getBalance(), hlgPaymentDetail.getPayment()));
|
|
|
hlgAccountService.updateById(hlgAccount);
|
|
|
- //3、账户明细表(插入)
|
|
|
+ /**
|
|
|
+ * account_detail账户明细表(插入)
|
|
|
+ */
|
|
|
HlgAccountDetail hlgAccountDetail = new HlgAccountDetail();
|
|
|
hlgAccountDetail.setAccountId(hlgAccount.getId());
|
|
|
hlgAccountDetail.setPaymentId(hlgPayment.getId());
|
|
|
@@ -1102,8 +1126,69 @@ public class HlgPaymentServiceImpl extends ServiceImpl<HlgPaymentMapper, HlgPaym
|
|
|
hlgAccountDetail.setGenerateTime(new Date());
|
|
|
hlgAccountDetail.setGenerateBy(sysUser.getUsername());
|
|
|
hlgAccountDetailService.save(hlgAccountDetail);
|
|
|
- result.success("金额返还成功");
|
|
|
- return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 不补发更新账户信息A-B
|
|
|
+ *
|
|
|
+ * @param hlgPayment
|
|
|
+ * @param hlgPaymentDetail
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void noSupplementUpdateAccountA_B(HlgPayment hlgPayment, HlgPaymentDetail hlgPaymentDetail) {
|
|
|
+ //获取当前登录用户
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ //查询开心平台相关信息
|
|
|
+ HlgCpSetting hlgCpSetting = hlgCpSettingService.findHlgCpSetting();
|
|
|
+ HlgCompany hlgCompanyK = hlgCompanyService.getById(hlgCpSetting.getCompanyId());
|
|
|
+ /**
|
|
|
+ * 1、account(更新)
|
|
|
+ */
|
|
|
+ QueryWrapper<HlgAccount> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("company_id", hlgCompanyK.getId());
|
|
|
+ queryWrapper.eq("subcontractor_id", hlgCpSetting.getSubcontractorId());
|
|
|
+ HlgAccount hlgAccount = hlgAccountService.getOne(queryWrapper);
|
|
|
+ //更新账户表
|
|
|
+ hlgAccount.setTotalPayment(businessAccountUtils.sub(hlgAccount.getTotalPayment(), hlgPaymentDetail.getPayment()));
|
|
|
+ hlgAccount.setBalance(businessAccountUtils.add(hlgAccount.getBalance(), hlgPaymentDetail.getPayment()));
|
|
|
+ hlgAccountService.updateById(hlgAccount);
|
|
|
+ /**
|
|
|
+ * 2、account-detail(插入)
|
|
|
+ */
|
|
|
+ HlgAccountDetail hlgAccountDetail = new HlgAccountDetail();
|
|
|
+ hlgAccountDetail.setAccountId(hlgAccount.getId());
|
|
|
+ hlgAccountDetail.setPaymentId(hlgPayment.getId());
|
|
|
+ hlgAccountDetail.setType(2);
|
|
|
+ hlgAccountDetail.setAmount(hlgPaymentDetail.getPayment());
|
|
|
+ hlgAccountDetail.setIsDisplay(1);
|
|
|
+ hlgAccountDetail.setIsDrawback(0);
|
|
|
+ hlgAccountDetail.setGenerateTime(new Date());
|
|
|
+ hlgAccountDetail.setGenerateBy(sysUser.getUsername());
|
|
|
+ hlgAccountDetailService.save(hlgAccountDetail);
|
|
|
+ /**
|
|
|
+ * 3、cp-account(更新)
|
|
|
+ */
|
|
|
+ QueryWrapper<HlgCpAccount> queryWrapperCp = new QueryWrapper<>();
|
|
|
+ queryWrapperCp.eq("company_id", hlgPayment.getCompanyId());
|
|
|
+ queryWrapperCp.eq("cp_company_id", hlgCompanyK.getId());
|
|
|
+ HlgCpAccount hlgCpAccount = hlgCpAccountService.getOne(queryWrapperCp);
|
|
|
+ //更新cp_account表
|
|
|
+ hlgCpAccount.setTotalPayment(businessAccountUtils.sub(hlgCpAccount.getTotalPayment(), hlgPaymentDetail.getPayment()));
|
|
|
+ hlgCpAccount.setBalance(businessAccountUtils.add(hlgCpAccount.getBalance(), hlgPaymentDetail.getPayment()));
|
|
|
+ hlgCpAccountService.updateById(hlgCpAccount);
|
|
|
+ /**
|
|
|
+ * 4、cp-account-detail(插入)
|
|
|
+ */
|
|
|
+ HlgCpAccountDetail hlgCpAccountDetail = new HlgCpAccountDetail();
|
|
|
+ hlgCpAccountDetail.setCpAccountId(hlgCpAccount.getId());
|
|
|
+ hlgCpAccountDetail.setPaymentId(hlgPayment.getId());
|
|
|
+ hlgCpAccountDetail.setType(2);
|
|
|
+ hlgCpAccountDetail.setAmount(hlgPaymentDetail.getPayment());
|
|
|
+ hlgCpAccountDetail.setIsDisplay(1);
|
|
|
+ hlgCpAccountDetail.setIsDrawback(0);
|
|
|
+ hlgCpAccountDetail.setGenerateTime(new Date());
|
|
|
+ hlgCpAccountDetail.setGenerateBy(sysUser.getUsername());
|
|
|
+ hlgCpAccountDetailService.save(hlgCpAccountDetail);
|
|
|
}
|
|
|
|
|
|
/**
|