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,15 +10,58 @@ import java.io.Serializable;
* @author Dell
* **/
public class ReginParams implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private CompanyBo company;
private RoleBo role;
private DepartmentBo department;
//用户基本信息
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
private String token;
......@@ -53,10 +96,12 @@ public class ReginParams implements Serializable {
public void setUserModel(AgencyUserModel userModel) {
this.userModel = userModel;
}
@Deprecated
public String getToken() {
return token;
}
@Deprecated
public void setToken(String 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;
}
}
......@@ -26,6 +26,9 @@ public class FailureAuditDto extends BaseDto {
@ApiModelProperty(value = "审核部门")
private String auditDepartment;
@ApiModelProperty(value = "审核部门")
private Long auditDepartmentId;
@ApiModelProperty(value = "审核时间")
private Date auditTime;
......@@ -38,4 +41,9 @@ public class FailureAuditDto extends BaseDto {
@ApiModelProperty(value = "设备故障报修单id")
private Long faultId;
@ApiModelProperty(value = "审核结果条件判断,0同意,1拒绝,2驳回")
private String condition;
}
......@@ -52,4 +52,7 @@ public class FailureMaintainDto extends BaseDto {
@ApiModelProperty(value = "附件")
private List<SourceFile> attachment;
@ApiModelProperty(value = "审核结果条件判断,0同意,1拒绝,2驳回")
private String condition;
}
......@@ -35,6 +35,9 @@ public class FailureAudit extends BaseEntity {
@TableField("audit_department")
private String auditDepartment;
@TableField("audit_department_id")
private Long auditDepartmentId;
/**
* 审核时间
*/
......@@ -53,4 +56,6 @@ public class FailureAudit extends BaseEntity {
@TableField("fault_id")
private Long faultId;
}
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;
* @date 2021-08-04
*/
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 {
public ResponseModel<List<FailureAuditDto>> selectForList() {
return ResponseHelper.buildResponse(failureAuditServiceImpl.queryForFailureAuditList());
}
}
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.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.entity.FailureDetails;
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.CommonResponseUtil;*/
import io.swagger.annotations.Api;
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 {
*
* @return
*/
/*
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public CommonResponse save(@RequestBody FailureDetailsDto model) {
*/
/* model = failureDetailsServiceImpl.savemodel(model);
return ResponseHelper.buildResponse(model);*//*
CommonResponse commonResponse = new CommonResponse();
try {
AgencyUserModel user = getUserInfo();
if (ObjectUtils.isEmpty(user)) {
return CommonResponseUtil.failure("用户session过期");
public ResponseModel<Object> save(@RequestBody FailureDetailsDto model) {
Object result = failureDetailsServiceImpl.savemodel(model,getSelectedOrgInfo());
return ResponseHelper.buildResponse(result);
// CommonResponse commonResponse = new CommonResponse();
// try {
// AgencyUserModel user = getUserInfo();
// if (ObjectUtils.isEmpty(user)) {
// return CommonResponseUtil.failure("用户session过期");
// }
// return failureDetailsServiceImpl.savemodel(model);
// } catch (Exception e) {
// logger.error("", e.getMessage());
// return CommonResponseUtil.failure("系统繁忙,请稍后再试");
// }
}
return failureDetailsServiceImpl.savemodel(model);
} catch (Exception e) {
logger.error("", e.getMessage());
return CommonResponseUtil.failure("系统繁忙,请稍后再试");
}
}
*/
/**
* 根据sequenceNbr更新
......
......@@ -118,5 +118,18 @@ public class FailureMaintainController extends BaseController {
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;
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.yeejoin.amos.boot.module.common.api.dto.FailureAuditDto;
import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto;
......@@ -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.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,11 +24,13 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
* @date 2021-08-04
*/
@Service
public class FailureAuditServiceImpl extends BaseService<FailureAuditDto, FailureAudit, FailureAuditMapper> implements IFailureAuditService {
public class FailureAuditServiceImpl extends BaseService<FailureAuditDto, FailureAudit, FailureAuditMapper>
implements IFailureAuditService {
@Autowired
FailureDetailsServiceImpl failureDetailsService;
/* @Autowired
RemoteWorkFlowService remoteWorkFlowService;*/
// @Autowired
// RemoteWorkFlowService remoteWorkFlowService;
/**
* 分页查询
......@@ -54,9 +57,9 @@ public class FailureAuditServiceImpl extends BaseService<FailureAuditDto, Failur
Integer auditResult = model.getAuditResult();
if (auditResult.equals(AuditResultEnum.AGREE.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());
}else if (auditResult.equals(AuditResultEnum.SEND_BACK.getCode())){
} else if (auditResult.equals(AuditResultEnum.SEND_BACK.getCode())) {
updateStatus(model, FailureStatuEnum.WAITING_SUBMIT.getCode());
}
return model;
......@@ -72,4 +75,13 @@ public class FailureAuditServiceImpl extends BaseService<FailureAuditDto, Failur
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
}
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;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
......@@ -15,7 +14,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -24,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
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.foundation.utils.Bean;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.alibaba.fastjson.JSONObject;
......@@ -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.PlanTaskVo;
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.PlanTaskFinishStatusEnum;
import com.yeejoin.amos.maintenance.common.enums.TaskIsOrderEnum;
......@@ -74,6 +74,7 @@ public class PlanTaskController extends AbstractBaseController {
@Autowired
private RemoteSecurityService remoteSecurityService;
private String loginOrgCode;
/**
* 计划执行查询
......@@ -484,54 +485,39 @@ public class PlanTaskController extends AbstractBaseController {
/**
* 查询任务列表
*
* @param queryRequests
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据用户条件查询所有计划任务(<font color='blue'>手机app</font>)", notes = "根据用户条件查询所有计划任务(<font color='blue'>手机app</font>)")
@RequestMapping(value = "/queryPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
@ApiOperation(value = "维保任务查询-mobile", notes = "根据用户条件查询所有计划任务")
@RequestMapping(value = "/queryPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse qryLoginUserPlanTask(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = false, defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) {
@ApiParam(value = "人员") @RequestParam(value = "userId", required = false) Long userId,
@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>();
ReginParams reginParams = getSelectedOrgInfo();
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("pageSize", pageable.getPageSize());
params.put("offset", pageable.getPageNumber() * pageable.getPageSize());
if (ObjectUtils.isEmpty(params.get("orderBy"))) {
params.put("orderBy", "beginTime desc");
}
if (params.get("orderBy").toString().contains("taskPlanNum")) {
params.put("orderBy", params.get("orderBy") + ",beginTime asc");
}
params.put("userId", userId);
params.put("startTime", startTime);
params.put("endTime", endTime);
params.put("finishStatus", finishStatus);
params.put("orderBy", OrderByEnum.getEumByCode(orderBy).getOderBy());
CommonPageable pageable = new CommonPageable(current, size);
try {
Page page = planTaskService.getPlanTasks(getToken(), getProduct(), getAppKey(), params);
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);
return CommonResponseUtil.success(planTaskService.getPlanTasks(params, pageable));
} catch (Exception e) {
e.printStackTrace();
return CommonResponseUtil.failure(e.getMessage());
}
}
......
......@@ -566,51 +566,15 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
@Override
public Page<HashMap<String, Object>> getPlanTasks(String toke, String product, String appKey, HashMap<String, Object> params) {
CommonPageable pageParam = new CommonPageable();
public Page<HashMap<String, Object>> getPlanTasks(HashMap<String, Object> params, CommonPageable pageParam) {
List<HashMap<String, Object>> content = Lists.newArrayList();
long total = planTaskMapper.getPlanTasksCount(params);
if (total == 0) {
return new PageImpl<>(content, pageParam, total);
}
content = planTaskMapper.getPlanTasks(params);
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
public Map queryPlanTaskById(Long planTaskId) {
......
......@@ -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.LeavePlanTaskVo;
import com.yeejoin.amos.maintenance.business.vo.PlanTaskVo;
import com.yeejoin.amos.maintenance.core.common.request.CommonPageable;
import org.springframework.data.domain.Page;
import com.yeejoin.amos.maintenance.business.param.CheckPtListPageParam;
......@@ -76,9 +77,10 @@ public interface IPlanTaskService {
/**
* 天剑查询假话任务信息
* @param params
* @param page
* @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获取计划任务信息
......
......@@ -59,7 +59,7 @@ public class PlanTaskPageParamUtil {
for(int i=0;i<queryRequests.size();i++){
String name = queryRequests.get(i).getName();
String type = queryRequests.get(i).getType();
if(type!=null && type!=""){
if(type!=null && !"".equals(type)){
if (!QueryOperatorEnum.ORDER_BY.getName().equals(type)) {
params.put(name, queryRequests.get(i).getValue());
} else if (QueryOperatorEnum.ORDER_BY.getName().equals(type)) {
......
......@@ -6,9 +6,23 @@
//import java.lang.annotation.RetentionPolicy;
//import java.lang.annotation.Target;
//
///**
// * @author DELL
// */
//@Target(ElementType.METHOD)
//@Retention(RetentionPolicy.RUNTIME)
//@Documented
//public @interface Permission {
// /**
// * value
// * @return
// */
// String value() default "";
//
// /**
// * 是否进行人员校验
// * @return
// */
// boolean isPersonIdentity() default false;
//}
//
//package com.yeejoin.amos.maintenance.core.framework;
//
//
//import java.util.List;
//import java.util.Map;
//
//import javax.servlet.http.HttpServletRequest;
//
//import org.aspectj.lang.JoinPoint;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Before;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.BeanUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.stereotype.Component;
//import org.springframework.util.ObjectUtils;
//import org.springframework.web.bind.annotation.ResponseBody;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//import org.typroject.tyboot.core.foundation.context.RequestContext;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
......@@ -37,6 +17,24 @@
//import com.yeejoin.amos.feign.privilege.model.RoleModel;
//import com.yeejoin.amos.maintenance.exception.PermissionException;
//import com.yeejoin.amos.maintenance.feign.RemoteSecurityService;
//import org.aspectj.lang.JoinPoint;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Before;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.BeanUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.stereotype.Component;
//import org.springframework.util.ObjectUtils;
//import org.springframework.web.bind.annotation.ResponseBody;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//import org.typroject.tyboot.core.foundation.context.RequestContext;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.List;
//import java.util.Map;
//
//@Aspect
//@Component
......@@ -50,65 +48,59 @@
// @Autowired
// private RemoteSecurityService remoteSecurityService;
//
// // 前置通知,在方法执行之前
// @Before(value = "@annotation(com.yeejoin.amos.maintenance.core.framework.Permission)")
// public void PermissionCheck(JoinPoint joinPoint) throws PermissionException {
// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder
// .getRequestAttributes()).getRequest();
//
// @Before(value = "@annotation(Permission) && @annotation(permission)")
// public void PermissionCheck(JoinPoint joinPoint, Permission permission) throws PermissionException {
// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
// logger.info("======开始权限校验======");
// // 用户token
// String token = request.getHeader("token");
// token = ObjectUtils.isEmpty(token) ? request.getHeader("X-Access-Token") : token;
// String product = request.getHeader("product");
// String appKey = request.getHeader("appKey");
// logger.info("用户token:" + token);
// RequestContext.setToken(token);
// RequestContext.setProduct(product);
// RequestContext.setAppKey(appKey);
// if (!TokenOperation.refresh(token)) {
// throw new PermissionException("登录信息失效,请重新登录");
// }
//
// if (joinPoint.getSignature().getName().equals("saveCurCompany")) {
// return;
// }
// FeignClientResult feignClientResult;
// AgencyUserModel userModel=null;
// AgencyUserModel userModel = null;
// try {
// feignClientResult = Privilege.agencyUserClient.getme();
// userModel = (AgencyUserModel) feignClientResult.getResult();
//
// } catch (InnerInvokException e) {
// e.printStackTrace();
// throw new PermissionException("用户信息校验失败");
// }
// String userId = null;
// ReginParams regionParam = new ReginParams();
// if(userModel != null){
// userId = userModel.getUserId();
// Map<Long, List<RoleModel>> orgRoles = userModel.getOrgRoles();
// List<RoleModel> roleModels = null;
// if(!ObjectUtils.isEmpty(orgRoles)) {
// for (Map.Entry<Long, List<RoleModel>> entry : orgRoles.entrySet()) {
// roleModels = entry.getValue();
// break;
// if (userModel == null) {
// throw new PermissionException("用户信息校验失败");
// }
// String name = "";
// String companyId = "";
// String type = "";
// if (permission.isPersonIdentity()) {
// //调用jcs,进行人员身份判断,是维保公司人员还是业主单位人员
// JSONObject result = new JSONObject();
// name = result.get("name").toString();
// companyId = result.get("companyId").toString();
// type = result.get("type").toString();
// }
// ReginParams regionParam = new ReginParams();
// String userId = userModel.getUserId();
// Map<Long, List<RoleModel>> orgRoles = userModel.getOrgRoles();
// ReginParams reginParams = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(userModel.getUserId(), token)), ReginParams.class);
// if(reginParams == null && userModel.getCompanys().size() > 0){
// if (reginParams == null && userModel.getCompanys().size() > 0) {
// CompanyModel companyModel = userModel.getCompanys().get(0);
//
// List<DepartmentModel> deptList = remoteSecurityService.getDepartmentTreeByCompanyId(token, product, appKey, companyModel.getSequenceNbr().toString());
// if(deptList.size() > 0){
// regionParam.setPersonIdentity(new ReginParams.PersonIdentity(type, name, companyId));
// if (deptList.size() > 0) {
// CompanyBo companyBo = convertCompanyModelToBo(companyModel);
// DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0));
// regionParam.setCompany(companyBo);
// regionParam.setDepartment(departmentBo);
// if(!ObjectUtils.isEmpty(roleModels)){
// regionParam.setRole(convertRoleModelToBo(roleModels.get(0)));
// if (!ObjectUtils.isEmpty(orgRoles) && !orgRoles.get(departmentBo.getSequenceNbr()).isEmpty()) {
// regionParam.setRole(convertRoleModelToBo(orgRoles.get(departmentBo.getSequenceNbr()).get(0)));
// }
// }else{
// if(!ObjectUtils.isEmpty(userModel.getOrgRoles()) && !ObjectUtils.isEmpty(companyModel) && userModel.getOrgRoles().get(companyModel.getSequenceNbr()).size() > 0){
// } else {
// if (!ObjectUtils.isEmpty(userModel.getOrgRoles()) && !ObjectUtils.isEmpty(companyModel) && userModel.getOrgRoles().get(companyModel.getSequenceNbr()).size() > 0) {
// RoleModel role = userModel.getOrgRoles().get(companyModel.getSequenceNbr()).get(0);
// RoleBo roleBo = new RoleBo();
// BeanUtils.copyProperties(role, roleBo);
......@@ -118,12 +110,11 @@
// redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(regionParam));
// }
// }
// }
//
//
// private DepartmentBo convertDepartmentModelToBo(DepartmentModel departmentModel){
// private DepartmentBo convertDepartmentModelToBo(DepartmentModel departmentModel) {
// DepartmentBo departmentBo = new DepartmentBo();
// if(departmentModel != null) {
// if (departmentModel != null) {
// departmentBo.setCompanySeq(departmentModel.getCompanySeq());
// departmentBo.setDepartmentDesc(departmentModel.getDepartmentDesc());
// departmentBo.setDepartmentName(departmentModel.getDepartmentName());
......@@ -139,13 +130,13 @@
// /**
// * Model 转 Bo
// */
// private CompanyBo convertCompanyModelToBo(CompanyModel companyModel){
// private CompanyBo convertCompanyModelToBo(CompanyModel companyModel) {
//
// CompanyBo companyBo = new CompanyBo();
// if(companyModel != null) {
// if (companyModel != null) {
// companyBo.setAddress(companyModel.getAddress());
// companyBo.setCompanyName(companyModel.getCompanyName());
// companyBo.setCompanyOrgCode(Integer.parseInt(companyModel.getCompanyOrgCode().toString()));
// companyBo.setCompanyOrgCode(companyModel.getCompanyOrgCode());
// companyBo.setEmail(companyModel.getEmail());
// companyBo.setLandlinePhone(companyModel.getLandlinePhone());
// companyBo.setLongitude(companyModel.getLongitude());
......@@ -160,7 +151,7 @@
//
// private RoleBo convertRoleModelToBo(RoleModel roleModel) {
// RoleBo roleBo = new RoleBo();
// if(roleModel != null){
// if (roleModel != null) {
// roleBo.setRoleName(roleModel.getRoleName());
// roleBo.setRoleType(roleModel.getRoleType());
// roleBo.setSequenceNbr(roleModel.getSequenceNbr());
......@@ -168,7 +159,13 @@
// return roleBo;
// }
//
// //redi缓存选择的用户信息
// /**
// * redis缓存选择的用户信息
// *
// * @param userId userId
// * @param token token
// * @return String
// */
// private String buildKey(String userId, String token) {
// return "region_" + userId + "_" + token;
//
......
......@@ -38,3 +38,10 @@ spring.data.mongodb.uri=mongodb://172.16.3.41:27017/command_db
file.url=http://39.98.45.134:9000/
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 @@
a.beginTime,
a.endTime,
a.checkDate,
a.finshNum,
a.finishNum,
a.taskPlanNum,
a.finishStatus,
a.batchNo,
a.userId executiveName,
a.userName,
a.userDept
<!-- (SELECT GROUP_CONCAT(`name`) FROM s_user where find_in_set(id,a.userId)>0 ORDER BY `id`) AS executiveName -->
FROM
(
SELECT
......@@ -213,7 +212,6 @@
pt.id batchNo,
pt.route_id,
pt.point_num taskPlanNum,
pt.finish_num finshNum,
pt.user_name userName,
pt.user_dept userDept
FROM
......@@ -222,20 +220,10 @@
) a
<where>
<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="orgCode != null and orgCode !=''" >
and (a.OrgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.OrgCode= #{orgCode} )
</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 != '' ">
AND (
......@@ -256,36 +244,6 @@
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>
</where>
<if test="orderBy != null and orderBy != '' "> order by ${orderBy} </if>
......@@ -299,50 +257,17 @@
FROM
(
SELECT
pt.id planTaskId,
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
pt.id
FROM
p_plan_task pt
INNER JOIN p_plan p ON pt.plan_id = p.id
) a
<where>
<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="orgCode != null and orgCode !=''" >
and (a.OrgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.OrgCode= #{orgCode} )
</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 != '' ">
AND (
(
......@@ -362,43 +287,9 @@
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>
</where>
</select>
<select id="queryPlanTaskById" resultType="Map">
SELECT
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