|
|
@ -19,6 +19,8 @@ import com.yxt.anrui.base.biz.busvehicleapplydetail.BusVehicleApplyDetailService |
|
|
|
import com.yxt.anrui.base.common.enums.BillTypeEnum; |
|
|
|
import com.yxt.anrui.base.common.utils.Rule; |
|
|
|
import com.yxt.anrui.base.common.utils.domain.BillNo; |
|
|
|
import com.yxt.anrui.fin.api.finpaymentrecord.FinPaymentrecordDto; |
|
|
|
import com.yxt.anrui.fin.api.finpaymentrecord.FinPaymentrecordFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flow.FlowableFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flow.UpdateFlowFieldVo; |
|
|
|
import com.yxt.anrui.flowable.api.flowtask.FlowTaskFeign; |
|
|
@ -76,6 +78,8 @@ public class BusVehicleApplyService extends MybatisBaseService<BusVehicleApplyMa |
|
|
|
private BaseManufactorSubscriptionService baseManufactorSubscriptionService; |
|
|
|
@Autowired |
|
|
|
private SysOrganizationFeign sysOrganizationFeign; |
|
|
|
@Autowired |
|
|
|
private FinPaymentrecordFeign finPaymentrecordFeign; |
|
|
|
|
|
|
|
/** |
|
|
|
* 分页列表 |
|
|
@ -103,20 +107,6 @@ public class BusVehicleApplyService extends MybatisBaseService<BusVehicleApplyMa |
|
|
|
qw.orderByDesc("bva.id"); |
|
|
|
IPage<BusVehicleApply> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<BusVehicleApplyVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
List<BusVehicleApplyVo> voList = pagging.getRecords(); |
|
|
|
voList.removeAll(Collections.singleton(null)); |
|
|
|
for (BusVehicleApplyVo v : voList) { |
|
|
|
List<BusVehicleApplyDetailVo> vo = busVehicleApplyDetailService.fetchByApplySid(v.getSid()); |
|
|
|
vo.removeAll(Collections.singleton(null)); |
|
|
|
BigDecimal bigDecimal = new BigDecimal("0"); |
|
|
|
for (BusVehicleApplyDetailVo o : vo) { |
|
|
|
String applyForDeposit = o.getApplyForDeposit(); |
|
|
|
if (StringUtils.isNotBlank(applyForDeposit)) { |
|
|
|
bigDecimal = bigDecimal.add(new BigDecimal(applyForDeposit)); |
|
|
|
} |
|
|
|
} |
|
|
|
v.setApplyForDeposit(bigDecimal.toString()); |
|
|
|
} |
|
|
|
PagerVo<BusVehicleApplyVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
@ -150,7 +140,7 @@ public class BusVehicleApplyService extends MybatisBaseService<BusVehicleApplyMa |
|
|
|
BusVehicleApply busVehicleApply = this.fetchBySid(sid); |
|
|
|
BeanUtil.copyProperties(busVehicleApply, busVehicleApplyDetailsVo); |
|
|
|
List<BusVehicleApplyDetailVo> busVehicleApplyDetailVos = busVehicleApplyDetailService.fetchByApplySid(sid); |
|
|
|
busVehicleApplyDetailsVo.setBusVehicleApplyDetailVoList(busVehicleApplyDetailVos); |
|
|
|
busVehicleApplyDetailsVo.setBusVehicleApplyDetailList(busVehicleApplyDetailVos); |
|
|
|
return busVehicleApplyDetailsVo; |
|
|
|
} |
|
|
|
|
|
|
@ -159,7 +149,7 @@ public class BusVehicleApplyService extends MybatisBaseService<BusVehicleApplyMa |
|
|
|
BusVehicleApply busVehicleApply = baseMapper.selectByCode(code); |
|
|
|
BeanUtil.copyProperties(busVehicleApply, busVehicleApplyDetailsVo); |
|
|
|
List<BusVehicleApplyDetailVo> busVehicleApplyDetailVos = busVehicleApplyDetailService.fetchByApplySid(busVehicleApply.getSid()); |
|
|
|
busVehicleApplyDetailsVo.setBusVehicleApplyDetailVoList(busVehicleApplyDetailVos); |
|
|
|
busVehicleApplyDetailsVo.setBusVehicleApplyDetailList(busVehicleApplyDetailVos); |
|
|
|
return busVehicleApplyDetailsVo; |
|
|
|
} |
|
|
|
|
|
|
@ -181,21 +171,21 @@ public class BusVehicleApplyService extends MybatisBaseService<BusVehicleApplyMa |
|
|
|
String billNo = getApplyCode(dto); |
|
|
|
entity.setApplicationCode(billNo); |
|
|
|
entity.setApplicationDate(DateUtil.today()); |
|
|
|
BigDecimal bigDecimalAll = new BigDecimal("0"); |
|
|
|
List<BusVehicleApplyDetailDto> busVehicleApplyDetailDtoList = dto.getBusVehicleApplyDetailDtoList(); |
|
|
|
int i = 0; |
|
|
|
List<BusVehicleApplyDetailDto> busVehicleApplyDetailDtoList = dto.getBusVehicleApplyDetailList(); |
|
|
|
for (BusVehicleApplyDetailDto busVehicleApplyDetailDto : busVehicleApplyDetailDtoList) { |
|
|
|
BusVehicleApplyDetail busVehicleApplyDetail = new BusVehicleApplyDetail(); |
|
|
|
BeanUtil.copyProperties(busVehicleApplyDetailDto, busVehicleApplyDetail, "sid"); |
|
|
|
busVehicleApplyDetail.setApplySid(entity.getSid()); |
|
|
|
if (StringUtils.isNotBlank(busVehicleApplyDetailDto.getApplyForDeposit())) { |
|
|
|
bigDecimalAll = bigDecimalAll.add(new BigDecimal(busVehicleApplyDetailDto.getApplyForDeposit())); |
|
|
|
i = i + Integer.valueOf(busVehicleApplyDetailDto.getApplyForDeposit()).intValue(); |
|
|
|
} |
|
|
|
busVehicleApplyDetailService.insert(busVehicleApplyDetail); |
|
|
|
} |
|
|
|
if (bigDecimalAll.compareTo(new BigDecimal(dto.getCurrentAmount())) != 0) { |
|
|
|
if (i != Integer.valueOf(dto.getCurrentAmount()).intValue()) { |
|
|
|
return rb.setMsg("申请订金合计计算错误"); |
|
|
|
} |
|
|
|
entity.setCurrentAmount(bigDecimalAll); |
|
|
|
entity.setCurrentAmount(i); |
|
|
|
baseMapper.insert(entity); |
|
|
|
sid = entity.getSid(); |
|
|
|
} else {//修改
|
|
|
@ -205,21 +195,23 @@ public class BusVehicleApplyService extends MybatisBaseService<BusVehicleApplyMa |
|
|
|
} |
|
|
|
BeanUtil.copyProperties(dto, busVehicleApply); |
|
|
|
busVehicleApplyDetailService.delByApplySid(dto.getSid()); |
|
|
|
BigDecimal bigDecimalAll = new BigDecimal("0"); |
|
|
|
List<BusVehicleApplyDetailDto> busVehicleApplyDetailDtoList = dto.getBusVehicleApplyDetailDtoList(); |
|
|
|
int i = 0; |
|
|
|
List<BusVehicleApplyDetailDto> busVehicleApplyDetailDtoList = dto.getBusVehicleApplyDetailList(); |
|
|
|
for (BusVehicleApplyDetailDto busVehicleApplyDetailDto : busVehicleApplyDetailDtoList) { |
|
|
|
BusVehicleApplyDetail busVehicleApplyDetail = new BusVehicleApplyDetail(); |
|
|
|
BeanUtil.copyProperties(busVehicleApplyDetailDto, busVehicleApplyDetail, "sid"); |
|
|
|
busVehicleApplyDetail.setApplySid(dto.getSid()); |
|
|
|
if (StringUtils.isNotBlank(busVehicleApplyDetailDto.getApplyForDeposit())) { |
|
|
|
bigDecimalAll = bigDecimalAll.add(new BigDecimal(busVehicleApplyDetailDto.getApplyForDeposit())); |
|
|
|
// NumberFormat numberFormat2 = NumberFormat.getNumberInstance();
|
|
|
|
// numberFormat2.setGroupingUsed(false);
|
|
|
|
if (busVehicleApplyDetailDto.getApplyForDeposit() != null) { |
|
|
|
i = i + Integer.valueOf(busVehicleApplyDetailDto.getApplyForDeposit()).intValue(); |
|
|
|
} |
|
|
|
busVehicleApplyDetailService.insert(busVehicleApplyDetail); |
|
|
|
} |
|
|
|
if (bigDecimalAll.compareTo(new BigDecimal(dto.getCurrentAmount())) != 0) { |
|
|
|
if (i != Integer.valueOf(dto.getCurrentAmount()).intValue()) { |
|
|
|
return rb.setMsg("申请订金合计计算错误"); |
|
|
|
} |
|
|
|
busVehicleApply.setCurrentAmount(bigDecimalAll); |
|
|
|
busVehicleApply.setCurrentAmount(i); |
|
|
|
baseMapper.updateById(busVehicleApply); |
|
|
|
|
|
|
|
} |
|
|
@ -397,6 +389,20 @@ public class BusVehicleApplyService extends MybatisBaseService<BusVehicleApplyMa |
|
|
|
baseManufactorSubscriptionDto.setPaymentMoney(bigDecimal.toString());//打款金额
|
|
|
|
baseManufactorSubscriptionDto.setProSchAppNo(busVehicleApply.getApplicationCode());//排产申请编号
|
|
|
|
ResultBean r = baseManufactorSubscriptionService.saveDto(baseManufactorSubscriptionDto); |
|
|
|
|
|
|
|
//推送到财务出纳
|
|
|
|
FinPaymentrecordDto finPaymentrecordDto = new FinPaymentrecordDto(); |
|
|
|
finPaymentrecordDto.setApplySid(busVehicleApply.getSid()); |
|
|
|
finPaymentrecordDto.setPayCompanySid(busVehicleApply.getCreateOrgSid()); |
|
|
|
finPaymentrecordDto.setPayType(1); |
|
|
|
finPaymentrecordDto.setCreateOrgSid(stringResultBean.getData()); |
|
|
|
finPaymentrecordDto.setUseOrgSid(stringResultBean.getData()); |
|
|
|
finPaymentrecordDto.setCost(busVehicleApply.getCurrentAmount().intValue()); |
|
|
|
finPaymentrecordDto.setCostTitleKey("1"); |
|
|
|
finPaymentrecordDto.setCostTitleValue("车款"); |
|
|
|
finPaymentrecordDto.setCostTypeKey("2"); |
|
|
|
finPaymentrecordDto.setCostTypeValue("排产"); |
|
|
|
finPaymentrecordFeign.save(finPaymentrecordDto); |
|
|
|
} |
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
|
} else { |
|
|
@ -521,7 +527,7 @@ public class BusVehicleApplyService extends MybatisBaseService<BusVehicleApplyMa |
|
|
|
if (StringUtils.isBlank(query.getUserSid())) { |
|
|
|
return rb.setMsg("参数错误:userSid"); |
|
|
|
} |
|
|
|
if(StringUtils.isBlank(query.getComment())){ |
|
|
|
if (StringUtils.isBlank(query.getComment())) { |
|
|
|
return rb.setMsg("请填写意见"); |
|
|
|
} |
|
|
|
BusVehicleApply busVehicleApply = fetchBySid(query.getBusinessSid()); |
|
|
|