Commit 8688d1a0 authored by lcl's avatar lcl

u

parent a3dec409
...@@ -34,7 +34,7 @@ public class CbQuantitySummaryController extends BaseController { ...@@ -34,7 +34,7 @@ public class CbQuantitySummaryController extends BaseController {
* @return * @return
*/ */
@GetMapping(value = "/subjectTree") @GetMapping(value = "/subjectTree")
public R<Map<String, Object>> subjectTree(CbProjectBaseBo bo) { public R<List<Map<String, Object>>> subjectTree(CbProjectBaseBo bo) {
return R.ok(baseService.subjectTree(bo)); return R.ok(baseService.subjectTree(bo));
} }
......
...@@ -49,6 +49,9 @@ public class CbSubject implements Serializable { ...@@ -49,6 +49,9 @@ public class CbSubject implements Serializable {
* 类型 0: 未归类 1:房建 * 类型 0: 未归类 1:房建
*/ */
private Integer type; private Integer type;
private Date createTime; private Date createTime;
private Integer sort;
} }
...@@ -18,7 +18,7 @@ import java.util.Map; ...@@ -18,7 +18,7 @@ import java.util.Map;
*/ */
public interface ICbQuantitySummaryService extends IService<CbQuantitySummary> { public interface ICbQuantitySummaryService extends IService<CbQuantitySummary> {
Map<String, Object> subjectTree(CbProjectBaseBo bo); List<Map<String, Object>> subjectTree(CbProjectBaseBo bo);
List<String> monthList(CbQuantitySummaryListBo bo); List<String> monthList(CbQuantitySummaryListBo bo);
......
...@@ -2,14 +2,17 @@ package com.dsk.cscec.service.impl; ...@@ -2,14 +2,17 @@ package com.dsk.cscec.service.impl;
import cn.hutool.crypto.SecureUtil; import cn.hutool.crypto.SecureUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsk.common.exception.ServiceException; import com.dsk.common.exception.ServiceException;
import com.dsk.cscec.domain.CbQuantitySummary; import com.dsk.cscec.domain.CbQuantitySummary;
import com.dsk.cscec.domain.CbQuantitySummaryActual; import com.dsk.cscec.domain.CbQuantitySummaryActual;
import com.dsk.cscec.domain.CbSubject;
import com.dsk.cscec.domain.bo.CbProjectBaseBo; import com.dsk.cscec.domain.bo.CbProjectBaseBo;
import com.dsk.cscec.domain.bo.CbQuantitySummaryListBo; import com.dsk.cscec.domain.bo.CbQuantitySummaryListBo;
import com.dsk.cscec.domain.vo.CbQuantitySummaryListVo; import com.dsk.cscec.domain.vo.CbQuantitySummaryListVo;
import com.dsk.cscec.mapper.CbQuantitySummaryMapper; import com.dsk.cscec.mapper.CbQuantitySummaryMapper;
import com.dsk.cscec.mapper.CbSubjectMapper;
import com.dsk.cscec.service.ICbQuantitySummaryActualService; import com.dsk.cscec.service.ICbQuantitySummaryActualService;
import com.dsk.cscec.service.ICbQuantitySummaryService; import com.dsk.cscec.service.ICbQuantitySummaryService;
import jodd.bean.BeanException; import jodd.bean.BeanException;
...@@ -19,6 +22,8 @@ import org.springframework.stereotype.Service; ...@@ -19,6 +22,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -36,10 +41,12 @@ public class CbQuantitySummaryServiceImpl extends ServiceImpl<CbQuantitySummaryM ...@@ -36,10 +41,12 @@ public class CbQuantitySummaryServiceImpl extends ServiceImpl<CbQuantitySummaryM
@Autowired @Autowired
private ICbQuantitySummaryActualService baseActualService; private ICbQuantitySummaryActualService baseActualService;
@Resource
private CbSubjectMapper cbSubjectMapper;
@Override @Override
public Map<String, Object> subjectTree(CbProjectBaseBo bo) { public List<Map<String, Object>> subjectTree(CbProjectBaseBo bo) {
Map<String, Object> resultMap = new HashMap<>(); List<Map<String, Object>> resultList = new ArrayList<>();
List<Map<String, Object>> list = baseMapper.selectSubject(bo); List<Map<String, Object>> list = baseMapper.selectSubject(bo);
if (!ObjectUtils.isEmpty(list)) { if (!ObjectUtils.isEmpty(list)) {
Map<String, Map<String, Map<String, List<Map<String, Object>>>>> map = list.stream() Map<String, Map<String, Map<String, List<Map<String, Object>>>>> map = list.stream()
...@@ -47,13 +54,42 @@ public class CbQuantitySummaryServiceImpl extends ServiceImpl<CbQuantitySummaryM ...@@ -47,13 +54,42 @@ public class CbQuantitySummaryServiceImpl extends ServiceImpl<CbQuantitySummaryM
Collectors.groupingBy(item -> item.get("one").toString(), Collectors.groupingBy(item -> item.get("one").toString(),
Collectors.groupingBy(item -> item.get("two").toString(), Collectors.groupingBy(item -> item.get("two").toString(),
Collectors.groupingBy(item -> item.get("three").toString())))); Collectors.groupingBy(item -> item.get("three").toString()))));
resultMap.put("房建类成本科目", map); Map<String, Object> resMap = new HashMap<>();
List<Map<String, Object>> resList = new ArrayList<>();
resMap.put("name", "房建类成本科目");
resMap.put("sort", 1);
for (Map.Entry<String, Map<String, Map<String, List<Map<String, Object>>>>> entry : map.entrySet()) {
Map<String, Object> oneMap = new HashMap<>();
List<Map<String, Object>> oneList = new ArrayList<>();
oneMap.put("name", entry.getKey());
oneMap.put("sort", cbSubjectMapper.selectOne(Wrappers.<CbSubject>lambdaQuery().eq(CbSubject::getCbSubjectName,entry.getKey())).getSort());
for (Map.Entry<String, Map<String, List<Map<String, Object>>>> twoEntry : entry.getValue().entrySet()) {
Map<String, Object> twoMap = new HashMap<>();
List<Map<String, Object>> twoList = new ArrayList<>();
twoMap.put("name", twoEntry.getKey());
for (Map.Entry<String, List<Map<String, Object>>> threeEntry : twoEntry.getValue().entrySet()) {
Map<String, Object> threeMap = new HashMap<>();
threeMap.put("name", threeEntry.getKey());
twoList.add(threeMap);
}
twoMap.put("children", twoList);
oneList.add(twoMap);
}
oneMap.put("children", oneList);
resList.add(oneMap);
}
resMap.put("children", resList);
resultList.add(resMap);
} }
int otherSubjectCount = baseMapper.selectOtherSubjectCount(bo); int otherSubjectCount = baseMapper.selectOtherSubjectCount(bo);
if (otherSubjectCount > 0) { if (otherSubjectCount > 0) {
resultMap.put("未归类项目", "other"); Map<String, Object> resMap = new HashMap<>();
resMap.put("name", "未归类项目");
resMap.put("sort", 2);
resultList.add(resMap);
} }
return resultMap; return resultList;
} }
@Override @Override
......
...@@ -26,7 +26,14 @@ ...@@ -26,7 +26,14 @@
cqsa.record_date cqsa.record_date
from cb_quantity_summary cqs from cb_quantity_summary cqs
join cb_quantity_summary_actual cqsa on cqs.id = cqsa.cb_quantity_summary_id join cb_quantity_summary_actual cqsa on cqs.id = cqsa.cb_quantity_summary_id
where cqs.del_falg = 0 and cqs.project_id = #{projectId} and cqs.cb_stage = #{cbStage} and cqs.cb_subject_name = #{cbSubjectName} left join cb_subject cs1 on cqs.cb_subject_name = cs1.cb_subject_name
where cqs.del_falg = 0 and cqs.project_id = #{projectId} and cqs.cb_stage = #{cbStage}
<if test="cbSubjectName != null and cbSubjectName !=''">
<choose>
<when test="cbSubjectName == '未归类项目'"> and cs1.id is null </when>
<otherwise> and cqs.cb_subject_name = #{cbSubjectName} </otherwise>
</choose>
</if>
group by cqsa.record_date group by cqsa.record_date
order by cqsa.record_date order by cqsa.record_date
</select> </select>
...@@ -38,11 +45,18 @@ ...@@ -38,11 +45,18 @@
cqs.unit, cqs.material_description, cqs.guide_price, cqs.bid_unit_price, cqs.unit_price_difference, cqs.quantity, cqs.unit, cqs.material_description, cqs.guide_price, cqs.bid_unit_price, cqs.unit_price_difference, cqs.quantity,
cqs.combined_price, cqs.combined_price_tax, cqs.brand_name, cqs.bid_source, cqs.remark, cqs.`number`, cqsa.quantities, cqs.combined_price, cqs.combined_price_tax, cqs.brand_name, cqs.bid_source, cqs.remark, cqs.`number`, cqsa.quantities,
cqsa.quantities_unit, cqsa.conversion_quantities, cqsa.conversion_unit, cqsa.purchase_unit_price, cqsa.create_time, cqsa.quantities_unit, cqsa.conversion_quantities, cqsa.conversion_unit, cqsa.purchase_unit_price, cqsa.create_time,
cqsa.id actualId, cqsa.ipm_project_code, cqsa.ipm_contract_code, cqsa.ipm_job_code, cqsa.push_quantities cqsa.id actualId, cqsa.ipm_project_code, cqsa.ipm_contract_code, cqsa.ipm_biz_code, cqsa.push_quantities
from cb_quantity_summary cqs from cb_quantity_summary cqs
left join cb_quantity_summary_actual cqsa on cqs.id = cqsa.cb_quantity_summary_id left join cb_quantity_summary_actual cqsa on cqs.id = cqsa.cb_quantity_summary_id
where cqs.del_falg = 0 and cqs.project_id = #{projectId} and cqs.cb_stage = #{cbStage} and cqs.cb_subject_name = #{cbSubjectName} left join cb_subject cs1 on cqs.cb_subject_name = cs1.cb_subject_name
where cqs.del_falg = 0 and cqs.project_id = #{projectId} and cqs.cb_stage = #{cbStage}
<if test="recordDate != null and recordDate != ''"> and cqsa.record_date &lt;= #{recordDate} </if> <if test="recordDate != null and recordDate != ''"> and cqsa.record_date &lt;= #{recordDate} </if>
<if test="cbSubjectName != null and cbSubjectName !=''">
<choose>
<when test="cbSubjectName == '未归类项目'"> and cs1.id is null </when>
<otherwise> and cqs.cb_subject_name = #{cbSubjectName} </otherwise>
</choose>
</if>
order by cqsa.record_date desc order by cqsa.record_date desc
) a ) a
group by a.id group by a.id
......
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