完善案件流程逻辑

This commit is contained in:
wanggeng888 2021-07-15 18:49:22 +08:00
parent e89d39969f
commit 4d48a48c79
13 changed files with 201 additions and 25 deletions

View File

@ -4,15 +4,21 @@ import com.cm.common.annotation.CheckRequestBodyAnnotation;
import com.cm.common.base.AbstractController;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.ParamsException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.enums.CheckTypeEnum;
import com.cm.inspection.pojo.dtos.check.Check2DTO;
import com.cm.inspection.pojo.vos.check.Check2VO;
import com.cm.inspection.service.check.ICheck2Service;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @ClassName: CheckAppController
* @Description: 检查表
@ -50,7 +56,7 @@ public class CheckApp2Controller extends AbstractController {
@ApiImplicitParam(name = "checkId", value = "原检查ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("save-re")
@PostMapping("save-re/{checkId}")
@CheckRequestBodyAnnotation
public SuccessResult saveRe(@RequestHeader("token") String token,
@PathVariable("checkId") String checkId,
@ -59,7 +65,17 @@ public class CheckApp2Controller extends AbstractController {
checkService.saveRe(token, checkId, check2VO);
return new SuccessResult();
}
@ApiOperation(value = "我的复查项列表", notes = "我的复查项列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage-recheck-of-mine")
public SuccessResultList<List<Check2DTO>> listPageReCheckOfMine(@RequestHeader("token") String token, ListPage page) {
Map<String, Object> params = requestParams();
page.setParams(params);
return checkService.listPageReCheckOfMine(token, page);
}
}

View File

@ -4,9 +4,8 @@ import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.exception.UpdateException;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO;
import com.cm.inspection.pojo.pos.gridpersonnel.GridPersonnelPO;
import org.springframework.stereotype.Repository;
import java.util.List;
@ -89,4 +88,12 @@ public interface IGridPersonnelDao {
* @throws UpdateException
*/
void updateGridPersonnelLeaderUserId(Map<String, Object> params) throws UpdateException;
/**
* 上级网格员
*
* @param params
* @return
*/
GridPersonnelPO getLeaderPO(Map<String, Object> params);
}

View File

@ -0,0 +1,36 @@
package com.cm.inspection.pojo.pos.gridpersonnel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
/**
* @ClassName: GridPersonnelDTO
* @Description: 网格人员
* @Author: WenG
* @Date: 2020-03-26 18:39
* @Version: 1.0
**/
@Data
@ToString
@ApiModel
public class GridPersonnelPO implements Serializable {
private static final long serialVersionUID = 1690871409983368941L;
private String gridPersonnelId;
private String userId;
private String area1;
private String area2;
private String area3;
private String area4;
private String area5;
private String leaderUserId;
private String personType;
private String gridType;
private Integer level;
private String industryId;
}

View File

@ -1,6 +1,7 @@
package com.cm.inspection.service;
import com.cm.common.base.AbstractService;
import com.cm.common.token.app.AppTokenManager;
/**
* When you feel like quitting. Think about why you started
@ -22,4 +23,8 @@ public class BaseService extends AbstractService {
public static final String MENU_EIA_REPORT = "list_eia_report";
public static final String MENU_DISCHARGE_PERMIT = "list_discharge_permit";
protected String getUserIdByToken(String token) {
return AppTokenManager.getInstance().getToken(token).getUserId();
}
}

View File

@ -97,6 +97,15 @@ public interface ICheck2Service {
*/
SuccessResultList<List<Check2DTO>> listPageReCheckOfMine(ListPage page);
/**
* 我的复查列表
*
* @param token
* @param page
* @return
*/
SuccessResultList<List<Check2DTO>> listPageReCheckOfMine(String token, ListPage page);
/**
* 未通过的检查项列表
*
@ -144,4 +153,6 @@ public interface ICheck2Service {
* @return
*/
SuccessResultList<List<Check2DTO>> listPageCityOfMine(ListPage page);
}

View File

@ -76,6 +76,7 @@ public class Check2ServiceImpl extends BaseService implements ICheck2Service {
String checkId = UUIDUtil.getUUID();
Map<String, Object> params = HashMapUtil.beanToMap(check2VO);
params.put("checkId", checkId);
params.put("isComplete", 0);
setSaveInfo(token, params);
LOG.debug("保存检查记录");
check2Dao.save(params);
@ -89,6 +90,7 @@ public class Check2ServiceImpl extends BaseService implements ICheck2Service {
String reCheckId = UUIDUtil.getUUID();
check2VO.setCheckType(CheckTypeEnum.RE_CHECK.getValue());
Map<String, Object> params = HashMapUtil.beanToMap(check2VO);
params.put("checkId", reCheckId);
setSaveInfo(token, params);
String grid = params.get("creator").toString();
String leaderId = gridPersonnelService.getLeaderId(grid, GridPersonnelTypeEnum.STREET);
@ -147,7 +149,22 @@ public class Check2ServiceImpl extends BaseService implements ICheck2Service {
@Override
public SuccessResultList<List<Check2DTO>> listPageReCheckOfMine(ListPage page) {
return null;
return listPageReCheckByUserId(securityComponent.getCurrentUser().getUserId(), page);
}
@Override
public SuccessResultList<List<Check2DTO>> listPageReCheckOfMine(String token, ListPage page) {
return listPageReCheckByUserId(getUserIdByToken(token), page);
}
private SuccessResultList<List<Check2DTO>> listPageReCheckByUserId(String userId, ListPage page) {
List<Task> tasks = processService.listTaskByAssigneeAndVariableKeyValue(userId, CheckProcessParamsEnum.IS_RE_REPORT.getValue(), 0);
List<String> checkIds = listLastCheckId(tasks);
if (checkIds.isEmpty()) {
return new SuccessResultList(new ArrayList<>(), 1, 0L);
}
page.getParams().put("checkIds", checkIds);
return listPage(page);
}
@Override
@ -163,7 +180,7 @@ public class Check2ServiceImpl extends BaseService implements ICheck2Service {
@Override
public SuccessResultList<List<Check2DTO>> listPageStreetOfMine(ListPage page) {
String userId = securityComponent.getCurrentUser().getUserId();
List<Task> tasks = processService.listTaskByAssigneeAndVariableKey(GridPersonnelTypeEnum.STREET.getValue(), userId);
List<Task> tasks = processService.listTaskByAssigneeAndVariableKey(userId, GridPersonnelTypeEnum.STREET.getValue());
List<String> checkIds = listLastCheckId(tasks);
if (checkIds.isEmpty()) {
return new SuccessResultList<>(new ArrayList<>(), 1, 0L);
@ -374,11 +391,7 @@ public class Check2ServiceImpl extends BaseService implements ICheck2Service {
}
List<String> lastCheckIds = new ArrayList<>();
for (Task task : tasks) {
Map<String, Object> taskVariableMap = task.getTaskLocalVariables();
if (taskVariableMap == null) {
continue;
}
Object lastCheckIdObj = taskVariableMap.get(CheckProcessParamsEnum.LAST_CHECK_ID.getValue());
Object lastCheckIdObj = processService.getTaskVariableByTaskId(task.getId(), CheckProcessParamsEnum.LAST_CHECK_ID.getValue());
if (lastCheckIdObj == null) {
continue;
}

View File

@ -1,7 +1,5 @@
package com.cm.inspection.service.gridpersonnel.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
@ -19,6 +17,7 @@ import com.cm.common.utils.UUIDUtil;
import com.cm.inspection.dao.gridpersonnel.IGridPersonnelDao;
import com.cm.inspection.enums.GridPersonnelTypeEnum;
import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO;
import com.cm.inspection.pojo.pos.gridpersonnel.GridPersonnelPO;
import com.cm.inspection.pojo.vos.gridpersonnel.GridPersonnelVO;
import com.cm.inspection.service.BaseService;
import com.cm.inspection.service.gridpersonnel.IGridPersonnelService;
@ -258,17 +257,23 @@ public class GridPersonnelServiceImpl extends BaseService implements IGridPerson
@Override
public String getLeaderId(String userId, GridPersonnelTypeEnum leaderGridPersonnelType) {
GridPersonnelDTO gridPersonnelDTO = get(userId);
if (gridPersonnelDTO == null) {
GridPersonnelPO gridPersonnelPO = getLeaderPOByUserId(userId);
if (gridPersonnelPO == null) {
return null;
}
if (!StringUtils.equals(gridPersonnelDTO.getGridType(), leaderGridPersonnelType.getValue())) {
if (!StringUtils.equals(gridPersonnelPO.getPersonType(), leaderGridPersonnelType.getValue())) {
return null;
}
if (StringUtils.isBlank(gridPersonnelDTO.getLeaderUserId())) {
if (StringUtils.isBlank(gridPersonnelPO.getLeaderUserId())) {
return null;
}
return gridPersonnelDTO.getLeaderUserId();
return gridPersonnelPO.getUserId();
}
private GridPersonnelPO getLeaderPOByUserId(String userId) {
Map<String, Object> params = getHashMap(2);
params.put("userId", userId);
return gridPersonnelDao.getLeaderPO(params);
}
@Override

View File

@ -8,6 +8,7 @@ import com.cm.common.result.SuccessResultList;
import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil;
import com.cm.inspection.dao.industrycheckitem.IIndustryCheckItemDao;
import com.cm.inspection.pojo.dtos.checkitemoption.CheckItemOptionDTO;
import com.cm.inspection.pojo.dtos.industrycheckitem.IndustryCheckItemDTO;
import com.cm.inspection.pojo.vos.industrycheckitem.IndustryCheckItemBindVO;
import com.cm.inspection.pojo.vos.industrycheckitem.IndustryCheckItemVO;
@ -16,6 +17,7 @@ import com.cm.inspection.service.checkitemoption.ICheckItemOptionService;
import com.cm.inspection.service.industrycheckitem.IIndustryCheckItemService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -176,8 +178,23 @@ public class IndustryCheckItemServiceImpl extends BaseService implements IIndust
* @param params
*/
private void setCheckItemOptions(List<IndustryCheckItemDTO> industryCheckItemDTOs, Map<String, Object> params) {
Set<String> checkItemIdSet = new HashSet<>();
for (IndustryCheckItemDTO industryCheckItemDTO : industryCheckItemDTOs) {
setCheckItemOptions(industryCheckItemDTO, params);
checkItemIdSet.add(industryCheckItemDTO.getCheckItemId());
}
params.put("checkItemIds", new ArrayList<>(checkItemIdSet));
List<CheckItemOptionDTO> checkItemOptionDTOs = checkItemOptionService.listCheckItemOption(params);
for (IndustryCheckItemDTO industryCheckItemDTO : industryCheckItemDTOs) {
List<CheckItemOptionDTO> checkItemOptions = industryCheckItemDTO.getCheckItemOptions();
for (int i = 0; i < checkItemOptionDTOs.size(); i++) {
CheckItemOptionDTO checkItemOptionDTO = checkItemOptionDTOs.get(i);
if (StringUtils.equals(industryCheckItemDTO.getCheckItemId(), checkItemOptionDTO.getCheckItemId())) {
checkItemOptions.add(checkItemOptionDTO);
checkItemOptionDTOs.remove(i);
i--;
}
}
industryCheckItemDTO.setCheckItemOptions(checkItemOptions);
}
}

View File

@ -93,6 +93,16 @@ public interface IProcessService {
*/
List<Task> listTaskByAssigneeAndVariableKey(String assignee, String key);
/**
* 任务列表通过执行人和变量Keyvalue
*
* @param assignee 执行人
* @param key 变量名
* @param value 变量值
* @return
*/
List<Task> listTaskByAssigneeAndVariableKeyValue(String assignee, String key, Object value);
/**
* 任务列表通过执行人和流程变量Key
*

View File

@ -107,6 +107,12 @@ public class ProcessServiceImpl implements IProcessService {
return taskList;
}
@Override
public List<Task> listTaskByAssigneeAndVariableKeyValue(String assignee, String key, Object value) {
TaskQuery taskQuery = taskService.createTaskQuery();
return taskQuery.taskAssignee(assignee).taskVariableValueEquals(key, value).list();
}
@Override
public List<Task> listTaskByAssigneeAndRuntimeVariableKey(String assignee, String key) {
List<Task> taskList = listTaskByAssignee(assignee);

View File

@ -141,6 +141,13 @@
AND
t1.check_item_id = #{checkItemId}
</if>
<if test="checkItemIds != null and checkItemIds.size > 0">
AND
t1.check_item_id IN
<foreach collection="checkItemIds" index="index" open="(" separator="," close=")">
#{checkItemIds[${index}]}
</foreach>
</if>
<if test="checkItemOptionIds != null and checkItemOptionIds.size > 0">
AND
t1.check_item_option_id IN

View File

@ -25,6 +25,21 @@
<result column="industry_id" property="industryId"/>
</resultMap>
<resultMap id="gridPersonnelPO" type="com.cm.inspection.pojo.pos.gridpersonnel.GridPersonnelPO">
<id column="grid_personnel_id" property="gridPersonnelId"/>
<result column="user_id" property="userId"/>
<result column="area1" property="area1"/>
<result column="area2" property="area2"/>
<result column="area3" property="area3"/>
<result column="area4" property="area4"/>
<result column="area5" property="area5"/>
<result column="leader_user_id" property="leaderUserId"/>
<result column="level" property="level"/>
<result column="person_type" property="personType"/>
<result column="grid_type" property="gridType"/>
<result column="industry_id" property="industryId"/>
</resultMap>
<!-- 新增网格人员 -->
<insert id="saveGridPersonnel" parameterType="map" flushCache="true">
INSERT INTO gen_grid_personnel(
@ -378,4 +393,37 @@
grid_personnel_id = #{gridPersonnelId}
</update>
<!-- 上级领导 -->
<select id="getLeaderPO" parameterType="map" resultMap="gridPersonnelPO" useCache="true">
SELECT
t1.user_id,
t1.area1,
t1.area2,
t1.area3,
t1.area4,
t1.area5,
t1.leader_user_id,
t1.person_type,
t1.grid_type,
t1.level,
t1.grid_personnel_id
FROM
gen_grid_personnel t1
WHERE
t1.is_delete = 0
<if test="userId != null and userId != ''">
AND
t1.user_id = (
SELECT
st1.leader_user_id
FROM
gen_grid_personnel st1
WHERE
st1.is_delete = 0
AND
st1.user_id = #{userId}
)
</if>
</select>
</mapper>

View File

@ -337,17 +337,12 @@
} else if(rowData == 2) {
checkType = '【复查】';
}
var isCoordination = '<span style="color: #FF5722;">【不配合】</span>';
if(row.isCoordination == 1) {
isCoordination = '<span style="color: #009688;">【配合】</span>';
}
var isComplete = '<span style="color: #FF5722;">【未完成】</span>';
if(row.isComplete == 1) {
isComplete = '<span style="color: #009688;">【完成】</span>'
}
var infoDiv = '<table>';
infoDiv += '<tr><td class="col-content">'+ checkType +'</td></tr>';
infoDiv += '<tr><td class="col-content">'+ isCoordination +'</td></tr>';
infoDiv += '<tr><td class="col-content">'+ isComplete +'</td></tr>';
infoDiv += '</table>';
return infoDiv;