Browse Source

Merge remote-tracking branch 'origin/master'

master
fanzongzhe0036 2 weeks ago
parent
commit
31214049be
  1. 47
      anrui-base/anrui-base-biz/src/main/java/com/yxt/anrui/base/biz/baseshuntinginvoicingapply/BaseShuntingInvoicingApplyService.java
  2. 31
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapply/FinPaymentapplyService.java
  3. 2
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapplydetailsbelow/FinPaymentapplyDetailsBelowMapper.java
  4. 11
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapplydetailsbelow/FinPaymentapplyDetailsBelowMapper.xml
  5. 4
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapplydetailsbelow/FinPaymentapplyDetailsBelowService.java
  6. 10
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapplydetailsbeloweve/FinPaymentapplyDetailsBelowEveMapper.java
  7. 22
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapplydetailsbeloweve/FinPaymentapplyDetailsBelowEveMapper.xml
  8. 21
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapplydetailsbeloweve/FinPaymentapplyDetailsBelowEveService.java
  9. 3
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapplyeve/FinPaymentapplyEveMapper.java
  10. 7
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapplyeve/FinPaymentapplyEveMapper.xml
  11. 4
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapplyeve/FinPaymentapplyEveService.java
  12. 3
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentrecord/FinPaymentrecordMapper.java
  13. 11
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentrecord/FinPaymentrecordMapper.xml
  14. 21
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentrecord/FinPaymentrecordService.java

47
anrui-base/anrui-base-biz/src/main/java/com/yxt/anrui/base/biz/baseshuntinginvoicingapply/BaseShuntingInvoicingApplyService.java

