|
@@ -0,0 +1,407 @@
|
|
|
+package com.gree.mall.manager.logic.settle.repair;
|
|
|
+
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.gree.mall.manager.bean.admin.AdminUserCom;
|
|
|
+import com.gree.mall.manager.bean.settle.repair.DailyImportSummaryVO;
|
|
|
+import com.gree.mall.manager.bean.settle.repair.DailyTotalCostBean;
|
|
|
+import com.gree.mall.manager.commonmapper.CommonMapper;
|
|
|
+import com.gree.mall.manager.commonmapper.DailyMapper;
|
|
|
+import com.gree.mall.manager.constant.DailyConstant;
|
|
|
+import com.gree.mall.manager.constant.SysDictConstant;
|
|
|
+import com.gree.mall.manager.exception.RemoteServiceException;
|
|
|
+import com.gree.mall.manager.logic.common.CommonLogic;
|
|
|
+import com.gree.mall.manager.plus.entity.*;
|
|
|
+import com.gree.mall.manager.plus.service.*;
|
|
|
+import com.gree.mall.manager.utils.CommonUtils;
|
|
|
+import com.gree.mall.manager.utils.DateUtils;
|
|
|
+import com.gree.mall.manager.zfire.bean.ZfireParamBean;
|
|
|
+import com.gree.mall.manager.zfire.util.FieldUtils;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+@Service
|
|
|
+@Slf4j
|
|
|
+@RequiredArgsConstructor
|
|
|
+public class DailyImportSummaryLogic {
|
|
|
+
|
|
|
+ private final CommonLogic commonLogic;
|
|
|
+ private final CommonMapper commonMapper;
|
|
|
+ private final SettleDailyImportSummaryItemService settleDailyImportSummaryItemService;
|
|
|
+ private final SettleDailyReduceCostService settleDailyReduceCostService;
|
|
|
+ private final DailyMapper dailyMapper;
|
|
|
+ private final SettleWebsitWorkerDirectorService settleWebsitWorkerDirectorService;
|
|
|
+ private final SettleDailyIssueSummaryRecordService settleDailyIssueSummaryRecordService;
|
|
|
+ private final SysDictCompanyService sysDictCompanyService;
|
|
|
+ private final SettleDailyWithholdService settleDailyWithholdService;
|
|
|
+
|
|
|
+
|
|
|
+ public IPage<DailyImportSummaryVO> page(ZfireParamBean zfireParamBean) {
|
|
|
+ AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
+ FieldUtils.supplyParam(zfireParamBean, DailyImportSummaryVO.class, adminUser);
|
|
|
+
|
|
|
+ return commonMapper.repairSettleDailyImportSummaryList(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()), zfireParamBean);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导入结算/工单扣回数据
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ public String importOrderData(String type, String importBatchNo, List<Object> datas, HttpServletRequest request) throws Exception {
|
|
|
+ StringBuffer errorData = new StringBuffer();
|
|
|
+ AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
+ log.info("【导入结算】:{}", DateUtils.formatDate(new Date()));
|
|
|
+ List<SettleDailyReduceCost> reduceList = new ArrayList<>();
|
|
|
+ //生成导入批次号
|
|
|
+ List<SettleDailyImportSummaryItem> summaryItemList = new ArrayList<>();
|
|
|
+ String batchNo = commonLogic.generateNo("reduce".equals(type) ? "HK" : "JS", "repair_daily", 11);
|
|
|
+ //传入批次号删除数据
|
|
|
+ if (StringUtils.isNotEmpty(importBatchNo)) {
|
|
|
+ if ("reduce".equals(type)) {
|
|
|
+ Integer count = settleDailyReduceCostService.lambdaQuery()
|
|
|
+ .eq(SettleDailyReduceCost::getImportBatchNo, importBatchNo)
|
|
|
+ .eq(SettleDailyReduceCost::getDoStatus, DailyConstant.DO_STATUS_HAS)
|
|
|
+ .count();
|
|
|
+
|
|
|
+ if (count > 0) {
|
|
|
+ throw new RemoteServiceException("存在已执行的数据");
|
|
|
+ }
|
|
|
+ settleDailyReduceCostService.lambdaUpdate().eq(SettleDailyReduceCost::getImportBatchNo, importBatchNo).remove();
|
|
|
+ } else {
|
|
|
+ Integer count = settleDailyImportSummaryItemService.lambdaQuery()
|
|
|
+ .eq(SettleDailyImportSummaryItem::getImportBatchNo, importBatchNo)
|
|
|
+ .eq(SettleDailyImportSummaryItem::getSummaryStatus, DailyConstant.SUMMARY_STATUS_HAS)
|
|
|
+ .count();
|
|
|
+ if (count > 0) {
|
|
|
+ throw new RemoteServiceException("存在已汇总的数据");
|
|
|
+ }
|
|
|
+ settleDailyImportSummaryItemService.lambdaUpdate().eq(SettleDailyImportSummaryItem::getImportBatchNo, importBatchNo)
|
|
|
+ .remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < datas.size(); i++) {
|
|
|
+ List<String> row = (List<String>) datas.get(i);
|
|
|
+ CommonUtils.initList(row, 100);
|
|
|
+// DailyWorkerNumberBean workerNumberBean = dailyMapper.queryWorkerNumber(row.get(33),row.get(34),row.get(44));
|
|
|
+// if(workerNumberBean == null){
|
|
|
+// throw new RemoteServiceException("行数" + row.get(0) + "姓名:"+row.get(33) +"找不到对应的工号");
|
|
|
+// }
|
|
|
+ SettleDailyReduceCost bean = new SettleDailyReduceCost();
|
|
|
+// bean.setWorkerNumber(workerNumberBean.getWorkerNumber());
|
|
|
+// bean.setBelongCompany(workerNumberBean.getBelongCompany());
|
|
|
+// bean.setBelongCompanyId(workerNumberBean.getBelongCompanyId());
|
|
|
+ bean.setImportBatchNo(batchNo);
|
|
|
+ bean.setDispatchOrderNo(row.get(1));
|
|
|
+ bean.setSelfNo(row.get(2));
|
|
|
+ bean.setOrderStatus(row.get(3));
|
|
|
+ bean.setSummaryNumber(row.get(4));
|
|
|
+ bean.setOldSummaryNumber(row.get(5));
|
|
|
+ bean.setSummaryName(row.get(6));
|
|
|
+ bean.setRepairType(row.get(7));
|
|
|
+ bean.setInOutMachine(row.get(8));
|
|
|
+ bean.setMachineCode(row.get(9));
|
|
|
+ bean.setOutMachineType(row.get(10));
|
|
|
+ bean.setOutMachineDescribe(row.get(11));
|
|
|
+ bean.setInMachineCode(row.get(12));
|
|
|
+ bean.setInMachineType(row.get(13));
|
|
|
+ bean.setInMachineDescribe(row.get(14));
|
|
|
+ bean.setUserName(row.get(15));
|
|
|
+ bean.setAreaCode(row.get(16));
|
|
|
+ bean.setMobile(row.get(17));
|
|
|
+ bean.setTel(row.get(18));
|
|
|
+ bean.setProvince(row.get(19));
|
|
|
+ bean.setCity(row.get(20));
|
|
|
+ bean.setCounty(row.get(21));
|
|
|
+ bean.setUserAddr(row.get(22));
|
|
|
+ bean.setGpsAddr(row.get(23));
|
|
|
+ bean.setPostalCode(row.get(24));
|
|
|
+ bean.setSaleDeptNo(row.get(25));
|
|
|
+ bean.setSaleDeptName(row.get(26));
|
|
|
+ bean.setInvoiceCode(row.get(27));
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(row.get(28))) {
|
|
|
+ bean.setBuyDate(new SimpleDateFormat("yyyy年MM月dd日").parse(row.get(28)));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(row.get(29))) {
|
|
|
+ bean.setInstallDate(new SimpleDateFormat("yyyy年MM月dd日").parse(row.get(29)));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(row.get(30))) {
|
|
|
+ bean.setReportDate(new SimpleDateFormat("yyyy年MM月dd日").parse(row.get(30)));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(row.get(31))) {
|
|
|
+ bean.setRepairDate(new SimpleDateFormat("yyyy年MM月dd日").parse(row.get(31)));
|
|
|
+ }
|
|
|
+ bean.setRepairWorkerId(row.get(32));
|
|
|
+ bean.setRepairWorkerName(row.get(33));
|
|
|
+ bean.setRepairWorkerMobile(row.get(34));
|
|
|
+ if (StringUtils.isNotBlank(row.get(35))) {
|
|
|
+ bean.setRepairFee(new BigDecimal(row.get(35)));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(row.get(36))) {
|
|
|
+ bean.setTrafficFee(new BigDecimal(row.get(36)));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(row.get(37))) {
|
|
|
+ bean.setAccommodationFee(new BigDecimal(row.get(37)));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(row.get(38))) {
|
|
|
+ bean.setLiftingFee(new BigDecimal(row.get(38)));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(row.get(39))) {
|
|
|
+ bean.setOtherFee(new BigDecimal(row.get(39)));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(row.get(40))) {
|
|
|
+ bean.setTotalFee(new BigDecimal(row.get(40)));
|
|
|
+ }
|
|
|
+ bean.setSettlementBatchNo(row.get(41));
|
|
|
+ bean.setInstallWebsitNo(row.get(42));
|
|
|
+ bean.setInstallWebsitName(row.get(43));
|
|
|
+ bean.setRepairUnit(row.get(44));
|
|
|
+ bean.setOldRepairUnit(row.get(45));
|
|
|
+ bean.setRepairName(row.get(46));
|
|
|
+ bean.setFaultPhenomenon(row.get(47));
|
|
|
+ bean.setFaultAnalysis(row.get(48));
|
|
|
+ bean.setRepairDetail(row.get(49));
|
|
|
+ bean.setRemark(row.get(50));
|
|
|
+ bean.setImportBy(adminUser.getNickName());
|
|
|
+ bean.setImportTime(new Date());
|
|
|
+ bean.setCreateTime(new Date());
|
|
|
+ bean.setWebsitName(row.get(46));
|
|
|
+ bean.setWebsitNumber(row.get(44));
|
|
|
+ if (StringUtils.isNotBlank(row.get(51))) {
|
|
|
+ bean.setSettlementTime(new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss").parse(row.get(51)));
|
|
|
+ }
|
|
|
+ if (("reduce").equals(type)) {
|
|
|
+ //设置执行状态未未执行
|
|
|
+ bean.setDoStatus(DailyConstant.DO_STATUS_NOT);
|
|
|
+ reduceList.add(bean);
|
|
|
+ } else {
|
|
|
+ SettleDailyImportSummaryItem item = new SettleDailyImportSummaryItem();
|
|
|
+ BeanUtils.copyProperties(bean, item);
|
|
|
+ item.setSummaryStatus(DailyConstant.SUMMARY_STATUS_NOT);
|
|
|
+ summaryItemList.add(item);
|
|
|
+ //查询在系统中已存在的
|
|
|
+// Integer count = dailyImportSummaryItemService.lambdaQuery()
|
|
|
+// .eq(DailyImportSummaryItem::getDispatchOrderNo,item.getDispatchOrderNo())
|
|
|
+// .eq(DailyImportSummaryItem::getSelfNo,item.getSelfNo())
|
|
|
+// .in(DailyImportSummaryItem::getOrderStatus,DailyConstant.SUMMARY_STATUS_ARRAY).count();
|
|
|
+// if(count > 0){
|
|
|
+// errorData.append("工单"+ item.getDispatchOrderNo());
|
|
|
+// }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ if (("reduce").equals(type)) {
|
|
|
+ settleDailyReduceCostService.saveBatch(reduceList);
|
|
|
+ dailyMapper.bindWorkerNumber2(batchNo);
|
|
|
+ //判断是否有匹配失败的师傅编号的
|
|
|
+ List<SettleDailyReduceCost> list = settleDailyReduceCostService.lambdaQuery()
|
|
|
+ .eq(SettleDailyReduceCost::getWorkerNumber, "")
|
|
|
+ .eq(SettleDailyReduceCost::getImportBatchNo, batchNo)
|
|
|
+ .last("limit 1")
|
|
|
+ .list();
|
|
|
+ if (list.size() > 0)
|
|
|
+ throw new RemoteServiceException("姓名:" + list.get(0).getRepairName() + ",派工序号:" + list.get(0).getDispatchOrderNo() + "找不到对应的师傅编号");
|
|
|
+ //判断是否存在导入重复的工单号
|
|
|
+ } else {
|
|
|
+ settleDailyImportSummaryItemService.saveBatch(summaryItemList);
|
|
|
+ dailyMapper.bindWorkerNumber(batchNo);
|
|
|
+ //判断是否有匹配失败的师傅编号的
|
|
|
+ List<SettleDailyImportSummaryItem> list = settleDailyImportSummaryItemService.lambdaQuery()
|
|
|
+ .eq(SettleDailyImportSummaryItem::getWorkerNumber, "")
|
|
|
+ .eq(SettleDailyImportSummaryItem::getImportBatchNo, batchNo)
|
|
|
+ .last("limit 1")
|
|
|
+ .list();
|
|
|
+ if (list.size() > 0)
|
|
|
+ throw new RemoteServiceException("姓名:" + list.get(0).getRepairName() + ",派工序号:" + list.get(0).getDispatchOrderNo() + "找不到对应的师傅编号");
|
|
|
+ //判断是否存在导入重复的工单号
|
|
|
+ List<String> errList = dailyMapper.queryDistinctOrderNo();
|
|
|
+ if (!CollectionUtils.isEmpty(errList)) {
|
|
|
+ errorData = errorData.append(StringUtils.join(errList, ","));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (errorData.length() > 0) {
|
|
|
+ errorData.append("已存在,导入失败");
|
|
|
+ }
|
|
|
+ return errorData.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 结算数据导入 -删除
|
|
|
+ */
|
|
|
+ public void repairDelete(String importBatchNo) {
|
|
|
+ AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
+
|
|
|
+ if (adminUser.getType() == 2) {
|
|
|
+ throw new RemoteServiceException("平台账号禁止操作");
|
|
|
+ }
|
|
|
+
|
|
|
+ Integer count = settleDailyImportSummaryItemService.lambdaQuery()
|
|
|
+ .eq(SettleDailyImportSummaryItem::getCompanyWechatId, adminUser.getAdminCompanyWechat().getCompanyWechatId())
|
|
|
+ .eq(SettleDailyImportSummaryItem::getImportBatchNo, importBatchNo)
|
|
|
+ .eq(SettleDailyImportSummaryItem::getSummaryStatus, DailyConstant.SUMMARY_STATUS_HAS).count();
|
|
|
+ if (count > 0) {
|
|
|
+ throw new RemoteServiceException("已汇总,无法删除");
|
|
|
+ }
|
|
|
+
|
|
|
+ settleDailyImportSummaryItemService.lambdaUpdate()
|
|
|
+ .eq(SettleDailyImportSummaryItem::getCompanyWechatId, adminUser.getAdminCompanyWechat().getCompanyWechatId())
|
|
|
+ .eq(SettleDailyImportSummaryItem::getImportBatchNo, importBatchNo)
|
|
|
+ .in(SettleDailyImportSummaryItem::getSummaryStatus, DailyConstant.SUMMARY_STATUS_CAN_DEL).remove();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ public void repairSummary(String importBatchNo, Boolean install) {
|
|
|
+ AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
+
|
|
|
+ if (adminUser.getType() == 2) {
|
|
|
+ throw new RemoteServiceException("平台账号禁止操作");
|
|
|
+ }
|
|
|
+ //不结算主管的身份证
|
|
|
+ List<SettleWebsitWorkerDirector> list = settleWebsitWorkerDirectorService.lambdaQuery().list();
|
|
|
+ List<String> notSettleIdcards = list.stream().map(SettleWebsitWorkerDirector::getIdcard).collect(Collectors.toList());
|
|
|
+ //结算数据导入明细
|
|
|
+ List<SettleDailyImportSummaryItem> updateList = settleDailyImportSummaryItemService.lambdaQuery().
|
|
|
+ eq(SettleDailyImportSummaryItem::getImportBatchNo, importBatchNo)
|
|
|
+ .in(SettleDailyImportSummaryItem::getSummaryStatus, DailyConstant.SUMMARY_STATUS_CAN_DO)
|
|
|
+ .in(SettleDailyImportSummaryItem::getOrderStatus, DailyConstant.SUMMARY_STATUS_ARRAY).list();
|
|
|
+
|
|
|
+ if (updateList.size() <= 0) {
|
|
|
+ throw new RemoteServiceException("该批次已汇总,请勿重复汇总。");
|
|
|
+ }
|
|
|
+ String opName = adminUser.getNickName();
|
|
|
+ String summaryBatchNo = updateList.get(0).getSummaryBatchNo();
|
|
|
+ if (StringUtils.isEmpty(summaryBatchNo)) {
|
|
|
+ summaryBatchNo = commonLogic.generateNo("HZ", "dailyBatch", 13);
|
|
|
+ }
|
|
|
+ settleDailyIssueSummaryRecordService.lambdaUpdate().eq(SettleDailyIssueSummaryRecord::getSummaryBatchNo, summaryBatchNo).remove();
|
|
|
+ //查询统计数据
|
|
|
+ List<DailyTotalCostBean> costBeans = dailyMapper.queryDailyTotalCost(importBatchNo, DailyConstant.SUMMARY_STATUS_CAN_DO, DailyConstant.SUMMARY_STATUS_ARRAY);
|
|
|
+
|
|
|
+ String nowMonth = DateUtil.format(new Date(), "yyyyMM");
|
|
|
+ List<SettleDailyIssueSummaryRecord> issueList = new ArrayList<>();
|
|
|
+ SysDictCompany dict = sysDictCompanyService.lambdaQuery()
|
|
|
+ .eq(SysDictCompany::getCompanyWechatId, adminUser.getAdminCompanyWechat().getCompanyWechatId())
|
|
|
+ .eq(SysDictCompany::getDictCode, SysDictConstant.REPAIR_DAILY)
|
|
|
+ .last("limit 1")
|
|
|
+ .one();
|
|
|
+ if (dict == null) {
|
|
|
+ throw new RemoteServiceException("未配置暂扣比例。");
|
|
|
+ }
|
|
|
+ List<SettleDailyWithhold> withholds = settleDailyWithholdService.lambdaQuery().list();
|
|
|
+
|
|
|
+ //1.标记为非新的历史待扣费用(防止驳回的时候误删)
|
|
|
+// dailyRemaineBuckleService.lambdaUpdate()
|
|
|
+// .set(DailyRemaineBuckle::getSummaryBatchNo,summaryBatchNo)
|
|
|
+// .set(DailyRemaineBuckle::getUpdateTime,new Date())
|
|
|
+// .set(DailyRemaineBuckle::getUpdateBy,opName)
|
|
|
+// .eq(DailyRemaineBuckle::getSummaryBatchNo,"").update();
|
|
|
+
|
|
|
+ //1.应发金额 = 维修费用 + 增减费用 - 扣回费用
|
|
|
+ //2.应发金额 = 应发金额 - 工伤残保
|
|
|
+ //3.应发金额 = 应发金额 - 暂扣款
|
|
|
+ //ps.如果不够扣,则有多少扣多少,然后留给下次扣。一个身份证只扣1次工伤残保
|
|
|
+ for (DailyTotalCostBean cost : costBeans) {
|
|
|
+ SettleDailyIssueSummaryRecord issue = new SettleDailyIssueSummaryRecord();
|
|
|
+ String BatchNo = commonLogic.generateNo("SF", "dailySalaryNo", 16);
|
|
|
+ //维修费
|
|
|
+ BigDecimal totalFee = cost.getTotalFee();
|
|
|
+ if (totalFee.doubleValue() < 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ //不结算主管过滤直接成0
|
|
|
+ if (notSettleIdcards.contains(cost.getIdCard()) && (install == null || !install)) {
|
|
|
+ issue.setRemark("安维主管结算费用0,原可结算金额:" + totalFee);
|
|
|
+ totalFee = BigDecimal.valueOf(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取身份证
|
|
|
+ issue.setMobile(cost.getMobile());
|
|
|
+ issue.setIdCard(cost.getIdCard());
|
|
|
+ issue.setRepairCount(cost.getRepairCount());
|
|
|
+ issue.setWebsitName(cost.getWebsitName());
|
|
|
+ issue.setWebsitNumber(cost.getWebsitNumber());
|
|
|
+ issue.setCompanyWechatId(cost.getCompanyWechatId());
|
|
|
+ issue.setCompanyWechatName(cost.getCompanyWechatName());
|
|
|
+ issue.setMonth(nowMonth);
|
|
|
+ issue.setServiceName(cost.getRepairWorkerName());
|
|
|
+ issue.setServiceNumber(cost.getWorkerNumber());
|
|
|
+ issue.setSummaryName(cost.getSummaryName());
|
|
|
+ issue.setSummaryNumber(cost.getSummaryNumber());
|
|
|
+ issue.setSalaryNo(BatchNo);
|
|
|
+ issue.setStatus(DailyConstant.SUMMARY_STATUS_HAS);
|
|
|
+ issue.setRepairTotalAmount(totalFee);
|
|
|
+ issue.setCreateTime(new Date());
|
|
|
+ issue.setCreateBy(opName);
|
|
|
+ issue.setSummaryBatchNo(summaryBatchNo);
|
|
|
+ issue.setSummaryTime(new Date());
|
|
|
+ issue.setSummaryBy(opName);
|
|
|
+ issue.setIsMonthSummary(false);
|
|
|
+ issue.setReduceCost(new BigDecimal(0));
|
|
|
+ issue.setIncrDecrCost(new BigDecimal(0));
|
|
|
+ issue.setShouldResidualInsuranceCost(BigDecimal.valueOf(0));
|
|
|
+ issue.setShouldEmpInsuranceCost(BigDecimal.valueOf(0));
|
|
|
+ issue.setEmpInsuranceCost(BigDecimal.valueOf(0));
|
|
|
+ issue.setResidualInsuranceCost(BigDecimal.valueOf(0));
|
|
|
+ issue.setShouldReduceCost(BigDecimal.valueOf(0));
|
|
|
+ issue.setWithholdTotalCost(BigDecimal.valueOf(0));
|
|
|
+ issue.setWithholdCost(BigDecimal.valueOf(0));
|
|
|
+ issue.setIssueCost(totalFee);
|
|
|
+ issue.setInstall(install);
|
|
|
+
|
|
|
+ if (install == null || !install) {
|
|
|
+ //暂扣金额
|
|
|
+ if (issue.getIssueCost().doubleValue() >= 0) {
|
|
|
+ BigDecimal withholdCost = issue.getIssueCost()
|
|
|
+ .multiply(new BigDecimal(dict.getDictValue()))
|
|
|
+ .setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ if (withholdCost.doubleValue() > 0) {
|
|
|
+ issue.setWithholdCost(withholdCost);
|
|
|
+ issue.setWithholdTotalCost(withholdCost);
|
|
|
+
|
|
|
+ issue.setIssueCost(issue.getIssueCost().subtract(withholdCost));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //处理本月要扣的工伤残保金,扣不完则留到历史费用
|
|
|
+ //2.扣工伤残保,并产生新的待扣记录
|
|
|
+// issue = this.deductGscb(opName, nowMonth, summaryBatchNo, issue, cost, withholds);
|
|
|
+ //3.处理历史待扣
|
|
|
+// issue = this.historyAmount(issue, summaryBatchNo, opName);
|
|
|
+ }
|
|
|
+ issueList.add(issue);
|
|
|
+ }
|
|
|
+ //生成数据到日结发放表
|
|
|
+ settleDailyIssueSummaryRecordService.saveOrUpdateBatch(issueList);
|
|
|
+
|
|
|
+ for (SettleDailyIssueSummaryRecord issueSummaryRecord : issueList) {
|
|
|
+ for (SettleDailyImportSummaryItem importSummaryItem : updateList) {
|
|
|
+ importSummaryItem.setSummaryBy(opName);
|
|
|
+ importSummaryItem.setSummaryTime(new Date());
|
|
|
+ importSummaryItem.setSummaryStatus(DailyConstant.SUMMARY_STATUS_HAS);
|
|
|
+ importSummaryItem.setSummaryBatchNo(summaryBatchNo);
|
|
|
+ importSummaryItem.setMonth(nowMonth);
|
|
|
+ if (issueSummaryRecord.getServiceNumber().equals(importSummaryItem.getWorkerNumber())
|
|
|
+ && issueSummaryRecord.getSummaryNumber().equals(importSummaryItem.getSummaryNumber())) {
|
|
|
+ importSummaryItem.setIssueSalaryId(issueSummaryRecord.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ settleDailyImportSummaryItemService.updateBatchById(updateList, 500);
|
|
|
+ }
|
|
|
+}
|