Commit b0543c49 by huluobin

付款计划详情 一级科目

parent 1b6044af
......@@ -4,6 +4,7 @@ import com.bailuntec.common.SpringContextUtil;
import com.bailuntec.cost.api.dto.CostPlanTempDto;
import com.blt.other.common.util.PathUtil;
import com.blt.other.module.cost.dao.CostTypeKindDao;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;
......@@ -22,8 +23,13 @@ public class CostPlanTempDomain {
private String dic; // 币种
private String typeNo; // 大类编号
@ApiModelProperty("会计一级科目")
private String accountingSubjectNo;
@ApiModelProperty("会计一级科目")
private String accountingSubjectName;
public CostPlanTempDto castToDto(){
public CostPlanTempDto castToDto() {
CostTypeKindDao costTypeKindDao = SpringContextUtil.getBean(CostTypeKindDao.class);
CostPlanTempDto dto = new CostPlanTempDto();
BeanUtils.copyProperties(this, dto);
......
......@@ -36,7 +36,6 @@ public class CostTypeController {
return CostResult.success(page);
}
@ApiOperation("获取费用类型详情")
@PostMapping("/queryDetail")
public CostResult<CostTypeResult> queryDetail(@RequestParam Integer id) {
......@@ -44,6 +43,12 @@ public class CostTypeController {
return CostResult.success(result);
}
@ApiOperation("根据编码获取费用类型详情")
@PostMapping("/queryByNo")
public CostResult<CostTypeResult> queryByNo(@RequestParam String typeNo) {
CostTypeResult result = costTypeService.queryByNo(typeNo);
return CostResult.success(result);
}
@ApiOperation("删除费用类型详情")
@PostMapping("/deleteById")
......
......@@ -22,4 +22,7 @@ public interface CostTypeDao extends BaseMapper<CostTypeDomain> {
//获取费用类型详情
CostTypeResult queryDetail(Integer id);
//获取费用类型详情
CostTypeResult queryByNo(String typeNo);
}
package com.blt.other.module.cost.dto.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
......@@ -19,15 +20,26 @@ import java.math.BigDecimal;
public class AddItemReq {
// 费用单表 id
private Integer id;
@ApiModelProperty("费用计划编号")
private String costPlanNo; // 费用计划编号
@ApiModelProperty("计划缓存编号")
private String tempNo; // 计划缓存编号
private String kindNo; // 种类编号
@ApiModelProperty("文件地址")
private String filePath; // 文件地址
@ApiModelProperty("费用金额")
private BigDecimal amount; // 费用总金额
@ApiModelProperty("付款理由")
private String costReason; // 付款理由
@ApiModelProperty("币种")
private String dic; // 币种
@ApiModelProperty("费用类型编号")
private String typeNo; // 大类编号
private BigDecimal planAmount;
// private MultipartFile fileSelect;
}
package com.blt.other.module.cost.dto.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
......@@ -19,15 +20,30 @@ import java.math.BigDecimal;
public class ResetItemReq {
private Integer id;
private Boolean delecteFile;
private MultipartFile fileSelect2;
@ApiModelProperty("费用计划编号")
private String costPlanNo; // 费用计划编号
@ApiModelProperty("计划缓存编号")
private String tempNo; // 计划缓存编号
private String kindNo; // 种类编号
@ApiModelProperty("文件地址")
private String filePath; // 文件地址
@ApiModelProperty("费用金额")
private BigDecimal amount; // 费用总金额
@ApiModelProperty("付款理由")
private String costReason; // 付款理由
@ApiModelProperty("币种")
private String dic; // 币种
@ApiModelProperty("费用类型编号")
private String typeNo; // 大类编号
private Boolean delecteFile;
private MultipartFile fileSelect2;
}
package com.blt.other.module.cost.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
......@@ -15,8 +16,13 @@ public class CostDetailDomain {
private String companyName; // 主体名称
private String typeNo; // 类型编号
private String typeName; // 类型标题
private String kindNo; // 种类编号
private String kindName; // 种类标题
@ApiModelProperty("会计一级科目")
private String accountingSubjectNo;
@ApiModelProperty("会计一级科目")
private String accountingSubjectName;
private Integer createUserid; // 创建人 id
private String createUsercode; // 创建人编号
private String createUsername; // 创建人名称
......
......@@ -219,7 +219,6 @@ public class CostDomain implements Serializable {
@ApiModelProperty("会计一级科目")
private String accountingSubjectName;
//-------------
@TableField(exist = false)
private CostTemplate costTemplate;
......
......@@ -47,4 +47,12 @@ public interface CostTypeService extends IService<CostTypeDomain> {
* @param id id
*/
void deleteById(Integer id);
/**
* 根据编码获取费用费用详情
*
* @param typeNo typeNo
* @return res
*/
CostTypeResult queryByNo(String typeNo);
}
......@@ -13,7 +13,6 @@ import com.blt.other.module.cost.dto.request.CostTypeAddReq;
import com.blt.other.module.cost.dto.request.CostTypeModifyReq;
import com.blt.other.module.cost.dto.request.CostTypeQueryPageReq;
import com.blt.other.module.cost.dto.response.CostTypeResult;
import com.blt.other.module.cost.model.AccountingSubject;
import com.blt.other.module.cost.service.CostTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
......@@ -84,6 +83,11 @@ public class CostTypeServiceImpl extends ServiceImpl<CostTypeDao, CostTypeDomain
baseMapper.deleteById(id);
}
@Override
public CostTypeResult queryByNo(String typeNo) {
return baseMapper.queryByNo(typeNo);
}
/**
* 根据ui类型获取费用类型 对应的费用模版类型
*
......
......@@ -3,12 +3,12 @@ package com.blt.other.module.cost.service.impl.costplan;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.common.util.CurUtils;
import com.blt.other.database.model.CostPlanDomain;
import com.blt.other.database.model.CostPlanTempDomain;
import com.blt.other.module.cost.model.CostDetailDomain;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostPlanService;
import com.blt.other.module.cost.utils.CostUtils;
import com.blt.other.database.model.CostPlanDomain;
import com.blt.other.database.model.CostPlanTempDomain;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -75,7 +75,6 @@ public class CostPlanNewPayServiceImpl extends AbstractCostPlanService implement
throw new RuntimeException("存在有金额、但是没有选择类型的子项目");
}
// 将 List<CostPlanTempDomain> 转为 List<CostDetailDomain>
AtomicInteger index = new AtomicInteger(1);
List<CostDetailDomain> costDetailDomainList = costPlanTempDomains.stream().map(costPlanTempDomain ->
this.tempToDetail(costPlanTempDomain, costPlanDomain, index.getAndIncrement())
......@@ -106,6 +105,9 @@ public class CostPlanNewPayServiceImpl extends AbstractCostPlanService implement
costDomain.setCostNo(costNo);
costDomain.setTypeNo(typeNo);
costDomain.setTypeName(costDetailDomains.get(0).getTypeName());
costDomain.setAccountingSubjectNo(costDetailDomains.get(0).getAccountingSubjectNo());
costDomain.setAccountingSubjectName(costDetailDomains.get(0).getAccountingSubjectName());
// CostTypeDomain costTypeDomain = costTypeDao.selectByTypeNo(typeNo);
// costDomain.setSubjectCode(costTypeDomain.getSubjectCode());
......
......@@ -4,24 +4,29 @@ import com.bailuntec.cost.api.dto.CostPlanTempDto;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.blt.other.common.util.CurUtils;
import com.blt.other.common.util.PathUtil;
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.CostTypeKindDomain;
import com.blt.other.module.cost.dao.AccountingSubjectMapper;
import com.blt.other.module.cost.dao.CostPlanDao;
import com.blt.other.module.cost.dao.CostPlanTempDao;
import com.blt.other.module.cost.dao.CostTypeDao;
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 com.blt.other.module.cost.utils.CostFileUtil;
import com.blt.other.database.model.CostPlanDomain;
import com.blt.other.database.model.CostPlanTempDomain;
import com.blt.other.database.model.CostTypeKindDomain;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
......@@ -67,18 +72,25 @@ public class CostPlanTempServiceImpl implements CostPlanTempService {
}
}
@Resource
AccountingSubjectMapper accountingSubjectMapper;
@Resource
CostTypeDao costTypeDao;
@Transactional(rollbackFor = Exception.class)
@Override
public AddItemResp doSave(AddItemReq req) {
CostTypeKindDomain kindByKindNo = costTypeKindService.getKindByKindNo(req.getKindNo());
req.setTypeNo(kindByKindNo.getTypeNo());
CostPlanTempDomain costPlanTempDomain = new CostPlanTempDomain();
BeanUtils.copyProperties(req, costPlanTempDomain);
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(req.getTypeNo());
AccountingSubject accountingSubject = accountingSubjectMapper.selectByNo(costTypeDomain.getAccountingSubjectNo());
costPlanTempDomain.setTempNo(this.createNo());
costPlanTempDomain.setAccountingSubjectNo(accountingSubject.getSubjectNo());
costPlanTempDomain.setAccountingSubjectName(accountingSubject.getName());
this.checkDic(costPlanTempDomain);
......@@ -156,12 +168,17 @@ public class CostPlanTempServiceImpl implements CostPlanTempService {
@Override
public CostPlanTempDomain resetItem(ResetItemReq req) {
CostTypeKindDomain kindByKindNo = costTypeKindService.getKindByKindNo(req.getKindNo());
req.setTypeNo(kindByKindNo.getTypeNo());
CostPlanTempDomain costPlanTempDomain = new CostPlanTempDomain();
com.bailuntec.common.BeanUtils.copyProperties(req, costPlanTempDomain);
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(req.getTypeNo());
AccountingSubject accountingSubject = accountingSubjectMapper.selectByNo(costTypeDomain.getAccountingSubjectNo());
costPlanTempDomain.setTempNo(this.createNo());
costPlanTempDomain.setAccountingSubjectNo(accountingSubject.getSubjectNo());
costPlanTempDomain.setAccountingSubjectName(accountingSubject.getName());
if (req.getDelecteFile()) {
costPlanTempDao.deletedFilePath(req.getTempNo());
}
......
......@@ -47,5 +47,22 @@
left join accounting_subject t2 on t1.accounting_subject_no = t2.subject_no
where t1.id = #{id}
</select>
<select id="queryByNo" resultType="com.blt.other.module.cost.dto.response.CostTypeResult">
select t1.id,
t1.type_no,
t1.type_name,
t1.description,
t1.accounting_subject_no,
t2.name as accounting_subject_name,
t1.create_time,
t1.update_user,
t1.update_user_id,
t1.last_update_time,
t1.create_user_id,
t1.create_user
from cost_type t1
left join accounting_subject t2 on t1.accounting_subject_no = t2.subject_no
where t1.type_no = #{typeNo}
</select>
</mapper>
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