@ -30,7 +30,6 @@ import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yxt.anrui.base.api.baseaccadjapply.BaseAccadjApply;
import com.yxt.anrui.base.api.baseinternalpurchasevehicle.BaseInternalPurchaseVehicle; import com.yxt.anrui.base.api.baseinternalpurchasevehicle.BaseInternalPurchaseVehicle;
import com.yxt.anrui.base.api.baseinternalpurchasevehicle.BaseInternalPurchaseVehicleDetailsVo; import com.yxt.anrui.base.api.baseinternalpurchasevehicle.BaseInternalPurchaseVehicleDetailsVo;
import com.yxt.anrui.base.api.baseshuntinginvoicinapplyeveh.BaseShuntingInvoicinApplyeVeh; import com.yxt.anrui.base.api.baseshuntinginvoicinapplyeveh.BaseShuntingInvoicinApplyeVeh;
@ -48,9 +47,6 @@ import com.yxt.anrui.base.biz.baseshuntinginvoicinapplyeveh.BaseShuntingInvoicin
import com.yxt.anrui.base.biz.basevehicle.BaseVehicleService; import com.yxt.anrui.base.biz.basevehicle.BaseVehicleService;
import com.yxt.anrui.base.biz.basevehiclecertificate.BaseVehicleCertificateService; import com.yxt.anrui.base.biz.basevehiclecertificate.BaseVehicleCertificateService;
import com.yxt.anrui.base.common.enums.VehicleState; import com.yxt.anrui.base.common.enums.VehicleState;
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempVo;
import com.yxt.anrui.fin.api.finbillapplication.FinBillApplicationDetailsVo;
import com.yxt.anrui.fin.api.finbillvehicle.FinBillVehicleDetailsVo;
import com.yxt.anrui.fin.api.fincompanyinvoicing.FinCompanyInvoicingDetailsVo; import com.yxt.anrui.fin.api.fincompanyinvoicing.FinCompanyInvoicingDetailsVo;
import com.yxt.anrui.fin.api.fincompanyinvoicing.FinCompanyInvoicingFeign; import com.yxt.anrui.fin.api.fincompanyinvoicing.FinCompanyInvoicingFeign;
import com.yxt.anrui.fin.api.finvehicleinvoice.FinVehicleInvoiceDto; import com.yxt.anrui.fin.api.finvehicleinvoice.FinVehicleInvoiceDto;
@ -66,7 +62,6 @@ import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrg;
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign;
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; import com.yxt.anrui.portal.api.sysuser.SysUserFeign;
import com.yxt.anrui.portal.api.sysuser.SysUserVo; import com.yxt.anrui.portal.api.sysuser.SysUserVo;
import com.yxt.anrui.portal.api.sysuser.UserQuery;
import com.yxt.anrui.portal.api.sysuser.UserRoleQuery; import com.yxt.anrui.portal.api.sysuser.UserRoleQuery;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import com.yxt.common.base.service.MybatisBaseService; import com.yxt.common.base.service.MybatisBaseService;
@ -74,29 +69,14 @@ import com.yxt.common.base.utils.PagerUtil;
import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo; import com.yxt.common.core.vo.PagerVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/**
* Project: anrui-base(调车开票) <br/>
* File: BaseShuntingInvoicingApplyService.java <br/>
* Class: com.yxt.anrui.base.biz.baseshuntinginvoicingapply.BaseShuntingInvoicingApplyService <br/>
* Description: 调车开票申请表 业务逻辑. <br/>
* Copyright: Copyright (c) 2011 <br/>
* Company: https://gitee.com/liuzp315 <br/>
* Makedate: 2022-07-11 15:30:28 <br/>
*
* @author liupopo
* @version 1.0
* @since 1.0
*/
@Service @Service
public class BaseShuntingInvoicingApplyService extends MybatisBaseService<BaseShuntingInvoicingApplyMapper, BaseShuntingInvoicingApply> { public class BaseShuntingInvoicingApplyService extends MybatisBaseService<BaseShuntingInvoicingApplyMapper, BaseShuntingInvoicingApply> {
@ -123,13 +103,6 @@ public class BaseShuntingInvoicingApplyService extends MybatisBaseService<BaseSh
@Autowired @Autowired
private BaseVehicleService baseVehicleService; private BaseVehicleService baseVehicleService;
private QueryWrapper<BaseShuntingInvoicingApply> createQueryWrapper(BaseShuntingInvoicingApplyQuery query) {
// todo: 这里根据具体业务调整查询条件
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
QueryWrapper<BaseShuntingInvoicingApply> qw = new QueryWrapper<>();
return qw;
}
public PagerVo<BaseShuntingInvoicingApplyVo> listPageVo(PagerQuery<BaseShuntingInvoicingApplyQuery> pq) { public PagerVo<BaseShuntingInvoicingApplyVo> listPageVo(PagerQuery<BaseShuntingInvoicingApplyQuery> pq) {
BaseShuntingInvoicingApplyQuery query = pq.getParams(); BaseShuntingInvoicingApplyQuery query = pq.getParams();
QueryWrapper<BaseShuntingInvoicingApply> qw = new QueryWrapper<>(); QueryWrapper<BaseShuntingInvoicingApply> qw = new QueryWrapper<>();
@ -271,15 +244,7 @@ public class BaseShuntingInvoicingApplyService extends MybatisBaseService<BaseSh
public ResultBean submitSunInv(SubmitBaseShuntingInvoicingApplyDto dto) { public ResultBean submitSunInv(SubmitBaseShuntingInvoicingApplyDto dto) {
ResultBean rb = ResultBean.fireFail(); ResultBean rb = ResultBean.fireFail();
List<BaseShuntingInvoicinApplyeVehDto> baseShuntingInvoicinApplyeVehs = dto.getBaseShuntingInvoicinApplyeVehs();
BaseShuntingInvoicingApply baseShuntingInvoicingApply = fetchBySid(dto.getSid()); BaseShuntingInvoicingApply baseShuntingInvoicingApply = fetchBySid(dto.getSid());
for (BaseShuntingInvoicinApplyeVehDto baseShuntingInvoicinApplyeVeh : baseShuntingInvoicinApplyeVehs) {
BaseInternalPurchaseVehicle baseInternalPurchaseVehicle = baseInternalPurchaseVehicleService.fetchBySid(baseShuntingInvoicinApplyeVeh.getPurchaseSid());
FinCompanyInvoicingDetailsVo finCompanyInvoicingDetailsVo = finCompanyInvoicingFeign.getDetailsByUseOrgAndSystem(baseShuntingInvoicingApply.getCallInOrgSid(), baseInternalPurchaseVehicle.getCallInBuyerOrgSid()).getData();
if (finCompanyInvoicingDetailsVo == null){
return rb.setMsg("调入分公司企业开票信息不存在");
}
}
int r = submitBusinessData(dto, baseShuntingInvoicingApply); int r = submitBusinessData(dto, baseShuntingInvoicingApply);
if (r == 3) { if (r == 3) {
return rb.setMsg("该申请不存在"); return rb.setMsg("该申请不存在");
@ -293,6 +258,15 @@ public class BaseShuntingInvoicingApplyService extends MybatisBaseService<BaseSh
return rb.setMsg(resultBean.getMsg()); return rb.setMsg(resultBean.getMsg());
} }
String businessSid = resultBean.getData(); String businessSid = resultBean.getData();
baseShuntingInvoicingApply = fetchBySid(businessSid);
List<BaseShuntingInvoicinApplyeVehDto> baseShuntingInvoicinApplyeVehs = dto.getBaseShuntingInvoicinApplyeVehs();
for (BaseShuntingInvoicinApplyeVehDto baseShuntingInvoicinApplyeVeh : baseShuntingInvoicinApplyeVehs) {
BaseInternalPurchaseVehicle baseInternalPurchaseVehicle = baseInternalPurchaseVehicleService.fetchBySid(baseShuntingInvoicinApplyeVeh.getPurchaseSid());
FinCompanyInvoicingDetailsVo finCompanyInvoicingDetailsVo = finCompanyInvoicingFeign.getDetailsByUseOrgAndSystem(baseShuntingInvoicingApply.getCallInOrgSid(), baseInternalPurchaseVehicle.getCallInBuyerOrgSid()).getData();
if (finCompanyInvoicingDetailsVo == null){
return rb.setMsg("调入分公司企业开票信息不存在");
}
}
//创建BusinessVariables实体对象 //创建BusinessVariables实体对象
BusinessVariables bv = new BusinessVariables(); BusinessVariables bv = new BusinessVariables();
//流程中的参数赋值 //流程中的参数赋值
@ -300,8 +274,7 @@ public class BaseShuntingInvoicingApplyService extends MybatisBaseService<BaseSh
//若有网关,则赋值网关中判断的字段。 //若有网关,则赋值网关中判断的字段。
variables.put("businessSid", businessSid); variables.put("businessSid", businessSid);
//用户的部门全路径sid //用户的部门全路径sid
BaseShuntingInvoicingApply baseShuntingInvoicingApply1 = fetchBySid(businessSid); bv.setOrgSidPath(baseShuntingInvoicingApply.getOrgSidPath());
bv.setOrgSidPath(baseShuntingInvoicingApply1.getOrgSidPath());
//业务sid //业务sid
bv.setBusinessSid(businessSid); bv.setBusinessSid(businessSid);
//用户sid //用户sid

31
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapply/FinPaymentapplyService.java

@ -507,6 +507,12 @@ public class FinPaymentapplyService extends MybatisBaseService<FinPaymentapplyMa
} }
String nextNodeUserSids_ = sysOrganization.getManagerSid(); String nextNodeUserSids_ = sysOrganization.getManagerSid();
bv.setNextNodeUserSids(nextNodeUserSids_); bv.setNextNodeUserSids(nextNodeUserSids_);
if ("004".equals(finPaymentapply.getCostTypeKey())) {
List<FinPaymentapplyEveDto> eveList = dto.getEveList();
for (FinPaymentapplyEveDto finPaymentapplyEveDto : eveList) {
finPaymentapplyDetailsBelowEveService.updateState(finPaymentapplyEveDto.getEveSid(), 2);
}
}
if (r == 1) { if (r == 1) {
ResultBean<UpdateFlowFieldVo> voResultBean = flowFeign.startProcess(bv); ResultBean<UpdateFlowFieldVo> voResultBean = flowFeign.startProcess(bv);
if (!voResultBean.getSuccess()) { if (!voResultBean.getSuccess()) {
@ -699,9 +705,9 @@ public class FinPaymentapplyService extends MybatisBaseService<FinPaymentapplyMa
//备注 //备注
finPaymentrecordDto.setRemarks(finPaymentrecordDto.getCostTypeValue() + finPaymentrecordDto.getCostTitleValue()); finPaymentrecordDto.setRemarks(finPaymentrecordDto.getCostTypeValue() + finPaymentrecordDto.getCostTitleValue());
//本次付款说明 //本次付款说明
if (StringUtils.isNotBlank(finPaymentapplyDetailVo.getRemarks())){ if (StringUtils.isNotBlank(finPaymentapplyDetailVo.getRemarks())) {
finPaymentrecordDto.setPayRemark(finPaymentapply.getPayCompany() + "/" + finPaymentapplyDetailVo.getActualPay() + "/" + finPaymentapplyDetailVo.getRemarks()); finPaymentrecordDto.setPayRemark(finPaymentapply.getPayCompany() + "/" + finPaymentapplyDetailVo.getActualPay() + "/" + finPaymentapplyDetailVo.getRemarks());
}else { } else {
finPaymentrecordDto.setPayRemark(finPaymentapply.getPayCompany() + "/" + finPaymentapplyDetailVo.getActualPay()); finPaymentrecordDto.setPayRemark(finPaymentapply.getPayCompany() + "/" + finPaymentapplyDetailVo.getActualPay());
} }
finPaymentrecordService.saveDto(finPaymentrecordDto); finPaymentrecordService.saveDto(finPaymentrecordDto);
@ -733,9 +739,9 @@ public class FinPaymentapplyService extends MybatisBaseService<FinPaymentapplyMa
//备注 //备注
finPaymentrecordDto.setRemarks(finPaymentrecordDto.getCostTypeValue() + finPaymentrecordDto.getCostTitleValue()); finPaymentrecordDto.setRemarks(finPaymentrecordDto.getCostTypeValue() + finPaymentrecordDto.getCostTitleValue());
//本次付款说明 //本次付款说明
if (StringUtils.isNotBlank(finPaymentapplyDetailsBelowDetailsVo.getRemarks())){ if (StringUtils.isNotBlank(finPaymentapplyDetailsBelowDetailsVo.getRemarks())) {
finPaymentrecordDto.setPayRemark(finPaymentapply.getPayCompany() + "/" + finPaymentapplyDetailsBelowDetailsVo.getRemarks()); finPaymentrecordDto.setPayRemark(finPaymentapply.getPayCompany() + "/" + finPaymentapplyDetailsBelowDetailsVo.getRemarks());
}else { } else {
finPaymentrecordDto.setPayRemark(finPaymentapply.getPayCompany()); finPaymentrecordDto.setPayRemark(finPaymentapply.getPayCompany());
} }
finPaymentrecordService.saveDto(finPaymentrecordDto); finPaymentrecordService.saveDto(finPaymentrecordDto);
@ -772,12 +778,13 @@ public class FinPaymentapplyService extends MybatisBaseService<FinPaymentapplyMa
//备注 //备注
finPaymentrecordDto.setRemarks(finPaymentrecordDto.getCostTypeValue() + finPaymentrecordDto.getCostTitleValue()); finPaymentrecordDto.setRemarks(finPaymentrecordDto.getCostTypeValue() + finPaymentrecordDto.getCostTitleValue());
//本次付款说明 //本次付款说明
if (StringUtils.isNotBlank(finPaymentapplyEveDetailsVo.getRemarks())){ if (StringUtils.isNotBlank(finPaymentapplyEveDetailsVo.getRemarks())) {
finPaymentrecordDto.setPayRemark(finPaymentapply.getPayCompany() + "/" + finPaymentapplyEveDetailsVo.getRemarks()); finPaymentrecordDto.setPayRemark(finPaymentapply.getPayCompany() + "/" + finPaymentapplyEveDetailsVo.getRemarks());
}else { } else {
finPaymentrecordDto.setPayRemark(finPaymentapply.getPayCompany()); finPaymentrecordDto.setPayRemark(finPaymentapply.getPayCompany());
} }
finPaymentrecordService.saveDto(finPaymentrecordDto); finPaymentrecordService.saveDto(finPaymentrecordDto);
finPaymentapplyDetailsBelowEveService.updateState(finPaymentapplyEveDetailsVo.getEveSid(), 3);
} }
} }
List<FinPaymentapplyVehicleVo> vehicleList = vo.getVehicleList(); List<FinPaymentapplyVehicleVo> vehicleList = vo.getVehicleList();
@ -1060,6 +1067,12 @@ public class FinPaymentapplyService extends MybatisBaseService<FinPaymentapplyMa
} }
Map<String, Object> map = BeanUtil.beanToMap(resultBean.getData()); Map<String, Object> map = BeanUtil.beanToMap(resultBean.getData());
updateFlowFiled(map); updateFlowFiled(map);
if ("004".equals(finPaymentapply.getCostTypeKey())){
List<FinPaymentapplyEveDetailsVo> finPaymentapplyEveDetailsVos = finPaymentapplyEveService.fetchByMainSid(query.getBusinessSid());
for (FinPaymentapplyEveDetailsVo finPaymentapplyEveDetailsVo : finPaymentapplyEveDetailsVos) {
finPaymentapplyDetailsBelowEveService.updateState(finPaymentapplyEveDetailsVo.getEveSid(),1);
}
}
return rb.success().setData(resultBean.getData()); return rb.success().setData(resultBean.getData());
} else { } else {
if (businessTaskId.equals(query.getTaskId())) { if (businessTaskId.equals(query.getTaskId())) {
@ -1071,6 +1084,12 @@ public class FinPaymentapplyService extends MybatisBaseService<FinPaymentapplyMa
} }
Map<String, Object> map = BeanUtil.beanToMap(resultBean.getData()); Map<String, Object> map = BeanUtil.beanToMap(resultBean.getData());
updateFlowFiled(map); updateFlowFiled(map);
if ("004".equals(finPaymentapply.getCostTypeKey())){
List<FinPaymentapplyEveDetailsVo> finPaymentapplyEveDetailsVos = finPaymentapplyEveService.fetchByMainSid(query.getBusinessSid());
for (FinPaymentapplyEveDetailsVo finPaymentapplyEveDetailsVo : finPaymentapplyEveDetailsVos) {
finPaymentapplyDetailsBelowEveService.updateState(finPaymentapplyEveDetailsVo.getEveSid(),1);
}
}
return rb.success().setData(resultBean.getData()); return rb.success().setData(resultBean.getData());
} }
} }

