张涛 1 year ago
parent
commit
2fda8d3690

+ 14
- 14
src/main/java/com/example/civilizedcity/common/BaseController.java View File

43
         return user;
43
         return user;
44
     }
44
     }
45
 
45
 
46
-    public TaPerson currentPerson() throws Exception {
47
-
48
-        String personId = request.getHeader("x-personId");
49
-        if (StringUtils.isEmpty(personId)) {
50
-            return null;
51
-        }
52
-
53
-        TaPerson taPerson = taPersonService.getById(personId);
54
-        if (taPerson == null || taPerson.getStatus() == Constants.STATUS_DELETE) {
55
-            return null;
56
-        }
57
-
58
-        return taPerson;
59
-    }
46
+//    public TaPerson currentPerson() throws Exception {
47
+//
48
+//        String personId = request.getHeader("x-personId");
49
+//        if (StringUtils.isEmpty(personId)) {
50
+//            return null;
51
+//        }
52
+//
53
+//        TaPerson taPerson = taPersonService.getById(personId);
54
+//        if (taPerson == null || taPerson.getStatus() == Constants.STATUS_DELETE) {
55
+//            return null;
56
+//        }
57
+//
58
+//        return taPerson;
59
+//    }
60
 
60
 
61
     public String getPersonDuty() throws Exception {
61
     public String getPersonDuty() throws Exception {
62
         String duty = request.getHeader("x-duty");
62
         String duty = request.getHeader("x-duty");

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

43
             //
43
             //
44
         }
44
         }
45
 
45
 
46
-        person = currentPerson();
47
-        if (null == person) {
48
-            return ResponseBean.error("请在小程序端操作");
49
-        }
46
+//        person = currentPerson();
47
+//        if (null == person) {
48
+//            return ResponseBean.error("请在小程序端操作");
49
+//        }
50
 
50
 
51
         List<StatVo> result = taIssueService.statMaIndex(user, person, duty);
51
         List<StatVo> result = taIssueService.statMaIndex(user, person, duty);
52
 
52
 

+ 9
- 12
src/main/java/com/example/civilizedcity/controller/TaFeedbackController.java View File

9
 import java.util.List;
9
 import java.util.List;
10
 
10
 
11
 import com.example.civilizedcity.common.StringUtils;
11
 import com.example.civilizedcity.common.StringUtils;
12
-import com.example.civilizedcity.entity.TaAttach;
13
-import com.example.civilizedcity.entity.TaIssue;
14
-import com.example.civilizedcity.entity.TaPerson;
12
+import com.example.civilizedcity.entity.*;
15
 import com.example.civilizedcity.service.TaAttachService;
13
 import com.example.civilizedcity.service.TaAttachService;
16
 import io.swagger.annotations.Api;
14
 import io.swagger.annotations.Api;
17
 import io.swagger.annotations.ApiOperation;
15
 import io.swagger.annotations.ApiOperation;
18
 import io.swagger.annotations.ApiParam;
16
 import io.swagger.annotations.ApiParam;
19
 import org.springframework.beans.factory.annotation.Autowired;
17
 import org.springframework.beans.factory.annotation.Autowired;
20
 import org.springframework.web.bind.annotation.*;
18
 import org.springframework.web.bind.annotation.*;
21
-import com.example.civilizedcity.entity.TaFeedback;
22
 import com.example.civilizedcity.service.TaFeedbackService;
19
 import com.example.civilizedcity.service.TaFeedbackService;
23
 
20
 
