外包商评价表格接口
This commit is contained in:
parent
b33826faac
commit
f61c9bcd27
|
|
@ -0,0 +1,19 @@
|
|||
package com.bonus.gs.sub.evaluate.evaluate.beans;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/2/24 - 15:00
|
||||
*/
|
||||
@Data
|
||||
public class TableData {
|
||||
private List<Map<String, Object>> oneList;
|
||||
private List<Map<String, Object>> twoList;
|
||||
private List<Map<String, Object>> threeList;
|
||||
private List<Map<String, Object>> childList;
|
||||
}
|
||||
|
|
@ -9,22 +9,22 @@ import com.bonus.gs.sub.evaluate.manager.controller.BaseController;
|
|||
import com.bonus.gs.sub.evaluate.manager.model.SysUser;
|
||||
import com.bonus.gs.sub.evaluate.manager.utils.AjaxRes;
|
||||
import com.bonus.gs.sub.evaluate.manager.utils.GlobalConst;
|
||||
import com.bonus.gs.sub.evaluate.manager.utils.POIOutputHelperNumBer;
|
||||
import com.bonus.gs.sub.evaluate.manager.utils.UserUtil;
|
||||
import com.bonus.gs.sub.evaluate.outsourceEnterprise.beans.ViolationBean;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/outsourcer/")
|
||||
|
|
@ -42,6 +42,14 @@ public class OutsourcerEvaluateController extends BaseController<EvaluateSubBean
|
|||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getTableList", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public AjaxRes getTableList(EvaluateSubBean o) {
|
||||
o.setDeptId(Objects.requireNonNull(UserUtil.getLoginUser()).getDeptId());
|
||||
AjaxRes ar = outsourcerEvaluateService.getTableList(o);
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getCollectData", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public AjaxRes getCollectData(EvaluateSubBean o) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ public interface OutsourcerEvaluateService {
|
|||
SetTemplateBean getTemplateListById(String id);
|
||||
|
||||
AjaxRes getTableTitle(EvaluateSubBean o);
|
||||
AjaxRes getTableList(EvaluateSubBean o);
|
||||
/**
|
||||
* 外包商评价列表
|
||||
* @param o OutsourcerBean
|
||||
|
|
|
|||
|
|
@ -155,6 +155,117 @@ public class OutsourcerEvaluateServiceImpl implements OutsourcerEvaluateService
|
|||
return ar;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxRes getTableList(EvaluateSubBean o) {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
String deptId = (StringUtils.isBlank(o.getDeptId()) || "0".equals(o.getDeptId())) ? "0" : o.getDeptId();
|
||||
String deptName = (StringUtils.isBlank(o.getDeptId()) || "0".equals(o.getDeptId())) ? "项目部" : dao.getDeptNameById(deptId);
|
||||
|
||||
int isBusinessDivision = 0;
|
||||
String orgType = dao.getIsBusinessDivision(deptId);
|
||||
if (StringUtils.isNotBlank(orgType)) {
|
||||
isBusinessDivision = Integer.parseInt(orgType);
|
||||
}
|
||||
List<SetTemplateBean> list = outsourcerEvaluateDao.getTemplateDeatailsList(o);
|
||||
|
||||
List<Map<String, Object>> oneList = new ArrayList<>();
|
||||
List<Map<String, Object>> twoList = new ArrayList<>();
|
||||
List<Map<String, Object>> threeList = new ArrayList<>();
|
||||
List<List<Map<String, Object>>> finalList = new ArrayList<>();
|
||||
|
||||
Map<String, Object> mapNum = new LinkedHashMap<>();
|
||||
mapNum.put("title", "序号");
|
||||
mapNum.put("mergeType", "rowspan");
|
||||
mapNum.put("num", 3);
|
||||
mapNum.put("minWidth", 100);
|
||||
mapNum.put("field", "index");
|
||||
|
||||
Map<String, Object> mapSub = new LinkedHashMap<>();
|
||||
mapSub.put("title", "施工业务外包商");
|
||||
mapSub.put("mergeType", "rowspan");
|
||||
mapSub.put("num", 3);
|
||||
mapSub.put("minWidth", 100);
|
||||
mapSub.put("field", "subName");
|
||||
|
||||
Map<String, Object> mapPro = new LinkedHashMap<>();
|
||||
mapPro.put("title", "工程名称");
|
||||
mapPro.put("mergeType", "rowspan");
|
||||
mapPro.put("num", 3);
|
||||
mapPro.put("minWidth", 100);
|
||||
mapPro.put("field", "proName");
|
||||
|
||||
oneList.add(mapNum);
|
||||
oneList.add(mapSub);
|
||||
oneList.add(mapPro);
|
||||
//添加二级标题、三级标题
|
||||
for (SetTemplateBean setTemplateBean : list) {
|
||||
if (!StringUtils.isBlank(setTemplateBean.getResponsibleDepartment())) {
|
||||
if (Arrays.asList(setTemplateBean.getResponsibleDepartment().split(",")).contains(deptId)) {
|
||||
addEvaChildMap(twoList, setTemplateBean, 1);
|
||||
addEvaChildMap(threeList, setTemplateBean, 1, deptName, deptId, o.getType());
|
||||
} else if (isBusinessDivision == 1) {
|
||||
if (Arrays.asList(setTemplateBean.getResponsibleDepartment().split(",")).contains("-1") ||
|
||||
Arrays.asList(setTemplateBean.getResponsibleDepartment().split(",")).contains(deptId)) {
|
||||
addEvaChildMap(twoList, setTemplateBean, 1);
|
||||
addEvaChildMap(threeList, setTemplateBean, 1, deptName, deptId, o.getType());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//获取二级标题的field
|
||||
Set<String> parentIdArr = new HashSet<>();
|
||||
for (Map<String, Object> stringObjectMap : twoList) {
|
||||
parentIdArr.add(stringObjectMap.get("field").toString());
|
||||
}
|
||||
//添加一级标题
|
||||
for (int i = 0; i < parentIdArr.size(); i++) {
|
||||
for (SetTemplateBean setTemplateBean : list) {
|
||||
if (parentIdArr.contains(setTemplateBean.getId())) {
|
||||
int num = 0;
|
||||
for (Map<String, Object> stringObjectMap : twoList) {
|
||||
if (stringObjectMap.get("field").equals(setTemplateBean.getId())) {
|
||||
num++;
|
||||
}
|
||||
}
|
||||
setTemplateBean.setParentId(setTemplateBean.getId() + "-");
|
||||
addEvaChildMap(oneList, setTemplateBean, num);
|
||||
}
|
||||
}
|
||||
}
|
||||
//添加数据
|
||||
String type = StringUtils.isBlank(o.getDeptId()) ? "项目" : "职能";
|
||||
if ("0".equals(o.getDeptId())) {
|
||||
type = "项目";
|
||||
}
|
||||
List<EvaluateSubBean> subList = outsourcerEvaluateDao.getSubAndProjectByEvaluateId(o.getEvaluateId(), type,
|
||||
UserUtil.getLoginUser().getId().toString());
|
||||
List<Map<String, Object>> childList = new ArrayList<>();
|
||||
if (subList != null && !subList.isEmpty()) {
|
||||
for (EvaluateSubBean subBean : subList) {
|
||||
Map<String, Object> childMap = new LinkedHashMap<>();
|
||||
childMap.put("subName", subBean.getSubName());
|
||||
childMap.put("proName", subBean.getProName());
|
||||
childMap.put("subId", subBean.getSubId());
|
||||
childMap.put("proId", subBean.getProId());
|
||||
for (Map<String, Object> stringObjectMap : threeList) {
|
||||
childMap.put(stringObjectMap.get("field").toString(), "");
|
||||
}
|
||||
childList.add(childMap);
|
||||
}
|
||||
}
|
||||
oneList = oneList.stream().distinct().collect(Collectors.toList());
|
||||
TableData tableData = new TableData();
|
||||
tableData.setOneList(oneList);
|
||||
tableData.setTwoList(twoList);
|
||||
tableData.setThreeList(threeList);
|
||||
tableData.setChildList(childList);
|
||||
ar.setSucceed(tableData);
|
||||
return ar;
|
||||
}
|
||||
|
||||
private void addEvaChildMap(List<Map<String, Object>> list, SetTemplateBean setTemplateBean, int num) {
|
||||
Map<String, Object> childMap = new LinkedHashMap<>();
|
||||
childMap.put("title", setTemplateBean.getIndexName());
|
||||
|
|
|
|||
|
|
@ -41,6 +41,17 @@ function search(type) {
|
|||
});
|
||||
}
|
||||
|
||||
/*function exportData() {
|
||||
let keyWord = $("#keyWord").val();
|
||||
let evaluateDeptId = $("#evaluateDeptId").val();
|
||||
let evStatus = $("#evStatus").val();
|
||||
let auditStatus = $("#auditStatus").val();
|
||||
let startDate = $("#startDate").val();
|
||||
let token = localStorage.getItem("token")
|
||||
let params = "?keyWord=" + keyWord + "&evaluateDeptId=" + evaluateDeptId + "&auditStatus=" + auditStatus + "&evStatus=" + evStatus + "&startDate=" + startDate + '&token=' + token;
|
||||
$(location).attr("href", ctxPath + '/outsourcer/outsourcerEvaluateList' + params);
|
||||
}*/
|
||||
|
||||
function initTable() {
|
||||
let loginUser = localStorage.getItem("loginUser");
|
||||
let user = JSON.parse(loginUser);
|
||||
|
|
|
|||
|
|
@ -62,9 +62,9 @@
|
|||
搜索
|
||||
</button>
|
||||
<button class="layui-btn" title="重置" type="button" onclick="search(2)">重置</button>
|
||||
<button class="layui-btn layui-bg-blue" title="导出" type="button" onclick="exportData()">
|
||||
导出
|
||||
</button>
|
||||
<!-- <button class="layui-btn layui-bg-blue" title="导出" type="button" onclick="exportData()">-->
|
||||
<!-- 导出-->
|
||||
<!-- </button>-->
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Reference in New Issue