2
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapplydetailsbelow/FinPaymentapplyDetailsBelowMapper.java

@ -47,6 +47,4 @@ public interface FinPaymentapplyDetailsBelowMapper extends BaseMapper<FinPayment
@Update("update fin_paymentapply_details_below set openDate = #{openDate} where sid = #{sid}") @Update("update fin_paymentapply_details_below set openDate = #{openDate} where sid = #{sid}")
void updateOpenDate(@Param("sid") String sid, @Param("openDate") String openDate); void updateOpenDate(@Param("sid") String sid, @Param("openDate") String openDate);
BigDecimal fetchBzj(String eveSid);
} }

11
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapplydetailsbelow/FinPaymentapplyDetailsBelowMapper.xml

@ -23,15 +23,4 @@
WHERE db.costTitleKey = '015' WHERE db.costTitleKey = '015'
AND a.useOrgSid = #{useOrgSid} AND a.useOrgSid = #{useOrgSid}
</select> </select>
<select id="fetchBzj" resultType="java.math.BigDecimal">
SELECT
fb.payAccount
FROM
fin_paymentapply_details_below fb
LEFT JOIN fin_paymentapply_details_below_eve fe
ON fe.detailSid = fb.sid
WHERE fe.sid = #{eveSid}
AND fb.costTitleKey = '015'
</select>
</mapper> </mapper>

