Commit bada4c4a by jianshuqin

修改借支单业务

parent 9b9f1d9c
...@@ -39,6 +39,7 @@ import com.blt.other.module.netsuite.dao.NetsuiteLogDao; ...@@ -39,6 +39,7 @@ import com.blt.other.module.netsuite.dao.NetsuiteLogDao;
import com.blt.other.module.netsuite.dto.NetsuiCostinfoDto; import com.blt.other.module.netsuite.dto.NetsuiCostinfoDto;
import com.blt.other.module.netsuite.dto.NetsuiteDataDto; import com.blt.other.module.netsuite.dto.NetsuiteDataDto;
import com.blt.other.module.netsuite.model.NetsuiteLogDomain; import com.blt.other.module.netsuite.model.NetsuiteLogDomain;
import com.blt.other.module.sys.model.CostReviewer;
import com.blt.other.module.sys.service.UserService; import com.blt.other.module.sys.service.UserService;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
...@@ -195,6 +196,15 @@ public abstract class AbstractCostService implements CostService { ...@@ -195,6 +196,15 @@ public abstract class AbstractCostService implements CostService {
Integer update = costDao.update(costDomain, new LambdaQueryWrapper<CostDomain>() Integer update = costDao.update(costDomain, new LambdaQueryWrapper<CostDomain>()
.eq(CostDomain::getCostNo, costDomain.getCostNo())); .eq(CostDomain::getCostNo, costDomain.getCostNo()));
//费用单明细
if (costDomain.getCostDetailDomainList() != null && costDomain.getCostDetailDomainList().size() > 0) {
for (CostDetailDomain costDetailDomain: costDomain.getCostDetailDomainList()) {
// costReviewerMapper.delete(new LambdaQueryWrapper<CostReviewer>()
// .eq(CostReviewer::getType, CostReviewer.finalReviewer)
// .eq(CostReviewer::getReferId, costCompanyDomain.getId()));
// baseMapper.updateById(costDetailDomain);
}
}
resp.setMsg("success"); resp.setMsg("success");
resp.setResult(this.getCostByCostNo(costDomain.getCostNo())); resp.setResult(this.getCostByCostNo(costDomain.getCostNo()));
......
...@@ -5,13 +5,19 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -5,13 +5,19 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.blt.other.common.exception.BizRuntimeException; import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.common.util.CurUtils; import com.blt.other.common.util.CurUtils;
import com.blt.other.database.model.CostPlanDomain; import com.blt.other.database.model.CostPlanDomain;
import com.blt.other.database.model.CostPlanTempDomain;
import com.blt.other.database.model.CostTypeDomain; import com.blt.other.database.model.CostTypeDomain;
import com.blt.other.module.cost.model.CostDetailDomain;
import com.blt.other.module.cost.model.CostDomain; import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostPlanService; import com.blt.other.module.cost.service.CostPlanService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/** /**
* <p> * <p>
...@@ -29,6 +35,8 @@ public class CostPlanNewLend1ServiceImpl extends AbstractCostPlanService impleme ...@@ -29,6 +35,8 @@ public class CostPlanNewLend1ServiceImpl extends AbstractCostPlanService impleme
public void save(CostPlanDomain planDomain) { public void save(CostPlanDomain planDomain) {
this.doSaveFinanceRecord(planDomain); this.doSaveFinanceRecord(planDomain);
this.completedCostPlan(planDomain); this.completedCostPlan(planDomain);
//子项目和借支总金额
planDomain.setPlanAmount(this.SaveCostPlanTemp(planDomain));
planDomain.setCostPlanStatus(0); planDomain.setCostPlanStatus(0);
planDomain.setLendStatus(1); planDomain.setLendStatus(1);
...@@ -50,7 +58,8 @@ public class CostPlanNewLend1ServiceImpl extends AbstractCostPlanService impleme ...@@ -50,7 +58,8 @@ public class CostPlanNewLend1ServiceImpl extends AbstractCostPlanService impleme
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(planDomain.getTypeNo()); CostTypeDomain costTypeDomain = costTypeDao.selectByNo(planDomain.getTypeNo());
planDomain.setTypeId(costTypeDomain.getId()); planDomain.setTypeId(costTypeDomain.getId());
//子项目和借支总金额
planDomain.setPlanAmount(this.SaveCostPlanTemp(planDomain));
costPlanDao.update(planDomain, new LambdaQueryWrapper<CostPlanDomain>() costPlanDao.update(planDomain, new LambdaQueryWrapper<CostPlanDomain>()
.eq(CostPlanDomain::getCostPlanNo, planDomain.getCostPlanNo())); .eq(CostPlanDomain::getCostPlanNo, planDomain.getCostPlanNo()));
} }
...@@ -81,7 +90,56 @@ public class CostPlanNewLend1ServiceImpl extends AbstractCostPlanService impleme ...@@ -81,7 +90,56 @@ public class CostPlanNewLend1ServiceImpl extends AbstractCostPlanService impleme
} }
int insert = costDao.insert(costDomain); int insert = costDao.insert(costDomain);
//增加借支明细
List<CostPlanTempDomain> costPlanTempDomains = costPlanTempDao.selectListByPlanNo(costDomain.getCostPlanNo());
if (costPlanTempDomains != null && costPlanTempDomains.size() > 0) {
AtomicInteger index = new AtomicInteger(1);
List<CostDetailDomain> listCostDetail = costPlanTempDomains.stream()
.map(costPlanTempDomain -> {
CostDetailDomain costDetailDomain = this.tempToDetail(costPlanTempDomain, costPlanDomain, index.getAndIncrement());
BeanUtils.copyProperties(costDomain, costDetailDomain);
costDetailDomain.setAmount(costPlanTempDomain.getAmount());
costDetailDomain.setProject(costPlanTempDomain.getProject());
return costDetailDomain;
}).collect(Collectors.toList());
for (CostDetailDomain costDetail : listCostDetail) {
if(StringUtils.isBlank(costDomain.getDic())){
costDetail.setDic("CNY");
}
if(StringUtils.isNotBlank(costDomain.getCategoryName())){
costDetail.setCategoryName(costDomain.getCategoryName());
} else {
costDetail.setCategoryName((StringUtils.isNotBlank(costDetail.getProject()) && costDetail.getProject().equals("集团") ? "管理成本" : "日常费用"));
}
// 生成付款费用详情
costDetailDao.insert(costDetail);
}
}
costLogService.save(costDomain.getCostNo(), costDomain.getCreateUserid(), "由费用计划:" + costDomain.getCostPlanNo() + " 生成借支单"); costLogService.save(costDomain.getCostNo(), costDomain.getCreateUserid(), "由费用计划:" + costDomain.getCostPlanNo() + " 生成借支单");
return insert; return insert;
} }
private BigDecimal SaveCostPlanTemp(CostPlanDomain planDomain){
//子项目和借支总金额
BigDecimal amount = BigDecimal.ZERO;
if (planDomain.getCostPlanTempDomainList() != null && planDomain.getCostPlanTempDomainList().size() > 0) {
costPlanTempDao.deletedByPlanNoAndTempNo(planDomain.getCostPlanNo(),planDomain.getCostPlanNo());
for (CostPlanTempDomain item: planDomain.getCostPlanTempDomainList()) {
BigDecimal itemAmount = item.getAmount();
String itemProject= item.getProject();
BeanUtils.copyProperties(planDomain, item);
CostPlanTempDomain costPlanTempDomain = new CostPlanTempDomain();
costPlanTempDomain.setCostPlanNo(planDomain.getCostPlanNo());
costPlanTempDomain.setTempNo(planDomain.getCostPlanNo());
costPlanTempDomain.setAmount(itemAmount);
costPlanTempDomain.setProject(itemProject);
costPlanTempDomain.setAccountingSubjectNo("");
//新增付款子项目
costPlanTempDao.insert(costPlanTempDomain);
amount = amount.add(item.getAmount());
}
planDomain.setPlanAmount(amount);
}
return amount;
}
} }
...@@ -2,9 +2,9 @@ spring: ...@@ -2,9 +2,9 @@ spring:
# 数据源配置 # 数据源配置
datasource: datasource:
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://cdb-aanqm573.gz.tencentcdb.com:10120/bailun_other?useUnicode=true&characterEncoding=utf-8&useSSL=false&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true url: jdbc:mysql://gz-cdb-lnrmt5zh.sql.tencentcdb.com:61369/bailun_other?useUnicode=true&characterEncoding=UTF-8&useSSL=false&rewriteBatchedStatements=true
username: root username: root
password: 'Aarob2020#' password: "#7kfnymAM$Y9-Ntf"
# url: jdbc:mysql://gz-cdb-lnrmt5zh.sql.tencentcdb.com:61369/bailun_other?useUnicode=true&characterEncoding=UTF-8&useSSL=false&rewriteBatchedStatements=true # url: jdbc:mysql://gz-cdb-lnrmt5zh.sql.tencentcdb.com:61369/bailun_other?useUnicode=true&characterEncoding=UTF-8&useSSL=false&rewriteBatchedStatements=true
# username: root # username: root
# password: "#7kfnymAM$Y9-Ntf" # password: "#7kfnymAM$Y9-Ntf"
......
...@@ -2,9 +2,9 @@ spring: ...@@ -2,9 +2,9 @@ spring:
# 数据源配置 # 数据源配置
datasource: datasource:
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://cdb-aanqm573.gz.tencentcdb.com:10120/bailun_other_pre?useUnicode=true&characterEncoding=utf-8&useSSL=false&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true url: jdbc:mysql://gz-cdb-lnrmt5zh.sql.tencentcdb.com:61369/bailun_other?useUnicode=true&characterEncoding=UTF-8&useSSL=false&rewriteBatchedStatements=true
username: root username: root
password: 'Aarob2020#' password: "#7kfnymAM$Y9-Ntf"
hikari: hikari:
maximum-pool-size: 200 maximum-pool-size: 200
minimum-idle: 10 minimum-idle: 10
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment