Commit 1e840717 by huluobin

# update

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