|
@ -31,21 +31,33 @@ 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.as.api.asbillsettelapply.*; |
|
|
import com.yxt.anrui.as.api.asbillsettelapply.flow.*; |
|
|
import com.yxt.anrui.as.api.asbillsettelapply.flow.*; |
|
|
import com.yxt.anrui.as.api.asbillsettelapply.flow.app.AppSettleDelegateQuery; |
|
|
import com.yxt.anrui.as.api.asbillsettelapply.flow.app.AppSettleDelegateQuery; |
|
|
import com.yxt.anrui.as.api.asbillsettelapply.flow.app.AppSettleTaskQuery; |
|
|
import com.yxt.anrui.as.api.asbillsettelapply.flow.app.AppSettleTaskQuery; |
|
|
import com.yxt.anrui.as.api.asbillsettelapply.flow.app.CompleteSettleDto; |
|
|
import com.yxt.anrui.as.api.asbillsettelapply.flow.app.CompleteSettleDto; |
|
|
import com.yxt.anrui.as.api.asbillsettelapply.flow.app.SettleFlowableQuery; |
|
|
import com.yxt.anrui.as.api.asbillsettelapply.flow.app.SettleFlowableQuery; |
|
|
|
|
|
import com.yxt.anrui.as.api.asbillsettelapplyaitem.AsBillSettelApplyAitem; |
|
|
|
|
|
import com.yxt.anrui.as.api.asbillsettelapplyaitemspec.AsBillSettelApplyAitemspec; |
|
|
|
|
|
import com.yxt.anrui.as.api.asbillsettelapplydetail.AsBillSettelApplyDetail; |
|
|
|
|
|
import com.yxt.anrui.as.api.asbillsettelapplysitem.AsBillSettelApplySitem; |
|
|
import com.yxt.anrui.as.api.asbusclaimcheckapply.AsBusclaimCheckApply; |
|
|
import com.yxt.anrui.as.api.asbusclaimcheckapply.AsBusclaimCheckApply; |
|
|
import com.yxt.anrui.as.api.asbusrepairbill.*; |
|
|
import com.yxt.anrui.as.api.asbusrepairbill.*; |
|
|
import com.yxt.anrui.as.api.asbusrepairbillnode.AsBusrepairBillNode; |
|
|
import com.yxt.anrui.as.api.asbusrepairbillnode.AsBusrepairBillNode; |
|
|
import com.yxt.anrui.as.api.asbusrepairbillreversesettle.*; |
|
|
import com.yxt.anrui.as.api.asbusrepairbillreversesettle.*; |
|
|
import com.yxt.anrui.as.api.asbusrepairbillreversesettle.flowable.*; |
|
|
import com.yxt.anrui.as.api.asbusrepairbillreversesettle.flowable.*; |
|
|
|
|
|
import com.yxt.anrui.as.api.asserviceattachitem.AsServiceAttachItem; |
|
|
import com.yxt.anrui.as.api.enums.AsBillTypeEnum; |
|
|
import com.yxt.anrui.as.api.enums.AsBillTypeEnum; |
|
|
import com.yxt.anrui.as.api.utils.AsRule; |
|
|
import com.yxt.anrui.as.api.utils.AsRule; |
|
|
|
|
|
import com.yxt.anrui.as.api.utils.FileUrlQuery; |
|
|
import com.yxt.anrui.as.api.utils.domain.AsBillNo; |
|
|
import com.yxt.anrui.as.api.utils.domain.AsBillNo; |
|
|
|
|
|
import com.yxt.anrui.as.biz.asbillsettelapplyaitem.AsBillSettelApplyAitemService; |
|
|
|
|
|
import com.yxt.anrui.as.biz.asbillsettelapplyaitemspec.AsBillSettelApplyAitemSpecService; |
|
|
|
|
|
import com.yxt.anrui.as.biz.asbillsettelapplydetail.AsBillSettelApplyDetailService; |
|
|
|
|
|
import com.yxt.anrui.as.biz.asbillsettelapplysitem.AsBillSettelApplySitemService; |
|
|
import com.yxt.anrui.as.biz.asbusrepairbill.AsBusrepairBillService; |
|
|
import com.yxt.anrui.as.biz.asbusrepairbill.AsBusrepairBillService; |
|
|
import com.yxt.anrui.as.biz.asbusrepairbillnode.AsBusrepairBillNodeService; |
|
|
import com.yxt.anrui.as.biz.asbusrepairbillnode.AsBusrepairBillNodeService; |
|
|
|
|
|
import com.yxt.anrui.as.biz.asserviceattachitem.AsServiceAttachItemService; |
|
|
import com.yxt.anrui.as.feign.flowable.flow.*; |
|
|
import com.yxt.anrui.as.feign.flowable.flow.*; |
|
|
import com.yxt.anrui.as.feign.flowable.flow2.FlowDelegateQuery; |
|
|
import com.yxt.anrui.as.feign.flowable.flow2.FlowDelegateQuery; |
|
|
import com.yxt.anrui.as.feign.flowable.flow2.FlowFeign; |
|
|
import com.yxt.anrui.as.feign.flowable.flow2.FlowFeign; |
|
@ -56,6 +68,7 @@ import com.yxt.anrui.as.feign.message.MessageFeign; |
|
|
import com.yxt.anrui.as.feign.message.MessageFlowVo; |
|
|
import com.yxt.anrui.as.feign.message.MessageFlowVo; |
|
|
import com.yxt.anrui.as.feign.message.MessageFlowableQuery; |
|
|
import com.yxt.anrui.as.feign.message.MessageFlowableQuery; |
|
|
import com.yxt.anrui.as.feign.portal.privilege.PrivilegeQuery; |
|
|
import com.yxt.anrui.as.feign.portal.privilege.PrivilegeQuery; |
|
|
|
|
|
import com.yxt.anrui.as.feign.portal.privilege.PrivilegeVo; |
|
|
import com.yxt.anrui.as.feign.portal.sysorganization.SysOrganizationFeign; |
|
|
import com.yxt.anrui.as.feign.portal.sysorganization.SysOrganizationFeign; |
|
|
import com.yxt.anrui.as.feign.portal.sysorganization.SysOrganizationVo; |
|
|
import com.yxt.anrui.as.feign.portal.sysorganization.SysOrganizationVo; |
|
|
import com.yxt.anrui.as.feign.portal.sysstafforg.SysStaffOrg; |
|
|
import com.yxt.anrui.as.feign.portal.sysstafforg.SysStaffOrg; |
|
@ -63,6 +76,12 @@ import com.yxt.anrui.as.feign.portal.sysstafforg.SysStaffOrgFeign; |
|
|
import com.yxt.anrui.as.feign.portal.sysuser.SysUserFeign; |
|
|
import com.yxt.anrui.as.feign.portal.sysuser.SysUserFeign; |
|
|
import com.yxt.anrui.as.feign.portal.sysuser.SysUserVo; |
|
|
import com.yxt.anrui.as.feign.portal.sysuser.SysUserVo; |
|
|
import com.yxt.anrui.as.feign.portal.sysuserrole.SysUserRoleFeign; |
|
|
import com.yxt.anrui.as.feign.portal.sysuserrole.SysUserRoleFeign; |
|
|
|
|
|
import com.yxt.anrui.as.feign.sms.smssalesbill.SalesGoodsVo; |
|
|
|
|
|
import com.yxt.anrui.as.feign.sms.smssalesbill.SalesInvoiceVo; |
|
|
|
|
|
import com.yxt.anrui.as.feign.sms.smssalesbill.SmsAttachitemVo; |
|
|
|
|
|
import com.yxt.anrui.as.feign.sms.smssalesbill.SmsSalesBillDetailsVo; |
|
|
|
|
|
import com.yxt.anrui.as.feign.wms.wmsInventory.WmsInventory; |
|
|
|
|
|
import com.yxt.anrui.as.feign.wms.wmsInventory.WmsInventoryFeign; |
|
|
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; |
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
@ -73,6 +92,7 @@ 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.math.BigDecimal; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@ -91,6 +111,19 @@ import java.util.stream.Collectors; |
|
|
*/ |
|
|
*/ |
|
|
@Service |
|
|
@Service |
|
|
public class AsBusrepairBillReverseSettleService extends MybatisBaseService<AsBusrepairBillReverseSettleMapper, AsBusrepairBillReverseSettle> { |
|
|
public class AsBusrepairBillReverseSettleService extends MybatisBaseService<AsBusrepairBillReverseSettleMapper, AsBusrepairBillReverseSettle> { |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private AsBillSettelApplyAitemService asBillSettelApplyAitemService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private AsBillSettelApplyAitemSpecService asBillSettelApplyAitemSpecService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private AsBillSettelApplySitemService asBillSettelApplySitemService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private AsBillSettelApplyDetailService asBillSettelApplyDetailService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private AsServiceAttachItemService asServiceAttachItemService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private WmsInventoryFeign wmsInventoryFeign; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private SysOrganizationFeign sysOrganizationFeign; |
|
|
private SysOrganizationFeign sysOrganizationFeign; |
|
|
@Autowired |
|
|
@Autowired |
|
@ -231,101 +264,407 @@ public class AsBusrepairBillReverseSettleService extends MybatisBaseService<AsBu |
|
|
baseMapper.updateById(entity); |
|
|
baseMapper.updateById(entity); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public AsBusrepairBillReverseSettleDetailsVo fetchDetailsVoBySid(String sid) { |
|
|
public AsBillSettelApplyDetailsVo fetchDetailsVoBySid(String sid) { |
|
|
AsBusrepairBillReverseSettleDetailsVo vo = new AsBusrepairBillReverseSettleDetailsVo(); |
|
|
AsBillSettelApplyDetailsVo vo = new AsBillSettelApplyDetailsVo(); |
|
|
AsBusrepairBillReverseSettle entity = fetchBySid(sid); |
|
|
AsBusrepairBillReverseSettle entity = fetchBySid(sid); |
|
|
if (null != entity) { |
|
|
if (null != entity) { |
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
vo.setUseSid(entity.getCreateBySid()); |
|
|
vo.setApplyDate(DateUtil.formatDate(entity.getCreateTime())); |
|
|
vo.setApplyDate(DateUtil.formatDate(entity.getApplyDate())); |
|
|
|
|
|
if (StringUtils.isNotBlank(entity.getProcInstId())) { |
|
|
if (StringUtils.isNotBlank(entity.getProcInstId())) { |
|
|
vo.setInstanceId(entity.getProcInstId()); |
|
|
|
|
|
vo.setProcInsId(entity.getProcInstId()); |
|
|
vo.setProcInsId(entity.getProcInstId()); |
|
|
|
|
|
vo.setInstanceId(entity.getProcInstId()); |
|
|
} |
|
|
} |
|
|
if (StringUtils.isNotBlank(entity.getSourceSid())) { |
|
|
String sourceSid = entity.getSourceSid(); |
|
|
AsBusrepairBillDetailsVo bill = asBusrepairBillService.fetchDetailsBySid(entity.getSourceSid()).getData(); |
|
|
AsBusrepairBillDetailsVo data = asBusrepairBillService.fetchDetailsBySid(entity.getSourceSid()).getData(); |
|
|
if (null != bill) { |
|
|
if (null != data) { |
|
|
BeanUtil.copyProperties(bill,vo,"id","sid","billNo","useOrgSid","createBySid","createOrgSid","orgPath"); |
|
|
vo.setSourceSid(data.getSid()); |
|
|
if (bill.getInvoiceVo() != null) { |
|
|
vo.setCustomerSid(data.getCustomerSid()); |
|
|
if (StringUtils.isNotBlank(bill.getInvoiceVo().getTaxRate())) { |
|
|
vo.setCustomerName(data.getCustomerName()); |
|
|
vo.setTaxRate(bill.getInvoiceVo().getTaxRate()); |
|
|
vo.setSourceBillNo(data.getBillNo()); |
|
|
} |
|
|
vo.setSourceBillDate(data.getCreateDate()); |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getWaitorName())) { |
|
|
|
|
|
vo.setWaitorName(data.getWaitorName()); |
|
|
} |
|
|
} |
|
|
|
|
|
vo.setBillType(data.getBillType()); |
|
|
if (StringUtils.isNotBlank(bill.getDiscountAmount())) { |
|
|
vo.setSubject(data.getSubject()); |
|
|
vo.setDiscountAmount(bill.getDiscountAmount()); |
|
|
vo.setIsGoOut(data.getIsGoOut()); |
|
|
|
|
|
vo.setIsGoOut2(data.getIsGoOut2()); |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getMobile())) { |
|
|
|
|
|
vo.setMobile(data.getMobile()); |
|
|
} |
|
|
} |
|
|
if (StringUtils.isNotBlank(bill.getCoupon())) { |
|
|
if (StringUtils.isNotBlank(data.getVinNo())) { |
|
|
vo.setCoupon(bill.getCoupon()); |
|
|
vo.setVinNo(data.getVinNo()); |
|
|
} |
|
|
} |
|
|
if (StringUtils.isNotBlank(bill.getScoreDeduct())) { |
|
|
if (StringUtils.isNotBlank(data.getVehMark())) { |
|
|
vo.setScoreDeduct(bill.getScoreDeduct()); |
|
|
vo.setVehMark(data.getVehMark()); |
|
|
} |
|
|
} |
|
|
if (StringUtils.isNotBlank(bill.getBillNo())) { |
|
|
InvoiceVo invoiceVo = data.getInvoiceVo(); |
|
|
vo.setSourceBillNo(bill.getBillNo()); |
|
|
if (null != invoiceVo) { |
|
|
|
|
|
if (StringUtils.isNotBlank(invoiceVo.getIsInvoicing())) { |
|
|
|
|
|
vo.setIsInvoicing(invoiceVo.getIsInvoicing()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(invoiceVo.getIsInvoicing2())) { |
|
|
|
|
|
vo.setIsInvoicing2(invoiceVo.getIsInvoicing2()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(invoiceVo.getTaxRate())) { |
|
|
|
|
|
vo.setTaxRate(invoiceVo.getTaxRate()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(invoiceVo.getTaxItems2())) { |
|
|
|
|
|
vo.setTaxItems(invoiceVo.getTaxItems2()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
if (StringUtils.isNotBlank(bill.getCreateDate())) { |
|
|
List<FileUrlQuery> fileName = data.getFileName(); |
|
|
vo.setSourceBillDate(bill.getCreateDate()); |
|
|
if (!fileName.isEmpty()) { |
|
|
|
|
|
vo.setFileName(fileName); |
|
|
|
|
|
List<String> files = new ArrayList<>(); |
|
|
|
|
|
for (FileUrlQuery fileUrlQuery : fileName) { |
|
|
|
|
|
files.add(fileUrlQuery.getUrl()); |
|
|
|
|
|
} |
|
|
|
|
|
vo.setFileName2(files); |
|
|
} |
|
|
} |
|
|
if (StringUtils.isNotBlank(bill.getWaitorName())) { |
|
|
List<SettleAitemVo> aitemVos = new ArrayList<>(); |
|
|
vo.setWaitorName(bill.getWaitorName()); |
|
|
List<SettleGoodsDetailsVo> goodsDetailsVos = new ArrayList<>(); |
|
|
|
|
|
List<SettleSitemVo> sitemVos = new ArrayList<>(); |
|
|
|
|
|
List<AsBillSettelApplyAitem> applyAitems = asBillSettelApplyAitemService.fetchByBillSid(sid); |
|
|
|
|
|
if (!applyAitems.isEmpty() && applyAitems.size() > 0) { |
|
|
|
|
|
for (AsBillSettelApplyAitem c : applyAitems) { |
|
|
|
|
|
SettleAitemVo e = new SettleAitemVo(); |
|
|
|
|
|
BeanUtil.copyProperties(c, e); |
|
|
|
|
|
aitemVos.add(e); |
|
|
|
|
|
} |
|
|
|
|
|
vo.setAitemVos(aitemVos); |
|
|
} |
|
|
} |
|
|
if (StringUtils.isNotBlank(bill.getBillType())) { |
|
|
List<AsBillSettelApplySitem> sitems = asBillSettelApplySitemService.fetchByBillSid(sid); |
|
|
vo.setBillType(bill.getBillType()); |
|
|
if (!sitems.isEmpty() && sitems.size() > 0) { |
|
|
|
|
|
for (AsBillSettelApplySitem c : sitems) { |
|
|
|
|
|
SettleSitemVo e = new SettleSitemVo(); |
|
|
|
|
|
BeanUtil.copyProperties(c, e); |
|
|
|
|
|
sitemVos.add(e); |
|
|
|
|
|
} |
|
|
|
|
|
vo.setSitemVos(sitemVos); |
|
|
} |
|
|
} |
|
|
if (StringUtils.isNotBlank(bill.getSubject())) { |
|
|
List<AsBillSettelApplyDetail> goods = asBillSettelApplyDetailService.fetchByBillSid(sid); |
|
|
vo.setSubject(bill.getSubject()); |
|
|
if (!goods.isEmpty() && goods.size() > 0) { |
|
|
|
|
|
for (AsBillSettelApplyDetail c : goods) { |
|
|
|
|
|
SettleGoodsDetailsVo e = new SettleGoodsDetailsVo(); |
|
|
|
|
|
BeanUtil.copyProperties(c, e); |
|
|
|
|
|
goodsDetailsVos.add(e); |
|
|
|
|
|
} |
|
|
|
|
|
vo.setGoodsDetailsVos(goodsDetailsVos); |
|
|
} |
|
|
} |
|
|
if (null != bill.getSettleVo()) { |
|
|
List<AsBillSettelApplyAitemspec> specs = asBillSettelApplyAitemSpecService.fetchByBillSid(sid); |
|
|
SettleVo settleVo = bill.getSettleVo(); |
|
|
if (!specs.isEmpty() && specs.size() > 0) { |
|
|
if (StringUtils.isNotBlank(settleVo.getSettleTime())) { |
|
|
for (AsBillSettelApplyAitemspec c : specs) { |
|
|
vo.setSettleDate(settleVo.getSettleTime()); |
|
|
if (c.getAttachItem().equals("外出费")) { |
|
|
|
|
|
if (null != c.getPrice()) { |
|
|
|
|
|
vo.setOutAmount(c.getPrice().toString()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(c.getRemarks())) { |
|
|
|
|
|
vo.setOutRemarks(c.getRemarks()); |
|
|
|
|
|
} |
|
|
|
|
|
if (null != c.getCostTotal()) { |
|
|
|
|
|
vo.setOutCost(c.getCostTotal().toString()); |
|
|
|
|
|
} |
|
|
|
|
|
if (null != c.getTaxPrice()) { |
|
|
|
|
|
vo.setOutKPAmount(c.getTaxPrice().toString()); |
|
|
|
|
|
} |
|
|
|
|
|
if (null != c.getPrint()) { |
|
|
|
|
|
vo.setOutPrint(c.getPrint().toString()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (c.getAttachItem().equals("厂家补助")) { |
|
|
|
|
|
if (null != c.getPrice()) { |
|
|
|
|
|
vo.setSubsidyAmount(c.getPrice().toString()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(c.getRemarks())) { |
|
|
|
|
|
vo.setSubsidyRemarks(c.getRemarks()); |
|
|
|
|
|
} |
|
|
|
|
|
if (null != c.getCostTotal()) { |
|
|
|
|
|
vo.setSubsidyCost(c.getCostTotal().toString()); |
|
|
|
|
|
} |
|
|
|
|
|
if (null != c.getTaxPrice()) { |
|
|
|
|
|
vo.setSubsidyKPAmount(c.getTaxPrice().toString()); |
|
|
|
|
|
} |
|
|
|
|
|
if (null != c.getPrint()) { |
|
|
|
|
|
vo.setSubsidyPrint(c.getPrint().toString()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (c.getAttachItem().equals("施救费")) { |
|
|
|
|
|
if (null != c.getPrice()) { |
|
|
|
|
|
vo.setRescueAmount(c.getPrice().toString()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(c.getRemarks())) { |
|
|
|
|
|
vo.setRescueRemarks(c.getRemarks()); |
|
|
|
|
|
} |
|
|
|
|
|
if (null != c.getCostTotal()) { |
|
|
|
|
|
vo.setRescueCost(c.getCostTotal().toString()); |
|
|
|
|
|
} |
|
|
|
|
|
if (null != c.getTaxPrice()) { |
|
|
|
|
|
vo.setRescueKPAmount(c.getTaxPrice().toString()); |
|
|
|
|
|
} |
|
|
|
|
|
if (null != c.getPrint()) { |
|
|
|
|
|
vo.setRescuePrint(c.getPrint().toString()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (StringUtils.isNotBlank(bill.getCustomerName())) { |
|
|
} |
|
|
vo.setCustomerName(bill.getCustomerName()); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return vo; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public AsBillSettelApplyDetailsVo reverseSettleInit(ReverseSettleInitQuery query) { |
|
|
|
|
|
AsBillSettelApplyDetailsVo vo = new AsBillSettelApplyDetailsVo(); |
|
|
|
|
|
AsBusrepairBillDetailsVo data = asBusrepairBillService.fetchDetailsBySid(query.getSid()).getData(); |
|
|
|
|
|
if (null != data) { |
|
|
|
|
|
vo.setSourceSid(data.getSid()); |
|
|
|
|
|
vo.setCustomerSid(data.getCustomerSid()); |
|
|
|
|
|
vo.setCustomerName(data.getCustomerName()); |
|
|
|
|
|
vo.setSourceBillNo(data.getBillNo()); |
|
|
|
|
|
vo.setSourceBillDate(data.getCreateDate()); |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getWaitorName())) { |
|
|
|
|
|
vo.setWaitorName(data.getWaitorName()); |
|
|
|
|
|
} |
|
|
|
|
|
vo.setBillType(data.getBillType()); |
|
|
|
|
|
vo.setSubject(data.getSubject()); |
|
|
|
|
|
vo.setIsGoOut(data.getIsGoOut()); |
|
|
|
|
|
vo.setIsGoOut2(data.getIsGoOut2()); |
|
|
|
|
|
BigDecimal yingshouZ = BigDecimal.ZERO; |
|
|
|
|
|
BigDecimal youhuiZ = BigDecimal.ZERO; |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getDiscountAmount())) { |
|
|
|
|
|
vo.setDiscountAmount(data.getDiscountAmount()); |
|
|
|
|
|
youhuiZ = new BigDecimal(data.getDiscountAmount()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getReceivableAmount())) { |
|
|
|
|
|
vo.setReceivableAmount(data.getReceivableAmount()); |
|
|
|
|
|
yingshouZ = new BigDecimal(data.getReceivableAmount()); |
|
|
|
|
|
} |
|
|
|
|
|
vo.setActualAmount(yingshouZ.subtract(youhuiZ).toString()); |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getMobile())) { |
|
|
|
|
|
vo.setMobile(data.getMobile()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getVinNo())) { |
|
|
|
|
|
vo.setVinNo(data.getVinNo()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getVehMark())) { |
|
|
|
|
|
vo.setVehMark(data.getVehMark()); |
|
|
|
|
|
} |
|
|
|
|
|
InvoiceVo invoiceVo = data.getInvoiceVo(); |
|
|
|
|
|
if (null != invoiceVo) { |
|
|
|
|
|
if (StringUtils.isNotBlank(invoiceVo.getIsInvoicing())) { |
|
|
|
|
|
vo.setIsInvoicing(invoiceVo.getIsInvoicing()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(invoiceVo.getIsInvoicing2())) { |
|
|
|
|
|
vo.setIsInvoicing2(invoiceVo.getIsInvoicing2()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(invoiceVo.getTaxRate())) { |
|
|
|
|
|
vo.setTaxRate(invoiceVo.getTaxRate()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(invoiceVo.getTaxItems2())) { |
|
|
|
|
|
vo.setTaxItems(invoiceVo.getTaxItems2()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getOutRemarks())) { |
|
|
|
|
|
vo.setOutRemarks(data.getOutRemarks()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getSubsidyRemarks())) { |
|
|
|
|
|
vo.setSubsidyRemarks(data.getSubsidyRemarks()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getRescueRemarks())) { |
|
|
|
|
|
vo.setRescueRemarks(data.getRescueRemarks()); |
|
|
|
|
|
} |
|
|
|
|
|
BigDecimal costAmount = BigDecimal.ZERO;//成本合计
|
|
|
|
|
|
BigDecimal profit = BigDecimal.ZERO;//总利润额
|
|
|
|
|
|
BigDecimal outAmount = BigDecimal.ZERO;//外出费
|
|
|
|
|
|
BigDecimal subsidyAmount = BigDecimal.ZERO;//厂家补助
|
|
|
|
|
|
BigDecimal rescueAmount = BigDecimal.ZERO;//施救费
|
|
|
|
|
|
BigDecimal outKPAmount = BigDecimal.ZERO;//外出费KP
|
|
|
|
|
|
BigDecimal subsidyKPAmount = BigDecimal.ZERO;//厂家补助KP
|
|
|
|
|
|
BigDecimal rescueKPAmount = BigDecimal.ZERO;//施救费KP
|
|
|
|
|
|
// BigDecimal sitemProfit = BigDecimal.ZERO;//维修项目利润
|
|
|
|
|
|
// BigDecimal goodsProfit = BigDecimal.ZERO;//维修用料利润
|
|
|
|
|
|
// BigDecimal otherProfit = BigDecimal.ZERO;//附件项目利润
|
|
|
|
|
|
// BigDecimal addProfit = BigDecimal.ZERO;//其他附加项目利润
|
|
|
|
|
|
if (StringUtils.isNotBlank(data.getHourAmount())) { |
|
|
|
|
|
vo.setHourAmount(data.getHourAmount()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getGoodsAmount())) { |
|
|
|
|
|
vo.setGoodsAmount(data.getGoodsAmount()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getAddAmount())) { |
|
|
|
|
|
vo.setAddAmount(data.getAddAmount()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getDiscountAmount())) { |
|
|
|
|
|
vo.setDiscountAmount(data.getDiscountAmount()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getOutAmount())) { |
|
|
|
|
|
vo.setOutAmount(data.getOutAmount()); |
|
|
|
|
|
outAmount = new BigDecimal(data.getOutAmount()); |
|
|
|
|
|
vo.setOutPrint(data.getOutAmount()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getOutKPAmount())) { |
|
|
|
|
|
vo.setOutKPAmount(data.getOutKPAmount()); |
|
|
|
|
|
outKPAmount = new BigDecimal(data.getOutKPAmount()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getSubsidyAmount())) { |
|
|
|
|
|
vo.setSubsidyAmount(data.getSubsidyAmount()); |
|
|
|
|
|
subsidyAmount = new BigDecimal(data.getSubsidyAmount()); |
|
|
|
|
|
vo.setSubsidyPrint(data.getSubsidyAmount()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(data.getSubsidyKPAmount())) { |
|
|
|
|
|
vo.setSubsidyKPAmount(data.getSubsidyKPAmount()); |
|
|
|
|
|
subsidyKPAmount = new BigDecimal(data.getSubsidyKPAmount()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getRescueAmount())) { |
|
|
|
|
|
vo.setRescueAmount(data.getRescueAmount()); |
|
|
|
|
|
rescueAmount = new BigDecimal(data.getRescueAmount()); |
|
|
|
|
|
vo.setRescuePrint(data.getRescueAmount()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getRescueKPAmount())) { |
|
|
|
|
|
vo.setRescueKPAmount(data.getRescueKPAmount()); |
|
|
|
|
|
rescueKPAmount = new BigDecimal(data.getRescueKPAmount()); |
|
|
|
|
|
} |
|
|
|
|
|
List<SitemVo> sitemVos = data.getSitemVos(); |
|
|
|
|
|
if (!sitemVos.isEmpty()) { |
|
|
|
|
|
List<SettleSitemVo> settleSitemVos = new ArrayList<>(); |
|
|
|
|
|
for (SitemVo s : sitemVos) { |
|
|
|
|
|
SettleSitemVo v = new SettleSitemVo(); |
|
|
|
|
|
BeanUtil.copyProperties(s, v); |
|
|
|
|
|
BigDecimal yingshou = BigDecimal.ZERO; //应收
|
|
|
|
|
|
BigDecimal youhui = BigDecimal.ZERO; //优惠
|
|
|
|
|
|
BigDecimal jiesuan = BigDecimal.ZERO; //结算
|
|
|
|
|
|
BigDecimal chengben = BigDecimal.ZERO; //成本
|
|
|
|
|
|
BigDecimal lirun = BigDecimal.ZERO; //利润
|
|
|
|
|
|
if (StringUtils.isNotBlank(s.getAmount())) { |
|
|
|
|
|
yingshou = new BigDecimal(s.getAmount()); |
|
|
|
|
|
v.setSitemReceivableAmount(yingshou.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(s.getDiscountAmount())) { |
|
|
|
|
|
youhui = new BigDecimal(s.getDiscountAmount()); |
|
|
} |
|
|
} |
|
|
if (StringUtils.isNotBlank(bill.getMobile())) { |
|
|
jiesuan = yingshou.subtract(youhui); |
|
|
vo.setMobile(bill.getMobile()); |
|
|
v.setSitemSettleAmount(jiesuan.toString()); |
|
|
|
|
|
if (StringUtils.isNotBlank(s.getCostTotal())) { |
|
|
|
|
|
chengben = new BigDecimal(s.getCostTotal()); |
|
|
} |
|
|
} |
|
|
if (StringUtils.isNotBlank(bill.getVinNo())) { |
|
|
v.setSitemCost(chengben.toString()); |
|
|
vo.setVinNo(bill.getVinNo()); |
|
|
lirun = jiesuan.subtract(chengben); |
|
|
|
|
|
v.setSitemPrint(lirun.toString()); |
|
|
|
|
|
costAmount = costAmount.add(chengben); |
|
|
|
|
|
profit = profit.add(lirun); |
|
|
|
|
|
settleSitemVos.add(v); |
|
|
|
|
|
} |
|
|
|
|
|
vo.setSitemVos(settleSitemVos); |
|
|
|
|
|
} |
|
|
|
|
|
List<GoodsDetailsVo> goodsDetailsVos = data.getGoodsDetailsVos(); |
|
|
|
|
|
if (!goodsDetailsVos.isEmpty()) { |
|
|
|
|
|
List<SettleGoodsDetailsVo> goodsList = new ArrayList<>(); |
|
|
|
|
|
for (GoodsDetailsVo g : goodsDetailsVos) { |
|
|
|
|
|
SettleGoodsDetailsVo v = new SettleGoodsDetailsVo(); |
|
|
|
|
|
BeanUtil.copyProperties(g, v, "partsSellers"); |
|
|
|
|
|
if (StringUtils.isNotBlank(g.getPartsSellers2())) { |
|
|
|
|
|
v.setPartsSellers(g.getPartsSellers2()); |
|
|
} |
|
|
} |
|
|
if (StringUtils.isNotBlank(bill.getVehMark())) { |
|
|
BigDecimal yingshou = BigDecimal.ZERO; //应收
|
|
|
vo.setVehMark(bill.getVehMark()); |
|
|
BigDecimal youhui = BigDecimal.ZERO; //优惠
|
|
|
|
|
|
BigDecimal jiesuan = BigDecimal.ZERO; //结算
|
|
|
|
|
|
BigDecimal chengben = BigDecimal.ZERO; //成本
|
|
|
|
|
|
BigDecimal chengbenPrice = BigDecimal.ZERO; //成本单价
|
|
|
|
|
|
BigDecimal lirun = BigDecimal.ZERO; //利润
|
|
|
|
|
|
BigDecimal count = BigDecimal.ZERO; //数量
|
|
|
|
|
|
if (StringUtils.isNotBlank(g.getCount())) { |
|
|
|
|
|
count = new BigDecimal(g.getCount()); |
|
|
} |
|
|
} |
|
|
if (StringUtils.isNotBlank(bill.getCustomerOrg())) { |
|
|
if (StringUtils.isNotBlank(g.getPrice())) { |
|
|
vo.setCustomerOrg(bill.getCustomerOrg()); |
|
|
BigDecimal price = new BigDecimal(g.getPrice()); |
|
|
|
|
|
yingshou = price.multiply(count); |
|
|
|
|
|
v.setGoodsReceivableAmount(yingshou.toString()); |
|
|
} |
|
|
} |
|
|
if (!bill.getSitemVos().isEmpty()) { |
|
|
if (StringUtils.isNotBlank(g.getDiscountAmount())) { |
|
|
vo.setSitemVos(bill.getSitemVos()); |
|
|
youhui = new BigDecimal(g.getDiscountAmount()); |
|
|
} |
|
|
} |
|
|
if (!bill.getGoodsDetailsVos().isEmpty()) { |
|
|
jiesuan = yingshou.subtract(youhui); |
|
|
vo.setGoodsDetailsVos(bill.getGoodsDetailsVos()); |
|
|
v.setGoodsSettleAmount(jiesuan.toString()); |
|
|
|
|
|
//求成本
|
|
|
|
|
|
if (StringUtils.isNotBlank(g.getInventorySid())) { |
|
|
|
|
|
String inventorySid = g.getInventorySid(); |
|
|
|
|
|
WmsInventory inventory = wmsInventoryFeign.fetchEntityBySid(inventorySid).getData(); |
|
|
|
|
|
if (null != inventory) { |
|
|
|
|
|
if (null != inventory.getCost()) { |
|
|
|
|
|
chengbenPrice = inventory.getCost(); |
|
|
|
|
|
chengben = chengbenPrice.multiply(count); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
v.setGoodsCost(chengben.toString()); |
|
|
|
|
|
lirun = jiesuan.subtract(chengben); |
|
|
|
|
|
v.setGoodsPrint(lirun.toString()); |
|
|
|
|
|
costAmount = costAmount.add(chengben); |
|
|
|
|
|
profit = profit.add(lirun); |
|
|
|
|
|
goodsList.add(v); |
|
|
|
|
|
} |
|
|
|
|
|
vo.setGoodsDetailsVos(goodsList); |
|
|
|
|
|
} |
|
|
|
|
|
List<AitemVo> aitemVos = data.getAitemVos(); |
|
|
|
|
|
if (!aitemVos.isEmpty()) { |
|
|
|
|
|
List<SettleAitemVo> aitemVoList = new ArrayList<>(); |
|
|
|
|
|
for (AitemVo a : aitemVos) { |
|
|
|
|
|
SettleAitemVo v = new SettleAitemVo(); |
|
|
|
|
|
BeanUtil.copyProperties(a, v); |
|
|
|
|
|
BigDecimal yingshou = BigDecimal.ZERO; //应收
|
|
|
|
|
|
BigDecimal chengben = BigDecimal.ZERO; //成本
|
|
|
|
|
|
BigDecimal lirun = BigDecimal.ZERO; //利润
|
|
|
|
|
|
if (StringUtils.isNotBlank(a.getPrice())) { |
|
|
|
|
|
yingshou = new BigDecimal(a.getPrice()); |
|
|
|
|
|
v.setAitemReceivableAmount(yingshou.toString()); |
|
|
} |
|
|
} |
|
|
if (!bill.getAitemVos().isEmpty()) { |
|
|
//求成本
|
|
|
vo.setAitemVos(bill.getAitemVos()); |
|
|
if (StringUtils.isNotBlank(a.getAitemSid())) { |
|
|
|
|
|
String aitemsid = a.getAitemSid(); |
|
|
|
|
|
AsServiceAttachItem attachItem = asServiceAttachItemService.fetchBySid(aitemsid); |
|
|
|
|
|
if (null != attachItem) { |
|
|
|
|
|
if (null != attachItem.getCost()) { |
|
|
|
|
|
chengben = attachItem.getCost(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
v.setAitemCost(chengben.toString()); |
|
|
|
|
|
lirun = yingshou.subtract(chengben); |
|
|
|
|
|
v.setAitemPrint(lirun.toString()); |
|
|
|
|
|
costAmount = costAmount.add(chengben); |
|
|
|
|
|
profit = profit.add(lirun); |
|
|
|
|
|
aitemVoList.add(v); |
|
|
} |
|
|
} |
|
|
|
|
|
vo.setAitemVos(aitemVoList); |
|
|
|
|
|
} |
|
|
|
|
|
vo.setOutCost("0"); |
|
|
|
|
|
vo.setSubsidyCost("0"); |
|
|
|
|
|
vo.setRescueCost("0"); |
|
|
|
|
|
profit = profit.add(outAmount); |
|
|
|
|
|
profit = profit.add(subsidyAmount); |
|
|
|
|
|
profit = profit.add(rescueAmount); |
|
|
|
|
|
// vo.setProfit(profit.toString());
|
|
|
|
|
|
// vo.setCostAmount(costAmount.toString());
|
|
|
|
|
|
List<FileUrlQuery> fileName = data.getFileName(); |
|
|
|
|
|
if (!fileName.isEmpty()) { |
|
|
|
|
|
vo.setFileName(fileName); |
|
|
|
|
|
List<String> files = new ArrayList<>(); |
|
|
|
|
|
for (FileUrlQuery fileUrlQuery : fileName) { |
|
|
|
|
|
files.add(fileUrlQuery.getUrl()); |
|
|
|
|
|
} |
|
|
|
|
|
vo.setFileName2(files); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
return vo; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public AsBusrepairBillReverseSettleDetailsVo reverseSettleInit(ReverseSettleInitQuery query) { |
|
|
|
|
|
AsBusrepairBillReverseSettleDetailsVo vo = new AsBusrepairBillReverseSettleDetailsVo(); |
|
|
|
|
|
String sourceSid = query.getSid(); |
|
|
|
|
|
String orgPath = query.getOrgPath(); |
|
|
|
|
|
String userSid = query.getUserSid(); |
|
|
|
|
|
vo.setApplyDate(DateUtil.formatDate(new Date())); |
|
|
|
|
|
vo.setSourceSid(sourceSid); |
|
|
|
|
|
vo.setUseSid(userSid); |
|
|
|
|
|
vo.setOrgPath(orgPath); |
|
|
|
|
|
//根据用户查询发起人、发起部门、发起日期为当前日期
|
|
|
//根据用户查询发起人、发起部门、发起日期为当前日期
|
|
|
String deptName = ""; |
|
|
String deptName = ""; |
|
|
String deptSid = ""; |
|
|
String deptSid = ""; |
|
|
String useOrgSid = ""; |
|
|
String useOrgSid = ""; |
|
|
|
|
|
String orgPath = query.getOrgPath(); |
|
|
|
|
|
String userSid = query.getUserSid(); |
|
|
if (StringUtils.isNotBlank(orgPath)) { |
|
|
if (StringUtils.isNotBlank(orgPath)) { |
|
|
List<String> split = Arrays.asList(orgPath.split("/")); |
|
|
List<String> split = Arrays.asList(orgPath.split("/")); |
|
|
if (split.size() > 1) { |
|
|
if (split.size() > 1) { |
|
@ -347,78 +686,16 @@ public class AsBusrepairBillReverseSettleService extends MybatisBaseService<AsBu |
|
|
ResultBean<SysOrganizationVo> organizationResultBean = sysOrganizationFeign.fetchBySid(useOrgSid); |
|
|
ResultBean<SysOrganizationVo> organizationResultBean = sysOrganizationFeign.fetchBySid(useOrgSid); |
|
|
if (organizationResultBean.getData() != null) { |
|
|
if (organizationResultBean.getData() != null) { |
|
|
vo.setUseOrgName(organizationResultBean.getData().getName()); |
|
|
vo.setUseOrgName(organizationResultBean.getData().getName()); |
|
|
vo.setUseOrgSid(useOrgSid); |
|
|
|
|
|
} |
|
|
} |
|
|
//根据用户sid查询人员姓名
|
|
|
//根据用户sid查询人员姓名
|
|
|
ResultBean<SysUserVo> userVoResultBean = sysUserFeign.fetchBySid(userSid); |
|
|
ResultBean<SysUserVo> userVoResultBean = sysUserFeign.fetchBySid(userSid); |
|
|
if (userVoResultBean.getSuccess()) { |
|
|
|
|
|
vo.setCreateByName(userVoResultBean.getData().getName()); |
|
|
|
|
|
} |
|
|
|
|
|
vo.setDept(deptName); |
|
|
vo.setDept(deptName); |
|
|
vo.setDeptSid(deptSid); |
|
|
vo.setDeptSid(deptSid); |
|
|
AsBusrepairBillDetailsVo bill = asBusrepairBillService.fetchDetailsBySid(sourceSid).getData(); |
|
|
vo.setCreateByName(userVoResultBean.getData().getName()); |
|
|
if (null != bill) { |
|
|
vo.setApplyDate(DateUtil.today()); |
|
|
BeanUtil.copyProperties(bill,vo,"id","sid","billNo","useOrgSid","createBySid","createOrgSid","orgPath"); |
|
|
vo.setOrgPath(orgPath); |
|
|
if (bill.getInvoiceVo() != null) { |
|
|
vo.setCreateBySid(userSid); |
|
|
if (StringUtils.isNotBlank(bill.getInvoiceVo().getTaxRate())) { |
|
|
vo.setUseOrgSid(useOrgSid); |
|
|
vo.setTaxRate(bill.getInvoiceVo().getTaxRate()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(bill.getDiscountAmount())) { |
|
|
|
|
|
vo.setDiscountAmount(bill.getDiscountAmount()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(bill.getCoupon())) { |
|
|
|
|
|
vo.setCoupon(bill.getCoupon()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(bill.getScoreDeduct())) { |
|
|
|
|
|
vo.setScoreDeduct(bill.getScoreDeduct()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(bill.getBillNo())) { |
|
|
|
|
|
vo.setSourceBillNo(bill.getBillNo()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(bill.getCreateDate())) { |
|
|
|
|
|
vo.setSourceBillDate(bill.getCreateDate()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(bill.getWaitorName())) { |
|
|
|
|
|
vo.setWaitorName(bill.getWaitorName()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(bill.getBillType())) { |
|
|
|
|
|
vo.setBillType(bill.getBillType()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(bill.getSubject())) { |
|
|
|
|
|
vo.setSubject(bill.getSubject()); |
|
|
|
|
|
} |
|
|
|
|
|
if (null != bill.getSettleVo()) { |
|
|
|
|
|
SettleVo settleVo = bill.getSettleVo(); |
|
|
|
|
|
if (StringUtils.isNotBlank(settleVo.getSettleTime())) { |
|
|
|
|
|
vo.setSettleDate(settleVo.getSettleTime()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(bill.getCustomerName())) { |
|
|
|
|
|
vo.setCustomerName(bill.getCustomerName()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(bill.getMobile())) { |
|
|
|
|
|
vo.setMobile(bill.getMobile()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(bill.getVinNo())) { |
|
|
|
|
|
vo.setVinNo(bill.getVinNo()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(bill.getVehMark())) { |
|
|
|
|
|
vo.setVehMark(bill.getVehMark()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(bill.getCustomerOrg())) { |
|
|
|
|
|
vo.setCustomerOrg(bill.getCustomerOrg()); |
|
|
|
|
|
} |
|
|
|
|
|
if (!bill.getSitemVos().isEmpty()) { |
|
|
|
|
|
vo.setSitemVos(bill.getSitemVos()); |
|
|
|
|
|
} |
|
|
|
|
|
if (!bill.getGoodsDetailsVos().isEmpty()) { |
|
|
|
|
|
vo.setGoodsDetailsVos(bill.getGoodsDetailsVos()); |
|
|
|
|
|
} |
|
|
|
|
|
if (!bill.getAitemVos().isEmpty()) { |
|
|
|
|
|
vo.setAitemVos(bill.getAitemVos()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return vo; |
|
|
return vo; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -452,24 +729,154 @@ public class AsBusrepairBillReverseSettleService extends MybatisBaseService<AsBu |
|
|
return billNo; |
|
|
return billNo; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public String saveReverseSettle(AsBusrepairBillReverseSettleDto dto) { |
|
|
public String saveReverseSettle(AsBillSettelApplyDetailsVo dto) { |
|
|
String sid = ""; |
|
|
String sid = ""; |
|
|
if (StringUtils.isNotBlank(dto.getSid())) { |
|
|
if (StringUtils.isBlank(dto.getSid())) { |
|
|
sid = dto.getSid(); |
|
|
|
|
|
AsBusrepairBillReverseSettle settle = fetchBySid(sid); |
|
|
|
|
|
BeanUtil.copyProperties(dto, settle, "id", "sid"); |
|
|
|
|
|
baseMapper.updateById(settle); |
|
|
|
|
|
} else { |
|
|
|
|
|
AsBusrepairBillReverseSettle entity = new AsBusrepairBillReverseSettle(); |
|
|
AsBusrepairBillReverseSettle entity = new AsBusrepairBillReverseSettle(); |
|
|
sid = entity.getSid(); |
|
|
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
if (StringUtils.isNotBlank(dto.getUseOrgSid())) { |
|
|
String applyCode = getApplyCode(dto.getUseOrgSid()); |
|
|
String applyCode = getApplyCode(dto.getUseOrgSid()); |
|
|
entity.setBillNo(applyCode); |
|
|
entity.setBillNo(applyCode); |
|
|
if (StringUtils.isNotBlank(dto.getRemarks())) { |
|
|
|
|
|
entity.setRemarks(dto.getRemarks()); |
|
|
} |
|
|
} |
|
|
entity.setNodeState("待提交"); |
|
|
|
|
|
entity.setCreateBySid(dto.getUseSid()); |
|
|
|
|
|
baseMapper.insert(entity); |
|
|
baseMapper.insert(entity); |
|
|
|
|
|
sid = entity.getSid(); |
|
|
|
|
|
} else { |
|
|
|
|
|
sid = dto.getSid(); |
|
|
|
|
|
AsBusrepairBillReverseSettle entity = fetchBySid(sid); |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getRemarks())) { |
|
|
|
|
|
entity.setRemarks(dto.getRemarks()); |
|
|
|
|
|
} |
|
|
|
|
|
baseMapper.updateById(entity); |
|
|
|
|
|
} |
|
|
|
|
|
asBillSettelApplyAitemService.delByBillSid(sid); |
|
|
|
|
|
asBillSettelApplyAitemSpecService.delByBillSid(sid); |
|
|
|
|
|
asBillSettelApplySitemService.delByBillSid(sid); |
|
|
|
|
|
asBillSettelApplyDetailService.delByBillSid(sid); |
|
|
|
|
|
BigDecimal costAll = BigDecimal.ZERO;//成本合计
|
|
|
|
|
|
BigDecimal printAll = BigDecimal.ZERO;//利润合计
|
|
|
|
|
|
if (!dto.getAitemVos().isEmpty() && dto.getAitemVos().size() > 0) { |
|
|
|
|
|
List<SettleAitemVo> aitemVos = dto.getAitemVos(); |
|
|
|
|
|
for (SettleAitemVo aitemVo : aitemVos) { |
|
|
|
|
|
AsBillSettelApplyAitem a = new AsBillSettelApplyAitem(); |
|
|
|
|
|
BeanUtil.copyProperties(aitemVo, a, "sid"); |
|
|
|
|
|
a.setMainSid(sid); |
|
|
|
|
|
asBillSettelApplyAitemService.insert(a); |
|
|
|
|
|
if (StringUtils.isNotBlank(aitemVo.getAitemCost())) { |
|
|
|
|
|
costAll = costAll.add(new BigDecimal(aitemVo.getAitemCost())); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(aitemVo.getAitemPrint())) { |
|
|
|
|
|
printAll = printAll.add(new BigDecimal(aitemVo.getAitemPrint())); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (!dto.getSitemVos().isEmpty() && dto.getSitemVos().size() > 0) { |
|
|
|
|
|
List<SettleSitemVo> sitemVos = dto.getSitemVos(); |
|
|
|
|
|
for (SettleSitemVo sitemVo : sitemVos) { |
|
|
|
|
|
AsBillSettelApplySitem a = new AsBillSettelApplySitem(); |
|
|
|
|
|
BeanUtil.copyProperties(sitemVo, a, "sid"); |
|
|
|
|
|
a.setMainSid(sid); |
|
|
|
|
|
asBillSettelApplySitemService.insert(a); |
|
|
|
|
|
if (StringUtils.isNotBlank(sitemVo.getSitemCost())) { |
|
|
|
|
|
costAll = costAll.add(new BigDecimal(sitemVo.getSitemCost())); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(sitemVo.getSitemPrint())) { |
|
|
|
|
|
printAll = printAll.add(new BigDecimal(sitemVo.getSitemPrint())); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (!dto.getGoodsDetailsVos().isEmpty() && dto.getGoodsDetailsVos().size() > 0) { |
|
|
|
|
|
List<SettleGoodsDetailsVo> goodsDetailsVos = dto.getGoodsDetailsVos(); |
|
|
|
|
|
for (SettleGoodsDetailsVo g : goodsDetailsVos) { |
|
|
|
|
|
AsBillSettelApplyDetail d = new AsBillSettelApplyDetail(); |
|
|
|
|
|
BeanUtil.copyProperties(g, d, "sid"); |
|
|
|
|
|
d.setMainSid(sid); |
|
|
|
|
|
asBillSettelApplyDetailService.insert(d); |
|
|
|
|
|
if (StringUtils.isNotBlank(g.getGoodsCost())) { |
|
|
|
|
|
costAll = costAll.add(new BigDecimal(g.getGoodsCost())); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(g.getGoodsPrint())) { |
|
|
|
|
|
printAll = printAll.add(new BigDecimal(g.getGoodsPrint())); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getOutAmount())) { |
|
|
|
|
|
BigDecimal outAmount = new BigDecimal(dto.getOutAmount()); |
|
|
|
|
|
if (outAmount.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
|
|
AsBillSettelApplyAitemspec s = new AsBillSettelApplyAitemspec(); |
|
|
|
|
|
s.setMainSid(sid); |
|
|
|
|
|
s.setAttachItem("外出费"); |
|
|
|
|
|
s.setPrice(outAmount); |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getOutKPAmount())) { |
|
|
|
|
|
s.setTaxPrice(new BigDecimal(dto.getOutKPAmount())); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getOutPrint())) { |
|
|
|
|
|
s.setPrint(new BigDecimal(dto.getOutPrint())); |
|
|
|
|
|
printAll = printAll.add(new BigDecimal(dto.getOutPrint())); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getOutCost())) { |
|
|
|
|
|
s.setCostTotal(new BigDecimal(dto.getOutCost())); |
|
|
|
|
|
costAll = costAll.add(new BigDecimal(dto.getOutCost())); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getOutRemarks())) { |
|
|
|
|
|
s.setRemarks(dto.getOutRemarks()); |
|
|
|
|
|
} |
|
|
|
|
|
asBillSettelApplyAitemSpecService.insert(s); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getSubsidyAmount())) { |
|
|
|
|
|
BigDecimal amount = new BigDecimal(dto.getSubsidyAmount()); |
|
|
|
|
|
if (amount.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
|
|
AsBillSettelApplyAitemspec s = new AsBillSettelApplyAitemspec(); |
|
|
|
|
|
s.setMainSid(sid); |
|
|
|
|
|
s.setAttachItem("厂家补助"); |
|
|
|
|
|
s.setPrice(amount); |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getSubsidyKPAmount())) { |
|
|
|
|
|
s.setTaxPrice(new BigDecimal(dto.getSubsidyKPAmount())); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getSubsidyPrint())) { |
|
|
|
|
|
s.setPrint(new BigDecimal(dto.getSubsidyPrint())); |
|
|
|
|
|
printAll = printAll.add(new BigDecimal(dto.getSubsidyPrint())); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getSubsidyCost())) { |
|
|
|
|
|
s.setCostTotal(new BigDecimal(dto.getSubsidyCost())); |
|
|
|
|
|
costAll = costAll.add(new BigDecimal(dto.getSubsidyCost())); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getSubsidyRemarks())) { |
|
|
|
|
|
s.setRemarks(dto.getSubsidyRemarks()); |
|
|
|
|
|
} |
|
|
|
|
|
asBillSettelApplyAitemSpecService.insert(s); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getRescueAmount())) { |
|
|
|
|
|
BigDecimal amount = new BigDecimal(dto.getRescueAmount()); |
|
|
|
|
|
if (amount.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
|
|
AsBillSettelApplyAitemspec s = new AsBillSettelApplyAitemspec(); |
|
|
|
|
|
s.setMainSid(sid); |
|
|
|
|
|
s.setAttachItem("施救费"); |
|
|
|
|
|
s.setPrice(amount); |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getRescueKPAmount())) { |
|
|
|
|
|
s.setTaxPrice(new BigDecimal(dto.getRescueKPAmount())); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getRescuePrint())) { |
|
|
|
|
|
s.setPrint(new BigDecimal(dto.getRescuePrint())); |
|
|
|
|
|
printAll = printAll.add(new BigDecimal(dto.getRescuePrint())); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getRescueCost())) { |
|
|
|
|
|
s.setCostTotal(new BigDecimal(dto.getRescueCost())); |
|
|
|
|
|
costAll = costAll.add(new BigDecimal(dto.getRescueCost())); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getRescueRemarks())) { |
|
|
|
|
|
s.setRemarks(dto.getRescueRemarks()); |
|
|
|
|
|
} |
|
|
|
|
|
asBillSettelApplyAitemSpecService.insert(s); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
AsBusrepairBillReverseSettle settelApply = fetchBySid(sid); |
|
|
|
|
|
if (null != settelApply) { |
|
|
|
|
|
settelApply.setCostAmount(costAll); |
|
|
|
|
|
settelApply.setProfit(printAll); |
|
|
|
|
|
baseMapper.updateById(settelApply); |
|
|
} |
|
|
} |
|
|
return sid; |
|
|
return sid; |
|
|
} |
|
|
} |
|
@ -923,4 +1330,60 @@ public class AsBusrepairBillReverseSettleService extends MybatisBaseService<AsBu |
|
|
ResultBean delegate = delegate(delegateQuery1); |
|
|
ResultBean delegate = delegate(delegateQuery1); |
|
|
return rb.success(); |
|
|
return rb.success(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public PagerVo<AsChoseBusrepairbillVo> busrepairListPage(PagerQuery<AsChoseBusrepairbillQuery> pq) { |
|
|
|
|
|
AsChoseBusrepairbillQuery query = pq.getParams(); |
|
|
|
|
|
QueryWrapper<AsBusrepairBillReverseSettle> qw = new QueryWrapper<>(); |
|
|
|
|
|
if (StringUtils.isNotBlank(query.getMenuUrl())) { |
|
|
|
|
|
PrivilegeQuery privilegeQuery = new PrivilegeQuery(); |
|
|
|
|
|
privilegeQuery.setOrgPath(query.getOrgPath()); |
|
|
|
|
|
privilegeQuery.setMenuUrl(query.getMenuUrl()); |
|
|
|
|
|
privilegeQuery.setUserSid(query.getUserSid()); |
|
|
|
|
|
ResultBean<PrivilegeVo> defaultIdReltBean = sysUserFeign.selectPrivilegeLevelPath(privilegeQuery); |
|
|
|
|
|
if (null != defaultIdReltBean.getData()) { |
|
|
|
|
|
//数据权限ID(1集团、2事业部、3分公司、4部门、5个人)
|
|
|
|
|
|
PrivilegeVo privilegeVo = defaultIdReltBean.getData(); |
|
|
|
|
|
if ("5".equals(privilegeVo.getOrgLevelKey())) { |
|
|
|
|
|
qw.eq("b.createBySid", privilegeVo.getLevelPath()); |
|
|
|
|
|
} else { |
|
|
|
|
|
qw.eq("b.orgSidPath", privilegeVo.getLevelPath()); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
PagerVo<AsChoseBusrepairbillVo> p = new PagerVo<>(); |
|
|
|
|
|
return p; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(query.getBillNo())) { |
|
|
|
|
|
qw.like("b.billNo", query.getBillNo()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(query.getBillType())) { |
|
|
|
|
|
qw.like("b.billType", query.getBillType()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(query.getSubject())) { |
|
|
|
|
|
qw.like("b.`subject`", query.getSubject()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(query.getCustomerName())) { |
|
|
|
|
|
qw.like("b.customerName", query.getCustomerName()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(query.getVehMark())) { |
|
|
|
|
|
qw.like("v.vehMark", query.getVehMark()); |
|
|
|
|
|
} |
|
|
|
|
|
qw.eq("b.nodeCode",6); |
|
|
|
|
|
qw.apply("(b.`subject` = '保内' OR (b.`subject` = '保外' and b.settleState = '0'))"); |
|
|
|
|
|
String startDate = query.getEntryTimeStart(); |
|
|
|
|
|
String endDate = query.getEntryTimeEnd(); |
|
|
|
|
|
qw.apply(StringUtils.isNotEmpty(startDate), "date_format (b.entryTime,'%Y-%m-%d') >= date_format('" + startDate + "','%Y-%m-%d')"). |
|
|
|
|
|
apply(StringUtils.isNotEmpty(endDate), "date_format (b.entryTime,'%Y-%m-%d') <= date_format('" + endDate + "','%Y-%m-%d')" |
|
|
|
|
|
); |
|
|
|
|
|
String closeDateStart = query.getSettleDateStart(); |
|
|
|
|
|
String closeDateEnd = query.getSettleDateEnd(); |
|
|
|
|
|
qw.apply(StringUtils.isNotEmpty(closeDateStart), "date_format (s.settleTime,'%Y-%m-%d') >= date_format('" + closeDateStart + "','%Y-%m-%d')"). |
|
|
|
|
|
apply(StringUtils.isNotEmpty(closeDateEnd), "date_format (s.settleTime,'%Y-%m-%') <= date_format('" + closeDateEnd + "','%Y-%m-%d')" |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
IPage<AsBusrepairBill> page = PagerUtil.queryToPage(pq); |
|
|
|
|
|
IPage<AsChoseBusrepairbillVo> pagging = baseMapper.busrepairListPage(page, qw); |
|
|
|
|
|
PagerVo<AsChoseBusrepairbillVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
|
|
return p; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|