4
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapplydetailsbelow/FinPaymentapplyDetailsBelowService.java

@ -57,8 +57,4 @@ public class FinPaymentapplyDetailsBelowService extends MybatisBaseService<FinPa
public void updateOpenDate(String sid, String openDate) { public void updateOpenDate(String sid, String openDate) {
baseMapper.updateOpenDate(sid, openDate); baseMapper.updateOpenDate(sid, openDate);
} }
public BigDecimal fetchBzj(String eveSid) {
return baseMapper.fetchBzj(eveSid);
}
} }

10
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapplydetailsbeloweve/FinPaymentapplyDetailsBelowEveMapper.java

@ -35,6 +35,7 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import com.yxt.anrui.fin.api.finpaymentapplydetailsbeloweve.FinPaymentapplyDetailsBelowEve; import com.yxt.anrui.fin.api.finpaymentapplydetailsbeloweve.FinPaymentapplyDetailsBelowEve;
import com.yxt.anrui.fin.api.finpaymentapplydetailsbeloweve.FinPaymentapplyDetailsBelowEveVo; import com.yxt.anrui.fin.api.finpaymentapplydetailsbeloweve.FinPaymentapplyDetailsBelowEveVo;
import org.apache.ibatis.annotations.Update;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
@ -49,4 +50,13 @@ public interface FinPaymentapplyDetailsBelowEveMapper extends BaseMapper<FinPaym
@Select("SELECT SUM(exePayPrice) FROM fin_paymentapply_details_below_eve WHERE detailSid = #{detailSid}") @Select("SELECT SUM(exePayPrice) FROM fin_paymentapply_details_below_eve WHERE detailSid = #{detailSid}")
BigDecimal selExePayByMainSid(String detailSid); BigDecimal selExePayByMainSid(String detailSid);
@Update("update fin_paymentapply_details_below_eve set state = #{state} where sid = #{eveSid}")
void updateState(@Param("eveSid") String eveSid,@Param("state") int state);
String fetchDetailsSid(String eveSid);
BigDecimal fetchExePriceTotal(String bzjSid);
List<String> fetchEveSidList(String bzjSid);
} }

