Browse Source

优化

master
zhouhaibin 4 months ago
parent
commit
d84a50c56e
  1. 2
      huzhou/src/main/java/com/easy/admin/modules/huzhou/controller/HuzhouProjectController.java
  2. 19
      huzhou/src/main/java/com/easy/admin/modules/huzhou/controller/WorkflowController.java
  3. 6
      huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/HuzhouProjectinfoMapper.java
  4. 55
      huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/mapping/HuzhouProjectinfoMapper.xml
  5. 2
      huzhou/src/main/java/com/easy/admin/modules/huzhou/service/IHuzhouProjectinfoService.java
  6. 26
      huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouProjectinfoServiceImpl.java
  7. 6
      huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/WorkflowServiceImpl.java
  8. 1
      huzhou/src/main/java/com/easy/admin/modules/huzhou/vo/ProjectInfoAuthSelect.java

2
huzhou/src/main/java/com/easy/admin/modules/huzhou/controller/HuzhouProjectController.java

@ -270,7 +270,7 @@ public class HuzhouProjectController {
*/ */
@GetMapping("/getUnitedTechnicalReviewList") @GetMapping("/getUnitedTechnicalReviewList")
public Result<?> getUnitedTechnicalReviewList(HuzhouProjectinfo projectinfo, public Result<?> getUnitedTechnicalReviewList(HuzhouProjectinfoOV projectinfo,
@RequestParam(name="current", defaultValue="1") Integer pageNo, @RequestParam(name="current", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize){ @RequestParam(name="pageSize", defaultValue="10") Integer pageSize){

19
huzhou/src/main/java/com/easy/admin/modules/huzhou/controller/WorkflowController.java

@ -56,6 +56,7 @@ import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors;
@RestController @RestController
@RequestMapping("/workflow") @RequestMapping("/workflow")
@ -386,9 +387,9 @@ public class WorkflowController {
} }
} }
for(HashMap<String, Object> lastUser:approvalEntityList){ for(HashMap<String, Object> lastUser:approvalEntityList){
if ("0".equals(lastUser.get("approvalStatue"))) { // if ("0".equals(lastUser.get("approvalStatue"))) {
continue; // continue;
} // }
for (int i =0;i<userTaskList.size();i++ ) { for (int i =0;i<userTaskList.size();i++ ) {
UserTask task=userTaskList.get(i); UserTask task=userTaskList.get(i);
// HashMap<String, Object> lastUser = approvalEntityList.get(approvalEntityList.size() - 1);//获取最后一个 // HashMap<String, Object> lastUser = approvalEntityList.get(approvalEntityList.size() - 1);//获取最后一个
@ -463,8 +464,16 @@ public class WorkflowController {
approvalEntityList.add(hashMap); approvalEntityList.add(hashMap);
} }
} }
List<HashMap<String, Object>> distinctList = approvalEntityList.stream()
return Result.OK(approvalEntityList); .collect(Collectors.collectingAndThen(
Collectors.toMap(
map -> map.get("operator"),
map -> map,
(existing, replacement) -> replacement // 如果重复,最后一个
),
map -> new ArrayList<>(map.values())
));
return Result.OK(distinctList);
} }
@GetMapping("/getProcessInstanceIdByProid") @GetMapping("/getProcessInstanceIdByProid")
public Result<?> getProcessInstanceIdByProid(String projectid,String stage){ public Result<?> getProcessInstanceIdByProid(String projectid,String stage){

6
huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/HuzhouProjectinfoMapper.java

@ -3,10 +3,7 @@ package com.easy.admin.modules.huzhou.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.easy.admin.modules.huzhou.vo.DimensionPageOV; import com.easy.admin.modules.huzhou.vo.*;
import com.easy.admin.modules.huzhou.vo.HuzhouProjectinfoOV;
import com.easy.admin.modules.huzhou.vo.NumByTypeOV;
import com.easy.admin.modules.huzhou.vo.ProjectPageOV;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import com.easy.admin.modules.huzhou.entity.HuzhouProjectinfo; import com.easy.admin.modules.huzhou.entity.HuzhouProjectinfo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -80,4 +77,5 @@ public interface HuzhouProjectinfoMapper extends BaseMapper<HuzhouProjectinfo> {
Map<String, BigDecimal> getTotalByProjectIds(@Param("projectIds") List<String> projectIds); Map<String, BigDecimal> getTotalByProjectIds(@Param("projectIds") List<String> projectIds);
List<HuzhouProjectinfoOV> getListByConditions(@Param("info") HuzhouProjectinfo info); List<HuzhouProjectinfoOV> getListByConditions(@Param("info") HuzhouProjectinfo info);
Page<HuzhouProjectinfoOV>getUnitedTechnicalReviewList(Page page, @Param("info") ProjectInfoAuthSelect info);
} }

55
huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/mapping/HuzhouProjectinfoMapper.xml

@ -415,4 +415,59 @@ order by create_date desc
</if> </if>
</where> </where>
</select> </select>
<select id="getUnitedTechnicalReviewList" resultMap="HuzhouProjectinfoMap">
-- SELECT u.*,COALESCE(p.processstatus, 0) as utrIsfinish from huzhou_projectinfo u LEFT join huzhou_processinfo p on u.id = p.projectId AND ( P.process_name ='createURT' OR p.process_name is null)
SELECT *
FROM (
SELECT
u.*,
COALESCE(p.processstatus, 0) as utrIsfinish
FROM
huzhou_projectinfo u
LEFT JOIN
huzhou_processinfo p
ON
u.id = p.projectId
AND (p.process_name = 'createURT' OR p.process_name IS NULL)
) subquery
<where>
<include refid="selectAuthSql"/>
<if test="info.projectName!=null and info.projectName!=''">
<bind name="tempStr" value="'%' + info.projectName + '%'" />
and subquery.project_name like #{tempStr}
</if>
<if test="info.adminDivision!=null and info.adminDivision!=''">
<bind name="tempStr" value="'%' + info.adminDivision + '%'" />
and subquery.admin_division like #{tempStr}
</if>
<if test="info.dutyWorkplace!=null and info.dutyWorkplace!=''">
<bind name="tempStr" value="'%' + info.dutyWorkplace + '%'" />
and subquery.duty_workplace like #{tempStr}
</if>
<if test="info.workplaceProperties!=null and info.workplaceProperties!=''">
<bind name="tempStr" value="'%' + info.workplaceProperties + '%'" />
and subquery.workplace_properties like #{tempStr}
</if>
<if test="info.dutyWorkplace!=null and info.dutyWorkplace!=''">
<bind name="tempStr" value="'%' + info.dutyWorkplace + '%'" />
and subquery.duty_workplace like #{tempStr}
</if>
<if test="info.reformName!=null and info.reformName!=''">
and subquery.reform_name = #{info.reformName}
</if>
<if test="info.superLeader!=null and info.superLeader!=''">
and subquery.super_leader = #{info.superLeader}
</if>
<if test="info.stage!=null and info.stage!=''">
and subquery.stage &gt;= #{info.stage}
</if>
<if test="info.utrIsfinishList!=null and info.utrIsfinishList!=''">
and subquery.utrIsfinish in
<foreach item="utrIsfinish" index="index" collection="info.utrIsfinishList" open="(" separator="," close=")">
#{utrIsfinish}
</foreach>
</if>
</where>
order by subquery.create_date desc
</select>
</mapper> </mapper>

2
huzhou/src/main/java/com/easy/admin/modules/huzhou/service/IHuzhouProjectinfoService.java

@ -180,7 +180,7 @@ public interface IHuzhouProjectinfoService extends IService<HuzhouProjectinfo> {
List<String> getDutyWorkplaceList(); List<String> getDutyWorkplaceList();
List<String> getAdminDivisionList(); List<String> getAdminDivisionList();
IPage<HuzhouProjectinfoOV> getUnitedTechnicalReviewList(HuzhouProjectinfo projectinfo, Integer pageNo, Integer pageSize); IPage<HuzhouProjectinfoOV> getUnitedTechnicalReviewList(HuzhouProjectinfoOV projectinfo, Integer pageNo, Integer pageSize);
} }