24
  /**
21
  /**
66
                              @ApiParam("我的") @RequestParam(value ="isMine", defaultValue = "false") Boolean isMine,
63
                              @ApiParam("我的") @RequestParam(value ="isMine", defaultValue = "false") Boolean isMine,
67
                              @ApiParam("问题单状态") @RequestParam(value = "bizStatus", required = false) String bizStatus) throws Exception {
64
                              @ApiParam("问题单状态") @RequestParam(value = "bizStatus", required = false) String bizStatus) throws Exception {
68
 
65
 
69
-        TaPerson taPerson = currentPerson();
70
-        if (null == taPerson && isMine) {
66
+        SysUser sysUser = currentUser();
67
+        if (null == sysUser && isMine) {
71
             return ResponseBean.error("请在小程序中操作");
68
             return ResponseBean.error("请在小程序中操作");
72
         }
69
         }
73
 
70
 
74
-        String personId = isMine ? taPerson.getPersonId() : null;
71
+        String personId = isMine ? sysUser.getUserId() : null;
75
         
72
         
76
         IPage<TaIssue> pg = new Page<>(pageNum, pageSize);
73
         IPage<TaIssue> pg = new Page<>(pageNum, pageSize);
77
         IPage<TaIssue> result = taFeedbackService.getPageBy(pg, personId, bizStatus);
74
         IPage<TaIssue> result = taFeedbackService.getPageBy(pg, personId, bizStatus);
100
             return ResponseBean.error("请上传照片");
97
             return ResponseBean.error("请上传照片");
101
         }
98
         }
102
 
99
 
103
-        TaPerson taPerson = currentPerson();
100
+        SysUser sysUser = currentUser();
104
 
101
 
105
-        taFeedbackService.createNew(taFeedback, taPerson);
102
+        taFeedbackService.createNew(taFeedback, sysUser);
106
         return ResponseBean.success(taFeedback);
103
         return ResponseBean.success(taFeedback);
107
     }
104
     }
108
     
105
     
129
     @ApiOperation("通过主键删除数据")
126
     @ApiOperation("通过主键删除数据")
130
     @DeleteMapping("/taFeedback/{id}")
127
     @DeleteMapping("/taFeedback/{id}")
131
     public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id) throws Exception {
128
     public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id) throws Exception {
132
-        TaPerson taPerson = currentPerson();
133
-        if (null == taPerson) {
129
+        SysUser sysUser = currentUser();
130
+        if (null == sysUser) {
134
             return ResponseBean.error("请在小程序中操作");
131
             return ResponseBean.error("请在小程序中操作");
135
         }
132
         }
136
 
133
 
139
             return ResponseBean.error("未找到相关数据");
136
             return ResponseBean.error("未找到相关数据");
140
         }
137
         }
141
 
138
 
142
-        if (!taPerson.getPersonId().equals(taFeedback.getPersonId())) {
139
+        if (!sysUser.getUserId().equals(taFeedback.getPersonId())) {
143
             return ResponseBean.error("暂无权限");
140
             return ResponseBean.error("暂无权限");
144
         }
141
         }
145
 
142
 

+ 13
- 11
src/main/java/com/example/civilizedcity/controller/WxMaController.java View File

13
 import com.example.civilizedcity.entity.TaPerson;
13
 import com.example.civilizedcity.entity.TaPerson;
14
 import com.example.civilizedcity.service.SysLoginService;
14
 import com.example.civilizedcity.service.SysLoginService;
15
 import com.example.civilizedcity.service.SysUserDutyService;
15
 import com.example.civilizedcity.service.SysUserDutyService;
16
+import com.example.civilizedcity.service.SysUserService;
16
 import com.example.civilizedcity.service.TaPersonReflectService;
17
 import com.example.civilizedcity.service.TaPersonReflectService;
17
 import com.example.civilizedcity.vo.LoginParam;
18
 import com.example.civilizedcity.vo.LoginParam;
18
 import com.example.civilizedcity.vo.WxChangePwd;
19
 import com.example.civilizedcity.vo.WxChangePwd;
168
         // 解密用户信息
169
         // 解密用户信息
169
         WxMaUserInfo userInfo = wxMaUitl.getUserInfo(param);
170
         WxMaUserInfo userInfo = wxMaUitl.getUserInfo(param);
170
 
171
 
171
-        TaPerson taPerson = currentPerson();
172
-        if (null == taPerson) {
172
+        SysUser sysUser = currentUser();
173
+        if (null == sysUser) {
173
             throw new Exception("校验当前人员失败, 请重试");
174
             throw new Exception("校验当前人员失败, 请重试");
174
         }
175
         }
175
 
176
 
176
-        taPerson.setAvatar(userInfo.getAvatarUrl());
177
-        taPerson.setName(userInfo.getNickName());
177
+        sysUser.setAvatar(userInfo.getAvatarUrl());
178
+        sysUser.setName(userInfo.getNickName());
178
 //        taPerson.setSex(Integer.parseInt(userInfo.getGender()));
179
 //        taPerson.setSex(Integer.parseInt(userInfo.getGender()));
179
 
180
 
180
-        taPersonService.updateById(taPerson);
181
+//        taPersonService.updateById(sysUser);
182
+         sysUserService.updateById(sysUser);
181
 
183
 
182
-        return ResponseBean.success(taPerson);
184
+        return ResponseBean.success(sysUser);
183
     }
185
     }
184
 
186
 
185
     @ApiOperation(value = "授权手机", notes = "授权手机", httpMethod = "PUT", response = TaPerson.class)
187
     @ApiOperation(value = "授权手机", notes = "授权手机", httpMethod = "PUT", response = TaPerson.class)
189
         // 解密
191
         // 解密
190
         WxMaPhoneNumberInfo phoneNoInfo = wxMaUitl.getPhoneNoInfo(code);
192
         WxMaPhoneNumberInfo phoneNoInfo = wxMaUitl.getPhoneNoInfo(code);
191
 
193
 
192
-        TaPerson taPerson = currentPerson();
193
-        if (null == taPerson) {
194
+        SysUser sysUser = currentUser();
195
+        if (null == sysUser) {
194
             throw new Exception("校验当前人员失败, 请重试");
196
             throw new Exception("校验当前人员失败, 请重试");
195
         }
197
         }
196
 
198
 
197
-        taPerson.setPhone(phoneNoInfo.getPhoneNumber());
198
-        taPersonService.updateById(taPerson);
199
+        sysUser.setPhone(phoneNoInfo.getPhoneNumber());
200
+        sysUserService.updateById(sysUser);
199
 
201
 
200
-        Map<String, Object> res = sysLoginService.loginByPerson(taPerson);
202
+        Map<String, Object> res = sysLoginService.loginByPerson(sysUser);
201
 
203
 
202
         return ResponseBean.success(res);
204
         return ResponseBean.success(res);
203
     }
205
     }

+ 2
- 1
src/main/java/com/example/civilizedcity/mapper/TaFeedbackMapper.java View File

22
 
22
 
23
     long countByVerifyStatus(@Param("personId") String personId, @Param("verifyStatus") String verifyStatus);
23
     long countByVerifyStatus(@Param("personId") String personId, @Param("verifyStatus") String verifyStatus);
24
 
24
 
25
-    Map<String, Object> statMaIndex(@Param("personId") String personId);
25
+    //    Map<String, Object> statMaIndex(@Param("personId") String personId);
26
+    Map<String, Object> statMaIndex(@Param("userId") String userId);
26
 
27
 
27
     IPage<TaIssue> getPageBy(IPage<TaIssue> pg,
28
     IPage<TaIssue> getPageBy(IPage<TaIssue> pg,
28
                              @Param("personId") String personId,
29
                              @Param("personId") String personId,

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

17
 
17
 
18
      boolean changePassword(SysUser user, WxChangePwd wxChangePwd);
18
      boolean changePassword(SysUser user, WxChangePwd wxChangePwd);
19
 
19
 
20
-    Map<String, Object> loginByPerson(TaPerson taPerson);
20
+    Map<String, Object> loginByPerson(SysUser sysUser);
21
 
21
 
22
     void removeByUser(String userId);
22
     void removeByUser(String userId);
23
 }
23
 }

+ 2
- 1
src/main/java/com/example/civilizedcity/service/TaFeedbackService.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.TaFeedback;
6
 import com.example.civilizedcity.entity.TaFeedback;
6
 import com.example.civilizedcity.entity.TaIssue;
7
 import com.example.civilizedcity.entity.TaIssue;
7
 import com.example.civilizedcity.entity.TaPerson;
8
 import com.example.civilizedcity.entity.TaPerson;
14
  */
