张延森 před 3 roky
rodič
revize
0c55db6135
44 změnil soubory, kde provedl 558 přidání a 178 odebrání
  1. 23
    2
      src/main/java/com/yunzhi/nanyang/common/BaseController.java
  2. 11
    11
      src/main/java/com/yunzhi/nanyang/config/AliyunConfig.java
  3. 87
    0
      src/main/java/com/yunzhi/nanyang/controller/MobileController.java
  4. 63
    0
      src/main/java/com/yunzhi/nanyang/controller/StatisController.java
  5. 4
    7
      src/main/java/com/yunzhi/nanyang/controller/SysUserController.java
  6. 17
    4
      src/main/java/com/yunzhi/nanyang/controller/TaAccountLogController.java
  7. 6
    27
      src/main/java/com/yunzhi/nanyang/controller/TaDispatchController.java
  8. 4
    21
      src/main/java/com/yunzhi/nanyang/controller/TaMachineryController.java
  9. 1
    6
      src/main/java/com/yunzhi/nanyang/controller/TaOrderController.java
  10. 64
    25
      src/main/java/com/yunzhi/nanyang/controller/TaPersonController.java
  11. 2
    8
      src/main/java/com/yunzhi/nanyang/controller/TaUserMachineryController.java
  12. 8
    31
      src/main/java/com/yunzhi/nanyang/controller/TaWithdrawalController.java
  13. 2
    8
      src/main/java/com/yunzhi/nanyang/controller/TaWorkJobController.java
  14. 4
    3
      src/main/java/com/yunzhi/nanyang/controller/WxMaController.java
  15. 3
    0
      src/main/java/com/yunzhi/nanyang/entity/TaPerson.java
  16. 10
    1
      src/main/java/com/yunzhi/nanyang/mapper/TaAccountLogMapper.java
  17. 5
    0
      src/main/java/com/yunzhi/nanyang/mapper/TaMachineryMapper.java
  18. 9
    0
      src/main/java/com/yunzhi/nanyang/mapper/TaOrderMapper.java
  19. 5
    0
      src/main/java/com/yunzhi/nanyang/mapper/TaOrgMapper.java
  20. 7
    0
      src/main/java/com/yunzhi/nanyang/mapper/TaPersonMapper.java
  21. 3
    1
      src/main/java/com/yunzhi/nanyang/mapper/TaWithdrawalMapper.java
  22. 1
    0
      src/main/java/com/yunzhi/nanyang/service/ISysUserService.java
  23. 3
    2
      src/main/java/com/yunzhi/nanyang/service/ITaAccountLogService.java
  24. 3
    0
      src/main/java/com/yunzhi/nanyang/service/ITaDispatchService.java
  25. 3
    0
      src/main/java/com/yunzhi/nanyang/service/ITaMachineryService.java
  26. 3
    0
      src/main/java/com/yunzhi/nanyang/service/ITaOrderService.java
  27. 3
    0
      src/main/java/com/yunzhi/nanyang/service/ITaOrgService.java
  28. 5
    0
      src/main/java/com/yunzhi/nanyang/service/ITaPersonService.java
  29. 3
    2
      src/main/java/com/yunzhi/nanyang/service/ITaWithdrawalService.java
  30. 4
    3
      src/main/java/com/yunzhi/nanyang/service/impl/TaAccountLogServiceImpl.java
  31. 46
    0
      src/main/java/com/yunzhi/nanyang/service/impl/TaDispatchServiceImpl.java
  32. 6
    0
      src/main/java/com/yunzhi/nanyang/service/impl/TaMachineryServiceImpl.java
  33. 5
    0
      src/main/java/com/yunzhi/nanyang/service/impl/TaMessageServiceImpl.java
  34. 6
    0
      src/main/java/com/yunzhi/nanyang/service/impl/TaOrderServiceImpl.java
  35. 6
    0
      src/main/java/com/yunzhi/nanyang/service/impl/TaOrgServiceImpl.java
  36. 11
    0
      src/main/java/com/yunzhi/nanyang/service/impl/TaPersonServiceImpl.java
  37. 58
    3
      src/main/java/com/yunzhi/nanyang/service/impl/TaWithdrawalServiceImpl.java
  38. 2
    2
      src/main/java/com/yunzhi/nanyang/shiro/filters/JWTFilter.java
  39. 0
    1
      src/main/java/com/yunzhi/nanyang/shiro/filters/MiniappFilter.java
  40. 2
    2
      src/main/java/com/yunzhi/nanyang/shiro/utils/JWTUtil.java
  41. 16
    0
      src/main/java/com/yunzhi/nanyang/vo/ChartParam.java
  42. 8
    8
      src/main/resources/application.yml
  43. 20
    0
      src/main/resources/mapper/TaAccountLogMapper.xml
  44. 6
    0
      src/main/resources/mapper/TaWithdrawalMapper.xml

+ 23
- 2
src/main/java/com/yunzhi/nanyang/common/BaseController.java Zobrazit soubor

@@ -66,8 +66,19 @@ public class BaseController {
66 66
         return taPerson;
67 67
     }
68 68
 
