Browse Source

巡检查询

wangbo 4 years ago
parent
commit
9f2030ca70

+ 4 - 1
operation_manager/src/main/java/com/huaxu/client/UserCenterClient.java

@@ -2,6 +2,8 @@ package com.huaxu.client;
 
 import com.huaxu.config.FeignConfig;
 
+import com.huaxu.task.entity.UserEntity;
+import lombok.NoArgsConstructor;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.*;
 
@@ -17,6 +19,7 @@ public interface UserCenterClient {
     @GetMapping("/dict/selectListByPCodes")
     Map<String,String> selectListByPCodes(@RequestParam String parentDictCodes);
 
+
     @PostMapping("/user/findUserIdsByUserIds")
-    Map<Long,String> findUserIdsByUserIds(Long[] ids);
+    List<UserEntity> findUserIdsByUserIds(Long[] ids);
 }

+ 25 - 6
operation_manager/src/main/java/com/huaxu/task/controller/PlanManageController.java

@@ -11,6 +11,7 @@ import com.huaxu.process.entity.ProcessDefinition;
 import com.huaxu.process.service.WorkFlowService;
 import com.huaxu.task.dto.PlanManageDto;
 import com.huaxu.task.entity.PlanManage;
+import com.huaxu.task.entity.UserEntity;
 import com.huaxu.task.service.PlanManageService;
 import com.huaxu.util.DatesUtil;
 import com.huaxu.util.UserUtil;
@@ -119,7 +120,7 @@ public class PlanManageController {
         IPage<PlanManageDto> iPage = new Page<>(pageNum, pageSize);
         iPage = planManageService.selectPage(iPage, planManageDto);
         Pagination<PlanManageDto> pages = new Pagination<>(iPage);
-        setUserName(pages);
+        //setUserName(pages);
         return new AjaxMessage<>(ResultStatus.OK, pages);
     }
 
@@ -147,10 +148,28 @@ public class PlanManageController {
         IPage<PlanManageDto> iPage = new Page<>(pageNum, pageSize);
         iPage = planManageService.selectPage(iPage, planManageDto);
         Pagination<PlanManageDto> pages = new Pagination<>(iPage);
-        setUserName(pages);
+        //setUserName(pages);
         return new AjaxMessage<>(ResultStatus.OK, pages);
     }
 
+    @GetMapping("/plan/pending/power")
+    @ApiOperation(value = "待处理权限")
+    public AjaxMessage<Boolean> selectPendingPower(
+            @ApiParam(value = "任务ID", required = true) @RequestParam(required = true) Integer id){
+        String currentUsers = null;
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        if(loginUser.getId() != null) {
+            currentUsers = String.format("%s,", loginUser.getId());
+        }
+        Map<String,Object> map = new HashMap<String,Object>();
+        map.put("id",id);
+        map.put("currentUsers",currentUsers);
+        int rows = planManageService.selectPendingPower(map);
+        if(rows>0){
+            new AjaxMessage<Boolean>(ResultStatus.OK, true);
+        }
+        return new AjaxMessage<Boolean>(ResultStatus.OK, false);
+    }
 
     /**
      * APP查询任务详情
@@ -276,9 +295,9 @@ public class PlanManageController {
             for( int i =0 ;i<idList.size(); i++){
                 ids[i] = idList.get(i);
             }
-            Map<Long, String> userMap = userCenterClient.findUserIdsByUserIds(ids);
+            List<UserEntity> userMap = userCenterClient.findUserIdsByUserIds(ids);
             for (PlanManage plan : pages.getList()) {
-                for (Map.Entry<Long, String> entry : userMap.entrySet()) {
+               /* for (Map.Entry<Long, String> entry : userMap.entrySet()) {
                     if(plan.getUserId() != null) {
                         if(entry.getKey()== Long.parseLong(plan.getUserId())){
                             plan.setUserName(entry.getValue());
@@ -298,8 +317,8 @@ public class PlanManageController {
                         if(entry.getKey()== Long.parseLong(plan.getUpdateBy())){
                             plan.setUpdateByName(entry.getValue());
                         }
-                    }
-                }
+                    }*/
+               // }
             }
         }
     }

+ 3 - 0
operation_manager/src/main/java/com/huaxu/task/dao/PlanManageMapper.java