22
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapplydetailsbeloweve/FinPaymentapplyDetailsBelowEveMapper.xml

@ -15,4 +15,26 @@
ON fe.useOrgSid = s.sid ON fe.useOrgSid = s.sid
<where> ${ew.sqlSegment} </where> <where> ${ew.sqlSegment} </where>
</select> </select>
<select id="fetchDetailsSid" resultType="java.lang.String">
SELECT
fe.detailSid
FROM
fin_paymentapply_details_below_eve fe
LEFT JOIN fin_paymentapply_eve pe
ON pe.eveSid = fe.sid
WHERE pe.eveSid = #{eveSid}
</select>
<select id="fetchExePriceTotal" resultType="java.math.BigDecimal">
SELECT
SUM(exePayPrice)
FROM
fin_paymentapply_details_below_eve
WHERE detailSid = #{bzjSid}
</select>
<select id="fetchEveSidList" resultType="java.lang.String">
SELECT sid FROM fin_paymentapply_details_below_eve WHERE detailSid = #{bzjSid}
</select>
</mapper> </mapper>

21
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapplydetailsbeloweve/FinPaymentapplyDetailsBelowEveService.java

@ -131,9 +131,8 @@ public class FinPaymentapplyDetailsBelowEveService extends MybatisBaseService<Fi
FinPaymentapplyDetailsBelowEveListQuery query = pq.getParams(); FinPaymentapplyDetailsBelowEveListQuery query = pq.getParams();
QueryWrapper<FinPaymentapplyDetailsBelowEve> qw = new QueryWrapper<>(); QueryWrapper<FinPaymentapplyDetailsBelowEve> qw = new QueryWrapper<>();
qw.eq("fe.useOrgSid", query.getUseOrgSid()); qw.eq("fe.useOrgSid", query.getUseOrgSid());
/*if (StringUtils.isNotBlank(query.getPayCompany())) { qw.eq("fe.payCompanySid", query.getPayCompanySid());
qw.like("fe.payCompany", query.getPayCompany()); qw.eq("fe.state", 1);
}*/
qw.orderByDesc("fe.createTime"); qw.orderByDesc("fe.createTime");
IPage<FinPaymentapplyDetailsBelowEve> page = PagerUtil.queryToPage(pq); IPage<FinPaymentapplyDetailsBelowEve> page = PagerUtil.queryToPage(pq);
IPage<FinPaymentapplyDetailsBelowEveVo> pagging = baseMapper.selectPageVo(page, qw); IPage<FinPaymentapplyDetailsBelowEveVo> pagging = baseMapper.selectPageVo(page, qw);
@ -180,4 +179,20 @@ public class FinPaymentapplyDetailsBelowEveService extends MybatisBaseService<Fi
public BigDecimal selExePayByMainSid(String detailSid) { public BigDecimal selExePayByMainSid(String detailSid) {
return baseMapper.selExePayByMainSid(detailSid); return baseMapper.selExePayByMainSid(detailSid);
} }
public void updateState(String eveSid, int state) {
baseMapper.updateState(eveSid,state);
}
public String fetchDetailsSid(String eveSid) {
return baseMapper.fetchDetailsSid(eveSid);
}
public BigDecimal fetchExePriceTotal(String bzjSid) {
return baseMapper.fetchExePriceTotal(bzjSid);
}
public List<String> fetchEveSidList(String bzjSid) {
return baseMapper.fetchEveSidList(bzjSid);
}
} }

