Commit 1e840717 by huluobin

# update

parent 41a60e40
......@@ -44,8 +44,8 @@ public class CostPlanDomain implements Serializable {
@ApiModelProperty("类型编号")
private Integer typeId;
@TableField(exist = false)
@Deprecated
// @TableField(exist = false)
// @Deprecated
@ApiModelProperty("类型编号")
private String typeNo;
// @TableField(exist = false)
......
......@@ -37,7 +37,7 @@ public class CostPlanTempDomain {
@ApiModelProperty("类型编号")
private Integer typeId;
@TableField(exist = false)
@ApiModelProperty("类型编号")
private String typeNo;
// @TableField(exist = false)
......@@ -47,10 +47,10 @@ public class CostPlanTempDomain {
@TableField(exist = false)
private Integer accountingSubjectId;
@TableField(exist = false)
@ApiModelProperty("会计一级科目")
private String accountingSubjectNo;
// @TableField(exist = false)
@ApiModelProperty("会计一级科目")
private String accountingSubjectName;
......
......@@ -73,4 +73,6 @@ public class CostQueryPageReq extends BaseRequest {
private List<String> keys;
private String typeName;
}
......@@ -25,23 +25,20 @@ public class CostDetailDomain {
@ApiModelProperty("类型编号")
private Integer typeId;
@TableField(exist = false)
@ApiModelProperty("类型编号")
private String typeNo;
// @TableField(exist = false)
@ApiModelProperty("类型标题")
private String typeName;
@TableField(exist = false)
@ApiModelProperty("描述")
private String description;
@TableField(exist = false)
private Integer accountingSubjectId;
@TableField(exist = false)
@ApiModelProperty("会计一级科目")
private String accountingSubjectNo;
// @TableField(exist = false)
@ApiModelProperty("会计一级科目")
private String accountingSubjectName;
......
......@@ -79,23 +79,20 @@ public class CostDomain implements Serializable {
@ApiModelProperty("类型编号")
private Integer typeId;
@TableField(exist = false)
@ApiModelProperty("类型编号")
private String typeNo;
@TableField(exist = false)
@ApiModelProperty("描述")
private String description;
// @TableField(exist = false)
@ApiModelProperty("类型标题")
private String typeName;
@TableField(exist = false)
@ApiModelProperty("描述")
private String description;
@TableField(exist = false)
private Integer accountingSubjectId;
@TableField(exist = false)
@ApiModelProperty("会计一级科目")
private String accountingSubjectNo;
// @TableField(exist = false)
@ApiModelProperty("会计一级科目")
private String accountingSubjectName;
......
......@@ -125,6 +125,7 @@ public abstract class AbstractCostPlanService implements CostPlanService {
AccountingSubject accountingSubject = accountingSubjectMapper.selectById(costTypeDomain.getAccountingSubjectId());
costPlanDomain.setTypeId(costTypeDomain.getId());
costPlanDomain.setTypeNo(costTypeDomain.getTypeNo());
costPlanDomain.setTypeName(costTypeDomain.getTypeName());
costPlanDomain.setAccountingSubjectId(accountingSubject.getId());
costPlanDomain.setAccountingSubjectName(accountingSubject.getName());
......
......@@ -37,6 +37,7 @@ public class CostPlanNewPayServiceImpl extends AbstractCostPlanService implement
List<CostPlanTempDomain> list = costPlanTempDao.selectListByPlanNo(planDomain.getCostPlanNo());
BigDecimal planAmount = list.stream().map(CostPlanTempDomain::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
planDomain.setPlanAmount(planAmount);
planDomain.setCostPlanStatus(0);
this.check(planDomain);
......@@ -60,25 +61,23 @@ public class CostPlanNewPayServiceImpl extends AbstractCostPlanService implement
public Integer affirm(String costPlanNo) {
// 获取 temp 表中的记录
CostPlanDomain costPlanDomain = costPlanDao.selectByNo(costPlanNo);
List<CostPlanTempDomain> costPlanTempDomains = costPlanTempDao.selectListByPlanNo(costPlanNo);
if (costPlanDomain.getCostPlanStatus() != 0) {
throw new BizRuntimeException("只能更新待确认的计划单");
}
costPlanDomain.setCostPlanStatus(1);
costPlanDao.update(costPlanDomain, new LambdaQueryWrapper<CostPlanDomain>()
.eq(CostPlanDomain::getCostPlanNo, costPlanDomain.getCostPlanNo()));
List<CostPlanTempDomain> costPlanTempDomains = costPlanTempDao.selectListByPlanNo(costPlanNo);
if (costPlanTempDomains.stream().anyMatch(temp -> null == temp.getTypeNo())) {
throw new RuntimeException("存在有金额、但是没有选择类型的子项目");
}
costPlanDomain.setCostPlanStatus(1);
costPlanDao.updateById(costPlanDomain);
AtomicInteger index = new AtomicInteger(1);
List<CostDetailDomain> costDetailDomainList = costPlanTempDomains.stream().map(costPlanTempDomain ->
this.tempToDetail(costPlanTempDomain, costPlanDomain, index.getAndIncrement())
).collect(Collectors.toList());
List<CostDetailDomain> costDetailDomainList = costPlanTempDomains.stream()
.map(costPlanTempDomain -> this.tempToDetail(costPlanTempDomain, costPlanDomain, index.getAndIncrement()))
.collect(Collectors.toList());
// 根据大类分类
Map<Integer, List<CostDetailDomain>> detailMap = costDetailDomainList.stream().collect(
......@@ -102,36 +101,36 @@ public class CostPlanNewPayServiceImpl extends AbstractCostPlanService implement
}
costByNo = costService.getCostByCostNo(costNo);
}
CostDetailDomain costDetailItem = costDetailDomainList.get(0);
costDomain.setCostNo(costNo);
costDomain.setTypeId(typeId);
costDomain.setAccountingSubjectId(costDetailDomains.get(0).getAccountingSubjectId());
costDomain.setTypeNo(costDetailItem.getTypeNo());
costDomain.setTypeName(costDetailItem.getTypeName());
costDomain.setAccountingSubjectNo(costDetailItem.getAccountingSubjectNo());
costDomain.setAccountingSubjectName(costDetailItem.getAccountingSubjectName());
costDomain.setAmount(costDetailDomains.stream().map(CostDetailDomain::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
if (null == costDomain.getAmount()) {
costDomain.setAmount(new BigDecimal(0));
}
for (CostDetailDomain costDetailDomain : costDetailDomains) {
costDomain.setAmount(costDomain.getAmount().add(costDetailDomain.getAmount()));
}
costDomain.setDic(costDetailDomains.get(0).getDic());
costDomain.setCostStatus(0);
BigDecimal toRmbRate = CurUtils.getCur(costDomain.getDic(), "CNY");
costDomain.setToRmbRate(toRmbRate);
costDomain.setAmountRmb(costDomain.getAmount().multiply(toRmbRate).setScale(2, BigDecimal.ROUND_HALF_UP));
// 执行添加记录流程
costDomain.setCostPlanNo(costPlanNo);
// 生成付款费用详情单
for (CostDetailDomain costDetailDomain : costDetailDomains) {
costDetailDomain.setCostNo(costNo);
for (CostDetailDomain costDetail : costDetailDomains) {
costDetail.setCostNo(costNo);
// 生成付款费用详情
costDetailDao.insert(costDetailDomain);
costDetailDao.insert(costDetail);
}
// 执行添加记录流程
costDomain.setCostPlanNo(costPlanNo);
int insert = costDao.insert(costDomain);
if (insert >= 1) {
// 记录日志
costDao.insert(costDomain);
costLogService.save(costDomain.getCostNo(), costDomain.getCreateUserid(), "由费用计划:" + costDomain.getCostPlanNo() + " 生成付款单");
}
});
return detailMap.keySet().size();
}
......
......@@ -14,6 +14,7 @@ import com.blt.other.module.cost.dto.request.AddItemReq;
import com.blt.other.module.cost.dto.request.AddItemResp;
import com.blt.other.module.cost.dto.request.ResetItemReq;
import com.blt.other.module.cost.dto.response.GetCostTempByPlanNoResp;
import com.blt.other.module.cost.model.AccountingSubject;
import com.blt.other.module.cost.service.CostPlanTempService;
import com.blt.other.module.cost.service.CostTypeKindService;
import org.springframework.beans.BeanUtils;
......@@ -85,7 +86,12 @@ public class CostPlanTempServiceImpl implements CostPlanTempService {
costPlanTempDomain.setTypeId(costTypeDomain.getId());
costPlanTempDomain.setAccountingSubjectId(costTypeDomain.getAccountingSubjectId());
costPlanTempDomain.setTypeNo(costTypeDomain.getTypeNo());
AccountingSubject accountingSubject = accountingSubjectMapper.selectById(costTypeDomain.getAccountingSubjectId());
costPlanTempDomain.setAccountingSubjectName(accountingSubject.getName());
costPlanTempDomain.setAccountingSubjectNo(accountingSubject.getSubjectNo());
this.checkDic(costPlanTempDomain);
......@@ -96,8 +102,7 @@ public class CostPlanTempServiceImpl implements CostPlanTempService {
CostPlanDomain costPlanDomain = costPlanDao.selectByNo(costPlanTempDomain.getCostPlanNo());
if (costPlanDomain != null) {
costPlanDomain.setPlanAmount(costPlanDomain.getPlanAmount().add(costPlanTempDomain.getAmount()));
costPlanDao.update(costPlanDomain, new LambdaQueryWrapper<CostPlanDomain>()
.eq(CostPlanDomain::getCostPlanNo, costPlanDomain.getCostPlanNo()));
costPlanDao.update(costPlanDomain, new LambdaQueryWrapper<CostPlanDomain>().eq(CostPlanDomain::getCostPlanNo, costPlanDomain.getCostPlanNo()));
}
AddItemResp resp = new AddItemResp();
......@@ -170,7 +175,12 @@ public class CostPlanTempServiceImpl implements CostPlanTempService {
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(req.getTypeNo());
costPlanTempDomain.setTypeId(costTypeDomain.getId());
costPlanTempDomain.setAccountingSubjectId(costTypeDomain.getAccountingSubjectId());
costPlanTempDomain.setTypeNo(costTypeDomain.getTypeNo());
AccountingSubject accountingSubject = accountingSubjectMapper.selectById(costTypeDomain.getAccountingSubjectId());
costPlanTempDomain.setAccountingSubjectName(accountingSubject.getName());
costPlanTempDomain.setAccountingSubjectNo(accountingSubject.getSubjectNo());
costPlanTempDao.updateById(costPlanTempDomain);
......
......@@ -307,6 +307,7 @@
# left join accounting_subject ast on ct.accounting_subject_id = ast.id
WHERE
true
<if test=" req.typeName!=null and req.typeName != ''">and t1.type_name= #{req.typeName}</if>
<if test=" req.costForm!=null and req.costForm != ''">and t1.cost_form= #{req.costForm}</if>
<if test=" req.isLend!=null and req.isLend != ''">and t1.is_lend=#{req.isLend}</if>
<if test=" req.companyNo!=null and req.companyNo != ''">and t1.company_no=#{req.companyNo}</if>
......@@ -332,7 +333,7 @@
<if test="key != null and key != '' ">or t1.cost_no LIKE CONCAT('%',#{key},'%')</if>
</foreach>
<foreach collection="req.keys" item="key" index="index">
<if test="key != null and key != '' ">or ct.type_name LIKE CONCAT('%',#{key},'%')</if>
<if test="key != null and key != '' ">or t1.type_name LIKE CONCAT('%',#{key},'%')</if>
</foreach>
<foreach collection="req.keys" item="key" index="index">
<if test="key != null and key != '' ">or t1.company_name LIKE CONCAT('%',#{key},'%')</if>
......
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