Yansen 2 years ago
parent
commit
07c1c813a8

+ 2
- 1
src/main/java/com/example/civilizedcity/common/Constants.java View File

57
 
57
 
58
     // 流程起始: 待交办
58
     // 流程起始: 待交办
59
     public final static String PROCESS_START = "start";
59
     public final static String PROCESS_START = "start";
60
-    public final static String PROCESS_RESTART = "restart";
60
+    // 流程: 被打回 - 市民提交
61
+    public final static String PROCESS_REJECT = "reject";
61
 
62
 
62
     // 审核
63
     // 审核
63
     public final static String PROCESS_VERIFY = "verify";
64
     public final static String PROCESS_VERIFY = "verify";

+ 48
- 0
src/main/java/com/example/civilizedcity/controller/StatController.java View File

1
+package com.example.civilizedcity.controller;
2
+
3
+import com.example.civilizedcity.common.BaseController;
4
+import com.example.civilizedcity.common.ResponseBean;
5
+import com.example.civilizedcity.entity.SysUser;
6
+import com.example.civilizedcity.entity.TaPerson;
7
+import com.example.civilizedcity.service.TaIssueService;
8
+import com.example.civilizedcity.vo.StatVo;
9
+import io.swagger.annotations.ApiOperation;
10
+import io.swagger.annotations.ApiParam;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.web.bind.annotation.GetMapping;
13
+import org.springframework.web.bind.annotation.RequestParam;
14
+import org.springframework.web.bind.annotation.RestController;
15
+
16
+import java.util.List;
17
+
18
+/**
19
+ * 查询统计
20
+ */
21
+@RestController
22
+public class StatController extends BaseController {
23
+
24
+    @Autowired
25
+    TaIssueService taIssueService;
26
+
27
+    @ApiOperation("小程序首页查询统计")
28
+    @GetMapping("/ma/index-stat")
29
+    public ResponseBean getMaIndex(@ApiParam("身份") @RequestParam(value = "duty", required = false) String duty) throws Exception {
30
+        SysUser user = null;
31
+        TaPerson person = null;
32
+
33
+        try {
34
+            user = currentUser();
35
+        } catch (Exception e) {
36
+            //
37
+        }
38
+        try {
39
+            person = currentPerson();
40
+        } catch (Exception e) {
41
+            //
42
+        }
43
+
44
+        List<StatVo> result = taIssueService.statMaIndex(user, duty);
45
+
46
+        return ResponseBean.success(result);
47
+    }
48
+}

+ 62
- 55
src/main/java/com/example/civilizedcity/controller/SysUserController.java View File

16
 import com.example.civilizedcity.entity.SysRole;
16
 import com.example.civilizedcity.entity.SysRole;
17
 import com.example.civilizedcity.service.SysResourceService;
17
 import com.example.civilizedcity.service.SysResourceService;
18
 import com.example.civilizedcity.service.SysRoleService;
18
 import com.example.civilizedcity.service.SysRoleService;
19
+import com.example.civilizedcity.service.SysUserDutyService;
19
 import io.swagger.annotations.Api;
20
 import io.swagger.annotations.Api;
20
 import io.swagger.annotations.ApiOperation;
21
 import io.swagger.annotations.ApiOperation;
21
 import io.swagger.annotations.ApiParam;
22
 import io.swagger.annotations.ApiParam;
24
 import com.example.civilizedcity.entity.SysUser;
25
 import com.example.civilizedcity.entity.SysUser;
25
 import com.example.civilizedcity.service.SysUserService;
26
 import com.example.civilizedcity.service.SysUserService;
26
 
27
 
27
- /**
28
+/**
28
  * 用户表;(sys_user)表控制层
29
  * 用户表;(sys_user)表控制层
30
+ *
29
  * @author : http://njyunzhi.com
31
  * @author : http://njyunzhi.com
30
  * @date : 2022-12-12
32
  * @date : 2022-12-12
31
  */
33
  */