26
huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouProjectinfoServiceImpl.java

@ -25,6 +25,7 @@ import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService; import org.activiti.engine.TaskService;
import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task; import org.activiti.engine.task.Task;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -1205,20 +1206,17 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
return fundByTypeResponse; return fundByTypeResponse;
} }
@Override @Override
public IPage<HuzhouProjectinfoOV> getUnitedTechnicalReviewList(HuzhouProjectinfo projectinfo, Integer pageNo, Integer pageSize) { public IPage<HuzhouProjectinfoOV> getUnitedTechnicalReviewList(HuzhouProjectinfoOV projectinfo, Integer pageNo, Integer pageSize) {
IPage<HuzhouProjectinfoOV> projectInfoAndChildPageList = getProjectInfoAndChildPageList(projectinfo, pageNo, pageSize);
projectInfoAndChildPageList.getRecords().stream().forEach(x -> { Page<HuzhouProjectinfoOV> projectInfoAndChildPageList = new Page<>(pageNo, pageSize);
String id = x.getId();
LambdaQueryWrapper<HuzhouProcessinfo> queryWrapper = new LambdaQueryWrapper<>(); ProjectInfoAuthSelect projectInfoAuthSelect = CommonUtils.setGetProjectInfoAuth(projectinfo);
queryWrapper.eq(HuzhouProcessinfo::getProjectid, id); if (StringUtils.isNotBlank(projectinfo.getUtrIsfinish())) {
queryWrapper.eq(HuzhouProcessinfo::getProcessName, "createURT"); String[] split = projectinfo.getUtrIsfinish().split(",");
List<HuzhouProcessinfo> list = processinfoService.list(queryWrapper); projectInfoAuthSelect.setUtrIsfinishList(Arrays.asList(split));
if (list.size() > 0) { }
x.setUtrIsfinish(list.get(0).getProcessstatus()); Page<HuzhouProjectinfoOV> unitedTechnicalReviewList = projectinfoMapper.getUnitedTechnicalReviewList(projectInfoAndChildPageList, projectInfoAuthSelect);
}else { return unitedTechnicalReviewList;
x.setUtrIsfinish("0");
}});
return projectInfoAndChildPageList;
} }
} }

