Commit 46b624a5 authored by tianbo's avatar tianbo

隐患流程修改

parent 76b58245
......@@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -231,7 +232,7 @@ public class LatentDangerController extends BaseController {
@ApiOperation(value = "隐患分页列表", notes = "隐患分页列表")
@PostMapping(value = "/page/list")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel listDanger(@ApiParam(value = "查询条件", required = true) @RequestBody PageParam pageParam) {
public ResponseModel listDanger(@ApiParam(value = "查询条件", required = true) @RequestBody PageParam pageParam) throws Exception {
IPage<LatentDanger> result = iLatentDangerService.listDanger(pageParam);
return ResponseHelper.buildResponse(result);
}
......@@ -282,7 +283,7 @@ public class LatentDangerController extends BaseController {
}
}
@ApiOperation(value = "隐患列表", notes = "查询隐患列表")
@ApiOperation(value = "所有隐患列表", notes = "所有隐患列表")
@PostMapping(value = "/list/all")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel<List<LatentDanger>> listAllDanger(@RequestBody LatentDangerListParam searchParam) {
......@@ -302,4 +303,18 @@ public class LatentDangerController extends BaseController {
public ResponseModel getDangerState() {
return ResponseHelper.buildResponse(iLatentDangerService.getDangerState());
}
@ApiOperation(value = "隐患审核", notes = "隐患审核")
@PostMapping(value = "/supervision/audit")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel dangerAudit(@RequestBody LatentDangerDto latentDangerDto, @RequestParam Integer executeType) throws Exception {
AgencyUserModel user = getUserInfo();
ReginParams reginParams = getSelectedOrgInfo();
String deptId = getDepartmentId(reginParams);
String departmentName = getDepartmentName(reginParams);
String userRealName = user.getRealName();
String userId = user.getUserId();
return ResponseHelper.buildResponse(iLatentDangerService.dangerAudit(latentDangerDto, executeType, userId,
userRealName, deptId, departmentName, reginParams));
}
}
......@@ -76,5 +76,10 @@ public class LatentDangerExecuteParam {
*/
private String dangerLevel;
/**
* 整改责任人
*/
private String reformUserId;
}
......@@ -28,6 +28,7 @@ import com.yeejoin.amos.latentdanger.business.dao.mapper.LatentDangerFlowRecordM
import com.yeejoin.amos.latentdanger.business.dao.mapper.LatentDangerMapper;
import com.yeejoin.amos.latentdanger.business.dao.mapper.LatentDangerPatrolMapper;
import com.yeejoin.amos.latentdanger.business.dto.DangerExecuteSubmitDto;
import com.yeejoin.amos.latentdanger.business.dto.ExecuteSubmitDto;
import com.yeejoin.amos.latentdanger.business.entity.mybatis.DangerResultBo;
import com.yeejoin.amos.latentdanger.business.entity.mybatis.DictBo;
import com.yeejoin.amos.latentdanger.business.entity.mybatis.extend.LatentDangerBo;
......@@ -37,7 +38,6 @@ import com.yeejoin.amos.latentdanger.business.entity.mybatis.extend.LatentDanger
import com.yeejoin.amos.latentdanger.business.param.LatentDangerDto;
import com.yeejoin.amos.latentdanger.business.param.LatentDangerExecuteParam;
import com.yeejoin.amos.latentdanger.business.param.LatentDangerListParam;
import com.yeejoin.amos.latentdanger.business.param.LatentDangerNormalParam;
import com.yeejoin.amos.latentdanger.business.param.PageParam;
import com.yeejoin.amos.latentdanger.business.service.intfc.ILatentDangerService;
import com.yeejoin.amos.latentdanger.business.util.CommonResponse;
......@@ -52,7 +52,6 @@ import com.yeejoin.amos.latentdanger.common.enums.DangerHandleStateEnum;
import com.yeejoin.amos.latentdanger.common.enums.DictTypeEnum;
import com.yeejoin.amos.latentdanger.common.enums.ExecuteStateEnum;
import com.yeejoin.amos.latentdanger.common.enums.ExecuteTypeEnum;
import com.yeejoin.amos.latentdanger.common.enums.InstanceKeyEnum;
import com.yeejoin.amos.latentdanger.common.enums.LatentDangerBizTypeEnum;
import com.yeejoin.amos.latentdanger.common.enums.LatentDangerExecuteTypeEnum;
import com.yeejoin.amos.latentdanger.common.enums.LatentDangerLevelEnum;
......@@ -1098,7 +1097,6 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
* @param departmentId
* @param departmentName
* @param executeSubmitDto
* @param role
* @return
*/
public DangerExecuteSubmitDto executeSubmit(LatentDangerExecuteParam param,
......@@ -1187,9 +1185,9 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
}
// 执行任务(带权限校验)
// Boolean executeResult = workflowExecuteService.CompleteTask(processInstanceId, condition, reginParams);
Boolean executeResult = workflowExecuteService.CompleteTask(processInstanceId, condition, reginParams);
// 校验权限
Boolean executeResult = workflowExecuteService.excuteTask(processInstanceId, condition);
// Boolean executeResult = workflowExecuteService.excuteTask(processInstanceId, condition);
if (!executeResult) {
executeSubmitDto.setIsOk(false);
executeResultMsg = "任务执行失败";
......@@ -1213,6 +1211,14 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
executeResultMsg = "设置节点执行人失败";
}
}
if (("supervised".equals(planType) &&
LatentDangerState.SupervisionDangerStateEnum.整改检查分管领导确认.getCode().equals(currentDangerState))
|| LatentDangerState.SupervisionDangerStateEnum.整改二次审核确认.getCode().equals(currentDangerState)) {
latentDanger.setDangerState(LatentDangerState.SupervisionDangerStateEnum.整改完毕.getCode());
latentDanger.setDangerStateName(LatentDangerState.SupervisionDangerStateEnum.整改完毕.getName());
executeResultMsg = latentDanger.getDangerStateName() + ExecuteTypeEnum.通过.getName();
}
} else {
LatentDangerState.SupervisionDangerStateEnum nextStateEnum =
LatentDangerState.SupervisionDangerStateEnum.getEnumByCode(currentStateEnum.getRejectNext());
......@@ -1223,13 +1229,14 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
latentDanger.setDangerState(nextState);
latentDanger.setDangerStateName(nextStateName);
if (ExecuteTypeEnum.通过.getCode().equals(param.getExecuteType()) &&
(LatentDangerState.SupervisionDangerStateEnum.整改检查分管领导确认.getCode().equals(currentDangerState)
|| LatentDangerState.SupervisionDangerStateEnum.整改二次审核确认.getCode().equals(currentDangerState))) {
latentDanger.setDangerState(LatentDangerState.SupervisionDangerStateEnum.整改完毕.getCode());
latentDanger.setDangerStateName(LatentDangerState.SupervisionDangerStateEnum.整改完毕.getName());
executeResultMsg = latentDanger.getDangerStateName() + ExecuteTypeEnum.通过.getName();
// 整改分配责任人
if (LatentDangerState.SupervisionDangerStateEnum.整改任务分配.getCode().equals(currentDangerState)) {
taskUserId = param.getReformUserId();
Object result = workflowExecuteService.setTaskAssign(processInstanceId, taskUserId);
if (!(Boolean) result) {
executeSubmitDto.setIsOk(false);
executeResultMsg = "设置节点执行人失败";
}
}
record = saveFlowRecord("", latentDanger.getDangerStateName(), userId, departmentId, null,
......@@ -1632,16 +1639,23 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
}
@Override
public IPage<LatentDanger> listDanger(PageParam pageParam) {
public IPage<LatentDanger> listDanger(PageParam pageParam) throws Exception {
IPage<LatentDanger> page = new Page<>(Integer.parseInt((String) pageParam.get("current")),
Integer.parseInt((String) pageParam.get("size")));
List allTaskList = Lists.newArrayList();
String idsStr = (String) pageParam.get("dangerIds");
List<String> dangerIdList = Lists.newArrayList();
if (StringUtil.isNotEmpty(idsStr)) {
// 查询指定隐患
dangerIdList = Lists.newArrayList(idsStr.split(","));
} else {
// 不指定隐患id-我的任务
JSONObject allTaskResult = workflowFeignService.getCurrentUserAllTaskList(workflowProcessDefinitionKey);
allTaskList = (List) allTaskResult.get("data");
if (ValidationUtil.isEmpty(allTaskList)) {
return page;
}
}
// if (StringUtil.isNotEmpty(pageParam.get("current")) && StringUtil.isNotEmpty(pageParam.get("size"))) {
// int offSet = (int) pageParam.get("current") * (int) pageParam.get("size");
// pageParam.put("offset", offSet);
// }
// 获取隐患地点的子节点
Object structureId = pageParam.get("structureId");
List<Long> structureIdList = Lists.newArrayList();
......@@ -1654,8 +1668,6 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
}
}
IPage<LatentDanger> page = new Page<>(Integer.parseInt((String) pageParam.get("current")),
Integer.parseInt((String) pageParam.get("size")));
LambdaQueryWrapper<LatentDanger> queryWrapper = new LambdaQueryWrapper();
queryWrapper.like(!ValidationUtil.isEmpty(pageParam.get("name")),
LatentDanger::getDangerName, pageParam.get("name"))
......@@ -1837,4 +1849,26 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
return LatentDangerState.PatrolDangerLevelEnum.getEnumList();
}
}
@Transactional
@Override
public Object dangerAudit(LatentDangerDto latentDangerDto, Integer executeType, String userId, String userName,
String deptId, String deptName, ReginParams reginParams) throws Exception {
LatentDanger latentDanger = this.baseMapper.selectById(latentDangerDto.getId());
if (ValidationUtil.isEmpty(latentDanger)) {
throw new Exception("隐患不存");
}
this.updateById(latentDanger);
DangerExecuteSubmitDto executeSubmitDto = new DangerExecuteSubmitDto();
LatentDangerExecuteParam executeParam = new LatentDangerExecuteParam();
executeParam.setExecuteType(executeType);
executeSubmit(executeParam, latentDanger, userId, userName, deptId, deptName, executeSubmitDto, reginParams);
if (!executeSubmitDto.getIsOk()) {
throw new Exception(executeSubmitDto.getMsg());
}
return true;
}
}
......@@ -10,17 +10,13 @@ import com.yeejoin.amos.latentdanger.business.param.LatentDangerDto;
import com.yeejoin.amos.latentdanger.business.param.LatentDangerExecuteParam;
import com.yeejoin.amos.latentdanger.business.param.PageParam;
import com.yeejoin.amos.latentdanger.business.vo.LatentDangerDetailVo;
import com.yeejoin.amos.latentdanger.common.enums.LatentDangerLevelEnum;
import com.yeejoin.amos.latentdanger.dao.entity.LatentDanger;
import org.springframework.data.domain.Page;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.latentdanger.business.dto.DangerExecuteSubmitDto;
import com.yeejoin.amos.latentdanger.business.param.LatentDangerListParam;
import com.yeejoin.amos.latentdanger.business.param.LatentDangerNormalParam;
import com.yeejoin.amos.latentdanger.business.param.LatentDangerPatrolParam;
import com.yeejoin.amos.latentdanger.business.util.CommonResponse;
import com.yeejoin.amos.latentdanger.business.vo.DangerTimeAxisVo;
import com.yeejoin.amos.latentdanger.core.common.response.DangerListResponse;
......@@ -103,7 +99,7 @@ public interface ILatentDangerService {
*/
JSONObject getReviewInfo(Long dangerId);
IPage<LatentDanger> listDanger(PageParam pageParam);
IPage<LatentDanger> listDanger(PageParam pageParam) throws Exception;
List<DangerListResponse> export(PageParam pageParam);
......@@ -131,4 +127,15 @@ public interface ILatentDangerService {
* @return
*/
List<Map<String, String>> getDangerState();
/**
* 隐患审核
*
* @return
* @param latentDangerDto
* @param executeType 执行类型(通过0、驳回1)
* @exception Exception
*/
Object dangerAudit(LatentDangerDto latentDangerDto, Integer executeType, String userId, String userName,
String deptId, String deptName, ReginParams reginParams) throws Exception;
}
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