1.季度审核部门审批节点时增加判断,当最后一个部门主任(4)提交的时候将流转到下一个节点。当四个部门提交之后算出平均分并存入json

2.根据项目获取季度列表时,增加根据季度排序
3.季度审核第一个页面分页餐宿修正
This commit is contained in:
zty 2024-07-22 10:55:19 +08:00
parent 03150899c9
commit 51cf25d901
3 changed files with 190 additions and 59 deletions

View File

@ -54,6 +54,6 @@
from project_assessment_indicators
WHERE project_id = #{map.projectId}
and ext_ ->> 'executor' like CONCAT('%', #{map.userId}, '%')
GROUP BY quarter, project_id) b on a.project_id = b.project_id and a.quarter = b.quarter
GROUP BY quarter, project_id) b on a.project_id = b.project_id and a.quarter = b.quarter ORDER BY b.quarter desc
</select>
</mapper>

View File

@ -60,6 +60,7 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
/**
* 季度审核第二个页面查看有多少个季度
*
* @param userId
* @param map
* @return
@ -67,7 +68,7 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
*/
@Override
@PostMapping(Api.PROJECT_QUARTERLY_EVALUATION_QUARTER_LIST)
public String quarterList(@RequestHeader Long userId,@RequestBody Map<String,Object> map) throws XQException {
public String quarterList(@RequestHeader Long userId, @RequestBody Map<String, Object> map) throws XQException {
try {
// ProjectAssessmentIndicators indicators = pageNoUtil.getT();
// EntityWrapper<ProjectAssessmentIndicators> wrapper = new EntityWrapper<>();
@ -82,11 +83,11 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
// wrapper.groupBy("ext_->>'taskName'");
// wrapper.setSqlSelect("quarter,AVG((ext_->>'sum')::FLOAT),project_id,ext_->>'taskName' ");
// List<Map<String, Object>> maps = indicatorsService.selectMaps(wrapper);
map.put("userId",userId);
map.put("projectId",Long.parseLong(String.valueOf(map.get("projectId"))));
map.put("userId", userId);
map.put("projectId", Long.parseLong(String.valueOf(map.get("projectId"))));
List<Map<String, Object>> maps = indicatorsService.getQuarterList(map);
return ApiResponse.fillSuccess(new ResultListReqUtil<Map<String, Object>>(maps,maps.size(),0));
}catch (Exception e){
return ApiResponse.fillSuccess(new ResultListReqUtil<Map<String, Object>>(maps, maps.size(), 0));
} catch (Exception e) {
log.error("ProjectAssessmentIndicatorsController.quarterList", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
}
@ -97,8 +98,12 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
public String list(@RequestHeader Long userId, @RequestBody PageNoUtil<ProjectAssessmentIndicators> pageNoUtil) throws XQException {
try {
Page<ProjectAssessmentIndicators> page = new Page<>(pageNoUtil.getPageNo(), pageNoUtil.getPageSize());
List<ProjectAssessmentIndicators> indicatorsServiceList = indicatorsService.getList(page, pageNoUtil.getT(),String.valueOf(userId));
ResultListReqUtil<ProjectAssessmentIndicators> listReqUtil = new ResultListReqUtil<>(indicatorsServiceList, pageNoUtil.getPageNo(), pageNoUtil.getPageSize());
List<ProjectAssessmentIndicators> indicatorsServiceList = indicatorsService.getList(page, pageNoUtil.getT(), String.valueOf(userId));
ResultListReqUtil<ProjectAssessmentIndicators> listReqUtil = new ResultListReqUtil<>();
listReqUtil.setLs(indicatorsServiceList);
;
listReqUtil.setPages(page.getPages());
listReqUtil.setTotal(page.getTotal());
return ApiResponse.fillSuccess(listReqUtil);
} catch (Exception e) {
log.error("ProjectAssessmentIndicatorsController.list", e);
@ -129,32 +134,34 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
}
}
//算出每个指标的平均数
boolean isOffice= (boolean) ext.get("isOffice");
if(isOffice){
double sum=0;
if(!StringUtils.isEmpty(sum)){
double strategyScoring = ext.get("strategyScoring")==null?0:Double.valueOf((String) ext.get("strategyScoring")) ;
double marketScoring = ext.get("marketScoring")==null?0:Double.valueOf((String) ext.get("marketScoring")) ;
double platformScoring = ext.get("platformScoring")==null?0:Double.valueOf((String) ext.get("platformScoring")) ;
double serviceScoring = ext.get("serviceScoring")==null?0:Double.valueOf((String) ext.get("serviceScoring")) ;
ArrayList<Double> arrayList = new ArrayList<>();
arrayList.add(serviceScoring);arrayList.add(strategyScoring);arrayList.add(marketScoring);arrayList.add(platformScoring);
int index=0;
for (int i = 0; i < arrayList.size(); i++) {
if(arrayList.get(i)>0){
index+=1;
sum+=arrayList.get(i);
}
boolean isOffice = (boolean) ext.get("isOffice");
if (isOffice) {
double strategyScoring = ext.get("strategyScoring") == null ? 0 : Double.valueOf((String) ext.get("strategyScoring"));
double marketScoring = ext.get("marketScoring") == null ? 0 : Double.valueOf((String) ext.get("marketScoring"));
double platformScoring = ext.get("platformScoring") == null ? 0 : Double.valueOf((String) ext.get("platformScoring"));
double serviceScoring = ext.get("serviceScoring") == null ? 0 : Double.valueOf((String) ext.get("serviceScoring"));
ArrayList<Double> arrayList = new ArrayList<>();
arrayList.add(serviceScoring);
arrayList.add(strategyScoring);
arrayList.add(marketScoring);
arrayList.add(platformScoring);
double sum = 0;
int index = 0;
for (int i = 0; i < arrayList.size(); i++) {
if (arrayList.get(i) > 0) {
index += 1;
sum += arrayList.get(i);
}
if(sum>0){
// sum=arrayList.stream().collect(Collectors.averagingDouble(x -> x));
sum=sum/index;
DecimalFormat df = new DecimalFormat("#.0");
String result = df.format(sum);
sum = Double.parseDouble(result);
}
ext.put("sum",sum);
}
if (index == 4 && sum > 0) {
// sum=arrayList.stream().collect(Collectors.averagingDouble(x -> x));
sum = sum / index;
DecimalFormat df = new DecimalFormat("#.0");
String result = df.format(sum);
sum = Double.parseDouble(result);
ext.put("sum", sum);
}
}
}
if (indicatorsService.updateById(indicators)) return ApiResponse.fillSuccess("操作成功!");
@ -173,65 +180,103 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
public String examine(@RequestHeader Long userId, @RequestBody Map map) throws XQException {
try {
if (!ObjectUtils.isEmpty(map)) {
//通过项目id季节拿到要审批的指标列表前面因为季度列表已经判断了权限这里就不做权限
String id = String.valueOf(map.get("id"));//项目id
ProjectInfo projectInfo = projectInfoService.selectById(Long.parseLong(id));
if (!ObjectUtils.isEmpty(projectInfo)) {
JSONObject ext = projectInfo.getExt();
EntityWrapper<ProjectAssessmentIndicators> indicatorsEntityWrapper = new EntityWrapper<>();
indicatorsEntityWrapper.eq("is_deleted", "0");
indicatorsEntityWrapper.eq("project_id", Long.parseLong(String.valueOf(id)));
indicatorsEntityWrapper.eq("quarter", String.valueOf(map.get("quarter")));
List<ProjectAssessmentIndicators> indicatorsList = indicatorsService.selectList(indicatorsEntityWrapper);
if (!ObjectUtils.isEmpty(indicatorsList)) {
ProjectAssessmentIndicators indicators = indicatorsList.get(0);
JSONObject ext = indicators.getExt();
if (!ObjectUtils.isEmpty(ext)) {
String taskName = String.valueOf(ext.get("taskName"));//节点名称
String examine = String.valueOf(map.get("examine"));//通过or驳回
String isOffice = String.valueOf(ext.get("isOffice"));//项目负责人是否是办公室部门的
boolean isOffice = (boolean) map.get("isOffice");//项目负责人是否是办公室部门的
Integer businessNumber = 0;//查看是第几个部门主任评级了
if (!ObjectUtils.isEmpty(ext.get("businessNumber"))) {
businessNumber = Integer.parseInt(String.valueOf(ext.get("businessNumber")));
}
switch (taskName) {
case "季度审核填报":
if ("1".equals(examine)) {
return ApiResponse.fillFail("季度审核填报无法驳回!");
} else if ("0".equals(examine)) {
if ("0".equals(isOffice)) {
examine(userId, "部门主任评级", ext, "", projectInfo);
} else if ("1".equals(isOffice)) {
examine(userId, "管理员审核", ext, "projectAdmin", projectInfo);
if (isOffice) {
map.put("taskName", "部门主任评级");
// examine(userId, "部门主任评级", ext, "", projectInfo);
} else {
map.put("taskName", "管理员审核");
map.put("executor", ext.get("projectAdmin"));
// examine(userId, "管理员审核", ext, "projectAdmin", projectInfo);
}
}
break;
case "部门主任评级":
if ("0".equals(examine)) {
examine(userId, "管理员审核", ext, "projectAdmin", projectInfo);
map.put("userId", String.valueOf(userId));
map.put("isBusiness", true);//添加当前是部门主任的标记
Object o = businessNumber == 3 ? map.put("taskName", "管理员审核") : map.put("taskName", "部门主任评级");
// map.put("taskName","管理员审核");
map.put("businessNumber", businessNumber);
map.put("executor", ext.get("projectAdmin"));
// examine(userId, "管理员审核", ext, "projectAdmin", projectInfo);
} else if ("1".equals(examine)) {
examine(userId, "季度审核填报", ext, "projectManager", projectInfo);
map.put("taskName", "季度审核填报");
map.put("executor", ext.get("projectManager"));
// examine(userId, "季度审核填报", ext, "projectManager", projectInfo);
}
break;
case "管理员审核":
ext.put("adminSpyj", map.get("spyj"));
// ext.put("adminSpyj", map.get("spyj"));
map.put("adminSpyj", map.get("spyj"));
if ("0".equals(examine)) {
examine(userId, "分管领导审核", ext, "branchLeaders", projectInfo);
map.put("taskName", "分管领导审核");
map.put("executor", ext.get("branchLeaders"));
// examine(userId, "分管领导审核", ext, "branchLeaders", projectInfo);
} else if ("1".equals(examine)) {
if ("0".equals(isOffice)) {
examine(userId, "部门主任评级", ext, "", projectInfo);
if (isOffice) {
map.put("taskName", "部门主任评级");
// examine(userId, "部门主任评级", ext, "", projectInfo);
} else {
examine(userId, "季度审核填报", ext, "projectManager", projectInfo);
map.put("taskName", "季度审核填报");
map.put("executor", ext.get("projectManager"));
// examine(userId, "季度审核填报", ext, "projectManager", projectInfo);
}
}
break;
case "分管领导审核":
ext.put("branchLeadersSpyj", map.get("spyj"));
map.put("branchLeadersSpyj", map.get("spyj"));
// ext.put("branchLeadersSpyj", map.get("spyj"));
if ("0".equals(examine)) {
examine(userId, "主要领导审核", ext, "MainLeader", projectInfo);
map.put("taskName", "主要领导审核");
map.put("executor", ext.get("MainLeader"));
// examine(userId, "主要领导审核", ext, "MainLeader", projectInfo);
} else if ("1".equals(examine)) {
examine(userId, "管理员审核", ext, "projectAdmin", projectInfo);
map.put("taskName", "管理员审核");
map.put("executor", ext.get("projectAdmin"));
// examine(userId, "管理员审核", ext, "projectAdmin", projectInfo);
}
break;
case "主要领导审核":
map.put("MainLeaderSpyj", map.get("spyj"));
if ("0".equals(examine)) {
ext.put("MainLeaderSpyj", map.get("spyj"));
examine(userId, "流程结束", ext, "MainLeader", projectInfo);
// ext.put("MainLeaderSpyj", map.get("spyj"));
map.put("executor", " ");
map.put("taskName", "流程结束");
// examine(userId, "流程结束", ext, "MainLeader", projectInfo);
} else if ("1".equals(examine)) {
examine(userId, "分管领导审核", ext, "branchLeaders", projectInfo);
map.put("taskName", "分管领导审核");
// examine(userId, "分管领导审核", ext, "branchLeaders", projectInfo);
}
default:
break;
}
examine(map, indicatorsList);
return ApiResponse.fillSuccess("操作成功!");
}
}
}
} catch (Exception e) {
@ -273,35 +318,121 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
/**
* 根据人事id返回是四个业务部那个部门的主任
*
* @param id
* @return
* @throws XQException
*/
@Override
@GetMapping(Api.PROJECT_QUARTERLY_EVALUATION_GETBUSINESS)
public String getBusinessByUserInfoId(@PathVariable String id) throws XQException{
public String getBusinessByUserInfoId(@PathVariable String id) throws XQException {
try {
EntityWrapper<FlowsConfiguration> flowsConfigurationEntityWrapper = new EntityWrapper<>();
flowsConfigurationEntityWrapper.eq("approved_role", "business");
flowsConfigurationEntityWrapper.eq("is_deleted", false);
flowsConfigurationEntityWrapper.eq("approver_id", Long.parseLong(id));
FlowsConfiguration flowsConfiguration = flowsConfigurationService.selectOne(flowsConfigurationEntityWrapper);
if(!ObjectUtils.isEmpty(flowsConfiguration)){
if (!ObjectUtils.isEmpty(flowsConfiguration)) {
EntityWrapper<SystemOrg> orgEntityWrapper = new EntityWrapper<>();
orgEntityWrapper.eq("is_deleted", false);
orgEntityWrapper.eq("id_",flowsConfiguration.getOrgId());
orgEntityWrapper.eq("id_", flowsConfiguration.getOrgId());
SystemOrg systemOrg = orgService.selectOne(orgEntityWrapper);
if(!ObjectUtils.isEmpty(systemOrg)){
if (!ObjectUtils.isEmpty(systemOrg)) {
return ApiResponse.fillSuccess(systemOrg.getOrgName());
}
}
}catch (Exception e){
} catch (Exception e) {
log.error("ProjectAssessmentIndicatorsController.getBusinessByUserInfoId", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
}
return ApiResponse.fillFail();
}
/**
* 审核
*
* @param map
* @param list
*/
public void examine(Map<String, Object> map, List<ProjectAssessmentIndicators> list) {
if (!ObjectUtils.isEmpty(list)) {
String taskName = String.valueOf(map.get("taskName"));
if (!"部门主任评级".equals(taskName)) {
for (int i = 0; i < list.size(); i++) {
ProjectAssessmentIndicators indicators = list.get(i);
JSONObject ext = indicators.getExt();
ext.put("executor", map.get("executor"));
ext.put("taskName", taskName);
Object adminSpyj = map.get("adminSpyj") == null ? null : ext.put("adminSpyj", map.get("adminSpyj"));
Object branchLeadersSpyj = map.get("branchLeadersSpyj") == null ? null : ext.put("branchLeadersSpyj", map.get("branchLeadersSpyj"));
Object MainLeaderSpyj = map.get("MainLeaderSpyj") == null ? null : ext.put("MainLeaderSpyj", map.get("MainLeaderSpyj"));
// ext.put("adminSpyj",map.get("adminSpyj"));
// ext.put("branchLeadersSpyj",map.get("branchLeadersSpyj"));
// ext.put("MainLeaderSpyj",map.get("MainLeaderSpyj"));
indicators.setExt(ext);
}
} else {
//如果节点是部门主任评级时则当前责任人是四个业务部的部门主任
EntityWrapper<SystemOrg> orgEntityWrapper = new EntityWrapper<>();
orgEntityWrapper.andNew().eq("is_deleted", false);
orgEntityWrapper.andNew().eq("org_name", "战略规划部").or()
.eq("org_name", "平台建设部").or()
.eq("org_name", "市场发展部").or()
.eq("org_name", "服务产品部");
orgEntityWrapper.setSqlSelect("id_");
List<Object> objectList = orgService.selectObjs(orgEntityWrapper);//先拿到部门集合ids
if (!StringUtils.isEmpty(objectList)) {
// 使用Streams将Object集合转换为Long集合
List<Long> longs = objectList.stream()
.map(obj -> (Long) obj) // 强制类型转换
.collect(Collectors.toList());
EntityWrapper<FlowsConfiguration> flowsConfigurationEntityWrapper = new EntityWrapper<>();
flowsConfigurationEntityWrapper.eq("approved_role", "business");
flowsConfigurationEntityWrapper.eq("is_deleted", false);
flowsConfigurationEntityWrapper.in("org_id", longs);
flowsConfigurationEntityWrapper.setSqlSelect("approver_id");
List<Object> objectList1 = flowsConfigurationService.selectObjs(flowsConfigurationEntityWrapper);//拿到人事集合ids
longs = objectList1.stream()
.map(obj -> (Long) obj) // 强制类型转换
.collect(Collectors.toList());
EntityWrapper<SystemUserLogin> userLoginEntityWrapper = new EntityWrapper<>();
userLoginEntityWrapper.eq("is_deleted", false);
userLoginEntityWrapper.in("userinfo_id", longs);
userLoginEntityWrapper.setSqlSelect("string_agg(id_::text,',')");
String executor = String.valueOf(userLoginService.selectObj(userLoginEntityWrapper));
boolean isBusiness = false;
if (!ObjectUtils.isEmpty(map.get("isBusiness"))) {
isBusiness = (boolean) map.get("isBusiness");
}
Integer businessNumber = (Integer) map.get("businessNumber");
if (isBusiness) { //如果当前节点是
//判断是第几个主任评级了
businessNumber = Integer.parseInt(String.valueOf(map.get("businessNumber")));
if (!ObjectUtils.isEmpty(businessNumber)) {
businessNumber += 1;
String userId = String.valueOf(map.get("userId"));
if (executor.contains(userId)) {
executor = executor.replace(userId, "");//删掉当前已提交的部门主任id
}
if (businessNumber == 4) {
executor = String.valueOf(map.get("executor"));
}
}
}
for (int i = 0; i < list.size(); i++) {
ProjectAssessmentIndicators indicators = list.get(i);
JSONObject ext = indicators.getExt();
ext.put("taskName", map.get("taskName"));
ext.put("businessNumber", businessNumber);
ext.put("executor", executor);
indicators.setExt(ext);
}
}
}
indicatorsService.updateAllColumnBatchById(list);
}
}
/**
* 审核
*

View File

@ -63,7 +63,7 @@ public class ProjectQuarterlyEvaluationController implements ProjectQuarterlyEva
if (!ObjectUtils.isEmpty(evaluationList)) {
list = projectInfoService.getListByIds(page, evaluationList);
}
ResultListReqUtil<ProjectInfoListItemResp> listReqUtil = new ResultListReqUtil<>(list, page.getPages(), page.getTotal());
ResultListReqUtil<ProjectInfoListItemResp> listReqUtil = new ResultListReqUtil<>(list, page.getTotal(), page.getPages());
return ApiResponse.fillSuccess(listReqUtil);
} catch (Exception e) {
log.error("ProjectQuarterlyEvaluationController.list", e);