6
huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/WorkflowServiceImpl.java

@ -166,13 +166,13 @@ public class WorkflowServiceImpl implements IWorkflowService {
List<HistoricTaskInstance> list = historyService List<HistoricTaskInstance> list = historyService
.createHistoricTaskInstanceQuery() .createHistoricTaskInstanceQuery()
.processInstanceId(processInstanceId) .processInstanceId(processInstanceId)
.orderByTaskCreateTime() .orderByTaskCreateTime().finished()
.desc() .desc()
.list(); .list();
HistoricTaskInstance taskInstance = null; HistoricTaskInstance taskInstance = null;
if (!list.isEmpty()) { if (!list.isEmpty()) {
if (list.get(1).getEndTime() != null) { if (list.get(0).getEndTime() != null) {
taskInstance = list.get(1); taskInstance = list.get(0);
String userid = taskInstance.getAssignee(); String userid = taskInstance.getAssignee();
//上一个节点是你处理的(已办可以撤回) //上一个节点是你处理的(已办可以撤回)
List<Comment> taskComments = taskService.getTaskComments(taskInstance.getId()); List<Comment> taskComments = taskService.getTaskComments(taskInstance.getId());

1
huzhou/src/main/java/com/easy/admin/modules/huzhou/vo/ProjectInfoAuthSelect.java

@ -12,4 +12,5 @@ public class ProjectInfoAuthSelect extends HuzhouProjectinfo {
List<String> adminDivisionList; List<String> adminDivisionList;
String orDutyPlace; String orDutyPlace;
List<String> notorDutyPlace; List<String> notorDutyPlace;
List<String> utrIsfinishList;
} }

Loading…
Cancel
Save