Commit 5d611ea0 by jianshuqin

费用单接口增加费用单明细信息

parent 50fe2180
......@@ -12,7 +12,7 @@ import java.util.List;
public interface CostDetailDao extends BaseMapper<CostDetailDomain> {
List<CostDetailDomain> selectListByCostNo(String costNo);
List<CostDetailDomain> selectListByCostNo(String... costNo);
CostDetailDomain selectByDetailNo(String detailNo);
......
package com.blt.other.module.cost.service.impl;
import com.bailuntec.common.exception.BizException;
import com.bailuntec.cost.api.dto.*;
import com.bailuntec.cost.api.request.ManageCostListReq;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -9,7 +8,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blt.other.common.config.property.ProjectConstant;
import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.common.util.CurUtils;
import com.blt.other.common.util.PathUtil;
import com.blt.other.database.model.*;
import com.blt.other.module.auth.dao.UserDao;
import com.blt.other.module.cost.dao.*;
......@@ -146,10 +144,8 @@ public class CostApiServiceImpl implements CostApiService {
costDomain.setCreateTime(new Date());
}
costDomain.setCostTemplateIdByFrom();
if(costForm != 1){
costDomain.setProject(logisticsCostDto.getProject());
costDomain.setProjectDate(logisticsCostDto.getProjectDate());
}
costDomain.setProject(logisticsCostDto.getProject());
costDomain.setProjectDate(logisticsCostDto.getProjectDate());
costDao.insert(costDomain);
if (costForm == 1) {
CostDetailDomain costDetailDomain = new CostDetailDomain();
......@@ -404,11 +400,16 @@ public class CostApiServiceImpl implements CostApiService {
@Override
public List<CostDto> getCostList(String startDate, String endDate, Integer pageNum, Integer pageSize) {
IPage<CostDomain> page = new Page<>(pageNum, pageSize);
List<CostDto> listCostDto = this.costDao.getCostList(page, startDate, endDate).stream().map(CostDomain::castToDto).collect(Collectors.toList());
if (listCostDto != null && listCostDto.size() > 0){
String[] listCostNo = listCostDto.stream().map(l -> l.getCostNo()).toArray(String[]::new);
List<CostDetailDomain> costDetailDomainList = costDetailDao.selectListByCostNo(listCostNo);
for (CostDto costDto:listCostDto.stream().filter(l -> l.getCostForm() == CostDomain.COST_FROM_1).collect(Collectors.toList())) {
costDto.setCostDetailList(costDetailDomainList.stream().filter(l -> l.getCostNo().equals(costDto.getCostNo())).map(CostDetailDomain::castToDto).collect(Collectors.toList()));
}
}
return this.costDao.getCostList(page, startDate, endDate)
.stream()
.map(CostDomain::castToDto)
.collect(Collectors.toList());
return listCostDto;
}
@Override
......
......@@ -13,7 +13,10 @@
FROM cost_detail t1
left join cost_type ct on t1.type_id = ct.id
left join bailun_other.accounting_subject ast on ct.accounting_subject_id = ast.id
WHERE t1.cost_no = #{costNo}
WHERE t1.cost_no in
<foreach collection="array" item="costNo" separator="," open="(" close=")">
#{costNo,jdbcType=VARCHAR}
</foreach>
</select>
<select id="selectByDetailNo" resultType="com.blt.other.module.cost.model.CostDetailDomain">
......
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