@@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 @Mapper
 public interface PlanManageMapper {
@@ -29,4 +30,6 @@ public interface PlanManageMapper {
     Page<PlanManageDto> findPage(IPage<PlanManageDto> page, @Param("plan") PlanManageDto planManageDto);
 
     PlanManageDto selectPlanDetail(Integer id);
+
+    int selectPendingPower(Map<String,Object> map);
 }

+ 130 - 0
operation_manager/src/main/java/com/huaxu/task/entity/UserEntity.java

@@ -0,0 +1,130 @@
+package com.huaxu.task.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.huaxu.model.ProgramItem;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * uims_user
+ * @author: WYY
+ * @date 2020-10-22 17:35
+ */
+@Data
+public class UserEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    @ApiModelProperty(value = "主键")
+    @TableId(type=IdType.AUTO)
+    private Long id;
+
+    /** 租户标识 */
+    @ApiModelProperty(value = "租户标识")
+    private String tenantId;
+
+    /** 用户名 */
+    @ApiModelProperty(value = "用户名")
+    private String username;
+
+    /** 手机号 */
+    @ApiModelProperty(value = "手机号")
+    private String phone;
+
+    /** 公司 */
+    @ApiModelProperty(value = "公司")
+    private Long companyOrgId;
+
+    /** 公司名称 */
+    @ApiModelProperty(value = "公司名称")
+    @TableField(exist = false)
+    private String companyOrgName;
+
+    /** 部门 */
+    @ApiModelProperty(value = "部门")
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private Long deptOrgId;
+
+    /** 部门名称 */
+    @ApiModelProperty(value = "部门名称")
+    @TableField(exist = false)
+    private String deptOrgName;
+
+
+    /** 头像 */
+    @ApiModelProperty(value = "头像")
+    private String photo;
+
+    /** 用户类型 */
+    @ApiModelProperty(value = "用户类型(0 超管 1 普通用户)")
+    private String userType;
+
+    /** 用户标签 */
+    @ApiModelProperty(value = "用户标签")
+    @TableField(exist = false)
+    private List<Long> userTags;
+
+    /** 启用状态 */
+    @ApiModelProperty(value = "启用状态")
+    private String enableState;
+
+    /** 邮箱 */
+    @ApiModelProperty(value = "邮箱")
+    private String email;
+
+    /** 数据删除标记 */
+    @ApiModelProperty(value = "数据删除标记")
+    @TableLogic
+    private Integer status;
+    /** 创建者 */
+    @ApiModelProperty(value = "创建者")
+    private String createBy;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
+    @NotNull(message = "参数值不能为空")
+    @ApiModelProperty(value = "创建时间")
+    private Date dateCreate;
+    /** 更新者 */
+    @ApiModelProperty(value = "更新者")
+    private String updateBy;
+
+    /** dateUpdate */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
+    @NotNull(message = "参数值不能为空")
+    @ApiModelProperty(value = "更新时间")
+    private Date dateUpdate;
+
+    /** 备注 */
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
+    /** 用户角色 */
+    @ApiModelProperty(value = "用户角色")
+    @TableField(exist = false)
+    private Long roleId;
+
+    /** 用户角色 */
+    @ApiModelProperty(value = "用户角色名称")
+    @TableField(exist = false)
+    private String roleName;
+    /** 用户角色 */
+    @ApiModelProperty(value = "用户组")
+    @TableField(exist = false)
+    private Long userGroupId;
+
+    @ApiModelProperty(value ="权限",hidden = true)
+    @TableField(exist = false)
+    private List<ProgramItem> programItems;
+
+    @ApiModelProperty(value="用户权限类型")
+    @TableField(exist = false)
+    private Integer permissonType;
+}

+ 6 - 0
operation_manager/src/main/java/com/huaxu/task/service/PlanManageService.java

@@ -7,6 +7,7 @@ import com.huaxu.task.entity.PlanManage;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 public interface PlanManageService {
     /**
@@ -51,4 +52,9 @@ public interface PlanManageService {
      * 按id查询任务和详情
      */
     PlanManageDto selectPlanDetail(Integer id);
+
+    /**
+     * 待处理权限
+     */
+    int selectPendingPower(Map<String,Object> map);
 }

+ 6 - 0
operation_manager/src/main/java/com/huaxu/task/service/impl/PlanManageServiceImpl.java

@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Map;
 
 @Service
 public class PlanManageServiceImpl implements PlanManageService {
@@ -56,4 +57,9 @@ public class PlanManageServiceImpl implements PlanManageService {
     public PlanManageDto selectPlanDetail(Integer id) {
         return planManageMapper.selectPlanDetail(id);
     }
+
+    @Override
+    public int selectPendingPower(Map<String, Object> map) {
+        return planManageMapper.selectPendingPower(map);
+    }
 }

+ 9 - 0
operation_manager/src/main/resources/mapper/task/PlanManageMapper.xml

@@ -383,6 +383,7 @@
     where id = #{id,jdbcType=INTEGER}
   </update>
 
+  <!--分页查询-->
   <select id="findPage" resultMap="TaskResultMap">
     select
     t1.id, t1.plan_id, plan_name, plan_user_id, user_id, plan_date, plan_start_date, plan_end_date,
@@ -446,6 +447,14 @@
     order by t1.date_create
   </select>
 
+
+  <!--待处理权限-->
+  <select id="selectPendingPower" resultType="java.lang.Integer" parameterType="map">
+    select count(1) from sc_plan_manage
+    where id = #{id,jdbcType=INTEGER} and INSTR(t1.current_users,#{currentUsers,jdbcType=VARCHAR})
+  </select>
+
+
   <!--删除-->
   <delete id="batchDelete">
     delete from  sc_plan_manage