Commit 738072ec by huluobin

# 更新

parent 92d94e31
package com.blt.other.module.cost.service.impl; package com.blt.other.module.cost.service.impl;
import com.bailuntec.common.BeanUtils; import com.bailuntec.common.BeanUtils;
import com.bailuntec.common.StringUtils;
import com.bailuntec.common.ListUtil; import com.bailuntec.common.ListUtil;
import com.bailuntec.common.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.common.util.PathUtil; import com.blt.other.common.util.PathUtil;
import com.blt.other.database.model.CostTypeDomain; import com.blt.other.database.model.CostTypeDomain;
import com.blt.other.module.cost.dao.AccountingSubjectMapper; import com.blt.other.module.cost.dao.AccountingSubjectMapper;
import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.dao.CostDetailDao; import com.blt.other.module.cost.dao.CostDetailDao;
import com.blt.other.module.cost.dao.CostTypeDao; import com.blt.other.module.cost.dao.CostTypeDao;
import com.blt.other.module.cost.dto.request.ResetReq; import com.blt.other.module.cost.dto.request.ResetReq;
...@@ -57,10 +59,17 @@ public class CostDetailServiceImpl extends ServiceImpl<CostDetailDao, CostDetail ...@@ -57,10 +59,17 @@ public class CostDetailServiceImpl extends ServiceImpl<CostDetailDao, CostDetail
CostTypeDao costTypeDao; CostTypeDao costTypeDao;
@Resource @Resource
AccountingSubjectMapper accountingSubjectMapper; AccountingSubjectMapper accountingSubjectMapper;
@Resource
CostDao costDao;
@Override @Override
public ResetResp reset(ResetReq req) { public ResetResp reset(ResetReq req) {
CostDetailDomain costDetailDomain = this.getCostDetailByDetailNo(req.getDetailNo()); CostDetailDomain costDetailDomain = this.getCostDetailByDetailNo(req.getDetailNo());
List<CostDetailDomain> costDetailDomainList = baseMapper.selectListByCostNo(costDetailDomain.getCostNo());
if (costDetailDomainList.size() > 1) {
throw new BizRuntimeException("大于1条不能改");
}
BeanUtils.copyProperties(req, costDetailDomain); BeanUtils.copyProperties(req, costDetailDomain);
if (req.getFileSelect2() != null) { if (req.getFileSelect2() != null) {
...@@ -76,6 +85,7 @@ public class CostDetailServiceImpl extends ServiceImpl<CostDetailDao, CostDetail ...@@ -76,6 +85,7 @@ public class CostDetailServiceImpl extends ServiceImpl<CostDetailDao, CostDetail
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(req.getTypeNo()); CostTypeDomain costTypeDomain = costTypeDao.selectByNo(req.getTypeNo());
AccountingSubject accountingSubject = accountingSubjectMapper.selectById(costTypeDomain.getAccountingSubjectId()); AccountingSubject accountingSubject = accountingSubjectMapper.selectById(costTypeDomain.getAccountingSubjectId());
costDetailDomain.setTypeId(costTypeDomain.getId());
costDetailDomain.setTypeNo(costTypeDomain.getTypeNo()); costDetailDomain.setTypeNo(costTypeDomain.getTypeNo());
costDetailDomain.setTypeName(costTypeDomain.getTypeName()); costDetailDomain.setTypeName(costTypeDomain.getTypeName());
costDetailDomain.setAccountingSubjectNo(accountingSubject.getSubjectNo()); costDetailDomain.setAccountingSubjectNo(accountingSubject.getSubjectNo());
......
...@@ -219,7 +219,17 @@ public abstract class AbstractCostService implements CostService { ...@@ -219,7 +219,17 @@ public abstract class AbstractCostService implements CostService {
costDomain.setToRmbRate(toRmbRate); costDomain.setToRmbRate(toRmbRate);
costDomain.setAmountRmb(costDomain.getAmount().multiply(toRmbRate).setScale(2, BigDecimal.ROUND_HALF_UP)); costDomain.setAmountRmb(costDomain.getAmount().multiply(toRmbRate).setScale(2, BigDecimal.ROUND_HALF_UP));
costDomain.setTypeId(costDetailDomains.get(0).getTypeId()); CostDetailDomain costDetailDomain = costDetailDomains.get(0);
CostTypeDomain costTypeDomain = costTypeDao.selectById(costDetailDomain.getTypeId());
AccountingSubject accountingSubject = accountingSubjectMapper.selectById(costTypeDomain.getAccountingSubjectId());
costDomain.setTypeId(costTypeDomain.getId());
costDomain.setTypeNo(costTypeDomain.getTypeNo());
costDomain.setTypeName(costTypeDomain.getTypeName());
costDomain.setAccountingSubjectNo(accountingSubject.getSubjectNo());
costDomain.setAccountingSubjectName(accountingSubject.getName());
costDomain.setLastModifyDate(LocalDateTime.now()); costDomain.setLastModifyDate(LocalDateTime.now());
costDao.updateById(costDomain); costDao.updateById(costDomain);
......
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