3
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapplyeve/FinPaymentapplyEveMapper.java

@ -30,6 +30,7 @@ import com.yxt.anrui.fin.api.finpaymentapplyeve.FinPaymentapplyEveDetailsVo;
import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import com.yxt.anrui.fin.api.finpaymentapplyeve.FinPaymentapplyEve; import com.yxt.anrui.fin.api.finpaymentapplyeve.FinPaymentapplyEve;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -46,4 +47,6 @@ public interface FinPaymentapplyEveMapper extends BaseMapper<FinPaymentapplyEve>
@Select("SELECT SUM(exePayPrice) FROM fin_paymentapply_eve WHERE applySid = #{applySid}") @Select("SELECT SUM(exePayPrice) FROM fin_paymentapply_eve WHERE applySid = #{applySid}")
BigDecimal fetchExePriceByMainSid(String applySid); BigDecimal fetchExePriceByMainSid(String applySid);
List<String> selPayEveSidList(@Param("eveSidList") List<String> eveSidList);
} }

7
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapplyeve/FinPaymentapplyEveMapper.xml

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yxt.anrui.fin.biz.finpaymentapplyeve.FinPaymentapplyEveMapper"> <mapper namespace="com.yxt.anrui.fin.biz.finpaymentapplyeve.FinPaymentapplyEveMapper">
<select id="selPayEveSidList" resultType="java.lang.String">
SELECT sid FROM fin_paymentapply_eve WHERE eveSid IN
<foreach collection="eveSidList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper> </mapper>

4
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentapplyeve/FinPaymentapplyEveService.java

@ -56,4 +56,8 @@ public class FinPaymentapplyEveService extends MybatisBaseService<FinPaymentappl
public BigDecimal fetchExePriceByMainSid(String applySid) { public BigDecimal fetchExePriceByMainSid(String applySid) {
return baseMapper.fetchExePriceByMainSid(applySid); return baseMapper.fetchExePriceByMainSid(applySid);
} }
public List<String> selPayEveSidList(List<String> eveSidList) {
return baseMapper.selPayEveSidList(eveSidList);
}
} }

3
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentrecord/FinPaymentrecordMapper.java

@ -34,7 +34,6 @@ import com.yxt.anrui.fin.api.finpaymentrecord.FinPaymentrecordVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
@ -56,5 +55,5 @@ public interface FinPaymentrecordMapper extends BaseMapper<FinPaymentrecord> {
String selectBatchNum(@Param("s") String s); String selectBatchNum(@Param("s") String s);
BigDecimal selPayPrice(String applySid); BigDecimal selPayPriceTotal(@Param("payEveSidList") List<String> payEveSidList);
} }

11
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentrecord/FinPaymentrecordMapper.xml

@ -67,6 +67,7 @@
#{item} #{item}
</foreach> </foreach>
</select> </select>
<select id="selectBatchNum" resultType="java.lang.String"> <select id="selectBatchNum" resultType="java.lang.String">
select RIGHT (batchNumber, 4) select RIGHT (batchNumber, 4)
from fin_paymentrecord from fin_paymentrecord
@ -75,11 +76,13 @@
limit 1 limit 1
</select> </select>
<select id="selPayPrice" resultType="java.math.BigDecimal"> <select id="selPayPriceTotal" resultType="java.math.BigDecimal">
SELECT SUM(cost) SELECT SUM(cost)
FROM fin_paymentrecord FROM fin_paymentrecord
WHERE applySid = #{applySid} WHERE state = 2
AND state = 2 AND busSid IN
AND (costTitleKey = '' OR costTitleKey IS NULL) <foreach collection="payEveSidList" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select> </select>
</mapper> </mapper>

