|
@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.lang.tree.Tree;
|
|
import cn.hutool.core.lang.tree.Tree;
|
|
|
import cn.hutool.core.lang.tree.TreeNodeConfig;
|
|
import cn.hutool.core.lang.tree.TreeNodeConfig;
|
|
|
import cn.hutool.core.lang.tree.TreeUtil;
|
|
import cn.hutool.core.lang.tree.TreeUtil;
|
|
|
|
|
+import cn.hutool.core.util.NumberUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
import com.alibaba.excel.EasyExcel;
|
|
@@ -96,6 +97,9 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private InsFeeFollowOrderMapper insFeeFollowOrderMapper;
|
|
private InsFeeFollowOrderMapper insFeeFollowOrderMapper;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private InsFeeFollowOrderReconciliationMapper insFeeFollowOrderReconciliationMapper;
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private InsPlyFollowInvoiceLinkMapper insPlyFollowInvoiceLinkMapper;
|
|
private InsPlyFollowInvoiceLinkMapper insPlyFollowInvoiceLinkMapper;
|
|
|
|
|
|
|
@@ -3763,6 +3767,9 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public InvoiceingResult followInvoicing(FollowInvoiceVo vo) {
|
|
public InvoiceingResult followInvoicing(FollowInvoiceVo vo) {
|
|
|
log.info("跟单费开票业务开始:参数=[{}]", JSONUtil.toJsonStr(vo));
|
|
log.info("跟单费开票业务开始:参数=[{}]", JSONUtil.toJsonStr(vo));
|
|
|
|
|
+ if (!NumberUtil.isNumber(vo.getTaxPoint())){
|
|
|
|
|
+ throw new SystemException("请输入正确的税点");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 校验明细列表
|
|
// 校验明细列表
|
|
|
List<InsFeeFollowOrderVo> details = vo.getDetails();
|
|
List<InsFeeFollowOrderVo> details = vo.getDetails();
|
|
@@ -4164,6 +4171,8 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
String partnerCompanyId,
|
|
String partnerCompanyId,
|
|
|
Map<Integer, BigDecimal> monthReceivableMap,
|
|
Map<Integer, BigDecimal> monthReceivableMap,
|
|
|
Map<String, BigDecimal> invoicedMap) {
|
|
Map<String, BigDecimal> invoicedMap) {
|
|
|
|
|
+
|
|
|
|
|
+ String systemCode = baseController.getSystemCode();
|
|
|
// 获取当月应收保费,默认为0
|
|
// 获取当月应收保费,默认为0
|
|
|
BigDecimal receivable = monthReceivableMap.getOrDefault(month, BigDecimal.ZERO);
|
|
BigDecimal receivable = monthReceivableMap.getOrDefault(month, BigDecimal.ZERO);
|
|
|
// 获取当月已开票金额,默认为0
|
|
// 获取当月已开票金额,默认为0
|
|
@@ -4186,6 +4195,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
queryWrapper.eq("year", year)
|
|
queryWrapper.eq("year", year)
|
|
|
.eq("month", month)
|
|
.eq("month", month)
|
|
|
.eq("partner_company_id", partnerCompanyId)
|
|
.eq("partner_company_id", partnerCompanyId)
|
|
|
|
|
+ .eq("system_code", systemCode)
|
|
|
.last("LIMIT 1"); // 取一条即可,或者根据业务取最新的
|
|
.last("LIMIT 1"); // 取一条即可,或者根据业务取最新的
|
|
|
InsFeeFollowOrder dbOrder = insFeeFollowOrderMapper.selectOne(queryWrapper);
|
|
InsFeeFollowOrder dbOrder = insFeeFollowOrderMapper.selectOne(queryWrapper);
|
|
|
if (dbOrder != null) {
|
|
if (dbOrder != null) {
|
|
@@ -4197,10 +4207,23 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
// 现在按wwq的要求改成:未开票金额 = 对账金额 - 已开票金额
|
|
// 现在按wwq的要求改成:未开票金额 = 对账金额 - 已开票金额
|
|
|
vo.setUninvoiced(dbOrder.getReconciliationAmount().subtract(invoiced));
|
|
vo.setUninvoiced(dbOrder.getReconciliationAmount().subtract(invoiced));
|
|
|
} else {
|
|
} else {
|
|
|
- // 数据库无记录,使用默认值或DTO里的值
|
|
|
|
|
- vo.setReconciliationAmount(null);
|
|
|
|
|
- vo.setFalselyIncreasedDifference(null);
|
|
|
|
|
- vo.setFalselyIncreasedReason(null);
|
|
|
|
|
|
|
+ QueryWrapper<InsFeeFollowOrderReconciliation> insFeeFollowOrderReconciliationQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
+ insFeeFollowOrderReconciliationQueryWrapper.eq("year", year)
|
|
|
|
|
+ .eq("month", month)
|
|
|
|
|
+ .eq("partner_company_id", partnerCompanyId)
|
|
|
|
|
+ .eq("system_code", systemCode)
|
|
|
|
|
+ .last("LIMIT 1"); // 取一条即可,或者根据业务取最新的
|
|
|
|
|
+ InsFeeFollowOrderReconciliation insFeeFollowOrderReconciliation = insFeeFollowOrderReconciliationMapper.selectOne(insFeeFollowOrderReconciliationQueryWrapper);
|
|
|
|
|
+ if (null != insFeeFollowOrderReconciliation){
|
|
|
|
|
+ vo.setReconciliationAmount(insFeeFollowOrderReconciliation.getReconciliationAmount());
|
|
|
|
|
+ vo.setFalselyIncreasedDifference(insFeeFollowOrderReconciliation.getFalselyIncreasedDifference());
|
|
|
|
|
+ vo.setFalselyIncreasedReason(insFeeFollowOrderReconciliation.getFalselyIncreasedReason());
|
|
|
|
|
+ }else{
|
|
|
|
|
+ // 数据库无记录,使用默认值或DTO里的值
|
|
|
|
|
+ vo.setReconciliationAmount(null);
|
|
|
|
|
+ vo.setFalselyIncreasedDifference(null);
|
|
|
|
|
+ vo.setFalselyIncreasedReason(null);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return vo;
|
|
return vo;
|
|
|
}
|
|
}
|