Commit 1d1d1028 authored by tangwei's avatar tangwei

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

parents 084793d8 7b79fbdf
...@@ -18,7 +18,7 @@ public enum WorkFlowEnum { ...@@ -18,7 +18,7 @@ public enum WorkFlowEnum {
GROUPNAME("groupName","角色组的key"), GROUPNAME("groupName","角色组的key"),
NAME("name","任务节点的key"), NAME("name","任务节点的key"),
PROCESSINSTANCEID("processInstanceId",""), PROCESSINSTANCEID("processInstanceId",""),
ASSIGN("assign","角色执行人key"); ASSIGN("assignee","角色执行人key");
private String code;//对应菜单组件名称 private String code;//对应菜单组件名称
private String desc;//描述 private String desc;//描述
......
...@@ -56,7 +56,7 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService { ...@@ -56,7 +56,7 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
public Map<String, Object> checkTaskAuthMap(String processInstanceId, ReginParams userInfo) { public Map<String, Object> checkTaskAuthMap(String processInstanceId, ReginParams userInfo) {
// 获取当前登录用户的角色 // 获取当前登录用户的角色
String currentLoginUserRole = userInfo.getRole().getRoleName(); String currentLoginUserRole = userInfo.getRole().getRoleName();
String currentLoginUserId = userInfo.getUserModel().getUserId(); String currentLoginUserName = userInfo.getUserModel().getUserName();
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put(WorkFlowEnum.CHECKFLAG.getCode(), false); map.put(WorkFlowEnum.CHECKFLAG.getCode(), false);
JSONObject teskObject = workflowFeignService.getTaskList(processInstanceId); JSONObject teskObject = workflowFeignService.getTaskList(processInstanceId);
...@@ -86,7 +86,7 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService { ...@@ -86,7 +86,7 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
.getString(WorkFlowEnum.ASSIGN.getCode()); .getString(WorkFlowEnum.ASSIGN.getCode());
if (StringUtils.isNotBlank(assignUser)) { if (StringUtils.isNotBlank(assignUser)) {
// 如果当前登录人与当前任务的设定人不一定,则直接返回权限校验失败 // 如果当前登录人与当前任务的设定人不一定,则直接返回权限校验失败
if (!assignUser.contains(currentLoginUserId)) { if (!assignUser.contains(currentLoginUserName)) {
return map; return map;
} }
map.put(WorkFlowEnum.TASKID.getCode(), detail.getString(WorkFlowEnum.ID.getCode())); map.put(WorkFlowEnum.TASKID.getCode(), detail.getString(WorkFlowEnum.ID.getCode()));
...@@ -144,7 +144,7 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService { ...@@ -144,7 +144,7 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
.getTaskGroupName(detail.getString(WorkFlowEnum.ID.getCode())); .getTaskGroupName(detail.getString(WorkFlowEnum.ID.getCode()));
try { try {
if (taskGroupNameObject.getJSONArray(WorkFlowEnum.DATA.getCode()) == null if (taskGroupNameObject.getJSONArray(WorkFlowEnum.DATA.getCode()) == null
&& taskGroupNameObject.getJSONArray(WorkFlowEnum.DATA.getCode()).size() < 1) { || taskGroupNameObject.getJSONArray(WorkFlowEnum.DATA.getCode()).size() < 1) {
workflowFeignService.setTaskUser(detail.getString(WorkFlowEnum.ID.getCode()), userId); workflowFeignService.setTaskUser(detail.getString(WorkFlowEnum.ID.getCode()), userId);
} }
} catch (Exception e) { } catch (Exception e) {
......
...@@ -12,7 +12,9 @@ public enum PlanStatusEnum { ...@@ -12,7 +12,9 @@ public enum PlanStatusEnum {
EXAMINE_TWO("二级待审核",2, 3), EXAMINE_TWO("二级待审核",2, 3),
EXAMINE_THREE("三级待审核",3, 4), EXAMINE_THREE("三级待审核",3, 4),
EXAMINE_FORMULATE("已审核/检查内容未制定",4, 5), EXAMINE_FORMULATE("已审核/检查内容未制定",4, 5),
EXAMINE_DEVELOPED("检查内容已制定/未执行",5, 5); EXAMINE_DEVELOPED("检查内容已制定/未执行",5, 6),
IN_EXECUTION("执行中",6, 7),
COMPLETED("已完成",7, 7);
/** /**
* 名称 * 名称
......
...@@ -171,6 +171,17 @@ public class Plan extends BasicEntity { ...@@ -171,6 +171,17 @@ public class Plan extends BasicEntity {
private String checkLevel; private String checkLevel;
/** /**
* 检查人单位id
*/
@Column(name="check_unit_id")
private String checkUnitId;
/**
* 检查人单位名称
*/
@Column(name="check_unit_name")
private String checkUnitName;
/**
* 备注 * 备注
*/ */
private String remark; private String remark;
...@@ -760,4 +771,20 @@ public class Plan extends BasicEntity { ...@@ -760,4 +771,20 @@ public class Plan extends BasicEntity {
public void setCheckLevel(String checkLevel) { public void setCheckLevel(String checkLevel) {
this.checkLevel = checkLevel; this.checkLevel = checkLevel;
} }
public String getCheckUnitId() {
return checkUnitId;
}
public void setCheckUnitId(String checkUnitId) {
this.checkUnitId = checkUnitId;
}
public String getCheckUnitName() {
return checkUnitName;
}
public void setCheckUnitName(String checkUnitName) {
this.checkUnitName = checkUnitName;
}
} }
\ No newline at end of file
...@@ -1062,6 +1062,8 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -1062,6 +1062,8 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
data = initDutyCarTemplate(ids); data = initDutyCarTemplate(ids);
} else if (ExcelEnums.RYZB.getType().equals(excelDto.getType())) { } else if (ExcelEnums.RYZB.getType().equals(excelDto.getType())) {
data = initDutyPersonTemplate(ids); data = initDutyPersonTemplate(ids);
}else if(ExcelEnums.WXXFZB.getType().equals(excelDto.getType())){
data = initDutyDutyFireFightingTemplate(ids);
} }
// 获取日期 // 获取日期
List<Map<String, Object>> rangeDate = dutyPersonShiftService.getBaseMapper().genRangeDate(beginDate, endDate); List<Map<String, Object>> rangeDate = dutyPersonShiftService.getBaseMapper().genRangeDate(beginDate, endDate);
...@@ -1070,6 +1072,29 @@ if (excelDtoList != null && excelDtoList.size() > 0) { ...@@ -1070,6 +1072,29 @@ if (excelDtoList != null && excelDtoList.size() > 0) {
exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, true); exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, true);
} }
private List<List<Object>> initDutyDutyFireFightingTemplate(String ids) {
List<List<Object>> data = new ArrayList<>();
// 根据id列表获取单位下的微型消防站集合
List<String> companyIdList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(ids)) {
companyIdList = Lists.newArrayList(ids.split(","));
}
List<FirefightersDto> firefightersDtoList = fireTeamService.getFighterByTeamId(companyIdList);
if (!firefightersDtoList.isEmpty()) {
AtomicInteger row = new AtomicInteger(1);
firefightersDtoList.forEach(o -> {
ArrayList<Object> list = new ArrayList<>();
list.add(row.getAndIncrement());
list.add(o.getFireTeamName() + "@" + o.getFireTeamId());
list.add(o.getName() + "@" + o.getSequenceNbr());
list.add(o.getJobTitle() + "@" + o.getJobTitleCode());
data.add(list);
});
}
return data;
}
public void dutyInfoExport(HttpServletResponse response, String beginDate, String endDate, ExcelDto excelDto) public void dutyInfoExport(HttpServletResponse response, String beginDate, String endDate, ExcelDto excelDto)
throws ParseException { throws ParseException {
// 获取日期 // 获取日期
......
...@@ -87,7 +87,7 @@ public class HiddenDangerController extends AbstractBaseController { ...@@ -87,7 +87,7 @@ public class HiddenDangerController extends AbstractBaseController {
@RequestParam(value = "planId") Long planId, @RequestParam(value = "planId") Long planId,
@ApiParam(value = "导入数据文件", required = true) @RequestBody MultipartFile file) { @ApiParam(value = "导入数据文件", required = true) @RequestBody MultipartFile file) {
List<HiddenDangerImportDto> list = FileHelper.importExcel(file, 0, 1, HiddenDangerImportDto.class); List<HiddenDangerImportDto> list = FileHelper.importExcel(file, 0, 1, HiddenDangerImportDto.class);
iHiddenDangerService.importDanger(getSelectedOrgInfo(),planId, list); iHiddenDangerService.importDanger(getSelectedOrgInfo(), planId, list);
return ResponseHelper.buildResponse("导入成功"); return ResponseHelper.buildResponse("导入成功");
} }
...@@ -106,7 +106,7 @@ public class HiddenDangerController extends AbstractBaseController { ...@@ -106,7 +106,7 @@ public class HiddenDangerController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "隐患删除") @ApiOperation(value = "隐患删除")
@DeleteMapping("{latentDangerIds}") @DeleteMapping("{latentDangerIds}")
public ResponseModel deleteByIds(@ApiParam(value = "隐患ids,隐患模块主键")@PathVariable String latentDangerIds){ public ResponseModel deleteByIds(@ApiParam(value = "隐患ids,隐患模块主键") @PathVariable String latentDangerIds) {
List<Long> ids = Arrays.stream(latentDangerIds.split(",")).mapToLong(Long::parseLong).boxed().collect(Collectors.toList()); List<Long> ids = Arrays.stream(latentDangerIds.split(",")).mapToLong(Long::parseLong).boxed().collect(Collectors.toList());
Boolean b = iHiddenDangerService.deleteBatch(ids); Boolean b = iHiddenDangerService.deleteBatch(ids);
return ResponseHelper.buildResponse(b); return ResponseHelper.buildResponse(b);
......
...@@ -33,7 +33,7 @@ public class PlanAuditController extends AbstractBaseController { ...@@ -33,7 +33,7 @@ public class PlanAuditController extends AbstractBaseController {
public ResponseModel auditWorkFlow( public ResponseModel auditWorkFlow(
@ApiParam(value = "工作流流水实例", required = true) @RequestBody PlanAuditLog planAuditLog, @ApiParam(value = "工作流流水实例", required = true) @RequestBody PlanAuditLog planAuditLog,
@ApiParam(value = "当前计划状态", required = true) @RequestParam Integer status, @ApiParam(value = "当前计划状态", required = true) @RequestParam Integer status,
@ApiParam(value = "执行控制条件", required = true) @RequestParam String condition) { @ApiParam(value = "执行控制条件", required = true) @RequestParam String condition) throws Exception {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
return ResponseHelper.buildResponse(planAuditService.auditWorkFlow(planAuditLog, status, condition, reginParams)); return ResponseHelper.buildResponse(planAuditService.auditWorkFlow(planAuditLog, status, condition, reginParams));
} }
......
...@@ -9,6 +9,7 @@ import com.yeejoin.amos.supervision.common.enums.DangerCheckTypeLevelEnum; ...@@ -9,6 +9,7 @@ import com.yeejoin.amos.supervision.common.enums.DangerCheckTypeLevelEnum;
import com.yeejoin.amos.supervision.common.enums.PlanStatusEnum; import com.yeejoin.amos.supervision.common.enums.PlanStatusEnum;
import com.yeejoin.amos.supervision.core.common.request.AddPlanRequest; import com.yeejoin.amos.supervision.core.common.request.AddPlanRequest;
import com.yeejoin.amos.supervision.core.common.response.PlanPointRespone; import com.yeejoin.amos.supervision.core.common.response.PlanPointRespone;
import com.yeejoin.amos.supervision.core.framework.PersonIdentify;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -88,6 +89,7 @@ public class PlanController extends AbstractBaseController { ...@@ -88,6 +89,7 @@ public class PlanController extends AbstractBaseController {
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PersonIdentify
@ApiOperation(value = "巡检计划新增及编辑", notes = "巡检计划新增及编辑") @ApiOperation(value = "巡检计划新增及编辑", notes = "巡检计划新增及编辑")
@RequestMapping(value = "/addPlan", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @RequestMapping(value = "/addPlan", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse checkPlanAdd(@ApiParam(value = "巡检计划", required = true) @RequestBody AddPlanRequest param) { public CommonResponse checkPlanAdd(@ApiParam(value = "巡检计划", required = true) @RequestBody AddPlanRequest param) {
......
...@@ -89,15 +89,14 @@ public class RoutePointItemController extends AbstractBaseController { ...@@ -89,15 +89,14 @@ public class RoutePointItemController extends AbstractBaseController {
/** /**
* 删除巡检路线点项关系 * 删除巡检路线点项关系
* *
* @param ids
* @return CommonResponse * @return CommonResponse
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "删除巡检路线点项关系", notes = "删除巡检路线点项关系") @ApiOperation(value = "删除巡检路线点项关系", notes = "删除巡检路线点项关系")
@PostMapping(value = "/deleteByIdIn", produces = "application/json;charset=UTF-8") @PostMapping(value = "/deleteByIdIn", produces = "application/json;charset=UTF-8")
public CommonResponse deleteByIdIn(@ApiParam(value = "ids", required = true) @RequestParam List<Long> ids) { public CommonResponse deleteByIdIn(@ApiParam(value = "ids", required = true) @RequestParam List<String> itemIds, @RequestParam Long planId) {
try { try {
routePointItemService.deleteByIdIn(ids); routePointItemService.deleteByIdIn(itemIds, planId);
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
......
...@@ -11,4 +11,10 @@ public interface PlanTaskDetailMapper extends BaseMapper { ...@@ -11,4 +11,10 @@ public interface PlanTaskDetailMapper extends BaseMapper {
Map findPlanTaskByTaskIdAndPointId(@Param(value="planTaskId") long planTaskId,@Param(value="pointId") long pointId); Map findPlanTaskByTaskIdAndPointId(@Param(value="planTaskId") long planTaskId,@Param(value="pointId") long pointId);
int findPlanTaskDetailByTaskId( @Param(value="planTaskId") long planTaskId); int findPlanTaskDetailByTaskId( @Param(value="planTaskId") long planTaskId);
/**
* 更新隐患信息
* @param planTaskDetailId 主键id
*/
void updateDanger(@Param(value="planTaskDetailId") long planTaskDetailId);
} }
...@@ -26,6 +26,11 @@ public interface IRoutePointItemDao extends BaseDao<RoutePointItem, Long> { ...@@ -26,6 +26,11 @@ public interface IRoutePointItemDao extends BaseDao<RoutePointItem, Long> {
@Modifying @Modifying
@Transactional @Transactional
@Query(value = "delete from p_route_point_item WHERE input_item_id in (?1) and plan_id = (?2)", nativeQuery = true)
int deleteByRoutePointItemIdAndPlanId(List<String> itemIds, Long planId);
@Modifying
@Transactional
@Query(value = "delete from p_route_point_item WHERE plan_id = ?1", nativeQuery = true) @Query(value = "delete from p_route_point_item WHERE plan_id = ?1", nativeQuery = true)
void deleteByPlanId(Long planId); void deleteByPlanId(Long planId);
} }
...@@ -1427,7 +1427,7 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1427,7 +1427,7 @@ public class CheckServiceImpl implements ICheckService {
List<CheckShot> checkShots = new ArrayList<>(); List<CheckShot> checkShots = new ArrayList<>();
InputItem inputItem = inputItemDao.getOne(item.getInputItemId()); InputItem inputItem = inputItemDao.getOne(item.getInputItemId());
CheckInput checkInput = new CheckInput(); CheckInput checkInput = new CheckInput();
if (!ObjectUtils.isEmpty(item.getId())) { if (!ObjectUtils.isEmpty(item.getId()) && item.getId() != 0) {
checkInput.setId(item.getId()); checkInput.setId(item.getId());
// 更新操作,将该点下所有图片删除,其余更新 // 更新操作,将该点下所有图片删除,其余更新
checkShotDao.deleteByCheckInputId(item.getId()); checkShotDao.deleteByCheckInputId(item.getId());
...@@ -1559,6 +1559,9 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1559,6 +1559,9 @@ public class CheckServiceImpl implements ICheckService {
planTaskDetailMapper.finishTaskDetail(Long.parseLong(detail.get("planTaskDetailId").toString()), recordParam.getPointId(), planTaskDetailMapper.finishTaskDetail(Long.parseLong(detail.get("planTaskDetailId").toString()), recordParam.getPointId(),
recordParam.getPlanTaskId(), mtUserSeq, userName, size, planTaskStatus); recordParam.getPlanTaskId(), mtUserSeq, userName, size, planTaskStatus);
// p_plan_task_detail更新隐患个数
planTaskDetailMapper.updateDanger(Long.parseLong(detail.get("planTaskDetailId").toString()));
// 隐患入库 // 隐患入库
if (!ObjectUtils.isEmpty(allDanger)) { if (!ObjectUtils.isEmpty(allDanger)) {
saveDanger(allDanger, planTask, check, recordParam); saveDanger(allDanger, planTask, check, recordParam);
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.supervision.business.service.impl; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.supervision.business.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Sequence; import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
...@@ -251,7 +252,10 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService { ...@@ -251,7 +252,10 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
Map<String, Object> result = new HashMap<>(32); Map<String, Object> result = new HashMap<>(32);
Optional<Plan> op = iPlanDao.findById(hiddenDangerDto.getPlanId()); Optional<Plan> op = iPlanDao.findById(hiddenDangerDto.getPlanId());
Plan plan = op.orElseThrow((() -> new RuntimeException("计划不存在"))); Plan plan = op.orElseThrow((() -> new RuntimeException("计划不存在")));
Point point = iPointDao.findById(hiddenDangerDto.getPointId()).orElseThrow(() -> new RuntimeException("单位不存在")); Point point = new Point();
if (!ObjectUtils.isEmpty(hiddenDangerDto.getPointId())) {
point = iPointDao.findById(hiddenDangerDto.getPointId()).orElseThrow(() -> new RuntimeException("单位不存在"));
}
//检查级别 //检查级别
DangerCheckTypeLevelEnum dangerCheckTypeLevelEnum = DangerCheckTypeLevelEnum.getEumByCode(plan.getCheckLevel()); DangerCheckTypeLevelEnum dangerCheckTypeLevelEnum = DangerCheckTypeLevelEnum.getEumByCode(plan.getCheckLevel());
//检查类型 //检查类型
...@@ -267,6 +271,8 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService { ...@@ -267,6 +271,8 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
result.put("bizName", hiddenDangerDto.getInputItemName()); result.put("bizName", hiddenDangerDto.getInputItemName());
result.put("accompanyingUserId", plan.getLeadPeopleIds()); result.put("accompanyingUserId", plan.getLeadPeopleIds());
result.put("accompanyingUserName", plan.getLeadPeopleNames()); result.put("accompanyingUserName", plan.getLeadPeopleNames());
result.put("checkUnitId",plan.getCheckUnitId());
result.put("checkUnitName",plan.getCheckUnitName());
this.buildCheckInfo(result, hiddenDangerDto.getCheckInputId()); this.buildCheckInfo(result, hiddenDangerDto.getCheckInputId());
return result; return result;
} }
......
package com.yeejoin.amos.supervision.business.service.impl; package com.yeejoin.amos.supervision.business.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.service.IWorkflowExcuteService; import com.yeejoin.amos.boot.biz.common.service.IWorkflowExcuteService;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.supervision.business.dao.repository.IPlanAuditDao; import com.yeejoin.amos.supervision.business.dao.repository.IPlanAuditDao;
import com.yeejoin.amos.supervision.business.dao.repository.IPlanAuditLogDao; import com.yeejoin.amos.supervision.business.dao.repository.IPlanAuditLogDao;
import com.yeejoin.amos.supervision.business.dao.repository.IPlanDao; import com.yeejoin.amos.supervision.business.dao.repository.IPlanDao;
import com.yeejoin.amos.supervision.business.service.intfc.IPlanAuditService; import com.yeejoin.amos.supervision.business.service.intfc.IPlanAuditService;
import com.yeejoin.amos.supervision.common.enums.CheckTypeSuEnum;
import com.yeejoin.amos.supervision.common.enums.DangerCheckTypeLevelEnum;
import com.yeejoin.amos.supervision.common.enums.PlanStatusEnum; import com.yeejoin.amos.supervision.common.enums.PlanStatusEnum;
import com.yeejoin.amos.supervision.common.enums.WorkFlowBranchEnum;
import com.yeejoin.amos.supervision.dao.entity.Plan;
import com.yeejoin.amos.supervision.dao.entity.PlanAudit; import com.yeejoin.amos.supervision.dao.entity.PlanAudit;
import com.yeejoin.amos.supervision.dao.entity.PlanAuditLog; import com.yeejoin.amos.supervision.dao.entity.PlanAuditLog;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
...@@ -16,6 +22,7 @@ import org.springframework.stereotype.Service; ...@@ -16,6 +22,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -34,26 +41,28 @@ public class PlanAuditServiceImpl implements IPlanAuditService { ...@@ -34,26 +41,28 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
@Autowired @Autowired
private IPlanDao planDao; private IPlanDao planDao;
@Autowired
WorkflowFeignService workflowFeignService;
@Override @Override
@Transactional @Transactional
public Boolean auditWorkFlow(PlanAuditLog planAuditLog, Integer status, String condition, ReginParams reginParams) { public Boolean auditWorkFlow(PlanAuditLog planAuditLog, Integer status, String condition, ReginParams reginParams) throws Exception {
PlanAudit planAudit = planAuditDao.findByPlanId(planAuditLog.getPlanId()); PlanAudit planAudit = planAuditDao.findByPlanId(planAuditLog.getPlanId());
if (ObjectUtils.isNotEmpty(planAudit)) { if (ObjectUtils.isNotEmpty(planAudit)) {
String instanceId = planAudit.getProcessInstanceId(); String instanceId = planAudit.getProcessInstanceId();
Map<String, Object> taskAuthMap = workflowExcuteService.checkTaskAuthMap(instanceId, reginParams); Map<String, Object> taskAuthMap = workflowExcuteService.checkTaskAuthMap(instanceId, reginParams);
if (taskAuthMap != null && !taskAuthMap.isEmpty()) { if (taskAuthMap != null && !taskAuthMap.isEmpty()) {
// 获取当前计划
Plan plan = planDao.getOne(planAuditLog.getPlanId());
String taskId = taskAuthMap.get("taskId") == null ? null : taskAuthMap.get("taskId").toString(); String taskId = taskAuthMap.get("taskId") == null ? null : taskAuthMap.get("taskId").toString();
String name = taskAuthMap.get("name") == null ? null : taskAuthMap.get("name").toString(); String name = taskAuthMap.get("name") == null ? null : taskAuthMap.get("name").toString();
String roleName = reginParams.getRole().getRoleName(); String roleName = reginParams.getRole().getRoleName();
boolean b = workflowExcuteService.CompleteTask(instanceId, condition, reginParams); workflowExcuteService.CompleteTask(instanceId, condition, reginParams);
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity(); ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
workflowExcuteService.setTaskAssign(instanceId, personIdentity.getPersonSeq()); String userId = reginParams.getUserModel().getUserId();
if (b) { // 更新计划状态,指定执行人
PlanStatusEnum statusEnum = PlanStatusEnum.getEnum(status); updatePlanStatus(condition,plan,instanceId,userId);
planDao.updatePlanStatus(statusEnum != null ? statusEnum.getNextStatus() : PlanStatusEnum.DRAFT.getValue(), planAuditLog.getPlanId()); // 更新流水表
} else {
planDao.updatePlanStatus(PlanStatusEnum.DRAFT.getValue(), planAuditLog.getPlanId());
}
planAuditLog.setPlanId(planAudit.getPlanId()); planAuditLog.setPlanId(planAudit.getPlanId());
planAuditLog.setPlanAuditId(planAudit.getId()); planAuditLog.setPlanAuditId(planAudit.getId());
planAuditLog.setExcuteUserId(personIdentity.getPersonSeq()); planAuditLog.setExcuteUserId(personIdentity.getPersonSeq());
...@@ -63,12 +72,42 @@ public class PlanAuditServiceImpl implements IPlanAuditService { ...@@ -63,12 +72,42 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
planAuditLog.setFlowJson(condition); planAuditLog.setFlowJson(condition);
planAuditLog.setRoleName(roleName); planAuditLog.setRoleName(roleName);
planAuditLogDao.save(planAuditLog); planAuditLogDao.save(planAuditLog);
return b; return Boolean.TRUE;
} }
} }
return Boolean.FALSE; return Boolean.FALSE;
} }
/**
* 更新计划id
* @param condition 同意0 不同意1
* @param plan 当前计划对象
*/
private void updatePlanStatus (String condition, Plan plan, String instanceId, String userId) throws Exception {
String fail = "1";
if (fail.equals(condition)) {
planDao.updatePlanStatus(PlanStatusEnum.DRAFT.getValue(), plan.getId());
} else {
//检查级别
DangerCheckTypeLevelEnum dangerCheckTypeLevelEnum = DangerCheckTypeLevelEnum.getEumByCode(plan.getCheckLevel());
//检查类型
CheckTypeSuEnum checkTypeSuEnum = CheckTypeSuEnum.getEumByCode(plan.getCheckTypeId());
String branch = PlanServiceImpl.workFlowExcuteBranch(dangerCheckTypeLevelEnum.getCondition(), checkTypeSuEnum.getCondition());
if (branch.equals(WorkFlowBranchEnum.DAILY.getWorkFlowBranch())) {
if (PlanStatusEnum.EXAMINE_THREE.getValue() == plan.getStatus()) {
workflowExcuteService.setTaskAssign(instanceId, plan.getLeadPeopleIds());
}
PlanStatusEnum statusEnum = PlanStatusEnum.getEnum(plan.getStatus());
planDao.updatePlanStatus(statusEnum != null ? statusEnum.getNextStatus() : PlanStatusEnum.DRAFT.getValue(), plan.getId());
} else {
if (PlanStatusEnum.EXAMINE_ONE.getValue() == plan.getStatus()) {
workflowExcuteService.setTaskAssign(instanceId, plan.getLeadPeopleIds());
}
planDao.updatePlanStatus(PlanStatusEnum.EXAMINE_FORMULATE.getValue(), plan.getId());
}
}
}
@Override @Override
public List<PlanAuditLog> listByPlanId(Long planId) { public List<PlanAuditLog> listByPlanId(Long planId) {
Sort.Order idOrder = new Sort.Order(Sort.Direction.ASC, "createDate"); Sort.Order idOrder = new Sort.Order(Sort.Direction.ASC, "createDate");
......
...@@ -193,7 +193,7 @@ public class PlanServiceImpl implements IPlanService { ...@@ -193,7 +193,7 @@ public class PlanServiceImpl implements IPlanService {
planAuditLog.setFlowTaskName("发起审核"); planAuditLog.setFlowTaskName("发起审核");
planAuditLog.setExcuteUserId(param.getCreateBy()); planAuditLog.setExcuteUserId(param.getCreateBy());
planAuditLog.setExcuteUserName(personIdentity.getPersonName()); planAuditLog.setExcuteUserName(personIdentity.getPersonName());
planAuditLog.setExcuteState(1); planAuditLog.setExcuteState(0);
planAuditLog.setRoleName(reginParams.getRole().getRoleName()); planAuditLog.setRoleName(reginParams.getRole().getRoleName());
planAuditLogDao.save(planAuditLog); planAuditLogDao.save(planAuditLog);
} }
......
package com.yeejoin.amos.supervision.business.service.impl; package com.yeejoin.amos.supervision.business.service.impl;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.supervision.business.dao.mapper.InputItemMapper; import com.yeejoin.amos.supervision.business.dao.mapper.InputItemMapper;
import com.yeejoin.amos.supervision.business.dao.mapper.RoutePointItemMapper; import com.yeejoin.amos.supervision.business.dao.mapper.RoutePointItemMapper;
...@@ -88,9 +89,9 @@ public class RoutePointItemServiceImpl implements IRoutePointItemService { ...@@ -88,9 +89,9 @@ public class RoutePointItemServiceImpl implements IRoutePointItemService {
} }
@Override @Override
public Integer deleteByIdIn(List<Long> ids) { public Integer deleteByIdIn(List<String> itemIds, Long planId) {
if (CollectionUtils.isNotEmpty(ids)) { if (CollectionUtils.isNotEmpty(itemIds) && ObjectUtils.isNotEmpty(planId)) {
return routePointItemDao.deleteByRoutePointItemId(ids); return routePointItemDao.deleteByRoutePointItemIdAndPlanId(itemIds, planId);
} }
return 0; return 0;
} }
......
...@@ -6,7 +6,7 @@ import com.yeejoin.amos.supervision.dao.entity.PlanAuditLog; ...@@ -6,7 +6,7 @@ import com.yeejoin.amos.supervision.dao.entity.PlanAuditLog;
import java.util.List; import java.util.List;
public interface IPlanAuditService { public interface IPlanAuditService {
Boolean auditWorkFlow(PlanAuditLog planAuditLog, Integer status, String condition, ReginParams reginParams); Boolean auditWorkFlow(PlanAuditLog planAuditLog, Integer status, String condition, ReginParams reginParams) throws Exception;
/** /**
* 查询指定计划的审批日志 * 查询指定计划的审批日志
......
...@@ -14,5 +14,5 @@ public interface IRoutePointItemService { ...@@ -14,5 +14,5 @@ public interface IRoutePointItemService {
Page<RoutePointItemVo> queryPage(InputItemPageParam criterias); Page<RoutePointItemVo> queryPage(InputItemPageParam criterias);
Integer deleteByIdIn(List<Long> ids); Integer deleteByIdIn(List<String> itemIds, Long planId);
} }
...@@ -180,6 +180,7 @@ ...@@ -180,6 +180,7 @@
p.name taskName, p.name taskName,
p.check_type_name checkTypeName, p.check_type_name checkTypeName,
P.check_type_id checkTypeId, P.check_type_id checkTypeId,
p.id planId,
pt.status, pt.status,
pt.user_id userId, pt.user_id userId,
date_format( date_format(
......
...@@ -18,4 +18,17 @@ ...@@ -18,4 +18,17 @@
where pp.id = #{pointId} where pp.id = #{pointId}
and pt.id = #{planTaskId} and pt.id = #{planTaskId}
</select> </select>
<update id="updateDanger">
UPDATE p_plan_task_detail pptd,
(SELECT SUM(pci.safety_danger_num) saf, SUM(pci.major_danger_num) maj, ptd.id FROM p_check_input pci
LEFT JOIN p_check pc ON pc.id = pci.check_id
LEFT JOIN p_plan_task_detail ptd ON ptd.id = pc.plan_task_detail_id
WHERE ptd.id = #{planTaskDetailId}) a
set
pptd.safety_danger_num = a.saf,
pptd.major_danger_num = a.maj
WHERE
pptd.id = a.id
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -1168,8 +1168,8 @@ ...@@ -1168,8 +1168,8 @@
LEFT JOIN p_check_input pci ON pci.route_point_item_id = ppi.id LEFT JOIN p_check_input pci ON pci.route_point_item_id = ppi.id
LEFT JOIN p_check_shot pcs ON pci.id = pcs.check_input_id LEFT JOIN p_check_shot pcs ON pci.id = pcs.check_input_id
WHERE WHERE
prp.route_id = #{routeId} AND pii.is_delete = 0 prp.route_id = #{routeId} AND prp.point_id = #{pointId} AND pii.is_delete = 0 AND
AND pci.input_value is NULL OR pci.input_value <![CDATA[<>]]> 'pass' ( pci.input_value is NULL OR pci.input_value <![CDATA[<>]]> 'pass')
GROUP BY ppi.id GROUP BY ppi.id
</select> </select>
......
...@@ -48,13 +48,18 @@ ...@@ -48,13 +48,18 @@
SELECT SELECT
COUNT(1) COUNT(1)
FROM FROM
(SELECT
COUNT(1)
FROM
p_route_point_item pi p_route_point_item pi
LEFT JOIN p_input_item i ON i.id = pi.input_item_id LEFT JOIN p_input_item i ON i.id = pi.input_item_id
<where> <where>
<if test="name!=null"> and i.name like concat(concat("%",#{name}),"%")</if> <if test="name!=null"> and i.name like concat(concat("%",#{name}),"%")</if>
<if test="planId!=null"> and pi.plan_id = #{planId} </if> <if test="planId!=null"> and pi.plan_id = #{planId} </if>
<!-- <if test="orgCode!=null"> and i.org_Code = #{orgCode}</if>--> <!-- <if test="orgCode!=null"> and i.org_Code = #{orgCode}</if>-->
</where> </where>
GROUP BY i.id
) a
</select> </select>
<!--查询 --> <!--查询 -->
<select id="queryPage" resultType="com.yeejoin.amos.supervision.business.vo.RoutePointItemVo"> <select id="queryPage" resultType="com.yeejoin.amos.supervision.business.vo.RoutePointItemVo">
...@@ -75,6 +80,7 @@ ...@@ -75,6 +80,7 @@
<if test="planId!=null"> and pi.plan_id = #{planId} </if> <if test="planId!=null"> and pi.plan_id = #{planId} </if>
<!-- <if test="orgCode!=null"> and i.org_Code = #{orgCode}</if>--> <!-- <if test="orgCode!=null"> and i.org_Code = #{orgCode}</if>-->
</where> </where>
GROUP BY i.id
<choose> <choose>
<when test="pageSize==-1"></when> <when test="pageSize==-1"></when>
<when test="pageSize!=-1">limit #{offset},#{pageSize}</when> <when test="pageSize!=-1">limit #{offset},#{pageSize}</when>
......
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