21
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finpaymentrecord/FinPaymentrecordService.java

@ -1695,14 +1695,27 @@ public class FinPaymentrecordService extends MybatisBaseService<FinPaymentrecord
} else if (StringUtils.isBlank(finPaymentrecord.getCostTitleKey())) {//平仓款 } else if (StringUtils.isBlank(finPaymentrecord.getCostTitleKey())) {//平仓款
//查询平仓总付款金额 //查询平仓总付款金额
FinPaymentapplyEve finPaymentapplyEve = finPaymentapplyEveService.fetchBySid(finPaymentrecord.getBusSid()); FinPaymentapplyEve finPaymentapplyEve = finPaymentapplyEveService.fetchBySid(finPaymentrecord.getBusSid());
BigDecimal exePayPriceTotal = finPaymentapplyEveService.fetchExePriceByMainSid(finPaymentapplyEve.getApplySid()); //查询银行保证金sid
String bzjSid = finPaymentapplyDetailsBelowEveService.fetchDetailsSid(finPaymentapplyEve.getEveSid());
//通过银行保证金查询关联平仓款总额
BigDecimal exePayPriceTotal = finPaymentapplyDetailsBelowEveService.fetchExePriceTotal(bzjSid);
if (exePayPriceTotal == null){
exePayPriceTotal = BigDecimal.ZERO;
}
//查询保证金 //查询保证金
BigDecimal bzj = finPaymentapplyDetailsBelowService.fetchBzj(finPaymentapplyEve.getEveSid()); BigDecimal bzj = finPaymentapplyDetailsBelowService.fetchBySid(bzjSid).getPayAccount();
if (bzj == null){ if (bzj == null){
bzj = BigDecimal.ZERO; bzj = BigDecimal.ZERO;
} }
//查询银行保证金下的平仓sid
List<String> eveSidList = finPaymentapplyDetailsBelowEveService.fetchEveSidList(bzjSid);
//查询融资付款平仓sid
List<String> payEveSidList = finPaymentapplyEveService.selPayEveSidList(eveSidList);
//查询已付款平仓款金额 //查询已付款平仓款金额
BigDecimal payPriceTotal = baseMapper.selPayPrice(finPaymentrecord.getApplySid()); BigDecimal payPriceTotal = baseMapper.selPayPriceTotal(payEveSidList);
if (payPriceTotal == null){
payPriceTotal = BigDecimal.ZERO;
}
if (payPriceTotal.compareTo(exePayPriceTotal) == -1) { if (payPriceTotal.compareTo(exePayPriceTotal) == -1) {
//借方 //借方
voucherResultDetailDtoJF.setSummary("还" + finPaymentrecord.getCostTitleValue() + finPaymentapplyEve.getOpenDate()); voucherResultDetailDtoJF.setSummary("还" + finPaymentrecord.getCostTitleValue() + finPaymentapplyEve.getOpenDate());
@ -1733,7 +1746,7 @@ public class FinPaymentrecordService extends MybatisBaseService<FinPaymentrecord
voucherResultDetailDtoDf.setSubjectNo("1009.03"); voucherResultDetailDtoDf.setSubjectNo("1009.03");
voucherResultDetailDtoDf.setDimensionDept(deptVo.getOrgCode()); voucherResultDetailDtoDf.setDimensionDept(deptVo.getOrgCode());
voucherResultDetailDtoDf.setBank(key); voucherResultDetailDtoDf.setBank(key);
voucherResultDetailDtoDf.setCredit(payPriceTotal.add(bzj).subtract(finPaymentrecord.getCost()).toString()); voucherResultDetailDtoDf.setCredit(exePayPriceTotal.add(bzj).subtract(finPaymentrecord.getCost()).toString());
voucherResultDetailDtos.add(voucherResultDetailDtoDf); voucherResultDetailDtos.add(voucherResultDetailDtoDf);
//贷方2 //贷方2
voucherResultDetailDtoDf2.setSummary("还" + finPaymentrecord.getCostTitleValue() + finPaymentapplyEve.getOpenDate()); voucherResultDetailDtoDf2.setSummary("还" + finPaymentrecord.getCostTitleValue() + finPaymentapplyEve.getOpenDate());

Loading…
Cancel
Save