35
 public class SysUserController extends BaseController {
37
 public class SysUserController extends BaseController {
36
 
38
 
37
     @Autowired
39
     @Autowired
38
-     SysRoleService sysRoleService;
40
+    SysRoleService sysRoleService;
39
 
41
 
40
     @Autowired
42
     @Autowired
41
-     SysResourceService sysResourceService;
43
+    SysResourceService sysResourceService;
42
 
44
 
43
-    /** 
44
-     * 通过ID查询单条数据 
45
+    @Autowired
46
+    SysUserDutyService sysUserDutyService;
47
+
48
+    /**
49
+     * 通过ID查询单条数据
45
      *
50
      *
46
      * @param userId 主键
51
      * @param userId 主键
47
      * @return 实例对象
52
      * @return 实例对象
57
         return ResponseBean.success(getPermissions(sysUser));
62
         return ResponseBean.success(getPermissions(sysUser));
58
     }
63
     }
59
 
64
 
60
-     /**
61
-      * 查询当前人员
62
-      *
63
-      * @param
64
-      * @return 实例对象
65
-      */
66
-     @ApiOperation("查询当前人员")
67
-     @GetMapping("/sysUser/current")
68
-     public ResponseBean current() throws Exception {
69
-         SysUser sysUser = currentUser();
70
-         return ResponseBean.success(getPermissions(sysUser));
71
-     }
72
-
73
-     private SysUser getPermissions(SysUser sysUser) {
74
-         List<SysRole> rolesList = sysRoleService.getByUser(sysUser.getUserId());
75
-         List<SysResource> resourcesList = sysResourceService.getByUser(sysUser.getUserId());
76
-
77
-         sysUser.setRolesList(rolesList);
78
-         sysUser.setResourcesList(resourcesList);
79
-
80
-         return sysUser;
81
-     }
82
-    
83
-    /** 
65
+    /**
66
+     * 查询当前人员
67
+     *
68
+     * @param
69
+     * @return 实例对象
70
+     */
71
+    @ApiOperation("查询当前人员")
72
+    @GetMapping("/sysUser/current")
73
+    public ResponseBean current() throws Exception {
74
+        SysUser sysUser = currentUser();
75
+        return ResponseBean.success(getPermissions(sysUser));
76
+    }
77
+
78
+    private SysUser getPermissions(SysUser sysUser) {
79
+        List<SysRole> rolesList = sysRoleService.getByUser(sysUser.getUserId());
80
+        List<SysResource> resourcesList = sysResourceService.getByUser(sysUser.getUserId());
81
+        List<String> dutyList = sysUserDutyService.getListByUser(sysUser.getUserId());
82
+
83
+        sysUser.setRolesList(rolesList);
84
+        sysUser.setResourcesList(resourcesList);
85
+        sysUser.setDutyList(dutyList);
86
+
87
+        return sysUser;
88
+    }
89
+
90
+    /**
84
      * 分页查询
91
      * 分页查询
85
      *
92
      *
86
-     * @param pageNum 当前页码
93
+     * @param pageNum  当前页码
87
      * @param pageSize 每页条数
94
      * @param pageSize 每页条数
88
      * @return 查询结果
95
      * @return 查询结果
89
      */
96
      */
94
                              @ApiParam("姓名") @RequestParam(value = "name", required = false) String name,
101
                              @ApiParam("姓名") @RequestParam(value = "name", required = false) String name,
95
                              @ApiParam("机构") @RequestParam(value = "orgId", required = false) String orgId,
102
                              @ApiParam("机构") @RequestParam(value = "orgId", required = false) String orgId,
96
                              @ApiParam("手机号") @RequestParam(value = "phone", required = false) String phone) throws Exception {
103
                              @ApiParam("手机号") @RequestParam(value = "phone", required = false) String phone) throws Exception {
97
-        
104
+
98
         IPage<SysUser> pg = new Page<>(pageNum, pageSize);
105
         IPage<SysUser> pg = new Page<>(pageNum, pageSize);
99
         QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
106
         QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
100
         queryWrapper.like(!StringUtils.isEmpty(name), "name", name);
107
         queryWrapper.like(!StringUtils.isEmpty(name), "name", name);
104
         queryWrapper.ne("user_id", Constants.ROOT_ID);
111
         queryWrapper.ne("user_id", Constants.ROOT_ID);
105
         queryWrapper.orderByDesc("create_date");
112
         queryWrapper.orderByDesc("create_date");
106
         IPage<SysUser> result = sysUserService.page(pg, queryWrapper);
113
         IPage<SysUser> result = sysUserService.page(pg, queryWrapper);
107
-        
114
+
108
         return ResponseBean.success(result);
115
         return ResponseBean.success(result);
109
     }
116
     }