69
-    public boolean checkOrgAccess(String orgId, String userId) {
70
-        return iSysUserDataScopeService.checkOrgAccess(orgId, userId);
69
+    public void checkOrgAccess(String orgId) throws Exception {
70
+        SysUser user = currentUser();
71
+
72
+        // 如果是管理员
73
+        if (Constants.ADMIN_ID.equals(user.getUserId())) return;
74
+
75
+        // 空机构
76
+        if (StringUtils.isEmpty(orgId)) return;
77
+
78
+        boolean canAccess = iSysUserDataScopeService.checkOrgAccess(orgId, user.getUserId());
79
+        if (!canAccess) {
80
+            throw new Exception("暂无机构数据权限");
81
+        }
71 82
     }
72 83
 
73 84
     public SysUser checkWorker(TaPerson taPerson) throws Exception {
@@ -83,6 +94,16 @@ public class BaseController {
83 94
         return sysUser;
84 95
     }
85 96
 
97
+    public void checkMClient(String client) throws Exception {
98
+        if (StringUtils.isEmpty(client)) {
99
+            throw new Exception("暂不支持的客户端");
100
+        }
101
+
102
+        if (!"android".equals(client) && !"ios".equals(client)) {
103
+            throw new Exception("暂不支持的客户端");
104
+        }
105
+    }
106
+
86 107
     public List<String> getAccessOrgs(String userId) {
87 108
         return iSysUserDataScopeService.getAccessOrgs(userId);
88 109
     }

+ 11
- 11
src/main/java/com/yunzhi/nanyang/config/AliyunConfig.java Zobrazit soubor

@@ -13,7 +13,7 @@ public class AliyunConfig {
13 13
 
14 14
     private Oss oss;
15 15
 
16
-    private Sms sms;
16
+//    private Sms sms;
17 17
 
18 18
     @Data
19 19
     public  static class Oss {
@@ -27,14 +27,14 @@ public class AliyunConfig {
27 27
         private String bucketURL;
28 28
     }
29 29
 
30
-    @Data
31
-    public static class Sms {
32
-        private Captcha captcha;
33
-    }
34
-
35
-    @Data
36
-    public static class Captcha {
37
-        private String code;
38
-        private String sign;
39
-    }
30
+//    @Data
31
+//    public static class Sms {
32
+//        private Captcha captcha;
33
+//    }
34
+//
35
+//    @Data
36
+//    public static class Captcha {
37
+//        private String code;
38
+//        private String sign;
39
+//    }
40 40
 }

+ 87
- 0
src/main/java/com/yunzhi/nanyang/controller/MobileController.java Zobrazit soubor

@@ -0,0 +1,87 @@
1
+package com.yunzhi.nanyang.controller;
2
+
3
+import com.yunzhi.nanyang.common.*;
4
+import com.yunzhi.nanyang.entity.SysUser;
5
+import com.yunzhi.nanyang.entity.TaPerson;
6
+import com.yunzhi.nanyang.service.ISysUserService;
7
+import com.yunzhi.nanyang.service.ITaPersonService;
8
+import com.yunzhi.nanyang.shiro.utils.JWTUtil;
9
+import com.yunzhi.nanyang.vo.LoginParam;
10
+import io.swagger.annotations.Api;
11
+import io.swagger.annotations.ApiOperation;
12
+import io.swagger.annotations.ApiParam;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.web.bind.annotation.*;
15
+
16
+import java.time.LocalDateTime;
17
+import java.util.HashMap;
18
+import java.util.Map;
19
+
20
+
21
+@Api(tags = "手机端登入/登出")
22
+@RestController
23
+@RequestMapping("/{client}/{clientId}")
24
+public class MobileController extends BaseController {
25
+
26
+    @Autowired
27
+    public ITaPersonService iTaPersonService;
28
+
29
+    @Autowired
30
+    public ISysUserService iSysUserService;
31
+
32
+    @Autowired
33
+    public SMSCaptcha smsCaptcha;
34
+
35
+    @PostMapping("/login")
36
+    @ApiOperation(value="app登录", notes = "app登录", httpMethod = "POST", response = ResponseBean.class)
37
+    public ResponseBean login(@ApiParam("客户端") @PathVariable String client,
38
+                              @ApiParam("客户端") @PathVariable String clientId,
39
+                              @ApiParam("登录参数") @RequestBody LoginParam loginParam) throws Exception {
40
+
41
+        checkMClient(client);
42
+
43
+        String phone = loginParam.getUserName();
44
+        if (StringUtils.isEmpty(phone)) {
45
+            return ResponseBean.error("请设置登录手机号");
46
+        }
47
+
48
+        String captchaCode = loginParam.getPassword();
49
+        if (StringUtils.isEmpty(captchaCode)) {
50
+            return ResponseBean.error("请设置登录验证码");
51
+        }
52
+
53
+        boolean isOk = smsCaptcha.validate(phone, captchaCode);
54
+        if (!isOk) {
55
+            return ResponseBean.error("验证码不正确或者已过期");
56
+        }
57
+
58
+        SysUser sysUser = iSysUserService.getExistBy("phone", phone, false, true);
59
+        if (null == sysUser) {
60
+            return ResponseBean.error("未找到对应手机号的农机手信息");
61
+        }
62
+
63
+        TaPerson taPerson = iTaPersonService.getByPhone(clientId, phone);
64
+        if (null == taPerson) {
65
+            taPerson = new TaPerson();
66
+            taPerson.setPhone(phone);
67
+            taPerson.setIdentity(clientId);
68
+            taPerson.setStatus(Constants.STATUS_NORMAL);
69
+            taPerson.setCreateDate(LocalDateTime.now());
70
+            iTaPersonService.save(taPerson);
71
+        }
72
+
73
+        // 如果是农机手
74
+        if (Constants.CLIENT_WORKER.equals(clientId)) {
75
+            iTaPersonService.tryBindUser(taPerson);
76
+        }
77
+
78
+        // 生成 token
79
+        String token = JWTUtil.sign(taPerson.getPersonId(), taPerson.getPersonId());
80
+
81
+        Map<String, Object> res = new HashMap<>();
82
+        res.put("person", taPerson);
83
+        res.put("token", token);
84
+
85
+        return ResponseBean.success(res);
86
+    }
87
+}

+ 63
- 0
src/main/java/com/yunzhi/nanyang/controller/StatisController.java Zobrazit soubor

@@ -0,0 +1,63 @@
1
+package com.yunzhi.nanyang.controller;
2
+
3
+import com.yunzhi.nanyang.common.BaseController;
4
+import com.yunzhi.nanyang.common.ResponseBean;
5
+import com.yunzhi.nanyang.service.ITaMachineryService;
6
+import com.yunzhi.nanyang.service.ITaOrderService;
7
+import com.yunzhi.nanyang.service.ITaOrgService;
8
+import com.yunzhi.nanyang.service.ITaPersonService;
9
+import com.yunzhi.nanyang.vo.ChartParam;
10
+import io.swagger.annotations.Api;
11
+import io.swagger.annotations.ApiOperation;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.web.bind.annotation.GetMapping;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RestController;
16
+
17
+import java.util.ArrayList;
18
+import java.util.HashMap;
19
+import java.util.List;
20
+
21
+@Api(tags = "统计查询")
22
+@RestController
23
+@RequestMapping("/admin")
24
+public class StatisController extends BaseController {
25
+
26
+    @Autowired
27
+    ITaPersonService iTaPersonService;
28
+
29
+    @Autowired
30
+    ITaOrgService iTaOrgService;
31
+
32
+    @Autowired
33
+    ITaMachineryService iTaMachineryService;
34
+
35
+    @Autowired
36
+    ITaOrderService iTaOrderService;
37
+
38
+
39
+    @GetMapping("/summary")
40
+    @ApiOperation(value="登录", notes = "登录", httpMethod = "POST", response = ResponseBean.class)
41
+    public ResponseBean summary() throws Exception {
42
+
43
+        List<ChartParam> resp = new ArrayList<>();
44
+
45
+        // 统计注册用户
46
+        ChartParam personNum = iTaPersonService.statisTotal();
47
+        resp.add(personNum);
48
+
49
+        // 合作社数
50
+        ChartParam orgNum = iTaOrgService.statisTotal();
51
+        resp.add(orgNum);
52
+
53
+        // 农机数
54
+        ChartParam machineryNum = iTaMachineryService.statisTotal();
55
+        resp.add(machineryNum);
56
+
57
+        // 订单数
58
+        ChartParam orderNum = iTaOrderService.statisTotal();
59
+        resp.add(orderNum);
60
+
61
+        return ResponseBean.success(resp);
62
+    }
63
+}

+ 4
- 7
src/main/java/com/yunzhi/nanyang/controller/SysUserController.java Zobrazit soubor

@@ -94,6 +94,8 @@ public class SysUserController extends BaseController {
94 94
         sysUser.setUserId(null);
95 95
         sysUser.setCreateUser(userId);
96 96
 
97
+        checkOrgAccess(sysUser.getOrgId());
98
+
97 99
         if (StringUtils.isEmpty(sysUser.getUserName()) || StringUtils.isEmpty(sysUser.getPhone())) {
98 100
             return ResponseBean.error("姓名或者手机不能为空");
99 101
         }
@@ -102,10 +104,6 @@ public class SysUserController extends BaseController {
102 104
             return ResponseBean.error("所属机构不能为空");
103 105
         }
104 106
 
105
-        if (!checkOrgAccess(sysUser.getOrgId(), userId)) {
106
-            return ResponseBean.error("无权限进行此操作");
107
-        }
108
-
109 107
         int cntPhone = iSysUserService.countBy("phone", sysUser.getPhone(), true);
110 108
         if (cntPhone > 0) {
111 109
             return ResponseBean.error("手机号码重复");
@@ -174,6 +172,8 @@ public class SysUserController extends BaseController {
174 172
         // 不支持更新创建人
175 173
         sysUser.setCreateUser(null);
176 174
 
175
+        checkOrgAccess(sysUser.getOrgId());
176
+
177 177
         if (StringUtils.isEmpty(sysUser.getUserName()) || StringUtils.isEmpty(sysUser.getPhone())) {
178 178
             return ResponseBean.error("姓名或者手机不能为空");
179 179
         }
@@ -181,9 +181,6 @@ public class SysUserController extends BaseController {
181 181
         if (StringUtils.isEmpty(sysUser.getOrgId())) {
182 182
             return ResponseBean.error("所属机构不能为空");
183 183
         }
184
-        if (!checkOrgAccess(sysUser.getOrgId(), userId)) {
185
-            return ResponseBean.error("无权限进行此操作");
186
-        }
187 184
 
188 185
         SysUser origin = iSysUserService.getByButNot("phone", sysUser.getPhone(), "user_id", id,true);
189 186
         if (origin != null) {

+ 17
- 4
src/main/java/com/yunzhi/nanyang/controller/TaAccountLogController.java Zobrazit soubor

@@ -3,8 +3,7 @@ package com.yunzhi.nanyang.controller;
3 3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
-import com.yunzhi.nanyang.common.BaseController;
7
-import com.yunzhi.nanyang.common.ResponseBean;
6
+import com.yunzhi.nanyang.common.*;
8 7
 import com.yunzhi.nanyang.entity.SysUser;
9 8
 import com.yunzhi.nanyang.entity.TaAccount;
10 9
 import com.yunzhi.nanyang.entity.TaPerson;
@@ -26,6 +25,8 @@ import com.yunzhi.nanyang.service.ITaAccountLogService;
26 25
 import com.yunzhi.nanyang.entity.TaAccountLog;
27 26
 import org.springframework.web.bind.annotation.RestController;
28 27
 
28
+import java.time.LocalDateTime;
29
+
29 30
 /**
30 31
  * <p>
31 32
     * 流水表 前端控制器
@@ -58,11 +59,23 @@ public class TaAccountLogController extends BaseController {
58 59
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
59 60
     @RequiresPermissions("fi-system:view")
60 61
     public ResponseBean taAccountLogList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
61
-                                         @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
62
+                                         @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
63
+                                         @ApiParam(value = "合作社ID") @RequestParam(value ="orgId", required = false) String orgId,
64
+                                         @ApiParam(value = "起始时间", example = "2022-03-01") @RequestParam(value ="start", required = false) String start,
65
+                                         @ApiParam(value = "结束时间", example = "2022-03-31") @RequestParam(value ="end", required = false) String end,
66
+                                         @ApiParam(value = "订单号") @RequestParam(value ="orderNo", required = false) String orderNo,
67
+                                         @ApiParam(value = "收支类型") @RequestParam(value ="feeType", required = false) Integer feeType,
68
+                                         @ApiParam(value = "消费类型") @RequestParam(value ="chargeType", required = false) String chargeType) throws Exception{
69
+
70
+        checkOrgAccess(orgId);
71
+
72
+        LocalDateTime startDate = DateUtils.getDayStart(start);
73
+        LocalDateTime endDate = DateUtils.getDayEnd(end);
74
+
62 75
 
63 76
         IPage<AccountRecord> pg = new Page<>(pageNum, pageSize);
64 77
 
65
-        IPage<AccountRecord> result = iTaAccountLogService.getPageBy(pg);
78
+        IPage<AccountRecord> result = iTaAccountLogService.getPageBy(pg, orgId, startDate, endDate, orderNo, feeType, chargeType);
66 79
         return ResponseBean.success(result);
67 80
     }
68 81
 

+ 6
- 27
src/main/java/com/yunzhi/nanyang/controller/TaDispatchController.java Zobrazit soubor

@@ -87,12 +87,7 @@ public class TaDispatchController extends BaseController {
87 87
                                        @ApiParam("状态") @RequestParam(value ="status", required = false) String status,
88 88
                                        @ApiParam("状态") @RequestParam(value ="isWarn", defaultValue = "false") Boolean isWarn) throws Exception{
89 89
 
90
-        SysUser user = currentUser();
91
-        if (!Constants.ADMIN_ID.equals(user.getUserId()) && !StringUtils.isEmpty(orgId)) {
92
-            if (!checkOrgAccess(user.getOrgId(), user.getUserId())) {
93
-                return ResponseBean.error("无权查询机构内容");
94
-            }
95
-        }
90
+        checkOrgAccess(orgId);
96 91
 
97 92
         IPage<TaOrder> pg = new Page<>(pageNum, pageSize);
98 93
 
@@ -112,10 +107,10 @@ public class TaDispatchController extends BaseController {
112 107
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
113 108
     @RequiresPermissions("orderjob:add")
114 109
     public ResponseBean taDispatchAdd(@ApiParam("保存内容") @RequestBody TaDispatch taDispatch) throws Exception{
115
-        SysUser user = currentUser();
116
-
117 110
         taDispatch.setDispatchId(null);
118 111
 
112
+        checkOrgAccess(taDispatch.getOrgId());
113
+
119 114
         if (StringUtils.isEmpty(taDispatch.getOrderId()) || StringUtils.isEmpty(taDispatch.getOrderId())) {
120 115
             return ResponseBean.error("订单或者接单机构为空");
121 116
         }
@@ -124,10 +119,6 @@ public class TaDispatchController extends BaseController {
124 119
             return ResponseBean.error("验证订单信息异常");
125 120
         }
126 121
 
127
-        if (!checkOrgAccess(taDispatch.getOrgId(), user.getUserId())) {
128
-            return ResponseBean.error("无操作权限");
129
-        }
130
-
131 122
         taDispatch.setOrgName(iTaOrgService.getById(taDispatch.getOrgId()).getName());
132 123
 
133 124
         if (!StringUtils.isEmpty(taDispatch.getMachineryId())) {
@@ -144,18 +135,10 @@ public class TaDispatchController extends BaseController {
144 135
 
145 136
         taDispatch.setStatus(Constants.STATUS_NORMAL);
146 137
 
147
-
148
-        if (iTaDispatchService.save(taDispatch)){
149
-
150
-            // 生成作业信息
151
-            TaWorkJob taWorkJob = iTaWorkJobService.createByDispatch(taDispatch, taOrder);
152
-
153
-            // 更新订单状态
154
-            iTaOrderService.updateStatus(taDispatch.getOrderId(), "dispatch_status", Constants.DISPATCH_DONE);
155
-
138
+        TaWorkJob taWorkJob = iTaDispatchService.createNew(taDispatch, taOrder);
139
+        if (null != taWorkJob){
156 140
             // 发送通知
157 141
             applicationEventPublisher.publishEvent(new WorkDispatchEvent(this, taWorkJob, taOrder));
158
-
159 142
             return ResponseBean.success(taDispatch);
160 143
         }else {
161 144
             return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
@@ -172,11 +155,7 @@ public class TaDispatchController extends BaseController {
172 155
     public ResponseBean taDispatchDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
173 156
         TaDispatch taDispatch = iTaDispatchService.getById(id);
174 157
 
175
-        SysUser user = currentUser();
176
-
177
-        if (!checkOrgAccess(taDispatch.getOrgId(), user.getUserId())) {
178
-            return ResponseBean.error("无操作权限");
179
-        }
158
+        checkOrgAccess(taDispatch.getOrgId());
180 159
 
181 160
         TaWorkJob taWorkJob = iTaWorkJobService.getExistBy("dispatch_id", id, false, true);
182 161
         if (null == taWorkJob) {

+ 4
- 21
src/main/java/com/yunzhi/nanyang/controller/TaMachineryController.java Zobrazit soubor

@@ -71,14 +71,7 @@ public class TaMachineryController extends BaseController {
71 71
                                         @ApiParam("类型") @RequestParam(value ="typeId", required = false) String typeId,
72 72
                                         @ApiParam("机构ID") @RequestParam(value ="orgId", required = false) String orgId,
73 73
                                         @ApiParam("状态") @RequestParam(value ="status", required = false) Integer status) throws Exception{
74
-        SysUser sysUser = currentUser();
75
-        boolean isAdmin = Constants.ADMIN_ID.equals(sysUser.getUserId());
76
-
77
-        if (!StringUtils.isEmpty(orgId) && !isAdmin) {
78
-            if (!checkOrgAccess(orgId, sysUser.getUserId())) {
79
-                return ResponseBean.error("无权限操作");
80
-            }
81
-        }
74
+        checkOrgAccess(orgId);
82 75
 
83 76
         IPage<TaMachinery> pg = new Page<>(pageNum, pageSize);
84 77
 
@@ -139,9 +132,7 @@ public class TaMachineryController extends BaseController {
139 132
             return ResponseBean.error("请设置农机归属");
140 133
         }
141 134
 
142
-        if (!checkOrgAccess(taMachinery.getOrgId(), sysUser.getUserId())) {
143
-            return ResponseBean.error("无权进行此操作");
144
-        }
135
+        checkOrgAccess(taMachinery.getOrgId());
145 136
 
146 137
         taMachinery.setMachineryId(null);
147 138
         taMachinery.setCreateUser(sysUser.getUserId());
@@ -161,16 +152,12 @@ public class TaMachineryController extends BaseController {
161 152
     @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
162 153
     @RequiresPermissions("machinery:delete")
163 154
     public ResponseBean taMachineryDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
164
-        SysUser sysUser = currentUser();
165
-
166 155
         TaMachinery taMachinery = iTaMachineryService.getExistBy("machinery_id", id, false, true);
167 156
         if (null == taMachinery) {
168 157
             return ResponseBean.success("success");
169 158
         }
170 159
 
171
-        if (!checkOrgAccess(taMachinery.getOrgId(), sysUser.getUserId())) {
172
-            return ResponseBean.error("无权进行此操作");
173
-        }
160
+        checkOrgAccess(taMachinery.getOrgId());
174 161
 
175 162
         if(iTaMachineryService.removeLogicById(id)){
176 163
             return ResponseBean.success("success");
@@ -190,15 +177,11 @@ public class TaMachineryController extends BaseController {
190 177
     @RequiresPermissions("machinery:update")
191 178
     public ResponseBean taMachineryUpdate(@ApiParam("对象ID") @PathVariable String id,
192 179
                                         @ApiParam("更新内容") @RequestBody TaMachinery taMachinery) throws Exception{
193
-        SysUser sysUser = currentUser();
194
-
195 180
         if (StringUtils.isEmpty(taMachinery.getOrgId())) {
196 181
             return ResponseBean.error("请设置农机归属");
197 182
         }
198 183
 
199
-        if (!checkOrgAccess(taMachinery.getOrgId(), sysUser.getUserId())) {
200
-            return ResponseBean.error("无权进行此操作");
201
-        }
184
+        checkOrgAccess(taMachinery.getOrgId());
202 185
 
203 186
         taMachinery.setMachineryId(id);
204 187
 

+ 1
- 6
src/main/java/com/yunzhi/nanyang/controller/TaOrderController.java Zobrazit soubor

@@ -82,12 +82,7 @@ public class TaOrderController extends BaseController {
82 82
                                 @ApiParam("评价状态") @RequestParam(value ="isEvaluated", required = false) Integer isEvaluated) throws Exception{
83 83
         SysUser current = currentUser();
84 84
         boolean isAdmin = Constants.ADMIN_ID.equals(current.getUserId());
85
-
86
-        if (!isAdmin && !StringUtils.isEmpty(orgId)) {
87
-            if (!checkOrgAccess(orgId, current.getUserId())) {
88
-                return ResponseBean.error("无机构查询权限");
89
-            }
90
-        }
85
+        checkOrgAccess(orgId);
91 86
 
92 87
         IPage<TaOrder> pg = new Page<>(pageNum, pageSize);
93 88
         IPage<TaOrder> result = iTaOrderService.getAdminPage(pg,

+ 64
- 25
src/main/java/com/yunzhi/nanyang/controller/TaPersonController.java Zobrazit soubor

@@ -3,12 +3,10 @@ package com.yunzhi.nanyang.controller;
3 3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
-import com.yunzhi.nanyang.common.BaseController;
7
-import com.yunzhi.nanyang.common.ResponseBean;
8
-import com.yunzhi.nanyang.common.SMSCaptcha;
9
-import com.yunzhi.nanyang.common.StringUtils;
6
+import com.yunzhi.nanyang.common.*;
10 7
 import com.yunzhi.nanyang.entity.SysUser;
11 8
 import com.yunzhi.nanyang.service.ISysUserService;
9
+import com.yunzhi.nanyang.shiro.utils.JWTUtil;
12 10
 import com.yunzhi.nanyang.vo.PhoneParam;
13 11
 import io.swagger.annotations.Api;
14 12
 import io.swagger.annotations.ApiOperation;
@@ -25,6 +23,9 @@ import com.yunzhi.nanyang.service.ITaPersonService;
25 23
 import com.yunzhi.nanyang.entity.TaPerson;
26 24
 import org.springframework.web.bind.annotation.RestController;
27 25
 
26
+import java.util.HashMap;
27
+import java.util.Map;
28
+
28 29
 /**
29 30
  * <p>
30 31
     * 人员表 前端控制器
@@ -136,10 +137,13 @@ public class TaPersonController extends BaseController {
136 137
 
137 138
         taPerson.setPersonId(id);
138 139
 
139
-        // 关联系统人员
140
-        SysUser sysUser = iSysUserService.getExistBy("phone", taPerson.getPhone(), false, true);
141
-        if (sysUser != null && StringUtils.isEmpty(taPerson.getUserId())) {
142
-            taPerson.setUserId(sysUser.getUserId());
140
+        // 如果是农机手
141
+        if (Constants.CLIENT_WORKER.equals(clientId)) {
142
+            // 关联系统人员
143
+            SysUser sysUser = iSysUserService.getExistBy("phone", taPerson.getPhone(), false, true);
144
+            if (sysUser != null && StringUtils.isEmpty(taPerson.getUserId())) {
145
+                taPerson.setUserId(sysUser.getUserId());
146
+            }
143 147
         }
144 148
 
145 149
         if (iTaPersonService.updateById(taPerson)){
@@ -176,30 +180,65 @@ public class TaPersonController extends BaseController {
176 180
             return ResponseBean.error("验证码不正确或者已过期");
177 181
         }
178 182
 
179
-        taPerson.setPhone(phoneParam.getPhone());
183
+        if (!StringUtils.isEmpty(taPerson.getPhone())) {
184
+            return ResponseBean.error("暂不支持手机号修改");
185
+        }
180 186
 
181
-        // 关联系统人员
182
-        SysUser sysUser = iSysUserService.getExistBy("phone", phoneParam.getPhone(), false, true);
183
-        if (sysUser != null && StringUtils.isEmpty(taPerson.getUserId())) {
184
-            taPerson.setUserId(sysUser.getUserId());
187
+        // 先去查询是否已经注册过
188
+        TaPerson origin = iTaPersonService.getByPhone(clientId, phoneParam.getPhone());
189
+        if (origin != null && !origin.getPersonId().equals(id)) {
190
+            // 找到同手机号人员, 说明是 app 端注册过的
191
+            // 那么把小程序端人员信息移植到 app 端人员上去
192
+            origin.setAppId(taPerson.getAppId());
193
+            origin.setOpenid(taPerson.getOpenid());
194
+
195
+            if (StringUtils.isEmpty(origin.getNickName())) {
196
+                origin.setNickName(taPerson.getNickName());
197
+            }
198
+            if (StringUtils.isEmpty(origin.getAvatar())) {
199
+                origin.setAvatar(taPerson.getAvatar());
200
+            }
201
+            if (null != origin.getSex()) {
202
+                origin.setSex(taPerson.getSex());
203
+            }
204
+
205
+            // 先把小程序端人员删除
206
+            taPerson.setOpenid("deleted");
207
+            taPerson.setStatus(Constants.STATUS_DELETE);
208
+            iTaPersonService.updateById(taPerson);
209
+            // 再赋值 taPerson , 后续再处理 taPerson 实际上就是处理的 app 人员了
210
+            taPerson = origin;
185 211
         }
186 212
 
187
-        if (iTaPersonService.updateById(taPerson)){
213
+        taPerson.setPhone(phoneParam.getPhone());
188 214
 
215
+        // 如果是农机手
216
+        if (Constants.CLIENT_WORKER.equals(clientId)) {
217
+            // 关联系统人员
218
+            SysUser sysUser = iSysUserService.getExistBy("phone", phoneParam.getPhone(), false, true);
219
+            if (sysUser != null && StringUtils.isEmpty(taPerson.getUserId())) {
220
+                taPerson.setUserId(sysUser.getUserId());
221
+            }
222
+        }
189 223
 
190
-            return ResponseBean.success(taPerson);
224
+        if (iTaPersonService.updateById(taPerson)){
225
+            // 因为有可能修改 person 为 app 端的人员, 所以此处刷新一次 token
226
+            String token = JWTUtil.sign(taPerson.getPersonId(), taPerson.getPersonId());
227
+            Map<String, Object> res = new HashMap<>();
228
+            res.put("person", taPerson);
229
+            res.put("token", token);
230
+            return ResponseBean.success(res);
191 231
         }else {
192 232
             return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
193 233
         }
194 234
     }
195
-//
196
-//    /**
197
-//     * 根据id查询对象
198
-//     * @param id  实体ID
199
-//     */
200
-//    @RequestMapping(value="/taPerson/{id}",method= RequestMethod.GET)
201
-//    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
202
-//    public ResponseBean taPersonGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
203
-//        return ResponseBean.success(iTaPersonService.getById(id));
204
-//    }
235
+
236
+    /**
237
+     * 根据id查询对象
238
+     */
239
+    @RequestMapping(value="/{client}/{clientId}/person/current",method= RequestMethod.GET)
240
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
241
+    public ResponseBean taPersonGet() throws Exception{
242
+        return ResponseBean.success(currentPerson());
243
+    }
205 244
 }

+ 2
- 8
src/main/java/com/yunzhi/nanyang/controller/TaUserMachineryController.java Zobrazit soubor

@@ -63,10 +63,7 @@ public class TaUserMachineryController extends BaseController {
63 63
             return ResponseBean.error("未找到指定人员");
64 64
         }
65 65
 
66
-        SysUser current = currentUser();
67
-        if (!checkOrgAccess(sysUser.getOrgId(), current.getUserId())) {
68
-            return ResponseBean.error("暂无权限");
69
-        }
66
+        checkOrgAccess(sysUser.getOrgId());
70 67
 
71 68
         List<TaUserMachinery> result = iTaUserMachineryService.getByUser(userId);
72 69
         return ResponseBean.success(result);
@@ -88,10 +85,7 @@ public class TaUserMachineryController extends BaseController {
88 85
             return ResponseBean.error("未找到指定人员");
89 86
         }
90 87
 
91
-        SysUser current = currentUser();
92
-        if (!checkOrgAccess(sysUser.getOrgId(), current.getUserId())) {
93
-            return ResponseBean.error("暂无权限");
94
-        }
88
+        checkOrgAccess(sysUser.getOrgId());
95 89
 
96 90
         if (iTaUserMachineryService.editWithUser(userId, userMachineryList)){
97 91
             return ResponseBean.success(userMachineryList);

+ 8
- 31
src/main/java/com/yunzhi/nanyang/controller/TaWithdrawalController.java Zobrazit soubor

@@ -65,25 +65,17 @@ public class TaWithdrawalController extends BaseController {
65 65
                                          @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
66 66
                                          @ApiParam("机构ID") @RequestParam(value ="orgId", required = false) String orgId,
67 67
                                          @ApiParam(value = "开始日期", example = "2022-03-01") @RequestParam(value ="start",required = false) String start,
68
-                                         @ApiParam(value = "结束日期", example = "2022-03-31") @RequestParam(value ="end",required = false) String end) throws Exception{
68
+                                         @ApiParam(value = "结束日期", example = "2022-03-31") @RequestParam(value ="end",required = false) String end,
69
+                                         @ApiParam("申请人") @RequestParam(value ="userName", required = false) String userName,
70
+                                         @ApiParam("审批状态") @RequestParam(value ="auditStatus", required = false) Integer auditStatus) throws Exception{
69 71
 
70
-        SysUser sysUser = currentUser();
71
-        boolean isAdmin = Constants.ADMIN_ID.equals(sysUser.getUserId());
72
-        if (!isAdmin) {
73
-            if (StringUtils.isEmpty(orgId)) {
74
-                orgId = sysUser.getOrgId();
75
-            } else {
76
-                if (!checkOrgAccess(orgId, sysUser.getUserId())) {
77
-                    return ResponseBean.error("暂无机构数据查询权限");
78
-                }
79
-            }
80
-        }
72
+        checkOrgAccess(orgId);
81 73
 
82 74
         LocalDateTime startDate = DateUtils.getDayStart(start);
83 75
         LocalDateTime endDate = DateUtils.getDayEnd(end);
84 76
 
85 77
         IPage<TaWithdrawal> pg = new Page<>(pageNum, pageSize);
86
-        IPage<TaWithdrawal> result = iTaWithdrawalService.getPageBy(pg, orgId, startDate, endDate);
78
+        IPage<TaWithdrawal> result = iTaWithdrawalService.getPageBy(pg, orgId, startDate, endDate, userName, auditStatus);
87 79
         return ResponseBean.success(result);
88 80
     }
89 81
 
@@ -235,12 +227,7 @@ public class TaWithdrawalController extends BaseController {
235 227
         }
236 228
 
237 229
         String orgId = origin.getOrgId();
238
-        boolean isAdmin = Constants.ADMIN_ID.equals(sysUser.getUserId());
239
-        if (!isAdmin) {
240
-            if (!checkOrgAccess(orgId, sysUser.getUserId())) {
241
-                return ResponseBean.error("暂无操作权限");
242
-            }
243
-        }
230
+        checkOrgAccess(orgId);
244 231
 
245 232
         // 不能重复审批, 因为审批有账户操作
246 233
         Integer auditStatus = origin.getAuditStatus();
@@ -259,11 +246,7 @@ public class TaWithdrawalController extends BaseController {
259 246
         origin.setAuditRemark(taWithdrawal.getAuditRemark());
260 247
         origin.setAuditDate(LocalDateTime.now());
261 248
 
262
-        if (iTaWithdrawalService.updateById(origin)){
263
-
264
-            // 处理账户信息
265
-            iTaAccountService.withdraw(origin);
266
-
249
+        if (iTaWithdrawalService.audit(origin)){
267 250
             return ResponseBean.success(iTaWithdrawalService.getById(id));
268 251
         }else {
269 252
             return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
@@ -285,14 +268,8 @@ public class TaWithdrawalController extends BaseController {
285 268
         SysUser user = iSysUserService.getById(taWithdrawal.getUserId());
286 269
         taWithdrawal.setPhone(user.getPhone());
287 270
 
288
-        SysUser sysUser = currentUser();
289 271
         String orgId = taWithdrawal.getOrgId();
290
-        boolean isAdmin = Constants.ADMIN_ID.equals(sysUser.getUserId());
291
-        if (!isAdmin) {
292
-            if (!checkOrgAccess(orgId, sysUser.getUserId())) {
293
-                return ResponseBean.error("暂无数据查询权限");
294
-            }
295
-        }
272
+        checkOrgAccess(orgId);
296 273
 
297 274
         TaOrg taOrg = iTaOrgService.getById(orgId);
298 275
         taWithdrawal.setOrgName(taOrg.getName());

+ 2
- 8
src/main/java/com/yunzhi/nanyang/controller/TaWorkJobController.java Zobrazit soubor

@@ -70,12 +70,7 @@ public class TaWorkJobController extends BaseController {
70 70
                                 @ApiParam(value = "农机型号ID") @RequestParam(value ="machineryTypeId", required = false) String machineryTypeId,
71 71
                                 @ApiParam(value = "农机ID") @RequestParam(value ="machineryId", required = false) String machineryId,
72 72
                                 @ApiParam(value = "农机手名称") @RequestParam(value ="workerName", required = false) String workerName) throws Exception{
73
-        SysUser sysUser = currentUser();
74
-        if (!Constants.ADMIN_ID.equals(sysUser.getUserId()) && !StringUtils.isEmpty(orgId)) {
75
-            if (checkOrgAccess(orgId, sysUser.getUserId())) {
76
-                return ResponseBean.error("暂无合作设数据权限");
77
-            }
78
-        }
73
+        checkOrgAccess(orgId);
79 74
 
80 75
         LocalDateTime startDate = DateUtils.getDayStart(start);
81 76
         LocalDateTime endDate = DateUtils.getDayEnd(end);
@@ -116,13 +111,12 @@ public class TaWorkJobController extends BaseController {
116 111
     /**
117 112
      * 暂停/开启
118 113
      * @param id  实体ID
119
-     * @param taWorkJob 实体对象
114
+     * @param mode 实体对象
120 115
      * @return
121 116
      */
122 117
     @RequestMapping(value="/{client}/worker/work-job/{id}/pause",method= RequestMethod.PUT)
123 118
     @ApiOperation(value="暂停/开启", notes = "暂停/开启", httpMethod = "PUT", response = ResponseBean.class)
124 119
     public ResponseBean taWorkJobUpdate(@ApiParam("客户端") @PathVariable String client,
125
-//                                      @ApiParam("客户端ID") @PathVariable String clientId,
126 120
                                         @ApiParam("对象ID") @PathVariable String id,
127 121
                                         @ApiParam("是否暂停") @RequestParam("mode") Boolean mode) throws Exception{
128 122
 

+ 4
- 3
src/main/java/com/yunzhi/nanyang/controller/WxMaController.java Zobrazit soubor

@@ -64,11 +64,11 @@ public class WxMaController extends BaseController {
64 64
     @GetMapping("/preload")
65 65
     @ApiOperation(value="小程序登录", notes = "小程序登录", httpMethod = "POST", response = ResponseBean.class)
66 66
     public ResponseBean preload(@ApiParam("客户端ID") @PathVariable String clientId,
67
-                                @ApiParam("小程序预加载参数") @RequestParam WxMaPreload wxMaPreload) throws Exception {
67
+                                @ApiParam("小程序预加载参数") @RequestParam(required = false) WxMaPreload wxMaPreload) throws Exception {
68 68
 
69 69
         if (Constants.CLIENT_WORKER.equals(clientId)) {
70 70
             List<TaMessageTemplate> list = iTaMessageTemplateService.getByTplType(Constants.MESSAGE_MINIAPP);
71
-            ResponseBean.success(new HashMap<String, Object>(){{
71
+            return ResponseBean.success(new HashMap<String, Object>(){{
72 72
                 put("tpls", list);
73 73
             }});
74 74
         }
@@ -103,13 +103,14 @@ public class WxMaController extends BaseController {
103 103
             taPerson = new TaPerson();
104 104
             taPerson.setAppId(miniapp.getAppId());
105 105
             taPerson.setOpenid(openid);
106
+            taPerson.setIdentity(clientId);
106 107
             taPerson.setStatus(Constants.STATUS_NORMAL);
107 108
             taPerson.setCreateDate(LocalDateTime.now());
108 109
             iTaPersonService.save(taPerson);
109 110
         }
110 111
 
111 112
         // 如果是农机手
112
-        if (Constants.CLIENT_WORKER.equals(miniapp.getClient())) {
113
+        if (Constants.CLIENT_WORKER.equals(clientId)) {
113 114
             iTaPersonService.tryBindUser(taPerson);
114 115
         }
115 116
 

+ 3
- 0
src/main/java/com/yunzhi/nanyang/entity/TaPerson.java Zobrazit soubor

@@ -50,6 +50,9 @@ public class TaPerson implements Serializable {
50 50
     @ApiModelProperty(value = "手机号")
51 51
     private String phone;
52 52
 
53
+    @ApiModelProperty(value = "身份")
54
+    private String identity;
55
+
53 56
     @ApiModelProperty(value = "绑定人员")
54 57
     private String userId;
55 58
 

+ 10
- 1
src/main/java/com/yunzhi/nanyang/mapper/TaAccountLogMapper.java Zobrazit soubor

@@ -5,6 +5,9 @@ import com.yunzhi.nanyang.entity.TaAccountLog;
5 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6 6
 import com.yunzhi.nanyang.vo.AccountRecord;
7 7
 import org.apache.ibatis.annotations.Mapper;
8
+import org.apache.ibatis.annotations.Param;
9
+
10
+import java.time.LocalDateTime;
8 11
 
9 12
 /**
10 13
  * <p>
@@ -17,5 +20,11 @@ import org.apache.ibatis.annotations.Mapper;
17 20
 @Mapper
18 21
 public interface TaAccountLogMapper extends BaseMapper<TaAccountLog> {
19 22
 
20
-    IPage<AccountRecord> getPageBy(IPage<AccountRecord> pg);
23
+    IPage<AccountRecord> getPageBy(IPage<AccountRecord> pg,
24
+                                   @Param("orgId") String orgId,
25
+                                   @Param("startDate") LocalDateTime startDate,
26
+                                   @Param("endDate") LocalDateTime endDate,
27
+                                   @Param("orderNo") String orderNo,
28
+                                   @Param("feeType") Integer feeType,
29
+                                   @Param("chargeType") String chargeType);
21 30
 }

+ 5
- 0
src/main/java/com/yunzhi/nanyang/mapper/TaMachineryMapper.java Zobrazit soubor

@@ -3,9 +3,11 @@ package com.yunzhi.nanyang.mapper;
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.yunzhi.nanyang.entity.TaMachinery;
5 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6
+import com.yunzhi.nanyang.vo.ChartParam;
6 7
 import com.yunzhi.nanyang.vo.MachineSummary;
7 8
 import org.apache.ibatis.annotations.Mapper;
8 9
 import org.apache.ibatis.annotations.Param;
10
+import org.apache.ibatis.annotations.Select;
9 11
 import org.apache.ibatis.annotations.Update;
10 12
 
11 13
 /**
@@ -42,4 +44,7 @@ public interface TaMachineryMapper extends BaseMapper<TaMachinery> {
42 44
                                  @Param("typeId") String typeId,
43 45
                                  @Param("orgId") String orgId,
44 46
                                  @Param("status") Integer status);
47
+
48
+    @Select("SELECT 'machinery' as `name`, count(*) as `value` FROM ta_machinery WHERE `status` > -1")
49
+    ChartParam statisTotal();
45 50
 }

+ 9
- 0
src/main/java/com/yunzhi/nanyang/mapper/TaOrderMapper.java Zobrazit soubor

@@ -3,9 +3,11 @@ package com.yunzhi.nanyang.mapper;
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.yunzhi.nanyang.entity.TaOrder;
5 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6
+import com.yunzhi.nanyang.vo.ChartParam;
6 7
 import org.apache.ibatis.annotations.Mapper;
7 8
 import org.apache.ibatis.annotations.Param;
8 9
 import org.apache.ibatis.annotations.Select;
10
+import org.apache.ibatis.annotations.Update;
9 11
 
10 12
 import java.util.List;
11 13
 
@@ -48,5 +50,12 @@ public interface TaOrderMapper extends BaseMapper<TaOrder> {
48 50
 
49 51
     List<TaOrder> checkMachineryDuty(@Param("machineryId") String machineryId,@Param("appointmentDate") String appointmentDate);
50 52
 
53
+    @Update("UPDATE ta_order SET pay_status = #{payStatus} WHERE order_id = #{orderId}")
51 54
     int updatePayStatus(@Param("orderId") String orderId, @Param("payStatus") int payStatus);
55
+
56
+    @Update("UPDATE ta_order SET dispatch_status = #{dispatchStatus} WHERE order_id = #{orderId}")
57
+    int updateDispatchStatus(@Param("orderId") String orderId, @Param("dispatchStatus") int dispatchStatus);
58
+
59
+    @Select("SELECT 'order' as `name`, count(*) as `value` FROM ta_order WHERE `status` > -1")
60
+    ChartParam statisTotal();
52 61
 }

+ 5
- 0
src/main/java/com/yunzhi/nanyang/mapper/TaOrgMapper.java Zobrazit soubor

@@ -3,8 +3,10 @@ package com.yunzhi.nanyang.mapper;
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.yunzhi.nanyang.entity.TaOrg;
5 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6
+import com.yunzhi.nanyang.vo.ChartParam;
6 7
 import org.apache.ibatis.annotations.Mapper;
7 8
 import org.apache.ibatis.annotations.Param;
9
+import org.apache.ibatis.annotations.Select;
8 10
 
9 11
 /**
10 12
  * <p>
@@ -18,4 +20,7 @@ import org.apache.ibatis.annotations.Param;
18 20
 public interface TaOrgMapper extends BaseMapper<TaOrg> {
19 21
 
20 22
     IPage<TaOrg> getPageBy(IPage<TaOrg> pg, @Param("userId") String userId, @Param("name") String name);
23
+
24
+    @Select("SELECT 'org' as `name`, count(*) as `value`  FROM ta_org t WHERE t.`status` > -1")
25
+    ChartParam statisTotal();
21 26
 }

+ 7
- 0
src/main/java/com/yunzhi/nanyang/mapper/TaPersonMapper.java Zobrazit soubor

@@ -2,6 +2,7 @@ package com.yunzhi.nanyang.mapper;
2 2
 
3 3
 import com.yunzhi.nanyang.entity.TaPerson;
4 4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import com.yunzhi.nanyang.vo.ChartParam;
5 6
 import org.apache.ibatis.annotations.Mapper;
6 7
 import org.apache.ibatis.annotations.Param;
7 8
 import org.apache.ibatis.annotations.Select;
@@ -22,4 +23,10 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
22 23
 
23 24
     @Select("SELECT * FROM ta_person t WHERE t.user_id = #{userId} AND t.`status` > -1")
24 25
     TaPerson getByUserId(@Param("userId") String userId);
26
+    
27
+    @Select("SELECT 'person' as `name`, count(*) as `value`  FROM ta_person t WHERE t.phone is not null AND t.`status` > -1")
28
+    ChartParam statisTotal();
29
+
30
+    @Select("SELECT * FROM ta_person t WHERE t.phone = #{phone} AND t.identity = #{clientId} AND t.`status` > -1")
31
+    TaPerson getByPhone(@Param("clientId") String clientId,@Param("phone")  String phone);
25 32
 }

+ 3
- 1
src/main/java/com/yunzhi/nanyang/mapper/TaWithdrawalMapper.java Zobrazit soubor

@@ -22,7 +22,9 @@ public interface TaWithdrawalMapper extends BaseMapper<TaWithdrawal> {
22 22
     IPage<TaWithdrawal> getPageBy(IPage<TaWithdrawal> pg,
23 23
                                   @Param("orgId") String orgId,
24 24
                                   @Param("startDate") LocalDateTime startDate,
25
-                                  @Param("endDate") LocalDateTime endDate);
25
+                                  @Param("endDate") LocalDateTime endDate,
26
+                                  @Param("userName") String userName,
27
+                                  @Param("auditStatus") Integer auditStatus);
26 28
 
27 29
     Integer getTotalMoney(@Param("orgId") String orgId,@Param("auditStatus") Integer auditStatus);
28 30
 }

+ 1
- 0
src/main/java/com/yunzhi/nanyang/service/ISysUserService.java Zobrazit soubor

@@ -20,4 +20,5 @@ public interface ISysUserService extends IBaseService<SysUser> {
20 20
     SysUser getByLoginId(String loginId);
21 21
 
22 22
     IPage<SysUser> getPageBy(IPage<SysUser> pg, String userId, String orgId, String name, String phone);
23
+
23 24
 }

+ 3
- 2
src/main/java/com/yunzhi/nanyang/service/ITaAccountLogService.java Zobrazit soubor

@@ -2,9 +2,10 @@ package com.yunzhi.nanyang.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.yunzhi.nanyang.entity.TaAccountLog;
5
-import com.baomidou.mybatisplus.extension.service.IService;
6 5
 import com.yunzhi.nanyang.vo.AccountRecord;
7 6
 
7
+import java.time.LocalDateTime;
8
+
8 9
 /**
9 10
  * <p>
10 11
  * 流水表 服务类
@@ -15,5 +16,5 @@ import com.yunzhi.nanyang.vo.AccountRecord;
15 16
  */
16 17
 public interface ITaAccountLogService extends IBaseService<TaAccountLog> {
17 18
 
18
-    IPage<AccountRecord> getPageBy(IPage<AccountRecord> pg);
19
+    IPage<AccountRecord> getPageBy(IPage<AccountRecord> pg, String orgId, LocalDateTime startDate, LocalDateTime endDate, String orderNo, Integer feeType, String chargeType);
19 20
 }

+ 3
- 0
src/main/java/com/yunzhi/nanyang/service/ITaDispatchService.java Zobrazit soubor

@@ -3,6 +3,7 @@ package com.yunzhi.nanyang.service;
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.yunzhi.nanyang.entity.TaDispatch;
5 5
 import com.yunzhi.nanyang.entity.TaOrder;
6
+import com.yunzhi.nanyang.entity.TaWorkJob;
6 7
 
7 8
 import java.time.LocalDateTime;
8 9
 
@@ -17,4 +18,6 @@ import java.time.LocalDateTime;
17 18
 public interface ITaDispatchService extends IBaseService<TaDispatch> {
18 19
 
19 20
     IPage<TaOrder> getPageBy(IPage<TaOrder> pg, String orgId, String typeId, String machineryId, LocalDateTime start, LocalDateTime end, String phone, String status, Boolean isWarn);
21
+
22
+    TaWorkJob createNew(TaDispatch taDispatch, TaOrder taOrder) throws Exception;
20 23
 }

+ 3
- 0
src/main/java/com/yunzhi/nanyang/service/ITaMachineryService.java Zobrazit soubor

@@ -2,6 +2,7 @@ package com.yunzhi.nanyang.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.yunzhi.nanyang.entity.TaMachinery;
5
+import com.yunzhi.nanyang.vo.ChartParam;
5 6
 import com.yunzhi.nanyang.vo.MachineSummary;
6 7
 
7 8
 /**
@@ -31,4 +32,6 @@ public interface ITaMachineryService extends IBaseService<TaMachinery> {
31 32
     boolean updateStatus(String machineryId, String statusColumn, int statusValue);
32 33
 
33 34
     IPage<TaMachinery> getPageBy(IPage<TaMachinery> pg, String name, String typeId, String orgId, Integer status);
35
+
36
+    ChartParam statisTotal();
34 37
 }

+ 3
- 0
src/main/java/com/yunzhi/nanyang/service/ITaOrderService.java Zobrazit soubor

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.yunzhi.nanyang.entity.SysUser;
5 5
 import com.yunzhi.nanyang.entity.TaOrder;
6 6
 import com.yunzhi.nanyang.entity.TaPerson;
7
+import com.yunzhi.nanyang.vo.ChartParam;
7 8
 
8 9
 import java.util.List;
9 10
 
@@ -38,4 +39,6 @@ public interface ITaOrderService extends IBaseService<TaOrder> {
38 39
     boolean updateStatus(String orderId, String statusColumn, int statusValue);
39 40
 
40 41
     List<TaOrder> checkMachineryDuty(String machineryId, String appointmentDate);
42
+
43
+    ChartParam statisTotal();
41 44
 }

+ 3
- 0
src/main/java/com/yunzhi/nanyang/service/ITaOrgService.java Zobrazit soubor

@@ -3,6 +3,7 @@ package com.yunzhi.nanyang.service;
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.yunzhi.nanyang.entity.SysUser;
5 5
 import com.yunzhi.nanyang.entity.TaOrg;
6
+import com.yunzhi.nanyang.vo.ChartParam;
6 7
 
7 8
 /**
8 9
  * <p>
@@ -17,4 +18,6 @@ public interface ITaOrgService extends IBaseService<TaOrg> {
17 18
     IPage<TaOrg> getPageBy(IPage<TaOrg> pg, SysUser sysUser, String name);
18 19
 
19 20
     boolean saveWithDataScope(TaOrg taOrg) throws Exception;
21
+
22
+    ChartParam statisTotal();
20 23
 }

+ 5
- 0
src/main/java/com/yunzhi/nanyang/service/ITaPersonService.java Zobrazit soubor

@@ -2,6 +2,7 @@ package com.yunzhi.nanyang.service;
2 2
 
3 3
 import com.yunzhi.nanyang.entity.TaPerson;
4 4
 import com.baomidou.mybatisplus.extension.service.IService;
5
+import com.yunzhi.nanyang.vo.ChartParam;
5 6
 
6 7
 /**
7 8
  * <p>
@@ -16,4 +17,8 @@ public interface ITaPersonService extends IBaseService<TaPerson> {
16 17
     TaPerson getByOpenId(String appid, String openid);
17 18
 
18 19
     void tryBindUser(TaPerson taPerson);
20
+
21
+    ChartParam statisTotal();
22
+
23
+    TaPerson getByPhone(String clientId, String phone);
19 24
 }

+ 3
- 2
src/main/java/com/yunzhi/nanyang/service/ITaWithdrawalService.java Zobrazit soubor

@@ -2,7 +2,6 @@ package com.yunzhi.nanyang.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.yunzhi.nanyang.entity.TaWithdrawal;
5
-import com.baomidou.mybatisplus.extension.service.IService;
6 5
 
7 6
 import java.time.LocalDateTime;
8 7
 
@@ -16,5 +15,7 @@ import java.time.LocalDateTime;
16 15
  */
17 16
 public interface ITaWithdrawalService extends IBaseService<TaWithdrawal> {
18 17
 
19
-    IPage<TaWithdrawal> getPageBy(IPage<TaWithdrawal> pg, String orgId, LocalDateTime startDate, LocalDateTime endDate);
18
+    IPage<TaWithdrawal> getPageBy(IPage<TaWithdrawal> pg, String orgId, LocalDateTime startDate, LocalDateTime endDate, String userName, Integer auditStatus);
19
+
20
+    boolean audit(TaWithdrawal origin) throws Exception;
20 21
 }

+ 4
- 3
src/main/java/com/yunzhi/nanyang/service/impl/TaAccountLogServiceImpl.java Zobrazit soubor

@@ -4,10 +4,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.yunzhi.nanyang.entity.TaAccountLog;
5 5
 import com.yunzhi.nanyang.mapper.TaAccountLogMapper;
6 6
 import com.yunzhi.nanyang.service.ITaAccountLogService;
7
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
8 7
 import com.yunzhi.nanyang.vo.AccountRecord;
9 8
 import org.springframework.stereotype.Service;
10 9
 
10
+import java.time.LocalDateTime;
11
+
11 12
 /**
12 13
  * <p>
13 14
  * 流水表 服务实现类
@@ -20,7 +21,7 @@ import org.springframework.stereotype.Service;
20 21
 public class TaAccountLogServiceImpl extends BaseServiceImpl<TaAccountLogMapper, TaAccountLog> implements ITaAccountLogService {
21 22
 
22 23
     @Override
23
-    public IPage<AccountRecord> getPageBy(IPage<AccountRecord> pg) {
24
-        return baseMapper.getPageBy(pg);
24
+    public IPage<AccountRecord> getPageBy(IPage<AccountRecord> pg, String orgId, LocalDateTime startDate, LocalDateTime endDate, String orderNo, Integer feeType, String chargeType) {
25
+        return baseMapper.getPageBy(pg, orgId, startDate, endDate, orderNo, feeType, chargeType);
25 26
     }
26 27
 }

+ 46
- 0
src/main/java/com/yunzhi/nanyang/service/impl/TaDispatchServiceImpl.java Zobrazit soubor

@@ -1,11 +1,17 @@
1 1
 package com.yunzhi.nanyang.service.impl;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.yunzhi.nanyang.common.Constants;
4 5
 import com.yunzhi.nanyang.entity.TaDispatch;
5 6
 import com.yunzhi.nanyang.entity.TaOrder;
7
+import com.yunzhi.nanyang.entity.TaWorkJob;
6 8
 import com.yunzhi.nanyang.mapper.TaDispatchMapper;
9
+import com.yunzhi.nanyang.mapper.TaOrderMapper;
10
+import com.yunzhi.nanyang.mapper.TaWorkJobMapper;
7 11
 import com.yunzhi.nanyang.service.ITaDispatchService;
12
+import org.springframework.beans.factory.annotation.Autowired;
8 13
 import org.springframework.stereotype.Service;
14
+import org.springframework.transaction.annotation.Transactional;
9 15
 
10 16
 import java.time.LocalDateTime;
11 17
 
@@ -20,8 +26,48 @@ import java.time.LocalDateTime;
20 26
 @Service
21 27
 public class TaDispatchServiceImpl extends BaseServiceImpl<TaDispatchMapper, TaDispatch> implements ITaDispatchService {
22 28
 
29
+    @Autowired
30
+    TaWorkJobMapper taWorkJobMapper;
31
+
32
+    @Autowired
33
+    TaOrderMapper taOrderMapper;
34
+
23 35
     @Override
24 36
     public IPage<TaOrder> getPageBy(IPage<TaOrder> pg, String orgId, String typeId, String machineryId, LocalDateTime start, LocalDateTime end, String phone, String status, Boolean isWarn) {
25 37
         return baseMapper.getPageBy(pg, orgId, typeId, machineryId, start, end, phone, status, isWarn);
26 38
     }
39
+
40
+    @Transactional(rollbackFor = Exception.class)
41
+    @Override
42
+    public TaWorkJob createNew(TaDispatch taDispatch, TaOrder taOrder) throws Exception {
43
+
44
+        if (!save(taDispatch)) {
45
+            return null;
46
+        }
47
+
48
+        TaWorkJob taWorkJob = new TaWorkJob();
49
+        LocalDateTime now = LocalDateTime.now();
50
+        taWorkJob.setJobId(null);
51
+        taWorkJob.setDispatchId(taDispatch.getDispatchId());
52
+        taWorkJob.setOrderId(taOrder.getOrderId());
53
+        taWorkJob.setWorkerId(taDispatch.getWorkerId());
54
+        taWorkJob.setWorkerName(taDispatch.getWorkerName());    // 非数据字段, 但是消息需要用到
55
+        taWorkJob.setMachineryId(taDispatch.getMachineryId());
56
+        taWorkJob.setMachineryName(taDispatch.getMachineryName());    // 非数据字段, 但是消息需要用到
57
+        taWorkJob.setStartDate(now);
58
+        taWorkJob.setOrgId(taDispatch.getOrgId());
59
+        taWorkJob.setStatus(Constants.WORK_READY);
60
+        taWorkJob.setCreateUser(taDispatch.getWorkerId());
61
+        taWorkJob.setCreateDate(now);
62
+
63
+        if (taWorkJobMapper.insert(taWorkJob) < 1) {
64
+            throw new Exception("生成作业信息异常");
65
+        }
66
+
67
+        if (taOrderMapper.updateDispatchStatus(taOrder.getOrderId(), Constants.DISPATCH_DONE) < 1) {
68
+            throw new Exception("更新订单状态失败");
69
+        }
70
+
71
+        return taWorkJob;
72
+    }
27 73
 }

+ 6
- 0
src/main/java/com/yunzhi/nanyang/service/impl/TaMachineryServiceImpl.java Zobrazit soubor

@@ -7,6 +7,7 @@ import com.yunzhi.nanyang.common.StringUtils;
7 7
 import com.yunzhi.nanyang.entity.*;
8 8
 import com.yunzhi.nanyang.mapper.*;
9 9
 import com.yunzhi.nanyang.service.ITaMachineryService;
10
+import com.yunzhi.nanyang.vo.ChartParam;
10 11
 import com.yunzhi.nanyang.vo.MachineSummary;
11 12
 import org.springframework.beans.factory.annotation.Autowired;
12 13
 import org.springframework.stereotype.Service;
@@ -139,6 +140,11 @@ public class TaMachineryServiceImpl extends BaseServiceImpl<TaMachineryMapper, T
139 140
         return baseMapper.getPageBy(pg, name, typeId, orgId, status);
140 141
     }
141 142
 
143
+    @Override
144
+    public ChartParam statisTotal() {
145
+        return baseMapper.statisTotal();
146
+    }
147
+
142 148
     private void saveImages(TaMachinery taMachinery) {
143 149
         String machineryId = taMachinery.getMachineryId();
144 150
         // 先删除所有

+ 5
- 0
src/main/java/com/yunzhi/nanyang/service/impl/TaMessageServiceImpl.java Zobrazit soubor

@@ -38,6 +38,9 @@ public class TaMessageServiceImpl extends BaseServiceImpl<TaMessageMapper, TaMes
38 38
     @Autowired
39 39
     WxUtils wxUtils;
40 40
 
41
+    @Autowired
42
+    SMSUtils smsUtils;
43
+
41 44
     @Async
42 45
     @Override
43 46
     public void sendMessage(WorkExpiredEvent evt) {
@@ -87,6 +90,8 @@ public class TaMessageServiceImpl extends BaseServiceImpl<TaMessageMapper, TaMes
87 90
                 if (!StringUtils.isEmpty(taPerson.getPhone()) && null != message) {
88 91
                     message.setTel(taPerson.getPhone());
89 92
                     message.setContent(String.format(tpl.getAppTplContent(), taWorkJob.getWorkerName(), orderNo));
93
+
94
+                    smsUtils.sendMessage(message);
90 95
                 } else {
91 96
                     log.error("发送短信失败, 可能无用户手机 " + taPerson.getPersonId());
92 97
                 }

+ 6
- 0
src/main/java/com/yunzhi/nanyang/service/impl/TaOrderServiceImpl.java Zobrazit soubor

@@ -9,6 +9,7 @@ import com.yunzhi.nanyang.entity.TaOrder;
9 9
 import com.yunzhi.nanyang.entity.TaPerson;
10 10
 import com.yunzhi.nanyang.mapper.TaOrderMapper;
11 11
 import com.yunzhi.nanyang.service.ITaOrderService;
12
+import com.yunzhi.nanyang.vo.ChartParam;
12 13
 import org.springframework.stereotype.Service;
13 14
 
14 15
 import java.time.LocalDateTime;
@@ -89,4 +90,9 @@ public class TaOrderServiceImpl extends BaseServiceImpl<TaOrderMapper, TaOrder>
89 90
     public List<TaOrder> checkMachineryDuty(String machineryId, String appointmentDate) {
90 91
         return baseMapper.checkMachineryDuty(machineryId, appointmentDate);
91 92
     }
93
+
94
+    @Override
95
+    public ChartParam statisTotal() {
96
+        return baseMapper.statisTotal();
97
+    }
92 98
 }

+ 6
- 0
src/main/java/com/yunzhi/nanyang/service/impl/TaOrgServiceImpl.java Zobrazit soubor

@@ -8,6 +8,7 @@ import com.yunzhi.nanyang.entity.TaOrg;
8 8
 import com.yunzhi.nanyang.mapper.SysUserDataScopeMapper;
9 9
 import com.yunzhi.nanyang.mapper.TaOrgMapper;
10 10
 import com.yunzhi.nanyang.service.ITaOrgService;
11
+import com.yunzhi.nanyang.vo.ChartParam;
11 12
 import org.springframework.beans.factory.annotation.Autowired;
12 13
 import org.springframework.stereotype.Service;
13 14
 import org.springframework.transaction.annotation.Transactional;
@@ -52,4 +53,9 @@ public class TaOrgServiceImpl extends BaseServiceImpl<TaOrgMapper, TaOrg> implem
52 53
 
53 54
         return true;
54 55
     }
56
+
57
+    @Override
58
+    public ChartParam statisTotal() {
59
+        return baseMapper.statisTotal();
60
+    }
55 61
 }

+ 11
- 0
src/main/java/com/yunzhi/nanyang/service/impl/TaPersonServiceImpl.java Zobrazit soubor

@@ -7,6 +7,7 @@ import com.yunzhi.nanyang.mapper.SysUserMapper;
7 7
 import com.yunzhi.nanyang.mapper.TaPersonMapper;
8 8
 import com.yunzhi.nanyang.service.ITaPersonService;
9 9
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
10
+import com.yunzhi.nanyang.vo.ChartParam;
10 11
 import org.springframework.beans.factory.annotation.Autowired;
11 12
 import org.springframework.stereotype.Service;
12 13
 
@@ -50,4 +51,14 @@ public class TaPersonServiceImpl extends BaseServiceImpl<TaPersonMapper, TaPerso
50 51
             e.printStackTrace();
51 52
         }
52 53
     }
54
+
55
+    @Override
56
+    public ChartParam statisTotal() {
57
+        return baseMapper.statisTotal();
58
+    }
59
+
60
+    @Override
61
+    public TaPerson getByPhone(String clientId, String phone) {
62
+        return baseMapper.getByPhone(clientId, phone);
63
+    }
53 64
 }

+ 58
- 3
src/main/java/com/yunzhi/nanyang/service/impl/TaWithdrawalServiceImpl.java Zobrazit soubor

@@ -1,11 +1,18 @@
1 1
 package com.yunzhi.nanyang.service.impl;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.yunzhi.nanyang.common.Constants;
5
+import com.yunzhi.nanyang.entity.TaAccount;
6
+import com.yunzhi.nanyang.entity.TaAccountLog;
4 7
 import com.yunzhi.nanyang.entity.TaWithdrawal;
8
+import com.yunzhi.nanyang.mapper.TaAccountLogMapper;
9
+import com.yunzhi.nanyang.mapper.TaAccountMapper;
5 10
 import com.yunzhi.nanyang.mapper.TaWithdrawalMapper;
11
+import com.yunzhi.nanyang.service.ITaAccountService;
6 12
 import com.yunzhi.nanyang.service.ITaWithdrawalService;
7
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
13
+import org.springframework.beans.factory.annotation.Autowired;
8 14
 import org.springframework.stereotype.Service;
15
+import org.springframework.transaction.annotation.Transactional;
9 16
 
10 17
 import java.time.LocalDateTime;
11 18
 
@@ -20,8 +27,56 @@ import java.time.LocalDateTime;
20 27
 @Service
21 28
 public class TaWithdrawalServiceImpl extends BaseServiceImpl<TaWithdrawalMapper, TaWithdrawal> implements ITaWithdrawalService {
22 29
 
30
+    @Autowired
31
+    ITaAccountService iTaAccountService;
32
+
33
+    @Autowired
34
+    TaAccountLogMapper taAccountLogMapper;
35
+
36
+    @Autowired
37
+    TaAccountMapper taAccountMapper;
38
+
39
+    @Override
40
+    public IPage<TaWithdrawal> getPageBy(IPage<TaWithdrawal> pg, String orgId, LocalDateTime startDate, LocalDateTime endDate, String userName, Integer auditStatus) {
41
+        return baseMapper.getPageBy(pg, orgId, startDate, endDate, userName, auditStatus);
42
+    }
43
+
44
+    @Transactional(rollbackFor = Exception.class)
23 45
     @Override
24
-    public IPage<TaWithdrawal> getPageBy(IPage<TaWithdrawal> pg, String orgId, LocalDateTime startDate, LocalDateTime endDate) {
25
-        return baseMapper.getPageBy(pg, orgId, startDate, endDate);
46
+    public boolean audit(TaWithdrawal taWithdrawal) throws Exception {
47
+
48
+        // 只有审核同意, 才需要处理账户信息
49
+        if (taWithdrawal.getAuditStatus() == Constants.AUDIT_AGREE) {
50
+            TaAccount taAccount = iTaAccountService.getUserAccount(taWithdrawal.getOrgId());
51
+
52
+            if (taAccount.getAmounts() < taWithdrawal.getMoney()) {
53
+                throw new Exception("账户余额不足");
54
+            }
55
+
56
+            TaAccountLog taAccountLog = new TaAccountLog();
57
+            taAccountLog.setAccountId(taAccount.getAccountId());
58
+            taAccountLog.setFeeType(Constants.ACCOUNT_EXPEND);
59
+            taAccountLog.setChargeType(Constants.ACCOUNT_WITHDRAW);
60
+            taAccountLog.setMoney(taWithdrawal.getMoney());
61
+            taAccountLog.setOrderId(taWithdrawal.getWithdrawalId());
62
+            taAccountLog.setCreateDate(LocalDateTime.now());
63
+
64
+            if (taAccountLogMapper.insert(taAccountLog) < 1) {
65
+                return false;
66
+            }
67
+
68
+            // 余额减少
69
+            int row = taAccountMapper.updateColumn(taAccount.getAccountId(), "amounts", taAccountLog.getFeeType() * Math.abs(taAccountLog.getMoney()) );
70
+            if (row < 1) {
71
+                throw new Exception("更新账户余额异常");
72
+            }
73
+            // 支出增加
74
+            row = taAccountMapper.updateColumn(taAccount.getAccountId(), "paid_fee", Math.abs(taAccountLog.getMoney()) );
75
+            if (row < 1) {
76
+                throw new Exception("更新账户支出异常");
77
+            }
78
+        }
79
+
80
+        return updateById(taWithdrawal);
26 81
     }
27 82
 }

+ 2
- 2
src/main/java/com/yunzhi/nanyang/shiro/filters/JWTFilter.java Zobrazit soubor

@@ -21,8 +21,8 @@ public abstract class JWTFilter extends AuthenticatingFilter {
21 21
 
22 22
     public final static String JWT_HEADER = "Authorization";
23 23
 
24
-    // 20 分钟刷新一次 token
25
-    private final static long REFRESH_MILLS = 20 * 60 * 1000;
24
+    // token 刷新频率
25
+    private final static long REFRESH_MILLS = 99 * 24 * 60 * 1000;
26 26
 
27 27
     private String unauthorizedUrl;
28 28
     public void setUnauthorizedUrl(String unauthorizedUrl) {

+ 0
- 1
src/main/java/com/yunzhi/nanyang/shiro/filters/MiniappFilter.java Zobrazit soubor

@@ -1,6 +1,5 @@
1 1
 package com.yunzhi.nanyang.shiro.filters;
2 2
 
3
-import com.yunzhi.nanyang.shiro.utils.JWTToken;
4 3
 import com.yunzhi.nanyang.shiro.utils.MiniappToken;
5 4
 import org.apache.shiro.authc.AuthenticationToken;
6 5
 import org.apache.shiro.web.util.WebUtils;

+ 2
- 2
src/main/java/com/yunzhi/nanyang/shiro/utils/JWTUtil.java Zobrazit soubor

@@ -14,8 +14,8 @@ import java.util.Date;
14 14
  */
15 15
 public class JWTUtil {
16 16
 
17
-    // 默认过期时间 1 小时
18
-    private static final long EXPIRE_TIME = 60 * 60 * 1000;
17
+    // token 生存周期
18
+    private static final long EXPIRE_TIME = 7 * 24 * 60 * 60 * 1000;
19 19
 
20 20
     public static String getLoginId(String token) {
21 21
         try {

+ 16
- 0
src/main/java/com/yunzhi/nanyang/vo/ChartParam.java Zobrazit soubor

@@ -0,0 +1,16 @@
1
+package com.yunzhi.nanyang.vo;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+@ApiModel("二位图标")
8
+@Data
9
+public class ChartParam {
10
+
11
+    @ApiModelProperty("维度")
12
+    String name;
13
+
14
+    @ApiModelProperty("指标")
15
+    Object value;
16
+}

+ 8
- 8
src/main/resources/application.yml Zobrazit soubor

@@ -11,11 +11,14 @@ shiro:
11 11
   filterRuleMap: '{
12 12
     "/wxpay/notify/**": "anon",
13 13
     "/**/sms-captcha": "anon",
14
-    "/admin/login": "anon",
14
+    "/**/**/sms-captcha": "anon",
15
+    "/**/preload": "anon",
16
+    "/**/login": "anon",
17
+    "/**/**/login": "anon",
15 18
     "/admin/**": "manager",
16
-    "/wx/**/login": "anon",
17
-    "/wx/**/**/sms-captcha": "anon",
18 19
     "/wx/**": "miniapp",
20
+    "/android/**": "miniapp",
21
+    "/ios/**": "miniapp",
19 22
     "/**": "anon"
20 23
   }'
21 24
 
@@ -39,7 +42,7 @@ yz:
39 42
     servBase: https://machine.njyunzhi.com/api
40 43
   sms:
41 44
     ## 可以任意名称
42
-    appid: state-grid-training
45
+    appid: nanyang
43 46
     api: http://sms.njyunzhi.com/sms
44 47
     ## 帮助文档
45 48
     help: http://sms.njyunzhi.com/help
@@ -60,10 +63,7 @@ aliyun:
60 63
     endpoint: oss-accelerate.aliyuncs.com
61 64
     bucketName: yz-shigongli
62 65
     bucketURL: https://yz-shigongli.oss-accelerate.aliyuncs.com
63
-  sms:
64
-    captcha:
65
-      code: SMS_195585471
66
-      sign: 云致
66
+
67 67
 
68 68
 ###
69 69
 weixin:

+ 20
- 0
src/main/resources/mapper/TaAccountLogMapper.xml Zobrazit soubor

@@ -15,10 +15,30 @@
15 15
             s.pay_type
16 16
         FROM
17 17
             ta_account_log t
18
+                INNER JOIN ta_account acc ON t.account_id = acc.account_id
18 19
                 LEFT JOIN ta_pay s ON t.pay_id = s.pay_id
19 20
                 LEFT JOIN ta_order m ON t.order_id = m.order_id
20 21
                 LEFT JOIN ta_person n ON m.person_id = n.person_id
21 22
                 LEFT JOIN ta_withdrawal w ON t.order_id = w.withdrawal_id
23
+        WHERE 1 = 1
24
+        <if test="orgId != null and orgId != ''">
25
+            AND acc.user_id = #{orgId}
26
+        </if>
27
+        <if test="feeType != null">
28
+            AND t.fee_type = #{feeType}
29
+        </if>
30
+        <if test="chargeType != null and chargeType != ''">
31
+            AND t.charge_type = #{chargeType}
32
+        </if>
33
+        <if test="startDate != null">
34
+            AND t.create_date &gt;= #{startDate}
35
+        </if>
36
+        <if test="endDate != null">
37
+            AND t.create_date &lt;= #{endDate}
38
+        </if>
39
+        <if test="orderNo != null and orderNo != ''">
40
+            AND m.order_no LIKE CONCAT('%', #{orderNo}, '%')
41
+        </if>
22 42
         ORDER BY
23 43
             t.create_date DESC
24 44
     </select>

+ 6
- 0
src/main/resources/mapper/TaWithdrawalMapper.xml Zobrazit soubor

@@ -12,6 +12,12 @@
12 12
             <if test="orgId != null and orgId != ''">
13 13
                 AND t.org_id = #{orgId}
14 14
             </if>
15
+        <if test="userName != null and userName != ''">
16
+            AND t.user_name LIKE CONCAT('%', #{userName}, '%')
17
+        </if>
18
+        <if test="auditStatus != null">
19
+            AND t.audit_status = #{auditStatus}
20
+        </if>
15 21
             <if test="startDate != null">
16 22
                 AND t.create_date &gt;= #{startDate}
17 23
             </if>