Commit 05639847 authored by 李成龙's avatar 李成龙

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

# Conflicts: # amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/controller/PlanTaskController.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/core/framework/Permission.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/core/framework/PermissionAspect.java
parents ca2f365d c99c1738
...@@ -10,18 +10,61 @@ import java.io.Serializable; ...@@ -10,18 +10,61 @@ import java.io.Serializable;
* @author Dell * @author Dell
* **/ * **/
public class ReginParams implements Serializable { public class ReginParams implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private CompanyBo company; private CompanyBo company;
private RoleBo role; private RoleBo role;
private DepartmentBo department; private DepartmentBo department;
//用户基本信息
private AgencyUserModel userModel; private AgencyUserModel userModel;
private PersonIdentity personIdentity;
public static class PersonIdentity {
private String identityType;
private String personName;
private String companyId;
public PersonIdentity(String identityType,String personName,String companyId){
this.identityType = identityType;
this.personName = personName;
this.companyId = companyId;
}
public String getIdentityType() {
return identityType;
}
public void setIdentityType(String identityType) {
this.identityType = identityType;
}
public String getPersonName() {
return personName;
}
public void setPersonName(String personName) {
this.personName = personName;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
}
public PersonIdentity getPersonIdentity() {
return personIdentity;
}
public void setPersonIdentity(PersonIdentity personIdentity) {
this.personIdentity = personIdentity;
}
@Deprecated @Deprecated
private String token; private String token;
public CompanyBo getCompany() { public CompanyBo getCompany() {
return company; return company;
} }
...@@ -46,19 +89,21 @@ public class ReginParams implements Serializable { ...@@ -46,19 +89,21 @@ public class ReginParams implements Serializable {
this.department = department; this.department = department;
} }
public AgencyUserModel getUserModel() { public AgencyUserModel getUserModel() {
return userModel; return userModel;
} }
public void setUserModel(AgencyUserModel userModel) {
this.userModel = userModel;
}
public void setUserModel(AgencyUserModel userModel) {
this.userModel = userModel;
}
@Deprecated @Deprecated
public String getToken() { public String getToken() {
return token; return token;
} }
@Deprecated @Deprecated
public void setToken(String token) { public void setToken(String token) {
this.token = token; this.token = token;
} }
} }
package com.yeejoin.amos.boot.biz.common.workflow.enums;
public enum WorkFlowUriEnum {
启动流程("启动流程", "/workflow/task/startTask", ""),
流程详情("流程详情", "/workflow/task/{taskId}", "taskId"),
合并启动流程("合并启动流程", "/workflow/task/startProcess", ""),
所有已执行任务详情("所有已执行任务详情","/workflow/activitiHistory/task/detail/{taskId}","taskId"),
流程任务("流程任务", "/workflow/task?processInstanceId={processInstanceId}", "processInstanceId"),
我的代办("我的代办", "/workflow/task/all-list?processDefinitionKey={processDefinitionKey}", "processDefinitionKey"),
我的代办有ID("我的代办有ID", "/workflow/task/all-list?processDefinitionKey={processDefinitionKey}&userId={userId}", "processDefinitionKey,userId"),
已执行任务("已执行任务", "/workflow/activitiHistory/all-historytasks?processDefinitionKey={processDefinitionKey}", "processDefinitionKey"),
已执行任务有ID("已执行任务有ID", "/workflow/activitiHistory/all-historytasks?processDefinitionKey={processDefinitionKey}&userId={userId}", "processDefinitionKey,userId"),
启动免登录流程("启动免登录流程", "/processes/{appKey}", "appKey"),
当前节点("当前节点", "/wf/taskstodo?processInstanceId={processInstanceId}", "processInstanceId"),
执行流程("执行流程", "/workflow/task/pickupAndCompleteTask/{taskId}", "taskId"),
终止流程("终止流程", "/wf/processes/{processInstanceId}?deleteReason={deleteReason}", "processInstanceId,deleteReason"),
当前子节点("当前子节点", "/wf/processes/{processInstanceId}/tasks?taskDefinitionKey={taskDefinitionKey}", "processInstanceId,taskDefinitionKey"),
工作流流水("工作流流水","/wf/processes/{processInstanceId}/tasks", "processInstanceId"),
子节点信息("子节点信息","/workflow/task/list/all/{instanceId}", "instanceId"),
所有已执行任务集合("所有已执行任务集合","/workflow/activitiHistory/tasks/{processInstanceId}", "processInstanceId");
private String desc;
private String uri;
private String params;
WorkFlowUriEnum(String desc, String uri, String params) {
this.desc = desc;
this.uri = uri;
this.params = params;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getParams() {
return params;
}
public void setParams(String params) {
this.params = params;
}
}
package com.yeejoin.amos.boot.biz.common.workflow.enums;
/**
* 是否枚举
* @author WJK
*
*/
public enum YesOrNoEnum {
NO("否","0"),
YES("是","1" );
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private String code;
private YesOrNoEnum(String name, String code){
this.name = name;
this.code = code;
}
public static YesOrNoEnum getEnum(String code) {
YesOrNoEnum jPushTypeEnum = null;
for(YesOrNoEnum type: YesOrNoEnum.values()) {
if (type.getCode().equals(code)) {
jPushTypeEnum = type;
break;
}
}
return jPushTypeEnum;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
...@@ -25,6 +25,9 @@ public class FailureAuditDto extends BaseDto { ...@@ -25,6 +25,9 @@ public class FailureAuditDto extends BaseDto {
@ApiModelProperty(value = "审核部门") @ApiModelProperty(value = "审核部门")
private String auditDepartment; private String auditDepartment;
@ApiModelProperty(value = "审核部门")
private Long auditDepartmentId;
@ApiModelProperty(value = "审核时间") @ApiModelProperty(value = "审核时间")
private Date auditTime; private Date auditTime;
...@@ -37,5 +40,10 @@ public class FailureAuditDto extends BaseDto { ...@@ -37,5 +40,10 @@ public class FailureAuditDto extends BaseDto {
@ApiModelProperty(value = "设备故障报修单id") @ApiModelProperty(value = "设备故障报修单id")
private Long faultId; private Long faultId;
@ApiModelProperty(value = "审核结果条件判断,0同意,1拒绝,2驳回")
private String condition;
} }
...@@ -51,5 +51,8 @@ public class FailureMaintainDto extends BaseDto { ...@@ -51,5 +51,8 @@ public class FailureMaintainDto extends BaseDto {
@ApiModelProperty(value = "附件") @ApiModelProperty(value = "附件")
private List<SourceFile> attachment; private List<SourceFile> attachment;
@ApiModelProperty(value = "审核结果条件判断,0同意,1拒绝,2驳回")
private String condition;
} }
...@@ -34,6 +34,9 @@ public class FailureAudit extends BaseEntity { ...@@ -34,6 +34,9 @@ public class FailureAudit extends BaseEntity {
*/ */
@TableField("audit_department") @TableField("audit_department")
private String auditDepartment; private String auditDepartment;
@TableField("audit_department_id")
private Long auditDepartmentId;
/** /**
* 审核时间 * 审核时间
...@@ -52,5 +55,7 @@ public class FailureAudit extends BaseEntity { ...@@ -52,5 +55,7 @@ public class FailureAudit extends BaseEntity {
*/ */
@TableField("fault_id") @TableField("fault_id")
private Long faultId; private Long faultId;
} }
package com.yeejoin.amos.boot.module.common.api.service; package com.yeejoin.amos.boot.module.common.api.service;
import com.yeejoin.amos.boot.module.common.api.entity.FailureAudit;
/** /**
* 接口类 * 接口类
...@@ -8,5 +9,5 @@ package com.yeejoin.amos.boot.module.common.api.service; ...@@ -8,5 +9,5 @@ package com.yeejoin.amos.boot.module.common.api.service;
* @date 2021-08-04 * @date 2021-08-04
*/ */
public interface IFailureAuditService { public interface IFailureAuditService {
public FailureAudit findByFaultId(Long faultId) ;
} }
package com.yeejoin.amos.maintenance.common.enums;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author DELL
* 维保任务排序
*/
public enum OrderByEnum {
/**
* 维保任务排序
*/
TIME_DESC("时间倒序", "1", "beginTime desc"),
TIME_ASC("时间正序", "2", "beginTime asc"),
PLAN_TASK_NUM_ASC("计划维保设施数正序", "3", "taskPlanNum asc"),
PLAN_TASK_NUM_DESC("计划维保设施数倒序", "4", "taskPlanNum desc"),
FINISH_NUM_DESC("完成数倒序", "5", "finishNum desc"),
FINISH_NUM_ASC("完成数正序", "6", "finishNum asc");
/**
* 名字
*/
private String name;
/**
* 编号
*/
private String code;
/**
* 条件
*/
private String oderBy;
public String getOderBy() {
return oderBy;
}
public void setOderBy(String oderBy) {
this.oderBy = oderBy;
}
OrderByEnum(String name, String code, String oderBy) {
this.code = code;
this.name = name;
this.oderBy = oderBy;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public static List<Map<String, Object>> getEnumList() {
return Arrays.stream(OrderByEnum.values()).map(e -> {
Map<String, Object> map = new HashMap<>();
map.put(e.getCode(), e.getName());
return map;
}).collect(Collectors.toList());
}
public static OrderByEnum getEumByCode(String code) throws Exception {
Optional<OrderByEnum> op = Arrays.stream(OrderByEnum.values()).filter(e->e.getCode().equals(code)).findFirst();
return op.orElseThrow(()->new Exception("非法的条件"));
}
}
...@@ -86,4 +86,7 @@ public class FailureAuditController extends BaseController { ...@@ -86,4 +86,7 @@ public class FailureAuditController extends BaseController {
public ResponseModel<List<FailureAuditDto>> selectForList() { public ResponseModel<List<FailureAuditDto>> selectForList() {
return ResponseHelper.buildResponse(failureAuditServiceImpl.queryForFailureAuditList()); return ResponseHelper.buildResponse(failureAuditServiceImpl.queryForFailureAuditList());
} }
} }
package com.yeejoin.amos.boot.module.common.biz.controller; package com.yeejoin.amos.boot.module.common.biz.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
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.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto; import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto;
import com.yeejoin.amos.boot.module.common.api.entity.FailureDetails; import com.yeejoin.amos.boot.module.common.api.entity.FailureDetails;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FailureDetailsServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.FailureDetailsServiceImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
/*import com.yeejoin.amos.patrol.business.util.CommonResponse; /*import com.yeejoin.amos.patrol.business.util.CommonResponse;
import com.yeejoin.amos.patrol.business.util.CommonResponseUtil;*/ import com.yeejoin.amos.patrol.business.util.CommonResponseUtil;*/
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/** /**
* *
...@@ -44,29 +53,29 @@ public class FailureDetailsController extends BaseController { ...@@ -44,29 +53,29 @@ public class FailureDetailsController extends BaseController {
* *
* @return * @return
*/ */
/*
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增") @ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public CommonResponse save(@RequestBody FailureDetailsDto model) { public ResponseModel<Object> save(@RequestBody FailureDetailsDto model) {
*/
/* model = failureDetailsServiceImpl.savemodel(model); Object result = failureDetailsServiceImpl.savemodel(model,getSelectedOrgInfo());
return ResponseHelper.buildResponse(model);*//* return ResponseHelper.buildResponse(result);
CommonResponse commonResponse = new CommonResponse(); // CommonResponse commonResponse = new CommonResponse();
try { // try {
AgencyUserModel user = getUserInfo(); // AgencyUserModel user = getUserInfo();
if (ObjectUtils.isEmpty(user)) { // if (ObjectUtils.isEmpty(user)) {
return CommonResponseUtil.failure("用户session过期"); // return CommonResponseUtil.failure("用户session过期");
} // }
return failureDetailsServiceImpl.savemodel(model); // return failureDetailsServiceImpl.savemodel(model);
} catch (Exception e) { // } catch (Exception e) {
logger.error("", e.getMessage()); // logger.error("", e.getMessage());
return CommonResponseUtil.failure("系统繁忙,请稍后再试"); // return CommonResponseUtil.failure("系统繁忙,请稍后再试");
} // }
} }
*/
/** /**
* 根据sequenceNbr更新 * 根据sequenceNbr更新
......
...@@ -118,5 +118,18 @@ public class FailureMaintainController extends BaseController { ...@@ -118,5 +118,18 @@ public class FailureMaintainController extends BaseController {
return ResponseHelper.buildResponse(failureMaintainServiceImpl.queryForFailureMaintainList()); return ResponseHelper.buildResponse(failureMaintainServiceImpl.queryForFailureMaintainList());
} }
/**
* 查询历史流程审核信息记录
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "设备故障报修单详情-报修日志", notes = "设备故障报修单详情-报修日志")
@GetMapping(value = "/getProcessHistory/{sequenceNbr}")
public ResponseModel<List<Object>> getProcessHistory(@PathVariable Long sequenceNbr ) {
if(sequenceNbr==null) {
return ResponseHelper.buildResponse(null);
}
return ResponseHelper.buildResponse(failureMaintainServiceImpl.getProcessHistoryList(sequenceNbr));
}
} }
package com.yeejoin.amos.boot.module.common.biz.service.impl; package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.FailureAuditDto; import com.yeejoin.amos.boot.module.common.api.dto.FailureAuditDto;
import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto; import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto;
...@@ -9,13 +17,6 @@ import com.yeejoin.amos.boot.module.common.api.enums.FailureStatuEnum; ...@@ -9,13 +17,6 @@ import com.yeejoin.amos.boot.module.common.api.enums.FailureStatuEnum;
import com.yeejoin.amos.boot.module.common.api.mapper.FailureAuditMapper; import com.yeejoin.amos.boot.module.common.api.mapper.FailureAuditMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFailureAuditService; import com.yeejoin.amos.boot.module.common.api.service.IFailureAuditService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
/** /**
* 服务实现类 * 服务实现类
* *
...@@ -23,53 +24,64 @@ import org.typroject.tyboot.core.rdbms.service.BaseService; ...@@ -23,53 +24,64 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
* @date 2021-08-04 * @date 2021-08-04
*/ */
@Service @Service
public class FailureAuditServiceImpl extends BaseService<FailureAuditDto, FailureAudit, FailureAuditMapper> implements IFailureAuditService { public class FailureAuditServiceImpl extends BaseService<FailureAuditDto, FailureAudit, FailureAuditMapper>
@Autowired implements IFailureAuditService {
FailureDetailsServiceImpl failureDetailsService; @Autowired
/* @Autowired FailureDetailsServiceImpl failureDetailsService;
RemoteWorkFlowService remoteWorkFlowService;*/
// @Autowired
// RemoteWorkFlowService remoteWorkFlowService;
/** /**
* 分页查询 * 分页查询
*/ */
public Page<FailureAuditDto> queryForFailureAuditPage(Page<FailureAuditDto> page) { public Page<FailureAuditDto> queryForFailureAuditPage(Page<FailureAuditDto> page) {
return this.queryForPage(page, null, false); return this.queryForPage(page, null, false);
} }
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<FailureAuditDto> queryForFailureAuditList() { public List<FailureAuditDto> queryForFailureAuditList() {
return this.queryForList("", false); return this.queryForList("", false);
} }
/** /**
* 发起审核 * 发起审核
*/ */
public FailureAuditDto savemodel(FailureAuditDto model) { public FailureAuditDto savemodel(FailureAuditDto model) {
// remoteWorkFlowService.currentTask(); // remoteWorkFlowService.currentTask();
this.createWithModel(model); this.createWithModel(model);
Integer auditResult = model.getAuditResult(); Integer auditResult = model.getAuditResult();
if (auditResult.equals(AuditResultEnum.AGREE.getCode())) { if (auditResult.equals(AuditResultEnum.AGREE.getCode())) {
updateStatus(model, FailureStatuEnum.WAITING_MAINTAIN.getCode()); updateStatus(model, FailureStatuEnum.WAITING_MAINTAIN.getCode());
} else if (auditResult.equals( AuditResultEnum.REFUSE.getCode())) { } else if (auditResult.equals(AuditResultEnum.REFUSE.getCode())) {
updateStatus(model, FailureStatuEnum.REFUSE.getCode()); updateStatus(model, FailureStatuEnum.REFUSE.getCode());
}else if (auditResult.equals(AuditResultEnum.SEND_BACK.getCode())){ } else if (auditResult.equals(AuditResultEnum.SEND_BACK.getCode())) {
updateStatus(model, FailureStatuEnum.WAITING_SUBMIT.getCode()); updateStatus(model, FailureStatuEnum.WAITING_SUBMIT.getCode());
} }
return model; return model;
} }
/** /**
* 修改故障保修单任务状态 * 修改故障保修单任务状态
*/ */
FailureDetailsDto updateStatus(FailureAuditDto model, Integer status) { FailureDetailsDto updateStatus(FailureAuditDto model, Integer status) {
FailureDetailsDto failureDetailsDto = failureDetailsService.queryBySeq(model.getFaultId()); FailureDetailsDto failureDetailsDto = failureDetailsService.queryBySeq(model.getFaultId());
failureDetailsDto.setCurrentStatus(status); failureDetailsDto.setCurrentStatus(status);
failureDetailsDto.setSequenceNbr(model.getFaultId()); failureDetailsDto.setSequenceNbr(model.getFaultId());
return failureDetailsService.updateWithModel(failureDetailsDto); return failureDetailsService.updateWithModel(failureDetailsDto);
} }
public FailureAudit findByFaultId(Long faultId) {
LambdaQueryWrapper<FailureAudit> wrapper = new LambdaQueryWrapper<FailureAudit>();
wrapper.eq(FailureAudit::getIsDelete, false);
wrapper.eq(FailureAudit::getFaultId, faultId);
wrapper.orderByAsc(FailureAudit::getAuditTime);
wrapper.last("LIMIT 1");
return this.baseMapper.selectOne(wrapper);
}
} }
\ No newline at end of file
...@@ -73,4 +73,13 @@ public class FailureMaintainServiceImpl extends BaseService<FailureMaintainDto,F ...@@ -73,4 +73,13 @@ public class FailureMaintainServiceImpl extends BaseService<FailureMaintainDto,F
} }
return failureMaintainDto; return failureMaintainDto;
} }
/**
* 查询当前故障报修单的流程的审批历史节点
* @param sequenceNbr
* @return
*/
public List<Object> getProcessHistoryList(Long sequenceNbr) {
// TODO Auto-generated method stub
return null;
}
} }
\ No newline at end of file
...@@ -2,7 +2,6 @@ package com.yeejoin.amos.maintenance.business.controller; ...@@ -2,7 +2,6 @@ package com.yeejoin.amos.maintenance.business.controller;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -15,7 +14,6 @@ import org.slf4j.Logger; ...@@ -15,7 +14,6 @@ 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;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -24,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMethod; ...@@ -24,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -42,6 +41,7 @@ import com.yeejoin.amos.maintenance.business.util.Toke; ...@@ -42,6 +41,7 @@ import com.yeejoin.amos.maintenance.business.util.Toke;
import com.yeejoin.amos.maintenance.business.vo.CodeOrderVo; import com.yeejoin.amos.maintenance.business.vo.CodeOrderVo;
import com.yeejoin.amos.maintenance.business.vo.PlanTaskVo; import com.yeejoin.amos.maintenance.business.vo.PlanTaskVo;
import com.yeejoin.amos.maintenance.business.vo.PointInputItemVo; import com.yeejoin.amos.maintenance.business.vo.PointInputItemVo;
import com.yeejoin.amos.maintenance.common.enums.OrderByEnum;
import com.yeejoin.amos.maintenance.common.enums.PlanTaskDetailStatusEnum; import com.yeejoin.amos.maintenance.common.enums.PlanTaskDetailStatusEnum;
import com.yeejoin.amos.maintenance.common.enums.PlanTaskFinishStatusEnum; import com.yeejoin.amos.maintenance.common.enums.PlanTaskFinishStatusEnum;
import com.yeejoin.amos.maintenance.common.enums.TaskIsOrderEnum; import com.yeejoin.amos.maintenance.common.enums.TaskIsOrderEnum;
...@@ -74,6 +74,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -74,6 +74,7 @@ public class PlanTaskController extends AbstractBaseController {
@Autowired @Autowired
private RemoteSecurityService remoteSecurityService; private RemoteSecurityService remoteSecurityService;
private String loginOrgCode;
/** /**
* 计划执行查询 * 计划执行查询
...@@ -484,54 +485,39 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -484,54 +485,39 @@ public class PlanTaskController extends AbstractBaseController {
/** /**
* 查询任务列表 * 查询任务列表
* *
* @param queryRequests * @param
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据用户条件查询所有计划任务(<font color='blue'>手机app</font>)", notes = "根据用户条件查询所有计划任务(<font color='blue'>手机app</font>)") @ApiOperation(value = "维保任务查询-mobile", notes = "根据用户条件查询所有计划任务")
@RequestMapping(value = "/queryPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @RequestMapping(value = "/queryPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse qryLoginUserPlanTask( public CommonResponse qryLoginUserPlanTask(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests, @ApiParam(value = "人员") @RequestParam(value = "userId", required = false) Long userId,
@ApiParam(value = "分页参数", required = false, defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) { @ApiParam(value = "开始日期") @RequestParam(value = "startTime") String startTime,
@ApiParam(value = "结束日期") @RequestParam(value = "endTime") String endTime,
@ApiParam(value = "维保状态") @RequestParam(value = "finishStatus", required = false) Integer finishStatus,
@ApiParam(value = "排序条件") @RequestParam(value = "orderBy") String orderBy,
@ApiParam(value = "业主单位") @RequestParam(value = "companyId", required = false) String companyId,
@ApiParam(value = "当前页") @RequestParam(value = "pageNumber") int current,
@ApiParam(value = "页大小") @RequestParam(value = "pageSize") int size) throws Exception {
HashMap<String, Object> params = new HashMap<String, Object>(); HashMap<String, Object> params = new HashMap<String, Object>();
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getLoginOrgCode(reginParams); String loginOrgCode = getLoginOrgCode(reginParams);
params = PlanTaskPageParamUtil.fillPlanTask(queryRequests, params); Map<String, Object> authMap = Bean.BeantoMap(reginParams.getPersonIdentity());
params.putAll(authMap);
params.put("companyId", companyId);
params.put("orgCode", loginOrgCode); params.put("orgCode", loginOrgCode);
params.put("pageSize", pageable.getPageSize()); params.put("userId", userId);
params.put("offset", pageable.getPageNumber() * pageable.getPageSize()); params.put("startTime", startTime);
if (ObjectUtils.isEmpty(params.get("orderBy"))) { params.put("endTime", endTime);
params.put("orderBy", "beginTime desc"); params.put("finishStatus", finishStatus);
} params.put("orderBy", OrderByEnum.getEumByCode(orderBy).getOderBy());
if (params.get("orderBy").toString().contains("taskPlanNum")) { CommonPageable pageable = new CommonPageable(current, size);
params.put("orderBy", params.get("orderBy") + ",beginTime asc");
}
try { try {
Page page = planTaskService.getPlanTasks(getToken(), getProduct(), getAppKey(), params); return CommonResponseUtil.success(planTaskService.getPlanTasks(params, pageable));
List<Map<String, Object>> li = page.getContent();
List<Map<String, Object>> li1 = new ArrayList<>();
if (li != null && li.size() > 0) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
for (Map<String, Object> msg : li) {
String[] userIds = msg.get("userId").toString().split(",");
for (String userId : userIds) {
msg.put("userId", userId);
}
if (msg.get("checkDate") != null)
msg.put("checkDate", sdf.format(sdf.parse(msg.get("checkDate").toString())));
li1.add(msg);
}
}
Page<Map<String, Object>> pd = new PageImpl<>(li1, page.getPageable(), page.getTotalElements());
return CommonResponseUtil.success(pd);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
return CommonResponseUtil.failure(e.getMessage()); return CommonResponseUtil.failure(e.getMessage());
} }
} }
......
...@@ -566,50 +566,14 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -566,50 +566,14 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
public Page<HashMap<String, Object>> getPlanTasks(String toke, String product, String appKey, HashMap<String, Object> params) { public Page<HashMap<String, Object>> getPlanTasks(HashMap<String, Object> params, CommonPageable pageParam) {
CommonPageable pageParam = new CommonPageable();
List<HashMap<String, Object>> content = Lists.newArrayList(); List<HashMap<String, Object>> content = Lists.newArrayList();
long total = planTaskMapper.getPlanTasksCount(params); long total = planTaskMapper.getPlanTasksCount(params);
if (total == 0) { if (total == 0) {
return new PageImpl<>(content, pageParam, total); return new PageImpl<>(content, pageParam, total);
} }
content = planTaskMapper.getPlanTasks(params); content = planTaskMapper.getPlanTasks(params);
return new PageImpl<>(content, pageParam, total);
if (!CollectionUtils.isEmpty(content)) {
Set<String> userIds = Sets.newHashSet();
content.forEach(e -> {
String userId = e.get("userId").toString();
if (StringUtil.isNotEmpty(userId)) {
userIds.add(userId);
}
});
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
Map<String, String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
List<String> userNames = new ArrayList<>();
content.forEach(e -> {
userNames.clear();
List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(","));
for (String userId : userIds1) {
userNames.add(userModelMap.get(userId));
}
userNames.remove(null);
if (userNames != null && userNames.size() > 0) {
e.put("executiveName", Joiner.on(",").join(userNames));
} else {
e.put("executiveName", " ");
}
/*e.put("beginTime",new Date().getTime());
e.put("endTime",new Date().getTime());*/
});
return new PageImpl<>(content, pageParam, total);
}
return null;
} }
@Override @Override
......
...@@ -9,6 +9,7 @@ import com.yeejoin.amos.maintenance.business.entity.mybatis.CheckChkExListBo; ...@@ -9,6 +9,7 @@ import com.yeejoin.amos.maintenance.business.entity.mybatis.CheckChkExListBo;
import com.yeejoin.amos.maintenance.business.vo.CodeOrderVo; import com.yeejoin.amos.maintenance.business.vo.CodeOrderVo;
import com.yeejoin.amos.maintenance.business.vo.LeavePlanTaskVo; import com.yeejoin.amos.maintenance.business.vo.LeavePlanTaskVo;
import com.yeejoin.amos.maintenance.business.vo.PlanTaskVo; import com.yeejoin.amos.maintenance.business.vo.PlanTaskVo;
import com.yeejoin.amos.maintenance.core.common.request.CommonPageable;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import com.yeejoin.amos.maintenance.business.param.CheckPtListPageParam; import com.yeejoin.amos.maintenance.business.param.CheckPtListPageParam;
...@@ -76,9 +77,10 @@ public interface IPlanTaskService { ...@@ -76,9 +77,10 @@ public interface IPlanTaskService {
/** /**
* 天剑查询假话任务信息 * 天剑查询假话任务信息
* @param params * @param params
* @param page
* @return * @return
*/ */
Page<HashMap<String, Object>> getPlanTasks(String toke,String product,String appKey,HashMap<String, Object> params); Page<HashMap<String, Object>> getPlanTasks(HashMap<String, Object> params, CommonPageable page);
/** /**
* 根据计划任务Id获取计划任务信息 * 根据计划任务Id获取计划任务信息
......
...@@ -59,7 +59,7 @@ public class PlanTaskPageParamUtil { ...@@ -59,7 +59,7 @@ public class PlanTaskPageParamUtil {
for(int i=0;i<queryRequests.size();i++){ for(int i=0;i<queryRequests.size();i++){
String name = queryRequests.get(i).getName(); String name = queryRequests.get(i).getName();
String type = queryRequests.get(i).getType(); String type = queryRequests.get(i).getType();
if(type!=null && type!=""){ if(type!=null && !"".equals(type)){
if (!QueryOperatorEnum.ORDER_BY.getName().equals(type)) { if (!QueryOperatorEnum.ORDER_BY.getName().equals(type)) {
params.put(name, queryRequests.get(i).getValue()); params.put(name, queryRequests.get(i).getValue());
} else if (QueryOperatorEnum.ORDER_BY.getName().equals(type)) { } else if (QueryOperatorEnum.ORDER_BY.getName().equals(type)) {
......
...@@ -6,9 +6,23 @@ ...@@ -6,9 +6,23 @@
//import java.lang.annotation.RetentionPolicy; //import java.lang.annotation.RetentionPolicy;
//import java.lang.annotation.Target; //import java.lang.annotation.Target;
// //
///**
// * @author DELL
// */
//@Target(ElementType.METHOD) //@Target(ElementType.METHOD)
//@Retention(RetentionPolicy.RUNTIME) //@Retention(RetentionPolicy.RUNTIME)
//@Documented //@Documented
//public @interface Permission { //public @interface Permission {
// /**
// * value
// * @return
// */
// String value() default ""; // String value() default "";
//
// /**
// * 是否进行人员校验
// * @return
// */
// boolean isPersonIdentity() default false;
//} //}
//
...@@ -38,3 +38,10 @@ spring.data.mongodb.uri=mongodb://172.16.3.41:27017/command_db ...@@ -38,3 +38,10 @@ spring.data.mongodb.uri=mongodb://172.16.3.41:27017/command_db
file.url=http://39.98.45.134:9000/ file.url=http://39.98.45.134:9000/
video.url=https://11.11.16.4:443/ video.url=https://11.11.16.4:443/
params.work.flow.normalProcessDefinitionKey=normalHazardManagement
params.work.flow.processDefinitionKey=hazardManagement
params.work.flow.address=http://172.16.3.4:30040
#params.work.flow.address=http://172.16.10.80:30040
params.spc.address=http://172.16.3.89:9001
failure.work.flow.processDefinitionKey=malfunction_repair
\ No newline at end of file
...@@ -179,14 +179,13 @@ ...@@ -179,14 +179,13 @@
a.beginTime, a.beginTime,
a.endTime, a.endTime,
a.checkDate, a.checkDate,
a.finshNum, a.finishNum,
a.taskPlanNum, a.taskPlanNum,
a.finishStatus, a.finishStatus,
a.batchNo, a.batchNo,
a.userId executiveName, a.userId executiveName,
a.userName, a.userName,
a.userDept a.userDept
<!-- (SELECT GROUP_CONCAT(`name`) FROM s_user where find_in_set(id,a.userId)>0 ORDER BY `id`) AS executiveName -->
FROM FROM
( (
SELECT SELECT
...@@ -213,7 +212,6 @@ ...@@ -213,7 +212,6 @@
pt.id batchNo, pt.id batchNo,
pt.route_id, pt.route_id,
pt.point_num taskPlanNum, pt.point_num taskPlanNum,
pt.finish_num finshNum,
pt.user_name userName, pt.user_name userName,
pt.user_dept userDept pt.user_dept userDept
FROM FROM
...@@ -222,20 +220,10 @@ ...@@ -222,20 +220,10 @@
) a ) a
<where> <where>
<if test="userId != null and userId > 0 "> and find_in_set(#{userId},a.userId)>0</if> <if test="userId != null and userId > 0 "> and find_in_set(#{userId},a.userId)>0</if>
<if test="routeId != null and userId > 0 "> and a.route_id = #{routeId} </if>
<if test="checkDate != null and checkDate != '' "> and a.beginTime <![CDATA[<=]]> #{checkDate} and a.endTime <![CDATA[>=]]> #{checkDate} </if>
<if test="finishStatus != null"> and a.finishStatus = #{finishStatus}</if> <if test="finishStatus != null"> and a.finishStatus = #{finishStatus}</if>
<if test="orgCode != null and orgCode !=''" > <if test="orgCode != null and orgCode !=''" >
and (a.OrgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.OrgCode= #{orgCode} ) and (a.OrgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.OrgCode= #{orgCode} )
</if> </if>
<choose>
<when test="departmentId != null and departmentId != 0 ">and a.userDept like concat('%', #{departmentId}, '%')</when>
<!-- <when test="departmentId == -1 and ids != null">and a.userId in-->
<!-- <foreach item="item" collection="ids" separator="," open="(" close=")" index="index">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </when>-->
</choose>
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' "> <if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
AND ( AND (
...@@ -256,36 +244,6 @@ ...@@ -256,36 +244,6 @@
AND a.endTime <![CDATA[>=]]> #{endTime} AND a.endTime <![CDATA[>=]]> #{endTime}
) )
) )
</if>
<if test="query != null and query != '' ">
<if test="queryType != null and queryType != 'executiveName' and queryType != 'plan' ">
AND EXISTS (
SELECT
1
FROM
p_point pp
LEFT JOIN p_route_point rp ON rp.point_id = pp.id
LEFT JOIN p_route r ON r.id = rp.route_id
where a.route_id = r.id
<if test="queryType == null or queryType == '' or queryType == 'all' ">
AND CONCAT(pp.name, ',',r.name, ',', pp.point_no,a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'route' ">
AND r.name LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'point' ">
AND CONCAT(pp.name, ',', pp.point_no) LIKE concat('%', #{query}, '%')
</if>
)
</if>
<if test="queryType != null and queryType == 'executiveName' ">
AND a.userName LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'plan' ">
AND CONCAT(a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
</if> </if>
</where> </where>
<if test="orderBy != null and orderBy != '' "> order by ${orderBy} </if> <if test="orderBy != null and orderBy != '' "> order by ${orderBy} </if>
...@@ -299,50 +257,17 @@ ...@@ -299,50 +257,17 @@
FROM FROM
( (
SELECT SELECT
pt.id planTaskId, pt.id
pt.org_code OrgCode,
p. NAME taskName,
pt. STATUS,
pt.user_id userId,
date_format(
pt.begin_time,
'%Y-%m-%d %H:%i:%s'
) beginTime,
date_format(
pt.end_time,
'%Y-%m-%d %H:%i:%s'
) endTime,
date_format( pt.check_date, '%Y-%m-%d %H:%i:%s' ) checkDate,
pt.finish_num finishNum,
pt.finish_status finishStatus,
pt.id batchNo,
pt.route_id,
pt.point_num taskPlanNum,
pt.finish_num finshNum,
pt.user_name userName,
pt.user_dept userDept
FROM FROM
p_plan_task pt p_plan_task pt
INNER JOIN p_plan p ON pt.plan_id = p.id INNER JOIN p_plan p ON pt.plan_id = p.id
) a ) a
<where> <where>
<if test="userId != null and userId > 0 "> and find_in_set(#{userId},a.userId)>0 </if> <if test="userId != null and userId > 0 "> and find_in_set(#{userId},a.userId)>0 </if>
<if test="routeId != null and userId > 0 "> and a.route_id = #{routeId} </if>
<if test="checkDate != null and checkDate != '' "> and a.beginTime <![CDATA[<=]]> #{checkDate} and a.endTime <![CDATA[>=]]> #{checkDate} </if>
<if test="finishStatus != null"> and a.finishStatus = #{finishStatus}</if> <if test="finishStatus != null"> and a.finishStatus = #{finishStatus}</if>
<if test="orgCode != null and orgCode !=''" > <if test="orgCode != null and orgCode !=''" >
and (a.OrgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.OrgCode= #{orgCode} ) and (a.OrgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.OrgCode= #{orgCode} )
</if> </if>
<choose>
<when test="departmentId != null and departmentId!= 0 ">and a.userDept like concat('%', #{departmentId}, '%') </when>
<!-- <when test="departmentId == -1 and ids != null">and a.userId in-->
<!-- <foreach item="item" collection="ids" separator="," open="(" close=")" index="index">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </when>-->
</choose>
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' "> <if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
AND ( AND (
( (
...@@ -362,43 +287,9 @@ ...@@ -362,43 +287,9 @@
AND a.endTime <![CDATA[>=]]> #{endTime} AND a.endTime <![CDATA[>=]]> #{endTime}
) )
) )
</if>
<if test="query != null and query != '' ">
<if test="queryType != null and queryType != 'executiveName' and queryType != 'plan' ">
AND EXISTS (
SELECT
1
FROM
p_point pp
LEFT JOIN p_route_point rp ON rp.point_id = pp.id
LEFT JOIN p_route r ON r.id = rp.route_id
where a.route_id = r.id
<if test="queryType == null or queryType == '' or queryType == 'all' ">
AND CONCAT(pp.name, ',',r.name, ',', pp.point_no,a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'route' ">
AND r.name LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'point' ">
AND CONCAT(pp.name, ',', pp.point_no) LIKE concat('%', #{query}, '%')
</if>
)
</if>
<if test="queryType != null and queryType == 'executiveName' ">
AND a.userName LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'plan' ">
AND CONCAT(a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
</if> </if>
</where> </where>
</select> </select>
<select id="queryPlanTaskById" resultType="Map"> <select id="queryPlanTaskById" resultType="Map">
SELECT SELECT
a.planTaskId, a.planTaskId,
......
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