110
-    
111
-    /** 
117
+
118
+    /**
112
      * 新增数据
119
      * 新增数据
113
      *
120
      *
114
      * @param sysUser 实例对象
121
      * @param sysUser 实例对象
125
         return ResponseBean.success(sysUser);
132
         return ResponseBean.success(sysUser);
126
     }
133
     }
127
 
134
 
128
-     /**
129
-      * 更新数据
130
-      *
131
-      * @param id 实例ID
132
-      * @return 实例对象
133
-      */
134
-     @ApiOperation("更新数据")
135
-     @PutMapping("/sysUser/{id}/status")
136
-     public ResponseBean edit(@ApiParam("对象ID") @PathVariable String id,
137
-                              @ApiParam("页码") @RequestParam(value = "status") Integer status) throws Exception {
138
-
139
-         SysUser sysUser = sysUserService.getById(id);
140
-         sysUser.setStatus(status);
141
-
142
-         sysUserService.updateById(sysUser);
143
-         return ResponseBean.success(sysUser);
144
-     }
145
-    
135
+    /**
136
+     * 更新数据
137
+     *
138
+     * @param id 实例ID
139
+     * @return 实例对象
140
+     */
141
+    @ApiOperation("更新数据")
142
+    @PutMapping("/sysUser/{id}/status")
143
+    public ResponseBean edit(@ApiParam("对象ID") @PathVariable String id,
144
+                             @ApiParam("页码") @RequestParam(value = "status") Integer status) throws Exception {
145
+
146
+        SysUser sysUser = sysUserService.getById(id);
147
+        sysUser.setStatus(status);
148
+
149
+        sysUserService.updateById(sysUser);
150
+        return ResponseBean.success(sysUser);
151
+    }
152
+
146
 //    /**
153
 //    /**
147
 //     * 更新数据
154
 //     * 更新数据
148
 //     *
155
 //     *
156
 //        sysUserService.updateById(sysUser);
163
 //        sysUserService.updateById(sysUser);
157
 //        return ResponseBean.success(sysUser);
164
 //        return ResponseBean.success(sysUser);
158
 //    }
165
 //    }
159
-    
160
-    /** 
166
+
167
+    /**
161
      * 通过主键删除数据
168
      * 通过主键删除数据
162
      *
169
      *
163
      * @param userId 主键
170
      * @param userId 主键
165
      */
172
      */
166
     @ApiOperation("通过主键删除数据")
173
     @ApiOperation("通过主键删除数据")
167
     @DeleteMapping("/sysUser/{id}")
174
     @DeleteMapping("/sysUser/{id}")
168
-    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id){
175
+    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id) {
169
         sysUserService.removeLogicById(id);
176
         sysUserService.removeLogicById(id);
170
         return ResponseBean.success("success");
177
         return ResponseBean.success("success");
171
     }
178
     }

+ 1
- 1
src/main/java/com/example/civilizedcity/entity/SysUserDuty.java View File

25
      /** 用户ID */
25
      /** 用户ID */
26
      @ApiModelProperty(name = "ID",notes = "")
26
      @ApiModelProperty(name = "ID",notes = "")
27
      @TableId(value = "id", type = IdType.AUTO)
27
      @TableId(value = "id", type = IdType.AUTO)
28
-     private String id ;
28
+     private Integer id ;
29
     /** 用户ID */
29
     /** 用户ID */
30
     @ApiModelProperty(name = "用户ID",notes = "")
30
     @ApiModelProperty(name = "用户ID",notes = "")
31
     private String userId ;
31
     private String userId ;

+ 3
- 0
src/main/java/com/example/civilizedcity/mapper/SysUserDutyMapper.java View File

17
 
17
 
18
      List<String> getListByUser(@Param("userId") String userId);
18
      List<String> getListByUser(@Param("userId") String userId);
19
 
19
 
20
+    SysUserDuty getByUserAndDuty(@Param("userId") String userId, @Param("duty") String duty);
21
+
22
+    int deleteNotIn(@Param("userId") String userId, @Param("idList") List<Integer> idList);
20
 }