15
  */
15
 public interface TaFeedbackService extends IBaseService<TaFeedback> {
16
 public interface TaFeedbackService extends IBaseService<TaFeedback> {
16
 
17
 
17
-    void createNew(TaFeedback taFeedback, TaPerson taPerson) throws Exception;
18
+    void createNew(TaFeedback taFeedback, SysUser sysUser) throws Exception;
18
 
19
 
19
     IPage<TaIssue> getPageBy(IPage<TaIssue> pg, String personId, String bizStatus);
20
     IPage<TaIssue> getPageBy(IPage<TaIssue> pg, String personId, String bizStatus);
20
 }
21
 }

+ 5
- 5
src/main/java/com/example/civilizedcity/service/impl/SysLoginServiceImpl.java View File

46
     }
46
     }
47
 
47
 
48
     @Override
48
     @Override
49
-    public Map<String, Object> loginByPerson(TaPerson taPerson) {
49
+    public Map<String, Object> loginByPerson(SysUser sysUser) {
50
         Map<String, Object> res = new HashMap<>();
50
         Map<String, Object> res = new HashMap<>();
51
         SysUser user = null;
51
         SysUser user = null;
52
 
52
 
53
-                List<SysUser> sysUserList = sysUserMapper.getListByPhone(taPerson.getPhone());
53
+                List<SysUser> sysUserList = sysUserMapper.getListByPhone(sysUser.getPhone());
54
         if (null == sysUserList || sysUserList.size() < 1) {
54
         if (null == sysUserList || sysUserList.size() < 1) {
55
             user = new SysUser();
55
             user = new SysUser();
56
-            user.setPhone(taPerson.getPhone());
56
+            user.setPhone(sysUser.getPhone());
57
             user.setIsUser(false);
57
             user.setIsUser(false);
58
-            user.setOrgId(taPerson.getPersonId()); // 机构ID 使用用户ID , 目前没有使用到
58
+            user.setOrgId(sysUser.getUserId()); // 机构ID 使用用户ID , 目前没有使用到
59
             user.setStatus(Constants.STATUS_NORMAL);
59
             user.setStatus(Constants.STATUS_NORMAL);
60
             user.setCreateDate(LocalDateTime.now());
60
             user.setCreateDate(LocalDateTime.now());
61
             sysUserMapper.insert(user);
61
             sysUserMapper.insert(user);
80
         // 登录新用户
80
         // 登录新用户
81
         StpUtil.login(user.getUserId(), "miniapp");
81
         StpUtil.login(user.getUserId(), "miniapp");
82
         res.put("user", user);
82
         res.put("user", user);
83
-        res.put("person", taPerson);
83
+        res.put("user", sysUser);
84
         res.put("token", StpUtil.getTokenValue());
84
         res.put("token", StpUtil.getTokenValue());
85
 
85
 
86
         return res;
86
         return res;

+ 10
- 10
src/main/java/com/example/civilizedcity/service/impl/TaFeedbackServiceImpl.java View File

24
 public class TaFeedbackServiceImpl extends BaseServiceImpl<TaFeedbackMapper, TaFeedback> implements TaFeedbackService {
24
 public class TaFeedbackServiceImpl extends BaseServiceImpl<TaFeedbackMapper, TaFeedback> implements TaFeedbackService {
25
 
25
 
26
     @Autowired
26
     @Autowired
27
-    TaPersonMapper taPersonMapper;
27
+    SysUserMapper sysUserMapper;
28
 
28
 
29
     @Autowired
29
     @Autowired
30
     TaIssueMapper taIssueMapper;
30
     TaIssueMapper taIssueMapper;
37
 
37
 
38
     @Transactional(rollbackFor = Exception.class)
38
     @Transactional(rollbackFor = Exception.class)
39
     @Override
39
     @Override
40
-    public void createNew(TaFeedback taFeedback, TaPerson taPerson) throws Exception {
40
+    public void createNew(TaFeedback taFeedback, SysUser sysUser) throws Exception {
41
 
41
 
42
         // 准备 TaFeedback 数据
42
         // 准备 TaFeedback 数据
43
         taFeedback.setFeedbackId(StringUtils.uuid());
43
         taFeedback.setFeedbackId(StringUtils.uuid());
44
 
44
 
45
         if (StringUtils.isEmpty(taFeedback.getName())) {
45
         if (StringUtils.isEmpty(taFeedback.getName())) {
46
-            taFeedback.setName(taPerson.getName());
46
+            taFeedback.setName(sysUser.getName());
47
         } else {
47
         } else {
48
-            if (StringUtils.isEmpty(taPerson.getName())) {
49
-                taPerson.setName(taFeedback.getName());
50
-                taPersonMapper.updateById(taPerson);
48
+            if (StringUtils.isEmpty(sysUser.getName())) {
49
+                sysUser.setName(taFeedback.getName());
50
+                sysUserMapper.updateById(sysUser);
51
             }
51
             }
52
         }
52
         }
53
 
53
 
54
         if (StringUtils.isEmpty(taFeedback.getPhone())) {
54
         if (StringUtils.isEmpty(taFeedback.getPhone())) {
55
-            taFeedback.setPhone(taPerson.getPhone());
55
+            taFeedback.setPhone(sysUser.getPhone());
56
         }
56
         }
57
 
57
 
58
-        taFeedback.setPersonId(taPerson.getPersonId());
58
+        taFeedback.setPersonId(sysUser.getUserId());
59
         taFeedback.setStatus(Constants.STATUS_NORMAL);
59
         taFeedback.setStatus(Constants.STATUS_NORMAL);
60
         taFeedback.setCreateDate(LocalDateTime.now());
60
         taFeedback.setCreateDate(LocalDateTime.now());
61
 
61
 
110
         process.setProcessNode(Constants.PROCESS_START);
110
         process.setProcessNode(Constants.PROCESS_START);
111
         process.setProcessStatus(Constants.APPLY_READY);
111
         process.setProcessStatus(Constants.APPLY_READY);
112
         process.setStatus(Constants.STATUS_NORMAL);
112
         process.setStatus(Constants.STATUS_NORMAL);
113
-        process.setCreateUser(taPerson.getPersonId());
114
-        process.setUserName(StringUtils.isEmpty(taFeedback.getName()) ? "市民" : taPerson.getName());
113
+        process.setCreateUser(sysUser.getUserId());
114
+        process.setUserName(StringUtils.isEmpty(taFeedback.getName()) ? "市民" : sysUser.getName());
115
         process.setCreateDate(LocalDateTime.now());
115
         process.setCreateDate(LocalDateTime.now());
116
         taIssueProcessMapper.insert(process);
116
         taIssueProcessMapper.insert(process);
117
     }
117
     }

+ 2
- 1
src/main/java/com/example/civilizedcity/service/impl/TaIssueServiceImpl.java View File

104
 
104
 
105
         // 市民
105
         // 市民
106
         else {
106
         else {
107
-            Map<String, Object> res = taFeedbackMapper.statMaIndex(person.getPersonId());
107
+//            Map<String, Object> res = taFeedbackMapper.statMaIndex(person.getPersonId());
108
+            Map<String, Object> res = taFeedbackMapper.statMaIndex(user.getUserId());
108
             if (null == res) {
109
             if (null == res) {
109
                 res = new HashMap<>();
110
                 res = new HashMap<>();
110
             }
111
             }

+ 1
- 1
src/main/resources/mapper/TaFeedbackMapper.xml View File

23
             ta_feedback t
23
             ta_feedback t
24
                 JOIN ta_issue s ON t.issue_id = s.issue_id
24
                 JOIN ta_issue s ON t.issue_id = s.issue_id
25
         WHERE
25
         WHERE
26
-            t.person_id = #{personId}
26
+            t.person_id = #{userId}
27
           AND t.`status` &gt; -1
27
           AND t.`status` &gt; -1
28
     </select>
28
     </select>
29
     <select id="getPageBy" resultType="com.example.civilizedcity.entity.TaIssue">
29
     <select id="getPageBy" resultType="com.example.civilizedcity.entity.TaIssue">