|
|
@ -41,6 +41,8 @@ import com.yxt.anrui.base.api.commoncontract.CommonContractFeign; |
|
|
|
import com.yxt.anrui.base.common.enums.VehicleStateTempOrLast; |
|
|
|
import com.yxt.anrui.buscenter.api.busdelivered.BusDeliveredDto; |
|
|
|
import com.yxt.anrui.buscenter.api.busdelivered.BusDeliveredFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.busdeposit.AppBusDepositBuscenterDetailVo; |
|
|
|
import com.yxt.anrui.buscenter.api.busdeposit.BusDepositFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrderFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.app.order.AppOrderDetailsVo; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.app.order.AppOrderModelInfoVo; |
|
|
@ -58,9 +60,11 @@ import com.yxt.anrui.fin.api.finselectedreceivablesdetailed.FinSelectedReceivabl |
|
|
|
import com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.AppFinUncollectedReceivablesDetailedVo; |
|
|
|
import com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.FinUncollectedReceivablesDetailed; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.arreceivebill.ARReceivebill; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.bdcustomer.BdCustomer; |
|
|
|
import com.yxt.anrui.fin.biz.finselectedreceivablesdetailed.FinSelectedReceivablesDetailedService; |
|
|
|
import com.yxt.anrui.fin.biz.finuncollectedreceivablesdetailed.FinUncollectedReceivablesDetailedService; |
|
|
|
import com.yxt.anrui.fin.biz.kingdee.arreceivebill.ArReceivebillService; |
|
|
|
import com.yxt.anrui.fin.biz.kingdee.bdcustomer.BdCustomerService; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationVo; |
|
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrg; |
|
|
@ -69,6 +73,7 @@ import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.HanZiConverterPinYin; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
@ -127,6 +132,10 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
private BusSalesOrderVehicleFeign busSalesOrderVehicleFeign; |
|
|
|
@Autowired |
|
|
|
private ArReceivebillService arReceivebillService; |
|
|
|
@Autowired |
|
|
|
private BusDepositFeign busDepositFeign; |
|
|
|
@Autowired |
|
|
|
private BdCustomerService bdCustomerService; |
|
|
|
|
|
|
|
private QueryWrapper<FinCollectionConfirmation> createQueryWrapper(FinCollectionConfirmationQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
@ -1245,6 +1254,130 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
if (confirmation == null) { |
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
} |
|
|
|
//===========================================
|
|
|
|
//推送收款单
|
|
|
|
ARReceivebill arReceivebill = new ARReceivebill(); |
|
|
|
//业务日期
|
|
|
|
arReceivebill.setFDATE(DateUtil.today()); |
|
|
|
|
|
|
|
//收款组织
|
|
|
|
ResultBean<SysOrganizationVo> resultBean = sysOrganizationFeign.fetchBySid(confirmation.getUseOrgSid()); |
|
|
|
if (resultBean.getSuccess()) { |
|
|
|
SysOrganizationVo vo = resultBean.getData(); |
|
|
|
if (vo != null) { |
|
|
|
arReceivebill.setFPAYORGID(vo.getOrgCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
//销售部门
|
|
|
|
if (StringUtils.isNotBlank(confirmation.getCreateDeptSid())) { |
|
|
|
resultBean = sysOrganizationFeign.fetchBySid(confirmation.getCreateDeptSid()); |
|
|
|
if (resultBean.getSuccess()) { |
|
|
|
SysOrganizationVo vo = resultBean.getData(); |
|
|
|
if (vo != null) { |
|
|
|
arReceivebill.setFSALEDEPTID(vo.getOrgCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
arReceivebill.setFREMARK(confirmation.getPayerName()); |
|
|
|
//物料列表
|
|
|
|
List<ARReceivebill.FRECEIVEBILLENTRY> fEntityList = new ArrayList<>(); |
|
|
|
ARReceivebill.FRECEIVEBILLENTRY freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); |
|
|
|
//推送车款
|
|
|
|
List<FinSelectedReceivablesDetailedVo> finSelectedReceivablesDetailedVos1 = finSelectedReceivablesDetailedService.fetchByAuditState1(sid, 1, "车款"); |
|
|
|
finSelectedReceivablesDetailedVos1.removeAll(Collections.singleton(null)); |
|
|
|
if (!finSelectedReceivablesDetailedVos1.isEmpty()) { |
|
|
|
for (FinSelectedReceivablesDetailedVo finSelectedReceivablesDetailedVo : finSelectedReceivablesDetailedVos1){ |
|
|
|
//先推送客户
|
|
|
|
BdCustomer bdCustomer = createBdCustomer(confirmation.getUseOrgSid(),finSelectedReceivablesDetailedVo.getCustomerName(),finSelectedReceivablesDetailedVo.getCustomerPhone()); |
|
|
|
ResultBean resultBeanMiddle = bdCustomerService.draftBdCustomer(bdCustomer); |
|
|
|
//往来单位
|
|
|
|
arReceivebill.setFCONTACTUNIT(bdCustomer.getFNumber()); |
|
|
|
//结算方式
|
|
|
|
freceivebillentry.setFSETTLETYPEIDKey(confirmation.getCollectionTypeKey()); |
|
|
|
freceivebillentry.setFSETTLETYPEIDType("customerPayType"); |
|
|
|
// BigDecimal bigAll = finSelectedReceivablesDetailedVos1.stream().map(FinSelectedReceivablesDetailedVo::getSubscriptionMoney).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
//收款金额
|
|
|
|
freceivebillentry.setFRECTOTALAMOUNTFOR(finSelectedReceivablesDetailedVo.getSumAll()); |
|
|
|
//登记日期
|
|
|
|
freceivebillentry.setFPOSTDATE(confirmation.getCollectionDate()); |
|
|
|
//收款用途
|
|
|
|
freceivebillentry.setFPURPOSEIDKey("001"); |
|
|
|
freceivebillentry.setFPURPOSEIDType("cw_skyt"); |
|
|
|
fEntityList.add(freceivebillentry); |
|
|
|
//项目类别key、value
|
|
|
|
arReceivebill.setF_PAEZ_AssistantType("payType"); |
|
|
|
FinUncollectedReceivablesDetailed finUncollectedReceivablesDetailed = finUncollectedReceivablesDetailedService.fetchBySid(finSelectedReceivablesDetailedVos1.get(0).getReceivablesSid()); |
|
|
|
arReceivebill.setF_PAEZ_AssistantKey(finUncollectedReceivablesDetailed.getPayTypeKey()); |
|
|
|
arReceivebill.setFRECEIVEBILLENTRY(fEntityList); |
|
|
|
ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//推送订金
|
|
|
|
List<FinSelectedReceivablesDetailedVo> finSelectedReceivablesDetailedVos2 = finSelectedReceivablesDetailedService.fetchByAuditState1(sid, 1, "订金"); |
|
|
|
fEntityList = new ArrayList<>(); |
|
|
|
freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); |
|
|
|
finSelectedReceivablesDetailedVos2.removeAll(Collections.singleton(null)); |
|
|
|
if (!finSelectedReceivablesDetailedVos2.isEmpty()) { |
|
|
|
for (FinSelectedReceivablesDetailedVo finSelectedReceivablesDetailedVo : finSelectedReceivablesDetailedVos2){ |
|
|
|
//先推送客户
|
|
|
|
BdCustomer bdCustomer = createBdCustomer(confirmation.getUseOrgSid(),finSelectedReceivablesDetailedVo.getCustomerName(),finSelectedReceivablesDetailedVo.getCustomerPhone()); |
|
|
|
ResultBean resultBeanMiddle = bdCustomerService.draftBdCustomer(bdCustomer); |
|
|
|
//往来单位
|
|
|
|
arReceivebill.setFCONTACTUNIT(bdCustomer.getFNumber()); |
|
|
|
//结算方式
|
|
|
|
freceivebillentry.setFSETTLETYPEIDKey(confirmation.getCollectionTypeKey()); |
|
|
|
freceivebillentry.setFSETTLETYPEIDType("customerPayType"); |
|
|
|
// BigDecimal bigAll = finSelectedReceivablesDetailedVos2.stream().map(FinSelectedReceivablesDetailedVo::getSubscriptionMoney).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
//收款金额
|
|
|
|
freceivebillentry.setFRECTOTALAMOUNTFOR(finSelectedReceivablesDetailedVo.getSumAll()); |
|
|
|
//登记日期
|
|
|
|
freceivebillentry.setFPOSTDATE(confirmation.getCollectionDate()); |
|
|
|
//收款用途
|
|
|
|
freceivebillentry.setFPURPOSEIDKey("002"); |
|
|
|
freceivebillentry.setFPURPOSEIDType("cw_skyt"); |
|
|
|
fEntityList.add(freceivebillentry); |
|
|
|
arReceivebill.setFRECEIVEBILLENTRY(fEntityList); |
|
|
|
//项目类别key、value
|
|
|
|
arReceivebill.setF_PAEZ_AssistantType("cw_sklb"); |
|
|
|
arReceivebill.setF_PAEZ_AssistantKey("006"); |
|
|
|
ResultBean resultBean2 = arReceivebillService.draftArReceivebill(arReceivebill); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
//简易订单-订金收取
|
|
|
|
if (finSelectedReceivablesDetailedVos1.isEmpty() && finSelectedReceivablesDetailedVos2.isEmpty()) { |
|
|
|
//先推送客户
|
|
|
|
AppBusDepositBuscenterDetailVo busDeposit = busDepositFeign.getDepositInfoDetails(confirmation.getBusSid()).getData(); |
|
|
|
BdCustomer bdCustomer = createBdCustomer(confirmation.getUseOrgSid(),busDeposit.getPayName(),busDeposit.getPhone()); |
|
|
|
ResultBean resultBeanMiddle = bdCustomerService.draftBdCustomer(bdCustomer); |
|
|
|
//往来单位
|
|
|
|
arReceivebill.setFCONTACTUNIT(bdCustomer.getFNumber()); |
|
|
|
fEntityList = new ArrayList<>(); |
|
|
|
freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); |
|
|
|
//结算方式
|
|
|
|
freceivebillentry.setFSETTLETYPEIDKey(confirmation.getCollectionTypeKey()); |
|
|
|
freceivebillentry.setFSETTLETYPEIDType("customerPayType"); |
|
|
|
BigDecimal bigAll = confirmation.getCollectionMoney(); |
|
|
|
//收款金额
|
|
|
|
freceivebillentry.setFRECTOTALAMOUNTFOR(bigAll.toString()); |
|
|
|
//登记日期
|
|
|
|
freceivebillentry.setFPOSTDATE(confirmation.getCollectionDate()); |
|
|
|
//收款用途:订金
|
|
|
|
freceivebillentry.setFPURPOSEIDKey("002"); |
|
|
|
freceivebillentry.setFPURPOSEIDType("cw_skyt"); |
|
|
|
fEntityList.add(freceivebillentry); |
|
|
|
arReceivebill.setFRECEIVEBILLENTRY(fEntityList); |
|
|
|
//项目类别key、value
|
|
|
|
arReceivebill.setF_PAEZ_AssistantType("cw_sklb"); |
|
|
|
arReceivebill.setF_PAEZ_AssistantKey("006"); |
|
|
|
ResultBean resultBean2 = arReceivebillService.draftArReceivebill(arReceivebill); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//===========================================
|
|
|
|
//查询该申请下的所有待审核的款项明细
|
|
|
|
BigDecimal subscriptionMoneyAll = new BigDecimal("0"); |
|
|
|
List<FinSelectedReceivablesDetailedVo> finSelectedReceivablesDetailedVos = finSelectedReceivablesDetailedService.fetchByAuditState(sid, 1); |
|
|
@ -1351,98 +1484,6 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
baseMapper.updateById(confirmation); |
|
|
|
//删除临时表的数据
|
|
|
|
ResultBean deleteResult = baseVehicleTempstateFeign.delByBusSid(sid); |
|
|
|
//推送收款单
|
|
|
|
ARReceivebill arReceivebill = new ARReceivebill(); |
|
|
|
//业务日期
|
|
|
|
arReceivebill.setFDATE(DateUtil.today()); |
|
|
|
//往来单位
|
|
|
|
arReceivebill.setFCONTACTUNIT(confirmation.getPayerName()); |
|
|
|
//收款组织
|
|
|
|
ResultBean<SysOrganizationVo> resultBean = sysOrganizationFeign.fetchBySid(confirmation.getUseOrgSid()); |
|
|
|
if (resultBean.getSuccess()) { |
|
|
|
SysOrganizationVo vo = resultBean.getData(); |
|
|
|
if (vo != null) { |
|
|
|
arReceivebill.setFPAYORGID(vo.getOrgCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
//销售部门
|
|
|
|
resultBean = sysOrganizationFeign.fetchBySid(confirmation.getCreateDeptSid()); |
|
|
|
if (resultBean.getSuccess()) { |
|
|
|
SysOrganizationVo vo = resultBean.getData(); |
|
|
|
if (vo != null) { |
|
|
|
arReceivebill.setFSALEDEPTID(vo.getOrgCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
//应付类别key、value
|
|
|
|
|
|
|
|
//物料列表
|
|
|
|
List<ARReceivebill.FRECEIVEBILLENTRY> fEntityList = new ArrayList<>(); |
|
|
|
ARReceivebill.FRECEIVEBILLENTRY freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); |
|
|
|
List<FinSelectedReceivablesDetailedVo> finSelectedReceivablesDetailedVos1 = finSelectedReceivablesDetailedService.fetchByAuditState1(sid, 1,"车款"); |
|
|
|
finSelectedReceivablesDetailedVos1.removeAll(Collections.singleton(null)); |
|
|
|
if(!finSelectedReceivablesDetailedVos1.isEmpty()){ |
|
|
|
//结算方式
|
|
|
|
freceivebillentry.setFSETTLETYPEIDKey(confirmation.getCollectionTypeKey()); |
|
|
|
freceivebillentry.setFSETTLETYPEIDType("paymentType"); |
|
|
|
BigDecimal bigAll = finSelectedReceivablesDetailedVos1.stream().map(FinSelectedReceivablesDetailedVo::getSubscriptionMoney).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
//收款金额
|
|
|
|
freceivebillentry.setFRECTOTALAMOUNTFOR(bigAll.toString()); |
|
|
|
//登记日期
|
|
|
|
freceivebillentry.setFPOSTDATE(confirmation.getCollectionDate()); |
|
|
|
//收款用途
|
|
|
|
freceivebillentry.setFPURPOSEIDKey("001"); |
|
|
|
freceivebillentry.setFPURPOSEIDType("cw_skyt"); |
|
|
|
fEntityList.add(freceivebillentry); |
|
|
|
arReceivebill.setFRECEIVEBILLENTRY(fEntityList); |
|
|
|
ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); |
|
|
|
} |
|
|
|
|
|
|
|
//推送订金
|
|
|
|
List<FinSelectedReceivablesDetailedVo> finSelectedReceivablesDetailedVos2 = finSelectedReceivablesDetailedService.fetchByAuditState1(sid, 1,"订金"); |
|
|
|
fEntityList = new ArrayList<>(); |
|
|
|
freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); |
|
|
|
finSelectedReceivablesDetailedVos2.removeAll(Collections.singleton(null)); |
|
|
|
if(!finSelectedReceivablesDetailedVos2.isEmpty()){ |
|
|
|
//结算方式
|
|
|
|
freceivebillentry.setFSETTLETYPEIDKey(confirmation.getCollectionTypeKey()); |
|
|
|
freceivebillentry.setFSETTLETYPEIDType("paymentType"); |
|
|
|
BigDecimal bigAll = finSelectedReceivablesDetailedVos2.stream().map(FinSelectedReceivablesDetailedVo::getSubscriptionMoney).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
//收款金额
|
|
|
|
freceivebillentry.setFRECTOTALAMOUNTFOR(bigAll.toString()); |
|
|
|
//登记日期
|
|
|
|
freceivebillentry.setFPOSTDATE(confirmation.getCollectionDate()); |
|
|
|
//收款用途
|
|
|
|
freceivebillentry.setFPURPOSEIDKey("002"); |
|
|
|
freceivebillentry.setFPURPOSEIDType("cw_skyt"); |
|
|
|
fEntityList.add(freceivebillentry); |
|
|
|
arReceivebill.setFRECEIVEBILLENTRY(fEntityList); |
|
|
|
ResultBean resultBean2 = arReceivebillService.draftArReceivebill(arReceivebill); |
|
|
|
} |
|
|
|
if(finSelectedReceivablesDetailedVos1.isEmpty() && finSelectedReceivablesDetailedVos2.isEmpty()){ |
|
|
|
fEntityList = new ArrayList<>(); |
|
|
|
freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); |
|
|
|
finSelectedReceivablesDetailedVos2.removeAll(Collections.singleton(null)); |
|
|
|
if(!finSelectedReceivablesDetailedVos2.isEmpty()){ |
|
|
|
//结算方式
|
|
|
|
freceivebillentry.setFSETTLETYPEIDKey(confirmation.getCollectionTypeKey()); |
|
|
|
freceivebillentry.setFSETTLETYPEIDType("paymentType"); |
|
|
|
BigDecimal bigAll = confirmation.getCollectionMoney(); |
|
|
|
//收款金额
|
|
|
|
freceivebillentry.setFRECTOTALAMOUNTFOR(bigAll.toString()); |
|
|
|
//登记日期
|
|
|
|
freceivebillentry.setFPOSTDATE(confirmation.getCollectionDate()); |
|
|
|
//收款用途
|
|
|
|
freceivebillentry.setFPURPOSEIDKey("002"); |
|
|
|
freceivebillentry.setFPURPOSEIDType("cw_skyt"); |
|
|
|
fEntityList.add(freceivebillentry); |
|
|
|
arReceivebill.setFRECEIVEBILLENTRY(fEntityList); |
|
|
|
ResultBean resultBean2 = arReceivebillService.draftArReceivebill(arReceivebill); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* baseMapper.cashierConfirm(sid); |
|
|
|
int auditState = 1; |
|
|
@ -1495,6 +1536,23 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
ResultBean deleteResult = baseVehicleTempstateFeign.delByBusSid(sid);*/ |
|
|
|
return rb.success().setMsg("款项确认成功"); |
|
|
|
} |
|
|
|
//组装客户推送
|
|
|
|
private BdCustomer createBdCustomer(String useOrgSid,String name,String mobile) { |
|
|
|
BdCustomer bdCustomer = new BdCustomer(); |
|
|
|
ResultBean<SysOrganizationVo> resultBean = sysOrganizationFeign.fetchBySid(useOrgSid); |
|
|
|
if (resultBean.getSuccess()) { |
|
|
|
SysOrganizationVo vo = resultBean.getData(); |
|
|
|
if (vo != null) { |
|
|
|
bdCustomer.setTOrgIds(vo.getOrgCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
String fname = name + mobile.substring(mobile.length() - 4); |
|
|
|
bdCustomer.setFName(fname); |
|
|
|
String code = HanZiConverterPinYin.getPinYinFirst(name) + mobile.substring(mobile.length() - 4); |
|
|
|
bdCustomer.setFNumber(code); |
|
|
|
return bdCustomer; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean saveFinConfirm(FinConfirmDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|