23
 }

+ 7
- 1
src/main/java/com/example/civilizedcity/mapper/TaIssueMapper.java View File

2
 
2
 
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import org.apache.ibatis.annotations.MapKey;
5
 import org.apache.ibatis.annotations.Mapper;
6
 import org.apache.ibatis.annotations.Mapper;
6
 import org.apache.ibatis.annotations.Param;
7
 import org.apache.ibatis.annotations.Param;
7
 import com.example.civilizedcity.entity.TaIssue;
8
 import com.example.civilizedcity.entity.TaIssue;
8
 
9
 
9
- /**
10
+import java.util.Map;
11
+
12
+/**
10
  * 问题表;(ta_issue)表数据库访问层
13
  * 问题表;(ta_issue)表数据库访问层
11
  * @author : http://njyunzhi.com
14
  * @author : http://njyunzhi.com
12
  * @date : 2022-12-12
15
  * @date : 2022-12-12
23
                      @Param("applyId") Integer applyId);
26
                      @Param("applyId") Integer applyId);
24
 
27
 
25
      int updateValidateStatus(@Param("issueId") Integer issueId, @Param("validateStatus") int validateStatus);
28
      int updateValidateStatus(@Param("issueId") Integer issueId, @Param("validateStatus") int validateStatus);
29
+
30
+     @MapKey("id")
31
+     Map<String, Object> statMaIndex(@Param("userId") String userId);
26
  }
32
  }

+ 7
- 1
src/main/java/com/example/civilizedcity/mapper/TaOrgIssueMapper.java View File

3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.example.civilizedcity.entity.TaIssue;
5
 import com.example.civilizedcity.entity.TaIssue;
6
+import org.apache.ibatis.annotations.MapKey;
6
 import org.apache.ibatis.annotations.Mapper;
7
 import org.apache.ibatis.annotations.Mapper;
7
 import org.apache.ibatis.annotations.Param;
8
 import org.apache.ibatis.annotations.Param;
8
 import com.example.civilizedcity.entity.TaOrgIssue;
9
 import com.example.civilizedcity.entity.TaOrgIssue;
9
 
10
 
10
- /**
11
+import java.util.Map;
12
+
13
+/**
11
  * 单位问题单;(ta_org_issue)表数据库访问层
14
  * 单位问题单;(ta_org_issue)表数据库访问层
12
  * @author : http://njyunzhi.com
15
  * @author : http://njyunzhi.com
13
  * @date : 2022-12-28
16
  * @date : 2022-12-28
23
      );
26
      );
24
 
27
 
25
      TaOrgIssue getByIssueAndOrg(@Param("issueId") Integer issueId, @Param("orgId") String orgId);
28
      TaOrgIssue getByIssueAndOrg(@Param("issueId") Integer issueId, @Param("orgId") String orgId);
29
+
30
+     @MapKey("id")
31
+     Map<String, Object> statMaIndex(@Param("orgId") String orgId);
26
  }
32
  }

+ 7
- 1
src/main/java/com/example/civilizedcity/service/TaIssueService.java View File

2
 
2
 
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.extension.service.IService;
4
 import com.baomidou.mybatisplus.extension.service.IService;
5
+import com.example.civilizedcity.entity.SysUser;
5
 import com.example.civilizedcity.entity.TaIssue;
6
 import com.example.civilizedcity.entity.TaIssue;
7
+import com.example.civilizedcity.vo.StatVo;
6
 
8
 
7
- /**
9
+import java.util.List;
10
+
11
+/**
8
  * 问题表;(ta_issue)表服务接口
12
  * 问题表;(ta_issue)表服务接口
9
  * @author : http://njyunzhi.com
13
  * @author : http://njyunzhi.com
10
  * @date : 2022-12-12
14
  * @date : 2022-12-12
16
      void updateValidateStatus(Integer issueId, int validateStatus);
20
      void updateValidateStatus(Integer issueId, int validateStatus);
17
 
21
 
18
      void updateApply(Integer issueId, String applyType, Integer applyId);
22
      void updateApply(Integer issueId, String applyType, Integer applyId);
23
+
24
+     List<StatVo> statMaIndex(SysUser user, String duty);
19
  }
25
  }

+ 28
- 4
src/main/java/com/example/civilizedcity/service/impl/SysUserServiceImpl.java View File

3
 import com.example.civilizedcity.common.Constants;
3
 import com.example.civilizedcity.common.Constants;
4
 import com.example.civilizedcity.common.EncryptUtils;
4
 import com.example.civilizedcity.common.EncryptUtils;
5
 import com.example.civilizedcity.common.StringUtils;
5
 import com.example.civilizedcity.common.StringUtils;
6
-import com.example.civilizedcity.entity.SysLogin;
7
-import com.example.civilizedcity.entity.SysRole;
8
-import com.example.civilizedcity.entity.SysUserRole;
6
+import com.example.civilizedcity.entity.*;
9
 import com.example.civilizedcity.mapper.SysLoginMapper;
7
 import com.example.civilizedcity.mapper.SysLoginMapper;
10
 import com.example.civilizedcity.mapper.SysUserDutyMapper;
8
 import com.example.civilizedcity.mapper.SysUserDutyMapper;
11
 import com.example.civilizedcity.mapper.SysUserRoleMapper;
9
 import com.example.civilizedcity.mapper.SysUserRoleMapper;
13
 import com.example.civilizedcity.vo.LoginParam;
11
 import com.example.civilizedcity.vo.LoginParam;
14
 import org.springframework.beans.factory.annotation.Autowired;
12
 import org.springframework.beans.factory.annotation.Autowired;
15
 import org.springframework.stereotype.Service;
13
 import org.springframework.stereotype.Service;
16
-import com.example.civilizedcity.entity.SysUser;
17
 import com.example.civilizedcity.mapper.SysUserMapper;
14
 import com.example.civilizedcity.mapper.SysUserMapper;
18
 import com.example.civilizedcity.service.SysUserService;
15
 import com.example.civilizedcity.service.SysUserService;
19
 
16
 
148
             sysUserRoleMapper.deleteNotIn(sysUser.getUserId(), idList);
145
             sysUserRoleMapper.deleteNotIn(sysUser.getUserId(), idList);
149
         }
146
         }
150
 
147
 
148
+        // 身份表
149
+        List<String> dutyList = sysUser.getDutyList();
150
+        if (null == dutyList || dutyList.size() == 0) {
151
+            sysUserDutyMapper.deleteByMap(new HashMap<String, Object>() {{
152
+                put("user_id", sysUser.getUserId());
153
+            }});
154
+        } else {
155
+            List<Integer> idList = new ArrayList<>();
156
+            for (String duty : dutyList) {
157
+                SysUserDuty item = new SysUserDuty();
158
+                item.setUserId(sysUser.getUserId());
159
+                item.setDuty(duty);
160
+
161
+                SysUserDuty exists = sysUserDutyMapper.getByUserAndDuty(sysUser.getUserId(), duty);
162
+                if (null != exists) {
163
+                    item.setId(exists.getId());
164
+                } else {
165
+                    sysUserDutyMapper.insert(item);
166
+                }
167
+
168
+                idList.add(item.getId());
169
+            }
170
+
171
+            // 去除垃圾数据
172
+            sysUserDutyMapper.deleteNotIn(sysUser.getUserId(), idList);
173
+        }
174
+
151
         return true;
175
         return true;
152
     }
176
     }
153
 
177
 

+ 61
- 0
src/main/java/com/example/civilizedcity/service/impl/TaIssueServiceImpl.java View File

1
 package com.example.civilizedcity.service.impl;
1
 package com.example.civilizedcity.service.impl;
2
 
2
 
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.example.civilizedcity.common.Constants;
5
+import com.example.civilizedcity.common.StringUtils;
6
+import com.example.civilizedcity.entity.SysUser;
7
+import com.example.civilizedcity.mapper.TaOrgIssueMapper;
8
+import com.example.civilizedcity.vo.StatVo;
4
 import org.springframework.beans.factory.annotation.Autowired;
9
 import org.springframework.beans.factory.annotation.Autowired;
5
 import org.springframework.stereotype.Service;
10
 import org.springframework.stereotype.Service;
6
 import com.example.civilizedcity.entity.TaIssue;
11
 import com.example.civilizedcity.entity.TaIssue;
7
 import com.example.civilizedcity.mapper.TaIssueMapper;
12
 import com.example.civilizedcity.mapper.TaIssueMapper;
8
 import com.example.civilizedcity.service.TaIssueService;
13
 import com.example.civilizedcity.service.TaIssueService;
9
 
14
 
15
+import java.util.ArrayList;
16
+import java.util.List;
17
+import java.util.Map;
18
+
10
 /**
19
 /**
11
  * 问题表;(ta_issue)表服务实现类
20
  * 问题表;(ta_issue)表服务实现类
12
  *
21
  *
16
 @Service
25
 @Service
17
 public class TaIssueServiceImpl extends BaseServiceImpl<TaIssueMapper, TaIssue> implements TaIssueService {
26
 public class TaIssueServiceImpl extends BaseServiceImpl<TaIssueMapper, TaIssue> implements TaIssueService {
18
 
27
 
28
+    @Autowired
29
+    TaOrgIssueMapper taOrgIssueMapper;
30
+
19
     @Override
31
     @Override
20
     public IPage<TaIssue> getPageBy(IPage<TaIssue> pg, String orgId) {
32
     public IPage<TaIssue> getPageBy(IPage<TaIssue> pg, String orgId) {
21
         if (null == orgId) {
33
         if (null == orgId) {
35
     public void updateApply(Integer issueId, String applyType, Integer applyId) {
47
     public void updateApply(Integer issueId, String applyType, Integer applyId) {
36
         baseMapper.updateApply(issueId, applyType, applyId);
48
         baseMapper.updateApply(issueId, applyType, applyId);
37
     }
49
     }
50
+
51
+    @Override
52
+    public List<StatVo> statMaIndex(SysUser user, String duty) {
53
+        List<StatVo> result = new ArrayList<>();
54
+
55
+        // 督察员
56
+        if (Constants.DUTY_INSPECTOR.equals(duty)) {
57
+            Map<String, Object> res = baseMapper.statMaIndex(user.getUserId());
58
+            result.add(new StatVo().setName("已上报").setValue(getStatValueBy(res.get("published_num"), 0)));
59
+            result.add(new StatVo().setName("已交办").setValue(getStatValueBy(res.get("assigned_num"), 0)));
60
+            result.add(new StatVo().setName("未交办").setValue(getStatValueBy(res.get("unassigned_num"), 0)));
61
+        }
62
+
63
+        // 管理员
64
+        else if (Constants.DUTY_MANAGER.equals(duty)) {
65
+            Map<String, Object> res = baseMapper.statMaIndex(null);
66
+            result.add(new StatVo().setName("未处理").setValue(getStatValueBy(res.get("unassigned_num"), 0)));
67
+            result.add(new StatVo().setName("已交办").setValue(getStatValueBy(res.get("assigned_num"), 0)));
68
+            result.add(new StatVo().setName("已办结").setValue(getStatValueBy(res.get("end_num"), 0)));
69
+        }
70
+
71
+        // 单位人员 或者 单位管理员
72
+        else if (Constants.DUTY_ORG_USER.equals(duty) || Constants.DUTY_ORG_MANAGER.equals(duty)) {
73
+            Map<String, Object> res = taOrgIssueMapper.statMaIndex(user.getOrgId());
74
+            result.add(new StatVo().setName("处理中").setValue(getStatValueBy(res.get("doing_num"), 0)));
75
+            result.add(new StatVo().setName("已办结").setValue(getStatValueBy(res.get("end_num"), 0)));
76
+            result.add(new StatVo().setName("已逾期").setValue(getStatValueBy(res.get("delay_num"), 0)));
77
+        }
78
+
79
+        // 查询人员
80
+        else if (Constants.DUTY_QUERY_PERSON.equals(duty)) {
81
+            Map<String, Object> res = baseMapper.statMaIndex(null);
82
+            result.add(new StatVo().setName("未处理").setValue(getStatValueBy(res.get("unassigned_num"), 0)));
83
+            result.add(new StatVo().setName("处理中").setValue(getStatValueBy(res.get("assigned_num"), 0)));
84
+            result.add(new StatVo().setName("已办结").setValue(getStatValueBy(res.get("end_num"), 0)));
85
+        }
86
+
87
+        // 市民
88
+        else {
89
+
90
+        }
91
+
92
+        return result;
93
+    }
94
+
95
+    Integer getStatValueBy(Object v, Integer def) {
96
+        if (null == v) return def;
97
+        return Integer.valueOf(v.toString());
98
+    }
38
 }
99
 }

+ 17
- 0
src/main/java/com/example/civilizedcity/vo/StatVo.java View File

1
+package com.example.civilizedcity.vo;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+import lombok.experimental.Accessors;
7
+
8
+@Data
9
+@Accessors(chain = true)
10
+@ApiModel("统计参数")
11
+public class StatVo {
12
+    @ApiModelProperty("统计指标")
13
+    String name;
14
+
15
+    @ApiModelProperty("统计结果")
16
+    Object value;
17
+}

+ 20
- 0
src/main/resources/mapper/SysUserDutyMapper.xml View File

2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 
3
 
4
 <mapper namespace="com.example.civilizedcity.mapper.SysUserDutyMapper">
4
 <mapper namespace="com.example.civilizedcity.mapper.SysUserDutyMapper">
5
+    <delete id="deleteNotIn">
6
+        DELETE t
7
+        FROM
8
+            sys_user_duty t
9
+        WHERE
10
+            t.user_id = #{userId}
11
+        AND t.id NOT IN
12
+        <foreach item="item" collection="idList" separator="," open="(" close=")" index="">
13
+            #{item}
14
+        </foreach>
15
+    </delete>
5
 
16
 
6
     <select id="getListByUser" resultType="java.lang.String">
17
     <select id="getListByUser" resultType="java.lang.String">
7
         SELECT
18
         SELECT
11
         WHERE
22
         WHERE
12
             t.user_id = #{userId}
23
             t.user_id = #{userId}
13
     </select>
24
     </select>
25
+    <select id="getByUserAndDuty" resultType="com.example.civilizedcity.entity.SysUserDuty">
26
+        SELECT
27
+            t.*
28
+        FROM
29
+            sys_user_duty t
30
+        WHERE
31
+            t.user_id = #{userId}
32
+            AND t.duty = #{duty}
33
+    </select>
14
 </mapper>
34
 </mapper>

+ 16
- 0
src/main/resources/mapper/TaIssueMapper.xml View File

45
         ORDER BY
45
         ORDER BY
46
             t.create_date DESC
46
             t.create_date DESC
47
     </select>
47
     </select>
48
+    <select id="statMaIndex" resultType="java.util.Map">
49
+        SELECT
50
+            UUID_SHORT() as id,
51
+            count(*) as published_num,
52
+            sum(IF(t.process_node = 'start', 1, 0)) as unassigned_num,
53
+            sum(IF(t.process_node = 'assigned', 1, 0)) as assigned_num,
54
+            sum(IF(t.process_node = 'reject', 1, 0)) as reject_num,
55
+            sum(IF(t.process_node = 'end', 1, 0)) as end_num
56
+        FROM
57
+            ta_issue t
58
+        WHERE 1 = 1
59
+          <if test="null != userId and userId != ''">
60
+              AND t.create_user = #{userId}
61
+          </if>
62
+          AND t.`status` > - 1
63
+    </select>
48
 </mapper>
64
 </mapper>

+ 12
- 0
src/main/resources/mapper/TaOrgIssueMapper.xml View File

46
           AND t.org_id = #{orgId}
46
           AND t.org_id = #{orgId}
47
           AND t.`status` = 1
47
           AND t.`status` = 1
48
     </select>
48
     </select>
49
+    <select id="statMaIndex" resultType="java.util.Map">
50
+        select
51
+            UUID_SHORT() as id,
52
+            SUM(IF(TO_DAYS(now()) > TO_DAYS(s.expire_date), 1, 0)) as delay_num,
53
+            SUM(s.process_node == 'end', 1, 0) as end_num,
54
+            SUM(s.process_node != 'end', 1, 0) as doing_num
55
+        from ta_org_issue t
56
+                 INNER JOIN ta_issue s on t.issue_id = s.issue_id
57
+        where t.org_id = #{orgId}
58
+          and t.`status` &gt; -1
59
+          and s.`status` &gt; -1
60
+    </select>
49
 </mapper>
61
 </mapper>