张延森 3 years ago
parent
commit
8f40038ba0
57 changed files with 1303 additions and 151 deletions
  1. 13
    0
      src/main/java/com/yunzhi/nanyang/common/BaseController.java
  2. 17
    0
      src/main/java/com/yunzhi/nanyang/common/Constants.java
  3. 1
    1
      src/main/java/com/yunzhi/nanyang/config/JacksonConfig.java
  4. 14
    22
      src/main/java/com/yunzhi/nanyang/controller/TaAccountController.java
  5. 32
    56
      src/main/java/com/yunzhi/nanyang/controller/TaAccountLogController.java
  6. 149
    0
      src/main/java/com/yunzhi/nanyang/controller/TaBankCardController.java
  7. 3
    2
      src/main/java/com/yunzhi/nanyang/controller/TaDispatchController.java
  8. 25
    1
      src/main/java/com/yunzhi/nanyang/controller/TaOrderController.java
  9. 201
    20
      src/main/java/com/yunzhi/nanyang/controller/TaWithdrawalController.java
  10. 37
    4
      src/main/java/com/yunzhi/nanyang/controller/TaWorkJobController.java
  11. 121
    0
      src/main/java/com/yunzhi/nanyang/controller/TdBankController.java
  12. 21
    9
      src/main/java/com/yunzhi/nanyang/controller/WxPayController.java
  13. 3
    0
      src/main/java/com/yunzhi/nanyang/entity/SysUser.java
  14. 1
    1
      src/main/java/com/yunzhi/nanyang/entity/TaAccount.java
  15. 3
    0
      src/main/java/com/yunzhi/nanyang/entity/TaAccountLog.java
  16. 55
    0
      src/main/java/com/yunzhi/nanyang/entity/TaBankCard.java
  17. 5
    0
      src/main/java/com/yunzhi/nanyang/entity/TaPerson.java
  18. 12
    1
      src/main/java/com/yunzhi/nanyang/entity/TaWithdrawal.java
  19. 20
    0
      src/main/java/com/yunzhi/nanyang/entity/TaWorkJob.java
  20. 54
    0
      src/main/java/com/yunzhi/nanyang/entity/TdBank.java
  21. 3
    0
      src/main/java/com/yunzhi/nanyang/mapper/TaAccountLogMapper.java
  22. 2
    0
      src/main/java/com/yunzhi/nanyang/mapper/TaAccountMapper.java
  23. 18
    0
      src/main/java/com/yunzhi/nanyang/mapper/TaBankCardMapper.java
  24. 2
    1
      src/main/java/com/yunzhi/nanyang/mapper/TaDispatchMapper.java
  25. 3
    1
      src/main/java/com/yunzhi/nanyang/mapper/TaOrderMapper.java
  26. 10
    0
      src/main/java/com/yunzhi/nanyang/mapper/TaWithdrawalMapper.java
  27. 12
    0
      src/main/java/com/yunzhi/nanyang/mapper/TaWorkJobMapper.java
  28. 18
    0
      src/main/java/com/yunzhi/nanyang/mapper/TdBankMapper.java
  29. 3
    0
      src/main/java/com/yunzhi/nanyang/service/ITaAccountLogService.java
  30. 5
    1
      src/main/java/com/yunzhi/nanyang/service/ITaAccountService.java
  31. 16
    0
      src/main/java/com/yunzhi/nanyang/service/ITaBankCardService.java
  32. 1
    2
      src/main/java/com/yunzhi/nanyang/service/ITaDispatchService.java
  33. 13
    1
      src/main/java/com/yunzhi/nanyang/service/ITaOrderService.java
  34. 2
    2
      src/main/java/com/yunzhi/nanyang/service/ITaPayService.java
  35. 4
    0
      src/main/java/com/yunzhi/nanyang/service/ITaWithdrawalService.java
  36. 4
    1
      src/main/java/com/yunzhi/nanyang/service/ITaWorkJobService.java
  37. 16
    0
      src/main/java/com/yunzhi/nanyang/service/ITdBankService.java
  38. 6
    0
      src/main/java/com/yunzhi/nanyang/service/impl/TaAccountLogServiceImpl.java
  39. 85
    1
      src/main/java/com/yunzhi/nanyang/service/impl/TaAccountServiceImpl.java
  40. 20
    0
      src/main/java/com/yunzhi/nanyang/service/impl/TaBankCardServiceImpl.java
  41. 2
    2
      src/main/java/com/yunzhi/nanyang/service/impl/TaDispatchServiceImpl.java
  42. 26
    2
      src/main/java/com/yunzhi/nanyang/service/impl/TaOrderServiceImpl.java
  43. 45
    12
      src/main/java/com/yunzhi/nanyang/service/impl/TaPayServiceImpl.java
  44. 7
    3
      src/main/java/com/yunzhi/nanyang/service/impl/TaPersonServiceImpl.java
  45. 7
    0
      src/main/java/com/yunzhi/nanyang/service/impl/TaWithdrawalServiceImpl.java
  46. 13
    1
      src/main/java/com/yunzhi/nanyang/service/impl/TaWorkJobServiceImpl.java
  47. 20
    0
      src/main/java/com/yunzhi/nanyang/service/impl/TdBankServiceImpl.java
  48. 34
    0
      src/main/java/com/yunzhi/nanyang/vo/AccountRecord.java
  49. 6
    4
      src/main/resources/mapper/SysMenuMapper.xml
  50. 18
    0
      src/main/resources/mapper/TaAccountLogMapper.xml
  51. 5
    0
      src/main/resources/mapper/TaAccountMapper.xml
  52. 5
    0
      src/main/resources/mapper/TaBankCardMapper.xml
  53. 4
    0
      src/main/resources/mapper/TaDispatchMapper.xml
  54. 15
    0
      src/main/resources/mapper/TaOrderMapper.xml
  55. 30
    0
      src/main/resources/mapper/TaWithdrawalMapper.xml
  56. 31
    0
      src/main/resources/mapper/TaWorkJobMapper.xml
  57. 5
    0
      src/main/resources/mapper/TdBankMapper.xml

+ 13
- 0
src/main/java/com/yunzhi/nanyang/common/BaseController.java View File

70
         return iSysUserDataScopeService.checkOrgAccess(orgId, userId);
70
         return iSysUserDataScopeService.checkOrgAccess(orgId, userId);
71
     }
71
     }
72
 
72
 
73
+    public SysUser checkWorker(TaPerson taPerson) throws Exception {
74
+        if (StringUtils.isEmpty(taPerson.getUserId())) {
75
+            throw new Exception("未绑定农机手");
76
+        }
77
+
78
+        SysUser sysUser = iSysUserService.getExistBy("user_id", taPerson.getUserId(), false, true);
79
+        if (null == sysUser) {
80
+            throw new Exception("农机手信息不存在");
81
+        }
82
+
83
+        return sysUser;
84
+    }
85
+
73
     public List<String> getAccessOrgs(String userId) {
86
     public List<String> getAccessOrgs(String userId) {
74
         return iSysUserDataScopeService.getAccessOrgs(userId);
87
         return iSysUserDataScopeService.getAccessOrgs(userId);
75
     }
88
     }

+ 17
- 0
src/main/java/com/yunzhi/nanyang/common/Constants.java View File

1
 package com.yunzhi.nanyang.common;
1
 package com.yunzhi.nanyang.common;
2
 
2
 
3
 public class Constants {
3
 public class Constants {
4
+    // 超级管理员ID
4
     public final static String ADMIN_ID = "1";
5
     public final static String ADMIN_ID = "1";
6
+    // 平台账户ID
7
+    public final static String SYSTEM_ACC_ID = "system";
5
 
8
 
6
     public final static int STATUS_DELETE = -1;
9
     public final static int STATUS_DELETE = -1;
7
     public final static int STATUS_READY = 0;
10
     public final static int STATUS_READY = 0;
15
     public final static String TARGET_MACHINERY = "machinery";  // 农机
18
     public final static String TARGET_MACHINERY = "machinery";  // 农机
16
     public final static String TARGET_NEWS = "news";    // 资讯
19
     public final static String TARGET_NEWS = "news";    // 资讯
17
 
20
 
21
+    // 账户收支类型
22
+    public final static int ACCOUNT_INCOME = 1; // 收入
23
+    public final static int ACCOUNT_EXPEND = -1; // 支出
24
+
25
+    // 账户消费类型
26
+    public final static String ACCOUNT_ORDER_PAY = "order_pay"; // 订单支付
27
+    public final static String ACCOUNT_ORDER_REFUND = "order_refund"; // 订单退款
28
+    public final static String ACCOUNT_WITHDRAW = "withdraw"; // 提现
29
+
30
+    // 审批状态
31
+    public final static int AUDIT_READY = 0;    // 待审批
32
+    public final static int AUDIT_AGREE = 1;    // 审批通过
33
+    public final static int AUDIT_DISAGREE = 2;    // 审批不通过
34
+
18
     // 订单状态
35
     // 订单状态
19
     public final static int ORDER_CANCEL = 9;  // 待支付
36
     public final static int ORDER_CANCEL = 9;  // 待支付
20
 
37
 

+ 1
- 1
src/main/java/com/yunzhi/nanyang/config/JacksonConfig.java View File

48
         // PrettyPrinter 格式化输出
48
         // PrettyPrinter 格式化输出
49
         objectMapper.configure(SerializationFeature.INDENT_OUTPUT, true);
49
         objectMapper.configure(SerializationFeature.INDENT_OUTPUT, true);
50
         // NULL不参与序列化
50
         // NULL不参与序列化
51
-        objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
51
+//        objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
52
 
52
 
53
         // 指定时区
53
         // 指定时区
54
         objectMapper.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
54
         objectMapper.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));

+ 14
- 22
src/main/java/com/yunzhi/nanyang/controller/TaAccountController.java View File

4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.yunzhi.nanyang.common.BaseController;
6
 import com.yunzhi.nanyang.common.BaseController;
7
+import com.yunzhi.nanyang.common.Constants;
7
 import com.yunzhi.nanyang.common.ResponseBean;
8
 import com.yunzhi.nanyang.common.ResponseBean;
9
+import com.yunzhi.nanyang.entity.SysUser;
10
+import com.yunzhi.nanyang.entity.TaPerson;
8
 import io.swagger.annotations.Api;
11
 import io.swagger.annotations.Api;
9
 import io.swagger.annotations.ApiOperation;
12
 import io.swagger.annotations.ApiOperation;
10
 import io.swagger.annotations.ApiParam;
13
 import io.swagger.annotations.ApiParam;
40
     public ITaAccountService iTaAccountService;
43
     public ITaAccountService iTaAccountService;
41
 
44
 
42
 
45
 
43
-    /**
44
-     * 分页查询列表
45
-     * @param pageNum
46
-     * @param pageSize
47
-     * @return
48
-     */
49
-    @RequestMapping(value="/taAccount",method= RequestMethod.GET)
50
-    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
-    public ResponseBean taAccountList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
-
54
-		    IPage<TaAccount> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<TaAccount> queryWrapper = new QueryWrapper<>();
56
-            queryWrapper.orderByDesc("create_date");
57
-
58
-            IPage<TaAccount> result = iTaAccountService.page(pg, queryWrapper);
59
-            return ResponseBean.success(result);
60
-    }
61
 
46
 
62
     /**
47
     /**
63
      * 保存对象
48
      * 保存对象
111
      * 根据id查询对象
96
      * 根据id查询对象
112
      * @param id  实体ID
97
      * @param id  实体ID
113
      */
98
      */
114
-    @RequestMapping(value="/taAccount/{id}",method= RequestMethod.GET)
115
-    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
-    public ResponseBean taAccountGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
-        return ResponseBean.success(iTaAccountService.getById(id));
99
+    @RequestMapping(value="/{client}/worker/account/mine",method= RequestMethod.GET)
100
+    @ApiOperation(value="我的钱包总额", notes = "我的钱包总额", httpMethod = "GET", response = ResponseBean.class)
101
+    public ResponseBean taAccountGet() throws Exception{
102
+        TaPerson taPerson = currentPerson();
103
+        SysUser sysUser = checkWorker(taPerson);
104
+        if (null == sysUser.getIsOrgManager() || !sysUser.getIsOrgManager()) {
105
+            return ResponseBean.error("");
106
+        }
107
+
108
+        TaAccount taAccount = iTaAccountService.getUserAccount(sysUser.getOrgId());
109
+        return ResponseBean.success(taAccount);
118
     }
110
     }
119
 }
111
 }

+ 32
- 56
src/main/java/com/yunzhi/nanyang/controller/TaAccountLogController.java View File

5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.yunzhi.nanyang.common.BaseController;
6
 import com.yunzhi.nanyang.common.BaseController;
7
 import com.yunzhi.nanyang.common.ResponseBean;
7
 import com.yunzhi.nanyang.common.ResponseBean;
8
+import com.yunzhi.nanyang.entity.SysUser;
9
+import com.yunzhi.nanyang.entity.TaAccount;
10
+import com.yunzhi.nanyang.entity.TaPerson;
11
+import com.yunzhi.nanyang.service.ITaAccountService;
12
+import com.yunzhi.nanyang.vo.AccountRecord;
8
 import io.swagger.annotations.Api;
13
 import io.swagger.annotations.Api;
9
 import io.swagger.annotations.ApiOperation;
14
 import io.swagger.annotations.ApiOperation;
10
 import io.swagger.annotations.ApiParam;
15
 import io.swagger.annotations.ApiParam;
16
+import org.apache.shiro.authz.annotation.RequiresPermissions;
11
 import org.slf4j.Logger;
17
 import org.slf4j.Logger;
12
 import org.slf4j.LoggerFactory;
18
 import org.slf4j.LoggerFactory;
13
 import org.springframework.beans.factory.annotation.Autowired;
19
 import org.springframework.beans.factory.annotation.Autowired;
39
     @Autowired
45
     @Autowired
40
     public ITaAccountLogService iTaAccountLogService;
46
     public ITaAccountLogService iTaAccountLogService;
41
 
47
 
48
+    @Autowired
49
+    public ITaAccountService iTaAccountService;
42
 
50
 
43
     /**
51
     /**
44
      * 分页查询列表
52
      * 分页查询列表
46
      * @param pageSize
54
      * @param pageSize
47
      * @return
55
      * @return
48
      */
56
      */
49
-    @RequestMapping(value="/taAccountLog",method= RequestMethod.GET)
57
+    @RequestMapping(value="/admin/account-log",method= RequestMethod.GET)
50
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
58
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
59
+    @RequiresPermissions("fi-system:view")
51
     public ResponseBean taAccountLogList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
60
     public ResponseBean taAccountLogList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
61
+                                         @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
 
62
 
54
-		    IPage<TaAccountLog> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<TaAccountLog> queryWrapper = new QueryWrapper<>();
56
-            queryWrapper.orderByDesc("create_date");
63
+        IPage<AccountRecord> pg = new Page<>(pageNum, pageSize);
57
 
64
 
58
-            IPage<TaAccountLog> result = iTaAccountLogService.page(pg, queryWrapper);
59
-            return ResponseBean.success(result);
65
+        IPage<AccountRecord> result = iTaAccountLogService.getPageBy(pg);
66
+        return ResponseBean.success(result);
60
     }
67
     }
61
 
68
 
62
     /**
69
     /**
63
-     * 保存对象
64
-     * @param taAccountLog 实体对象
70
+     * 分页查询列表
71
+     * @param pageNum
72
+     * @param pageSize
65
      * @return
73
      * @return
66
      */
74
      */
67
-    @RequestMapping(value="/taAccountLog",method= RequestMethod.POST)
68
-    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
-    public ResponseBean taAccountLogAdd(@ApiParam("保存内容") @RequestBody TaAccountLog taAccountLog) throws Exception{
70
-
71
-        if (iTaAccountLogService.save(taAccountLog)){
72
-            return ResponseBean.success(taAccountLog);
73
-        }else {
74
-            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
75
-        }
76
-    }
77
-
78
-    /**
79
-     * 根据id删除对象
80
-     * @param id  实体ID
81
-     */
82
-    @RequestMapping(value="/taAccountLog/{id}", method= RequestMethod.DELETE)
83
-    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
-    public ResponseBean taAccountLogDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
-        if(iTaAccountLogService.removeById(id)){
86
-            return ResponseBean.success("success");
87
-        }else {
88
-            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
75
+    @RequestMapping(value="/{client}/worker/account-log",method= RequestMethod.GET)
76
+    @ApiOperation(value="我的钱包明细", notes = "我的钱包明细", httpMethod = "GET", response = ResponseBean.class)
77
+    public ResponseBean taAccountList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
78
+                                      @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
79
+        TaPerson taPerson = currentPerson();
80
+        SysUser sysUser = checkWorker(taPerson);
81
+        if (null == sysUser.getIsOrgManager() || !sysUser.getIsOrgManager()) {
82
+            return ResponseBean.error("");
89
         }
83
         }
90
-    }
91
 
84
 
92
-    /**
93
-     * 修改对象
94
-     * @param id  实体ID
95
-     * @param taAccountLog 实体对象
96
-     * @return
97
-     */
98
-    @RequestMapping(value="/taAccountLog/{id}",method= RequestMethod.PUT)
99
-    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
-    public ResponseBean taAccountLogUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
-                                        @ApiParam("更新内容") @RequestBody TaAccountLog taAccountLog) throws Exception{
85
+        TaAccount taAccount = iTaAccountService.getUserAccount(sysUser.getOrgId());
102
 
86
 
103
-        if (iTaAccountLogService.updateById(taAccountLog)){
104
-            return ResponseBean.success(iTaAccountLogService.getById(id));
105
-        }else {
106
-            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
107
-        }
108
-    }
87
+        IPage<TaAccountLog> pg = new Page<>(pageNum, pageSize);
88
+        QueryWrapper<TaAccountLog> queryWrapper = new QueryWrapper<>();
89
+        queryWrapper.eq("account_id", taAccount.getAccountId());
90
+        queryWrapper.orderByDesc("create_date");
109
 
91
 
110
-    /**
111
-     * 根据id查询对象
112
-     * @param id  实体ID
113
-     */
114
-    @RequestMapping(value="/taAccountLog/{id}",method= RequestMethod.GET)
115
-    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
-    public ResponseBean taAccountLogGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
-        return ResponseBean.success(iTaAccountLogService.getById(id));
92
+        IPage<TaAccountLog> result = iTaAccountLogService.page(pg, queryWrapper);
93
+        return ResponseBean.success(result);
118
     }
94
     }
119
 }
95
 }

+ 149
- 0
src/main/java/com/yunzhi/nanyang/controller/TaBankCardController.java View File

1
+package com.yunzhi.nanyang.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.yunzhi.nanyang.common.BaseController;
7
+import com.yunzhi.nanyang.common.Constants;
8
+import com.yunzhi.nanyang.common.ResponseBean;
9
+import com.yunzhi.nanyang.entity.TaPerson;
10
+import io.swagger.annotations.Api;
11
+import io.swagger.annotations.ApiOperation;
12
+import io.swagger.annotations.ApiParam;
13
+import org.slf4j.Logger;
14
+import org.slf4j.LoggerFactory;
15
+import org.springframework.beans.factory.annotation.Autowired;
16
+import org.springframework.web.bind.annotation.PathVariable;
17
+import org.springframework.web.bind.annotation.RequestBody;
18
+import org.springframework.web.bind.annotation.RequestMapping;
19
+import org.springframework.web.bind.annotation.RequestMethod;
20
+import org.springframework.web.bind.annotation.RequestParam;
21
+import com.yunzhi.nanyang.service.ITaBankCardService;
22
+import com.yunzhi.nanyang.entity.TaBankCard;
23
+import org.springframework.web.bind.annotation.RestController;
24
+
25
+/**
26
+ * <p>
27
+    * 银行卡 前端控制器
28
+    * </p>
29
+ *
30
+ * @author yansen
31
+ * @since 2022-04-08
32
+ */
33
+
34
+@Api(tags = "银行卡")
35
+@RestController
36
+@RequestMapping("/")
37
+public class TaBankCardController extends BaseController {
38
+
39
+    private final Logger logger = LoggerFactory.getLogger(TaBankCardController.class);
40
+
41
+    @Autowired
42
+    public ITaBankCardService iTaBankCardService;
43
+
44
+
45
+    /**
46
+     * 分页查询列表
47
+     * @param pageNum
48
+     * @param pageSize
49
+     * @return
50
+     */
51
+    @RequestMapping(value="/{client}/worker/bankcard",method= RequestMethod.GET)
52
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
53
+    public ResponseBean taBankCardList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
54
+									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
55
+        TaPerson taPerson = currentPerson();
56
+        checkWorker(taPerson);
57
+
58
+        IPage<TaBankCard> pg = new Page<>(pageNum, pageSize);
59
+        QueryWrapper<TaBankCard> queryWrapper = new QueryWrapper<>();
60
+        queryWrapper.gt("status", Constants.STATUS_DELETE);
61
+        queryWrapper.eq("person_id", taPerson.getPersonId());
62
+        queryWrapper.orderByDesc("create_date");
63
+
64
+        IPage<TaBankCard> result = iTaBankCardService.page(pg, queryWrapper);
65
+        return ResponseBean.success(result);
66
+    }
67
+
68
+    /**
69
+     * 保存对象
70
+     * @param taBankCard 实体对象
71
+     * @return
72
+     */
73
+    @RequestMapping(value="/{client}/worker/bankcard",method= RequestMethod.POST)
74
+    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
75
+    public ResponseBean taBankCardAdd(@ApiParam("保存内容") @RequestBody TaBankCard taBankCard) throws Exception{
76
+        TaPerson taPerson = currentPerson();
77
+        checkWorker(taPerson);
78
+
79
+        taBankCard.setPersonId(taPerson.getPersonId());
80
+        if (iTaBankCardService.save(taBankCard)){
81
+            return ResponseBean.success(taBankCard);
82
+        }else {
83
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
84
+        }
85
+    }
86
+
87
+    /**
88
+     * 根据id删除对象
89
+     * @param id  实体ID
90
+     */
91
+    @RequestMapping(value="/{client}/worker/bankcard/{id}", method= RequestMethod.DELETE)
92
+    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
93
+    public ResponseBean taBankCardDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
94
+        TaBankCard bankCard = validate(id);
95
+
96
+        if(iTaBankCardService.removeLogicById(id)){
97
+            return ResponseBean.success("success");
98
+        }else {
99
+            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
100
+        }
101
+    }
102
+
103
+    /**
104
+     * 修改对象
105
+     * @param id  实体ID
106
+     * @param taBankCard 实体对象
107
+     * @return
108
+     */
109
+    @RequestMapping(value="/{client}/worker/bankcard/{id}",method= RequestMethod.PUT)
110
+    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
111
+    public ResponseBean taBankCardUpdate(@ApiParam("对象ID") @PathVariable String id,
112
+                                        @ApiParam("更新内容") @RequestBody TaBankCard taBankCard) throws Exception{
113
+        TaBankCard bankCard = validate(id);
114
+        taBankCard.setCardId(id);
115
+        taBankCard.setPersonId(bankCard.getPersonId());
116
+
117
+        if (iTaBankCardService.updateById(taBankCard)){
118
+            return ResponseBean.success(iTaBankCardService.getById(id));
119
+        }else {
120
+            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
121
+        }
122
+    }
123
+
124
+    /**
125
+     * 根据id查询对象
126
+     * @param id  实体ID
127
+     */
128
+    @RequestMapping(value="/{client}/worker/bankcard/{id}",method= RequestMethod.GET)
129
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
130
+    public ResponseBean taBankCardGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
131
+        return ResponseBean.success(validate(id));
132
+    }
133
+
134
+    private TaBankCard validate(String cardId) throws Exception {
135
+        TaPerson taPerson = currentPerson();
136
+        checkWorker(taPerson);
137
+
138
+        TaBankCard bankCard = iTaBankCardService.getExistBy("card_id", cardId, false, true);
139
+        if (null == bankCard) {
140
+            throw new Exception("银行卡不存在");
141
+        }
142
+
143
+        if (!taPerson.getPersonId().equals(bankCard.getPersonId())) {
144
+            throw new Exception("无权操作");
145
+        }
146
+
147
+        return bankCard;
148
+    }
149
+}

+ 3
- 2
src/main/java/com/yunzhi/nanyang/controller/TaDispatchController.java View File

79
                                        @ApiParam(value = "预约开始", example = "2022-03-01") @RequestParam(value ="startDate",required = false) String startDate,
79
                                        @ApiParam(value = "预约开始", example = "2022-03-01") @RequestParam(value ="startDate",required = false) String startDate,
80
                                        @ApiParam(value = "预约结束", example = "2022-03-31") @RequestParam(value ="endDate",required = false) String endDate,
80
                                        @ApiParam(value = "预约结束", example = "2022-03-31") @RequestParam(value ="endDate",required = false) String endDate,
81
                                        @ApiParam("手机号") @RequestParam(value ="phone",required = false) String phone,
81
                                        @ApiParam("手机号") @RequestParam(value ="phone",required = false) String phone,
82
-                                       @ApiParam("状态") @RequestParam(value ="status", required = false) String status) throws Exception{
82
+                                       @ApiParam("状态") @RequestParam(value ="status", required = false) String status,
83
+                                       @ApiParam("状态") @RequestParam(value ="isWarn", defaultValue = "false") Boolean isWarn) throws Exception{
83
 
84
 
84
         SysUser user = currentUser();
85
         SysUser user = currentUser();
85
         if (!Constants.ADMIN_ID.equals(user.getUserId()) && !StringUtils.isEmpty(orgId)) {
86
         if (!Constants.ADMIN_ID.equals(user.getUserId()) && !StringUtils.isEmpty(orgId)) {
93
         LocalDateTime start = DateUtils.getDayStart(startDate);
94
         LocalDateTime start = DateUtils.getDayStart(startDate);
94
         LocalDateTime end = DateUtils.getDayEnd(endDate);
95
         LocalDateTime end = DateUtils.getDayEnd(endDate);
95
 
96
 
96
-        IPage<TaOrder> result = iTaDispatchService.getPageBy(pg, orgId, typeId, machineryId, start, end, phone, status);
97
+        IPage<TaOrder> result = iTaDispatchService.getPageBy(pg, orgId, typeId, machineryId, start, end, phone, status, isWarn);
97
         return ResponseBean.success(result);
98
         return ResponseBean.success(result);
98
     }
99
     }
99
 
100
 

+ 25
- 1
src/main/java/com/yunzhi/nanyang/controller/TaOrderController.java View File

56
     @Autowired
56
     @Autowired
57
     public ITaPayService iTaPayService;
57
     public ITaPayService iTaPayService;
58
 
58
 
59
+    @Autowired
60
+    public ITaDispatchService iTaDispatchService;
61
+
59
     /**
62
     /**
60
      * 分页查询列表
63
      * 分页查询列表
61
      * @param pageNum
64
      * @param pageNum
66
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
69
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
67
     public ResponseBean getList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
70
     public ResponseBean getList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
68
                                 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
71
                                 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
72
+                                @ApiParam("是否预警") @RequestParam(value ="isWarn", defaultValue = "false") Boolean isWarn,
69
                                 @ApiParam("机构") @RequestParam(value ="orgId", required = false) String orgId,
73
                                 @ApiParam("机构") @RequestParam(value ="orgId", required = false) String orgId,
74
+                                @ApiParam("订单号") @RequestParam(value ="orderNo", required = false) String orderNo,
70
                                 @ApiParam("农机") @RequestParam(value ="machineryId", required = false) String machineryId,
75
                                 @ApiParam("农机") @RequestParam(value ="machineryId", required = false) String machineryId,
71
                                 @ApiParam("类型") @RequestParam(value ="typeId", required = false) String typeId,
76
                                 @ApiParam("类型") @RequestParam(value ="typeId", required = false) String typeId,
72
                                 @ApiParam("下单人") @RequestParam(value ="personName", required = false) String personName,
77
                                 @ApiParam("下单人") @RequestParam(value ="personName", required = false) String personName,
85
         }
90
         }
86
 
91
 
87
         IPage<TaOrder> pg = new Page<>(pageNum, pageSize);
92
         IPage<TaOrder> pg = new Page<>(pageNum, pageSize);
88
-        IPage<TaOrder> result = iTaOrderService.getAdminPage(pg, isAdmin ? null : current, orgId, machineryId, typeId, personName, phone, payStatus, dispatchStatus, workStatus, isEvaluated);
93
+        IPage<TaOrder> result = iTaOrderService.getAdminPage(pg,
94
+                isAdmin ? null : current.getUserId(),
95
+                orgId,
96
+                orderNo,
97
+                machineryId,
98
+                typeId,
99
+                personName,
100
+                phone,
101
+                payStatus,
102
+                dispatchStatus,
103
+                workStatus,
104
+                isEvaluated,
105
+                isWarn);
106
+
89
         return ResponseBean.success(result);
107
         return ResponseBean.success(result);
90
     }
108
     }
91
 
109
 
226
             throw new Exception("订单机构不存在");
244
             throw new Exception("订单机构不存在");
227
         }
245
         }
228
 
246
 
247
+        TaDispatch taDispatch = iTaDispatchService.getExistBy("order_id", taOrder.getOrderId(), false, true);
248
+        if (taDispatch != null) {
249
+            taOrder.setWorkId(taDispatch.getWorkerId());
250
+            taOrder.setWorkName(taDispatch.getWorkerName());
251
+        }
252
+
229
         taOrder.setOrgName(taOrg.getName());
253
         taOrder.setOrgName(taOrg.getName());
230
 
254
 
231
         TaPerson taPerson = iTaPersonService.getById(taOrder.getPersonId());
255
         TaPerson taPerson = iTaPersonService.getById(taOrder.getPersonId());

+ 201
- 20
src/main/java/com/yunzhi/nanyang/controller/TaWithdrawalController.java View File

3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.*;
7
+import com.yunzhi.nanyang.entity.*;
8
+import com.yunzhi.nanyang.service.ISysUserService;
9
+import com.yunzhi.nanyang.service.ITaAccountService;
10
+import com.yunzhi.nanyang.service.ITaBankCardService;
8
 import io.swagger.annotations.Api;
11
 import io.swagger.annotations.Api;
9
 import io.swagger.annotations.ApiOperation;
12
 import io.swagger.annotations.ApiOperation;
10
 import io.swagger.annotations.ApiParam;
13
 import io.swagger.annotations.ApiParam;
17
 import org.springframework.web.bind.annotation.RequestMethod;
20
 import org.springframework.web.bind.annotation.RequestMethod;
18
 import org.springframework.web.bind.annotation.RequestParam;
21
 import org.springframework.web.bind.annotation.RequestParam;
19
 import com.yunzhi.nanyang.service.ITaWithdrawalService;
22
 import com.yunzhi.nanyang.service.ITaWithdrawalService;
20
-import com.yunzhi.nanyang.entity.TaWithdrawal;
21
 import org.springframework.web.bind.annotation.RestController;
23
 import org.springframework.web.bind.annotation.RestController;
22
 
24
 
25
+import java.time.LocalDateTime;
26
+
23
 /**
27
 /**
24
  * <p>
28
  * <p>
25
     * 提现表 前端控制器
29
     * 提现表 前端控制器
39
     @Autowired
43
     @Autowired
40
     public ITaWithdrawalService iTaWithdrawalService;
44
     public ITaWithdrawalService iTaWithdrawalService;
41
 
45
 
46
+    @Autowired
47
+    public ISysUserService iSysUserService;
48
+
49
+    @Autowired
50
+    public ITaBankCardService iTaBankCardService;
51
+
52
+    @Autowired
53
+    public ITaAccountService iTaAccountService;
54
+
42
 
55
 
43
     /**
56
     /**
44
      * 分页查询列表
57
      * 分页查询列表
46
      * @param pageSize
59
      * @param pageSize
47
      * @return
60
      * @return
48
      */
61
      */
49
-    @RequestMapping(value="/taWithdrawal",method= RequestMethod.GET)
62
+    @RequestMapping(value="/admin/withdrawal",method= RequestMethod.GET)
50
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
63
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
     public ResponseBean taWithdrawalList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
64
     public ResponseBean taWithdrawalList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
65
+                                         @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
66
+                                         @ApiParam("机构ID") @RequestParam(value ="orgId", required = false) String orgId,
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{
69
+
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
+        }
53
 
81
 
54
-		    IPage<TaWithdrawal> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<TaWithdrawal> queryWrapper = new QueryWrapper<>();
56
-            queryWrapper.orderByDesc("create_date");
82
+        LocalDateTime startDate = DateUtils.getDayStart(start);
83
+        LocalDateTime endDate = DateUtils.getDayEnd(end);
57
 
84
 
58
-            IPage<TaWithdrawal> result = iTaWithdrawalService.page(pg, queryWrapper);
59
-            return ResponseBean.success(result);
85
+        IPage<TaWithdrawal> pg = new Page<>(pageNum, pageSize);
86
+        IPage<TaWithdrawal> result = iTaWithdrawalService.getPageBy(pg, orgId, startDate, endDate);
87
+        return ResponseBean.success(result);
60
     }
88
     }
61
 
89
 
62
     /**
90
     /**
64
      * @param taWithdrawal 实体对象
92
      * @param taWithdrawal 实体对象
65
      * @return
93
      * @return
66
      */
94
      */
67
-    @RequestMapping(value="/taWithdrawal",method= RequestMethod.POST)
95
+    @RequestMapping(value="/{client}/worker/withdrawal",method= RequestMethod.POST)
68
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
96
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
     public ResponseBean taWithdrawalAdd(@ApiParam("保存内容") @RequestBody TaWithdrawal taWithdrawal) throws Exception{
97
     public ResponseBean taWithdrawalAdd(@ApiParam("保存内容") @RequestBody TaWithdrawal taWithdrawal) throws Exception{
98
+        TaPerson taPerson = currentPerson();
99
+        SysUser sysUser = checkWorker(taPerson);
100
+        if (null == sysUser) {
101
+            return ResponseBean.error("农机手信息异常");
102
+        }
103
+
104
+        if (null == sysUser.getIsOrgManager() || !sysUser.getIsOrgManager()) {
105
+            return ResponseBean.error("暂无权限进行当前操作");
106
+        }
107
+
108
+        if (!StringUtils.isEmpty(taWithdrawal.getAccountCardNo())) {
109
+            TaBankCard bankCard = iTaBankCardService.getById(taWithdrawal.getAccountCardNo());
110
+            if (null == bankCard || !taPerson.getPersonId().equals(bankCard.getPersonId())) {
111
+                return ResponseBean.error("银行卡校验异常");
112
+            }
113
+        }
114
+
115
+        if (!iTaAccountService.checkAmount(sysUser.getOrgId(), taWithdrawal.getMoney(), true)) {
116
+            return ResponseBean.error("账户余额不足");
117
+        }
118
+
119
+        taWithdrawal.setAuditStatus(Constants.AUDIT_READY);
120
+        taWithdrawal.setUserId(sysUser.getUserId());
121
+        taWithdrawal.setUserName(sysUser.getUserName());
122
+        taWithdrawal.setOrgId(sysUser.getOrgId());
70
 
123
 
71
         if (iTaWithdrawalService.save(taWithdrawal)){
124
         if (iTaWithdrawalService.save(taWithdrawal)){
72
             return ResponseBean.success(taWithdrawal);
125
             return ResponseBean.success(taWithdrawal);
79
      * 根据id删除对象
132
      * 根据id删除对象
80
      * @param id  实体ID
133
      * @param id  实体ID
81
      */
134
      */
82
-    @RequestMapping(value="/taWithdrawal/{id}", method= RequestMethod.DELETE)
135
+    @RequestMapping(value="/{client}/worker/withdrawal/{id}", method= RequestMethod.DELETE)
83
     @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
136
     @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
-    public ResponseBean taWithdrawalDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
-        if(iTaWithdrawalService.removeById(id)){
137
+    public ResponseBean taWithdrawalDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
138
+        TaPerson taPerson = currentPerson();
139
+        SysUser sysUser = checkWorker(taPerson);
140
+        if (null == sysUser) {
141
+            return ResponseBean.error("农机手信息异常");
142
+        }
143
+
144
+        if (null == sysUser.getIsOrgManager() || !sysUser.getIsOrgManager()) {
145
+            return ResponseBean.error("暂无权限进行当前操作");
146
+        }
147
+
148
+        TaWithdrawal taWithdrawal = iTaWithdrawalService.getExistBy("withdrawal_id", id, false, true);
149
+        if (null == taWithdrawal || !sysUser.getUserId().equals(taWithdrawal.getUserId())) {
150
+            return ResponseBean.error("暂无权限进行当前操作");
151
+        }
152
+
153
+        Integer auditStatus = taWithdrawal.getAuditStatus();
154
+        if (null != auditStatus && auditStatus != Constants.AUDIT_READY) {
155
+            return ResponseBean.error("申请已进入审批流程");
156
+        }
157
+
158
+        if(iTaWithdrawalService.removeLogicById(id)){
86
             return ResponseBean.success("success");
159
             return ResponseBean.success("success");
87
         }else {
160
         }else {
88
             return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
161
             return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
95
      * @param taWithdrawal 实体对象
168
      * @param taWithdrawal 实体对象
96
      * @return
169
      * @return
97
      */
170
      */
98
-    @RequestMapping(value="/taWithdrawal/{id}",method= RequestMethod.PUT)
171
+    @RequestMapping(value="/{client}/worker/withdrawal/{id}",method= RequestMethod.PUT)
99
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
172
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
-    public ResponseBean taWithdrawalUpdate(@ApiParam("对象ID") @PathVariable Integer id,
173
+    public ResponseBean taWithdrawalUpdate(@ApiParam("对象ID") @PathVariable String id,
101
                                         @ApiParam("更新内容") @RequestBody TaWithdrawal taWithdrawal) throws Exception{
174
                                         @ApiParam("更新内容") @RequestBody TaWithdrawal taWithdrawal) throws Exception{
175
+        TaPerson taPerson = currentPerson();
176
+        SysUser sysUser = checkWorker(taPerson);
177
+        if (null == sysUser) {
178
+            return ResponseBean.error("农机手信息异常");
179
+        }
180
+
181
+        if (null == sysUser.getIsOrgManager() || !sysUser.getIsOrgManager()) {
182
+            return ResponseBean.error("暂无权限进行当前操作");
183
+        }
184
+
185
+        TaWithdrawal origin = iTaWithdrawalService.getExistBy("withdrawal_id", id, false, true);
186
+        if (null == origin || !sysUser.getUserId().equals(origin.getUserId())) {
187
+            return ResponseBean.error("暂无权限进行当前操作");
188
+        }
189
+
190
+        Integer auditStatus = origin.getAuditStatus();
191
+        if (null != auditStatus && auditStatus != Constants.AUDIT_READY) {
192
+            return ResponseBean.error("申请已进入审批流程");
193
+        }
194
+
195
+        // 只允许修改 金额与卡号
196
+        if (!StringUtils.isEmpty(taWithdrawal.getAccountCardNo())) {
197
+            TaBankCard bankCard = iTaBankCardService.getById(taWithdrawal.getAccountCardNo());
198
+            if (null == bankCard || !taPerson.getPersonId().equals(bankCard.getPersonId())) {
199
+                return ResponseBean.error("银行卡校验异常");
200
+            }
201
+        }
202
+
203
+        if (!iTaAccountService.checkAmount(origin.getOrgId(), taWithdrawal.getMoney(), true)) {
204
+            return ResponseBean.error("账户余额不足");
205
+        }
206
+
207
+        origin.setMoney(taWithdrawal.getMoney());
208
+        origin.setAccountCardNo(taWithdrawal.getAccountCardNo());
209
+        origin.setAccountCardType(taWithdrawal.getAccountCardType());
210
+
211
+        if (iTaWithdrawalService.updateById(origin)){
212
+            return ResponseBean.success(iTaWithdrawalService.getById(id));
213
+        }else {
214
+            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
215
+        }
216
+    }
217
+
218
+
219
+    /**
220
+     * 修改对象
221
+     * @param id  实体ID
222
+     * @param taWithdrawal 实体对象
223
+     * @return
224
+     */
225
+    @RequestMapping(value="/admin/withdrawal/{id}",method= RequestMethod.PUT)
226
+    @ApiOperation(value="审批", notes = "审批", httpMethod = "PUT", response = ResponseBean.class)
227
+    public ResponseBean taWithdrawalAudit(@ApiParam("对象ID") @PathVariable String id,
228
+                                          @ApiParam("更新内容") @RequestBody TaWithdrawal taWithdrawal) throws Exception{
229
+        SysUser sysUser = currentUser();
230
+
231
+        TaWithdrawal origin = iTaWithdrawalService.getExistBy("withdrawal_id", id, false, true);
232
+        if (null == origin) {
233
+            return ResponseBean.error("申请不存在");
234
+        }
235
+
236
+        String orgId = origin.getOrgId();
237
+        boolean isAdmin = Constants.ADMIN_ID.equals(sysUser.getUserId());
238
+        if (!isAdmin) {
239
+            if (!checkOrgAccess(orgId, sysUser.getUserId())) {
240
+                return ResponseBean.error("暂无操作权限");
241
+            }
242
+        }
243
+
244
+        // 不能重复审批, 因为审批有账户操作
245
+        Integer auditStatus = origin.getAuditStatus();
246
+        if (null != auditStatus && auditStatus > Constants.AUDIT_READY) {
247
+            return ResponseBean.error("审批流程已走完");
248
+        }
249
+
250
+        if (!iTaAccountService.checkAmount(orgId, taWithdrawal.getMoney(), false) && Constants.AUDIT_AGREE == taWithdrawal.getAuditStatus()) {
251
+            return ResponseBean.error("账户余额不足");
252
+        }
253
+
254
+        // 只允许修改审批相关信息
255
+        origin.setAuditUser(sysUser.getUserId());
256
+        origin.setAuditUserName(sysUser.getUserName());
257
+        origin.setAuditStatus(taWithdrawal.getAuditStatus());
258
+        origin.setAuditRemark(taWithdrawal.getAuditRemark());
259
+
260
+        if (iTaWithdrawalService.updateById(origin)){
261
+
262
+            // 处理账户信息
263
+            iTaAccountService.withdraw(origin);
102
 
264
 
103
-        if (iTaWithdrawalService.updateById(taWithdrawal)){
104
             return ResponseBean.success(iTaWithdrawalService.getById(id));
265
             return ResponseBean.success(iTaWithdrawalService.getById(id));
105
         }else {
266
         }else {
106
             return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
267
             return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
111
      * 根据id查询对象
272
      * 根据id查询对象
112
      * @param id  实体ID
273
      * @param id  实体ID
113
      */
274
      */
114
-    @RequestMapping(value="/taWithdrawal/{id}",method= RequestMethod.GET)
275
+    @RequestMapping(value="/admin/withdrawal/{id}",method= RequestMethod.GET)
115
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
276
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
-    public ResponseBean taWithdrawalGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
-        return ResponseBean.success(iTaWithdrawalService.getById(id));
277
+    public ResponseBean taWithdrawalGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
278
+        TaWithdrawal taWithdrawal = iTaWithdrawalService.getExistBy("withdrawal_id", id, false, true);
279
+        if (null == taWithdrawal) {
280
+            return ResponseBean.error("提现申请不存在");
281
+        }
282
+
283
+        SysUser sysUser = currentUser();
284
+        String orgId = taWithdrawal.getOrgId();
285
+        boolean isAdmin = Constants.ADMIN_ID.equals(sysUser.getUserId());
286
+        if (!isAdmin) {
287
+            if (!checkOrgAccess(orgId, sysUser.getUserId())) {
288
+                return ResponseBean.error("暂无数据查询权限");
289
+            }
290
+        }
291
+
292
+        TaBankCard taBankCard = iTaBankCardService.getById(taWithdrawal.getAccountCardNo());
293
+        taWithdrawal.setBankCard(taBankCard);
294
+
295
+        TaAccount taAccount = iTaAccountService.getUserAccount(taWithdrawal.getOrgId());
296
+        taWithdrawal.setAmountLeft(taAccount.getAmounts());
297
+
298
+        return ResponseBean.success(taWithdrawal);
118
     }
299
     }
119
 }
300
 }

+ 37
- 4
src/main/java/com/yunzhi/nanyang/controller/TaWorkJobController.java View File

3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
-import com.yunzhi.nanyang.common.BaseController;
7
-import com.yunzhi.nanyang.common.Constants;
8
-import com.yunzhi.nanyang.common.ResponseBean;
9
-import com.yunzhi.nanyang.common.StringUtils;
6
+import com.yunzhi.nanyang.common.*;
10
 import com.yunzhi.nanyang.entity.*;
7
 import com.yunzhi.nanyang.entity.*;
11
 import com.yunzhi.nanyang.service.*;
8
 import com.yunzhi.nanyang.service.*;
12
 import io.swagger.annotations.Api;
9
 import io.swagger.annotations.Api;
55
     @Autowired
52
     @Autowired
56
     public ITaMachineryService iTaMachineryService;
53
     public ITaMachineryService iTaMachineryService;
57
 
54
 
55
+
56
+    /**
57
+     * 分页查询列表
58
+     * @param pageNum
59
+     * @param pageSize
60
+     * @return
61
+     */
62
+    @RequestMapping(value="/admin/work-job",method= RequestMethod.GET)
63
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
64
+    public ResponseBean getList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
65
+                                @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
66
+                                @ApiParam(value = "合作社ID") @RequestParam(value ="orgId", required = false) String orgId,
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,
69
+                                @ApiParam(value = "订单号") @RequestParam(value ="orderNo", required = false) String orderNo,
70
+                                @ApiParam(value = "农机型号ID") @RequestParam(value ="machineryTypeId", required = false) String machineryTypeId,
71
+                                @ApiParam(value = "农机ID") @RequestParam(value ="machineryId", required = false) String machineryId,
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
+        }
79
+
80
+        LocalDateTime startDate = DateUtils.getDayStart(start);
81
+        LocalDateTime endDate = DateUtils.getDayEnd(end);
82
+
83
+        Integer status = Constants.WORK_DONE;
84
+
85
+        IPage<TaWorkJob> pg = new Page<>(pageNum, pageSize);
86
+        IPage<TaWorkJob> result = iTaWorkJobService.getAdminPageBy(pg, orgId, startDate, endDate, status, orderNo, machineryTypeId, machineryId, workerName);
87
+        return ResponseBean.success(result);
88
+    }
89
+
90
+
58
     /**
91
     /**
59
      * 分页查询列表
92
      * 分页查询列表
60
      * @param pageNum
93
      * @param pageNum

+ 121
- 0
src/main/java/com/yunzhi/nanyang/controller/TdBankController.java View File

1
+package com.yunzhi.nanyang.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.yunzhi.nanyang.common.BaseController;
7
+import com.yunzhi.nanyang.common.Constants;
8
+import com.yunzhi.nanyang.common.ResponseBean;
9
+import io.swagger.annotations.Api;
10
+import io.swagger.annotations.ApiOperation;
11
+import io.swagger.annotations.ApiParam;
12
+import org.slf4j.Logger;
13
+import org.slf4j.LoggerFactory;
14
+import org.springframework.beans.factory.annotation.Autowired;
15
+import org.springframework.web.bind.annotation.PathVariable;
16
+import org.springframework.web.bind.annotation.RequestBody;
17
+import org.springframework.web.bind.annotation.RequestMapping;
18
+import org.springframework.web.bind.annotation.RequestMethod;
19
+import org.springframework.web.bind.annotation.RequestParam;
20
+import com.yunzhi.nanyang.service.ITdBankService;
21
+import com.yunzhi.nanyang.entity.TdBank;
22
+import org.springframework.web.bind.annotation.RestController;
23
+
24
+/**
25
+ * <p>
26
+    * 银行 前端控制器
27
+    * </p>
28
+ *
29
+ * @author yansen
30
+ * @since 2022-04-10
31
+ */
32
+
33
+@Api(tags = "银行")
34
+@RestController
35
+@RequestMapping("/")
36
+public class TdBankController extends BaseController {
37
+
38
+    private final Logger logger = LoggerFactory.getLogger(TdBankController.class);
39
+
40
+    @Autowired
41
+    public ITdBankService iTdBankService;
42
+
43
+
44
+    /**
45
+     * 分页查询列表
46
+     * @param pageNum
47
+     * @param pageSize
48
+     * @return
49
+     */
50
+    @RequestMapping(value="/{client}/{clientId}/bank",method= RequestMethod.GET)
51
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
52
+    public ResponseBean tdBankList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
53
+                                   @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
54
+
55
+        IPage<TdBank> pg = new Page<>(pageNum, pageSize);
56
+        QueryWrapper<TdBank> queryWrapper = new QueryWrapper<>();
57
+        queryWrapper.eq("status", Constants.STATUS_NORMAL);
58
+        queryWrapper.orderByAsc("sort_no");
59
+
60
+        IPage<TdBank> result = iTdBankService.page(pg, queryWrapper);
61
+        return ResponseBean.success(result);
62
+    }
63
+
64
+//    /**
65
+//     * 保存对象
66
+//     * @param tdBank 实体对象
67
+//     * @return
68
+//     */
69
+//    @RequestMapping(value="/tdBank",method= RequestMethod.POST)
70
+//    @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
71
+//    public ResponseBean tdBankAdd(@ApiParam("保存内容") @RequestBody TdBank tdBank) throws Exception{
72
+//
73
+//        if (iTdBankService.save(tdBank)){
74
+//            return ResponseBean.success(tdBank);
75
+//        }else {
76
+//            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
77
+//        }
78
+//    }
79
+//
80
+//    /**
81
+//     * 根据id删除对象
82
+//     * @param id  实体ID
83
+//     */
84
+//    @RequestMapping(value="/tdBank/{id}", method= RequestMethod.DELETE)
85
+//    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
86
+//    public ResponseBean tdBankDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
87
+//        if(iTdBankService.removeById(id)){
88
+//            return ResponseBean.success("success");
89
+//        }else {
90
+//            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
91
+//        }
92
+//    }
93
+//
94
+//    /**
95
+//     * 修改对象
96
+//     * @param id  实体ID
97
+//     * @param tdBank 实体对象
98
+//     * @return
99
+//     */
100
+//    @RequestMapping(value="/tdBank/{id}",method= RequestMethod.PUT)
101
+//    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
102
+//    public ResponseBean tdBankUpdate(@ApiParam("对象ID") @PathVariable Integer id,
103
+//                                        @ApiParam("更新内容") @RequestBody TdBank tdBank) throws Exception{
104
+//
105
+//        if (iTdBankService.updateById(tdBank)){
106
+//            return ResponseBean.success(iTdBankService.getById(id));
107
+//        }else {
108
+//            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
109
+//        }
110
+//    }
111
+//
112
+//    /**
113
+//     * 根据id查询对象
114
+//     * @param id  实体ID
115
+//     */
116
+//    @RequestMapping(value="/tdBank/{id}",method= RequestMethod.GET)
117
+//    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
118
+//    public ResponseBean tdBankGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
119
+//        return ResponseBean.success(iTdBankService.getById(id));
120
+//    }
121
+}

+ 21
- 9
src/main/java/com/yunzhi/nanyang/controller/WxPayController.java View File

1
 package com.yunzhi.nanyang.controller;
1
 package com.yunzhi.nanyang.controller;
2
 
2
 
3
 import com.github.binarywang.wxpay.bean.notify.*;
3
 import com.github.binarywang.wxpay.bean.notify.*;
4
+import com.github.binarywang.wxpay.exception.WxPayException;
4
 import com.github.binarywang.wxpay.service.WxPayService;
5
 import com.github.binarywang.wxpay.service.WxPayService;
5
 import com.yunzhi.nanyang.common.BaseController;
6
 import com.yunzhi.nanyang.common.BaseController;
6
 import com.yunzhi.nanyang.common.WxUtils;
7
 import com.yunzhi.nanyang.common.WxUtils;
25
 
26
 
26
     @ResponseBody
27
     @ResponseBody
27
     @RequestMapping("/notify/order")
28
     @RequestMapping("/notify/order")
28
-    public String payNotify(@RequestBody String jsonData) throws Exception {
29
+    public String payNotify(@RequestBody String jsonData) {
29
         WxPayService payService = wxUtils.getPayService();
30
         WxPayService payService = wxUtils.getPayService();
30
-        WxPayOrderNotifyV3Result result = payService.parseOrderNotifyV3Result(jsonData, null);
31
+        WxPayOrderNotifyV3Result result = null;
32
+        try {
33
+            result = payService.parseOrderNotifyV3Result(jsonData, null);
34
+            orderPayService.notifyOrder(result.getResult());
35
+            return WxPayNotifyResponse.success("OK");
36
+        } catch (Exception e) {
37
+            e.printStackTrace();
38
+            return WxPayNotifyResponse.fail(e.getMessage());
39
+        }
31
 
40
 
32
-        orderPayService.notifyOrder(result.getResult());
33
 
41
 
34
-        return WxPayNotifyResponse.success("OK");
35
     }
42
     }
36
 
43
 
37
     @ResponseBody
44
     @ResponseBody
38
     @RequestMapping("/notify/refund")
45
     @RequestMapping("/notify/refund")
39
-    public String refundNotify(@RequestBody String jsonData) throws Exception {
46
+    public String refundNotify(@RequestBody String jsonData) {
40
         WxPayService payService = wxUtils.getPayService();
47
         WxPayService payService = wxUtils.getPayService();
41
-        WxPayRefundNotifyV3Result result = payService.parseRefundNotifyV3Result(jsonData, null);
48
+        WxPayRefundNotifyV3Result result = null;
49
+        try {
50
+            result = payService.parseRefundNotifyV3Result(jsonData, null);
51
+            orderPayService.refundNotifyOrder(result.getResult());
52
+            return WxPayNotifyResponse.success("OK");
53
+        } catch (Exception e) {
54
+            e.printStackTrace();
55
+            return WxPayNotifyResponse.fail(e.getMessage());
56
+        }
42
 
57
 
43
-        orderPayService.refundNotifyOrder(result.getResult());
44
-
45
-        return WxPayNotifyResponse.success("OK");
46
     }
58
     }
47
 
59
 
48
 }
60
 }

+ 3
- 0
src/main/java/com/yunzhi/nanyang/entity/SysUser.java View File

50
     @ApiModelProperty(value = "机构ID")
50
     @ApiModelProperty(value = "机构ID")
51
     private String orgId;
51
     private String orgId;
52
 
52
 
53
+    @ApiModelProperty(value = "是否机构管理员")
54
+    private Boolean isOrgManager;
55
+
53
     @ApiModelProperty(value = "状态")
56
     @ApiModelProperty(value = "状态")
54
     private Integer status;
57
     private Integer status;
55
 
58
 

+ 1
- 1
src/main/java/com/yunzhi/nanyang/entity/TaAccount.java View File

27
     private static final long serialVersionUID = 1L;
27
     private static final long serialVersionUID = 1L;
28
 
28
 
29
     @ApiModelProperty(value = "账户id")
29
     @ApiModelProperty(value = "账户id")
30
-    @TableId(value = "account_id", type = IdType.INPUT)
30
+    @TableId(value = "account_id", type = IdType.UUID)
31
     private String accountId;
31
     private String accountId;
32
 
32
 
33
     @ApiModelProperty(value = "人员ID;1银行卡号2微信账户3支付宝账户")
33
     @ApiModelProperty(value = "人员ID;1银行卡号2微信账户3支付宝账户")

+ 3
- 0
src/main/java/com/yunzhi/nanyang/entity/TaAccountLog.java View File

30
     @TableId(value = "log_id", type = IdType.AUTO)
30
     @TableId(value = "log_id", type = IdType.AUTO)
31
     private Integer logId;
31
     private Integer logId;
32
 
32
 
33
+    @ApiModelProperty(value = "支付Id")
34
+    private String payId;
35
+
33
     @ApiModelProperty(value = "账户Id")
36
     @ApiModelProperty(value = "账户Id")
34
     private String accountId;
37
     private String accountId;
35
 
38
 

+ 55
- 0
src/main/java/com/yunzhi/nanyang/entity/TaBankCard.java View File

1
+package com.yunzhi.nanyang.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import java.time.LocalDateTime;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import java.io.Serializable;
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Data;
10
+import lombok.EqualsAndHashCode;
11
+import lombok.experimental.Accessors;
12
+
13
+/**
14
+ * <p>
15
+ * 银行卡
16
+ * </p>
17
+ *
18
+ * @author yansen
19
+ * @since 2022-04-08
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+@ApiModel(value="TaBankCard对象", description="银行卡")
25
+public class TaBankCard implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    @ApiModelProperty(value = "卡ID")
30
+    @TableId(value = "card_id", type = IdType.UUID)
31
+    private String cardId;
32
+
33
+    @ApiModelProperty(value = "卡号")
34
+    private String cardNo;
35
+
36
+    @ApiModelProperty(value = "人员ID")
37
+    private String personId;
38
+
39
+    @ApiModelProperty(value = "持卡人名称")
40
+    private String owerName;
41
+
42
+    @ApiModelProperty(value = "预留手机")
43
+    private String phone;
44
+
45
+    @ApiModelProperty(value = "开户行")
46
+    private String ownerBank;
47
+
48
+    @ApiModelProperty(value = "状态")
49
+    private Integer status;
50
+
51
+    @ApiModelProperty(value = "创建时间")
52
+    private LocalDateTime createDate;
53
+
54
+
55
+}

+ 5
- 0
src/main/java/com/yunzhi/nanyang/entity/TaPerson.java View File

2
 
2
 
3
 import com.baomidou.mybatisplus.annotation.IdType;
3
 import com.baomidou.mybatisplus.annotation.IdType;
4
 import java.time.LocalDateTime;
4
 import java.time.LocalDateTime;
5
+
6
+import com.baomidou.mybatisplus.annotation.TableField;
5
 import com.baomidou.mybatisplus.annotation.TableId;
7
 import com.baomidou.mybatisplus.annotation.TableId;
6
 import java.io.Serializable;
8
 import java.io.Serializable;
7
 import io.swagger.annotations.ApiModel;
9
 import io.swagger.annotations.ApiModel;
57
     @ApiModelProperty(value = "创建时间")
59
     @ApiModelProperty(value = "创建时间")
58
     private LocalDateTime createDate;
60
     private LocalDateTime createDate;
59
 
61
 
62
+    @TableField(exist = false)
63
+    @ApiModelProperty(value = "是否机构管理员")
64
+    private Boolean isOrgManager;
60
 
65
 
61
 }
66
 }

+ 12
- 1
src/main/java/com/yunzhi/nanyang/entity/TaWithdrawal.java View File

2
 
2
 
3
 import com.baomidou.mybatisplus.annotation.IdType;
3
 import com.baomidou.mybatisplus.annotation.IdType;
4
 import java.time.LocalDateTime;
4
 import java.time.LocalDateTime;
5
+
6
+import com.baomidou.mybatisplus.annotation.TableField;
5
 import com.baomidou.mybatisplus.annotation.TableId;
7
 import com.baomidou.mybatisplus.annotation.TableId;
6
 import java.io.Serializable;
8
 import java.io.Serializable;
7
 import io.swagger.annotations.ApiModel;
9
 import io.swagger.annotations.ApiModel;
27
     private static final long serialVersionUID = 1L;
29
     private static final long serialVersionUID = 1L;
28
 
30
 
29
     @ApiModelProperty(value = "提现Id")
31
     @ApiModelProperty(value = "提现Id")
30
-    @TableId(value = "withdrawal_id", type = IdType.INPUT)
32
+    @TableId(value = "withdrawal_id", type = IdType.UUID)
31
     private String withdrawalId;
33
     private String withdrawalId;
32
 
34
 
33
     @ApiModelProperty(value = "申请人")
35
     @ApiModelProperty(value = "申请人")
69
     @ApiModelProperty(value = "机构ID")
71
     @ApiModelProperty(value = "机构ID")
70
     private String orgId;
72
     private String orgId;
71
 
73
 
74
+    @ApiModelProperty(value = "机构名称")
75
+    private String orgName;
76
+
72
     @ApiModelProperty(value = "状态")
77
     @ApiModelProperty(value = "状态")
73
     private Integer status;
78
     private Integer status;
74
 
79
 
80
+    @TableField(exist = false)
81
+    @ApiModelProperty(value = "银行卡")
82
+    private TaBankCard bankCard;
75
 
83
 
84
+    @TableField(exist = false)
85
+    @ApiModelProperty(value = "账户余额")
86
+    private Integer amountLeft;
76
 }
87
 }

+ 20
- 0
src/main/java/com/yunzhi/nanyang/entity/TaWorkJob.java View File

73
     @ApiModelProperty(value = "创建时间")
73
     @ApiModelProperty(value = "创建时间")
74
     private LocalDateTime createDate;
74
     private LocalDateTime createDate;
75
 
75
 
76
+    @TableField(exist = false)
77
+    @ApiModelProperty(value = "订单号")
78
+    private String orderNo;
79
+
76
     @TableField(exist = false)
80
     @TableField(exist = false)
77
     @ApiModelProperty(value = "下单人Id")
81
     @ApiModelProperty(value = "下单人Id")
78
     private String personId;
82
     private String personId;
101
     @ApiModelProperty(value = "下单时间")
105
     @ApiModelProperty(value = "下单时间")
102
     private LocalDateTime orderDate;
106
     private LocalDateTime orderDate;
103
 
107
 
108
+    @TableField(exist = false)
109
+    @ApiModelProperty(value = "农机手名称")
110
+    private String workerName;
111
+
104
     @TableField(exist = false)
112
     @TableField(exist = false)
105
     @ApiModelProperty(value = "农机名称")
113
     @ApiModelProperty(value = "农机名称")
106
     private String machineryName;
114
     private String machineryName;
115
+
116
+    @TableField(exist = false)
117
+    @ApiModelProperty(value = "机构名称")
118
+    private String orgName;
119
+
120
+    @TableField(exist = false)
121
+    @ApiModelProperty(value = "农机型号Id")
122
+    private String machineryTypeId;
123
+
124
+    @TableField(exist = false)
125
+    @ApiModelProperty(value = "农机型号名称")
126
+    private String machineryTypeName;
107
 }
127
 }

+ 54
- 0
src/main/java/com/yunzhi/nanyang/entity/TdBank.java View File

1
+package com.yunzhi.nanyang.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import java.io.Serializable;
6
+import io.swagger.annotations.ApiModel;
7
+import io.swagger.annotations.ApiModelProperty;
8
+import lombok.Data;
9
+import lombok.EqualsAndHashCode;
10
+import lombok.experimental.Accessors;
11
+
12
+/**
13
+ * <p>
14
+ * 银行
15
+ * </p>
16
+ *
17
+ * @author yansen
18
+ * @since 2022-04-10
19
+ */
20
+@Data
21
+@EqualsAndHashCode(callSuper = false)
22
+@Accessors(chain = true)
23
+@ApiModel(value="TdBank对象", description="银行")
24
+public class TdBank implements Serializable {
25
+
26
+    private static final long serialVersionUID = 1L;
27
+
28
+    @ApiModelProperty(value = "银行ID")
29
+    @TableId(value = "bank_id", type = IdType.INPUT)
30
+    private String bankId;
31
+
32
+    @ApiModelProperty(value = "银行编码")
33
+    private String bankCode;
34
+
35
+    @ApiModelProperty(value = "名称")
36
+    private String name;
37
+
38
+    @ApiModelProperty(value = "logo")
39
+    private String logo;
40
+
41
+    @ApiModelProperty(value = "颜色1")
42
+    private String color1;
43
+
44
+    @ApiModelProperty(value = "颜色2")
45
+    private String color2;
46
+
47
+    @ApiModelProperty(value = "状态")
48
+    private Integer status;
49
+
50
+    @ApiModelProperty(value = "排序")
51
+    private Integer sortNo;
52
+
53
+
54
+}

+ 3
- 0
src/main/java/com/yunzhi/nanyang/mapper/TaAccountLogMapper.java View File

1
 package com.yunzhi.nanyang.mapper;
1
 package com.yunzhi.nanyang.mapper;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.yunzhi.nanyang.entity.TaAccountLog;
4
 import com.yunzhi.nanyang.entity.TaAccountLog;
4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6
+import com.yunzhi.nanyang.vo.AccountRecord;
5
 import org.apache.ibatis.annotations.Mapper;
7
 import org.apache.ibatis.annotations.Mapper;
6
 
8
 
7
 /**
9
 /**
15
 @Mapper
17
 @Mapper
16
 public interface TaAccountLogMapper extends BaseMapper<TaAccountLog> {
18
 public interface TaAccountLogMapper extends BaseMapper<TaAccountLog> {
17
 
19
 
20
+    IPage<AccountRecord> getPageBy(IPage<AccountRecord> pg);
18
 }
21
 }

+ 2
- 0
src/main/java/com/yunzhi/nanyang/mapper/TaAccountMapper.java View File

3
 import com.yunzhi.nanyang.entity.TaAccount;
3
 import com.yunzhi.nanyang.entity.TaAccount;
4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
 import org.apache.ibatis.annotations.Mapper;
5
 import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
6
 
7
 
7
 /**
8
 /**
8
  * <p>
9
  * <p>
15
 @Mapper
16
 @Mapper
16
 public interface TaAccountMapper extends BaseMapper<TaAccount> {
17
 public interface TaAccountMapper extends BaseMapper<TaAccount> {
17
 
18
 
19
+    int updateColumn(@Param("accountId") String accountId,@Param("columnName") String columnName,@Param("value") int value);
18
 }
20
 }

+ 18
- 0
src/main/java/com/yunzhi/nanyang/mapper/TaBankCardMapper.java View File

1
+package com.yunzhi.nanyang.mapper;
2
+
3
+import com.yunzhi.nanyang.entity.TaBankCard;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 银行卡 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2022-04-08
14
+ */
15
+@Mapper
16
+public interface TaBankCardMapper extends BaseMapper<TaBankCard> {
17
+
18
+}

+ 2
- 1
src/main/java/com/yunzhi/nanyang/mapper/TaDispatchMapper.java View File

27
                              @Param("start") LocalDateTime start,
27
                              @Param("start") LocalDateTime start,
28
                              @Param("end") LocalDateTime end,
28
                              @Param("end") LocalDateTime end,
29
                              @Param("phone") String phone,
29
                              @Param("phone") String phone,
30
-                             @Param("status") String status);
30
+                             @Param("status") String status,
31
+                             @Param("isWarn") Boolean isWarn);
31
 }
32
 }

+ 3
- 1
src/main/java/com/yunzhi/nanyang/mapper/TaOrderMapper.java View File

26
     IPage<TaOrder> getAdminPage(IPage<TaOrder> pg,
26
     IPage<TaOrder> getAdminPage(IPage<TaOrder> pg,
27
                                 @Param("userId") String userId,
27
                                 @Param("userId") String userId,
28
                                 @Param("orgId") String orgId,
28
                                 @Param("orgId") String orgId,
29
+                                @Param("orderNo") String orderNo,
29
                                 @Param("machineryId") String machineryId,
30
                                 @Param("machineryId") String machineryId,
30
                                 @Param("typeId") String typeId,
31
                                 @Param("typeId") String typeId,
31
                                 @Param("personName") String personName,
32
                                 @Param("personName") String personName,
33
                                 @Param("payStatus") Integer payStatus,
34
                                 @Param("payStatus") Integer payStatus,
34
                                 @Param("dispatchStatus") Integer dispatchStatus,
35
                                 @Param("dispatchStatus") Integer dispatchStatus,
35
                                 @Param("workStatus") Integer workStatus,
36
                                 @Param("workStatus") Integer workStatus,
36
-                                @Param("isEvaluated") Integer isEvaluated);
37
+                                @Param("isEvaluated") Integer isEvaluated,
38
+                                @Param("isWarn") Boolean isWarn);
37
 
39
 
38
     IPage<TaOrder> getClientPage(IPage<TaOrder> pg,
40
     IPage<TaOrder> getClientPage(IPage<TaOrder> pg,
39
                                  @Param("personId") String personId,
41
                                  @Param("personId") String personId,

+ 10
- 0
src/main/java/com/yunzhi/nanyang/mapper/TaWithdrawalMapper.java View File

1
 package com.yunzhi.nanyang.mapper;
1
 package com.yunzhi.nanyang.mapper;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.yunzhi.nanyang.entity.TaWithdrawal;
4
 import com.yunzhi.nanyang.entity.TaWithdrawal;
4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
 import org.apache.ibatis.annotations.Mapper;
6
 import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
8
+
9
+import java.time.LocalDateTime;
6
 
10
 
7
 /**
11
 /**
8
  * <p>
12
  * <p>
15
 @Mapper
19
 @Mapper
16
 public interface TaWithdrawalMapper extends BaseMapper<TaWithdrawal> {
20
 public interface TaWithdrawalMapper extends BaseMapper<TaWithdrawal> {
17
 
21
 
22
+    IPage<TaWithdrawal> getPageBy(IPage<TaWithdrawal> pg,
23
+                                  @Param("orgId") String orgId,
24
+                                  @Param("startDate") LocalDateTime startDate,
25
+                                  @Param("endDate") LocalDateTime endDate);
26
+
27
+    Integer getTotalMoney(@Param("orgId") String orgId,@Param("auditStatus") Integer auditStatus);
18
 }
28
 }

+ 12
- 0
src/main/java/com/yunzhi/nanyang/mapper/TaWorkJobMapper.java View File

6
 import org.apache.ibatis.annotations.Mapper;
6
 import org.apache.ibatis.annotations.Mapper;
7
 import org.apache.ibatis.annotations.Param;
7
 import org.apache.ibatis.annotations.Param;
8
 
8
 
9
+import java.time.LocalDateTime;
10
+
9
 /**
11
 /**
10
  * <p>
12
  * <p>
11
  * 作业表 Mapper 接口
13
  * 作业表 Mapper 接口
20
     IPage<TaWorkJob> getPageBy(IPage<TaWorkJob> pg, @Param("userId") String userId);
22
     IPage<TaWorkJob> getPageBy(IPage<TaWorkJob> pg, @Param("userId") String userId);
21
 
23
 
22
     TaWorkJob getDetailBy(@Param("id") String id);
24
     TaWorkJob getDetailBy(@Param("id") String id);
25
+
26
+    IPage<TaWorkJob> getAdminPageBy(IPage<TaWorkJob> pg,
27
+                                    @Param("orgId") String orgId,
28
+                                    @Param("startDate") LocalDateTime startDate,
29
+                                    @Param("endDate") LocalDateTime endDate,
30
+                                    @Param("status") Integer status,
31
+                                    @Param("orderNo") String orderNo,
32
+                                    @Param("machineryTypeId") String machineryTypeId,
33
+                                    @Param("machineryId") String machineryId,
34
+                                    @Param("workerName") String workerName);
23
 }
35
 }

+ 18
- 0
src/main/java/com/yunzhi/nanyang/mapper/TdBankMapper.java View File

1
+package com.yunzhi.nanyang.mapper;
2
+
3
+import com.yunzhi.nanyang.entity.TdBank;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 银行 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2022-04-10
14
+ */
15
+@Mapper
16
+public interface TdBankMapper extends BaseMapper<TdBank> {
17
+
18
+}

+ 3
- 0
src/main/java/com/yunzhi/nanyang/service/ITaAccountLogService.java View File

1
 package com.yunzhi.nanyang.service;
1
 package com.yunzhi.nanyang.service;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.yunzhi.nanyang.entity.TaAccountLog;
4
 import com.yunzhi.nanyang.entity.TaAccountLog;
4
 import com.baomidou.mybatisplus.extension.service.IService;
5
 import com.baomidou.mybatisplus.extension.service.IService;
6
+import com.yunzhi.nanyang.vo.AccountRecord;
5
 
7
 
6
 /**
8
 /**
7
  * <p>
9
  * <p>
13
  */
15
  */
14
 public interface ITaAccountLogService extends IBaseService<TaAccountLog> {
16
 public interface ITaAccountLogService extends IBaseService<TaAccountLog> {
15
 
17
 
18
+    IPage<AccountRecord> getPageBy(IPage<AccountRecord> pg);
16
 }
19
 }

+ 5
- 1
src/main/java/com/yunzhi/nanyang/service/ITaAccountService.java View File

1
 package com.yunzhi.nanyang.service;
1
 package com.yunzhi.nanyang.service;
2
 
2
 
3
 import com.yunzhi.nanyang.entity.TaAccount;
3
 import com.yunzhi.nanyang.entity.TaAccount;
4
-import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.yunzhi.nanyang.entity.TaWithdrawal;
5
 
5
 
6
 /**
6
 /**
7
  * <p>
7
  * <p>
12
  * @since 2022-03-08
12
  * @since 2022-03-08
13
  */
13
  */
14
 public interface ITaAccountService extends IBaseService<TaAccount> {
14
 public interface ITaAccountService extends IBaseService<TaAccount> {
15
+    TaAccount getUserAccount(String userId) throws Exception;
15
 
16
 
17
+    boolean checkAmount(String orgId, Integer money, Boolean isIncluded) throws Exception;
18
+
19
+    boolean withdraw(TaWithdrawal taWithdrawal) throws Exception;
16
 }
20
 }

+ 16
- 0
src/main/java/com/yunzhi/nanyang/service/ITaBankCardService.java View File

1
+package com.yunzhi.nanyang.service;
2
+
3
+import com.yunzhi.nanyang.entity.TaBankCard;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+
6
+/**
7
+ * <p>
8
+ * 银行卡 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2022-04-08
13
+ */
14
+public interface ITaBankCardService extends IBaseService<TaBankCard> {
15
+
16
+}

+ 1
- 2
src/main/java/com/yunzhi/nanyang/service/ITaDispatchService.java View File

2
 
2
 
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.yunzhi.nanyang.entity.TaDispatch;
4
 import com.yunzhi.nanyang.entity.TaDispatch;
5
-import com.baomidou.mybatisplus.extension.service.IService;
6
 import com.yunzhi.nanyang.entity.TaOrder;
5
 import com.yunzhi.nanyang.entity.TaOrder;
7
 
6
 
8
 import java.time.LocalDateTime;
7
 import java.time.LocalDateTime;
17
  */
16
  */
18
 public interface ITaDispatchService extends IBaseService<TaDispatch> {
17
 public interface ITaDispatchService extends IBaseService<TaDispatch> {
19
 
18
 
20
-    IPage<TaOrder> getPageBy(IPage<TaOrder> pg, String orgId, String typeId, String machineryId, LocalDateTime start, LocalDateTime end, String phone, String status);
19
+    IPage<TaOrder> getPageBy(IPage<TaOrder> pg, String orgId, String typeId, String machineryId, LocalDateTime start, LocalDateTime end, String phone, String status, Boolean isWarn);
21
 }
20
 }

+ 13
- 1
src/main/java/com/yunzhi/nanyang/service/ITaOrderService.java View File

19
 
19
 
20
     String getNextOrderNO();
20
     String getNextOrderNO();
21
 
21
 
22
-    IPage<TaOrder> getAdminPage(IPage<TaOrder> pg, SysUser sysUser, String orgId, String machineryId, String typeId, String personName, String phone, Integer payStatus, Integer dispatchStatus, Integer workStatus, Integer isEvaluated);
22
+    IPage<TaOrder> getAdminPage(IPage<TaOrder> pg,
23
+                                String userId,
24
+                                String orgId,
25
+                                String orderNo,
26
+                                String machineryId,
27
+                                String typeId,
28
+                                String personName,
29
+                                String phone,
30
+                                Integer payStatus,
31
+                                Integer dispatchStatus,
32
+                                Integer workStatus,
33
+                                Integer isEvaluated,
34
+                                Boolean isWarn);
23
 
35
 
24
     IPage<TaOrder> getClientPage(IPage<TaOrder> pg, TaPerson taPerson, SysUser sysUser, Integer workStatus, String q);
36
     IPage<TaOrder> getClientPage(IPage<TaOrder> pg, TaPerson taPerson, SysUser sysUser, Integer workStatus, String q);
25
 
37
 

+ 2
- 2
src/main/java/com/yunzhi/nanyang/service/ITaPayService.java View File

14
 
14
 
15
     TaPay getByOrderNo(String orderNo);
15
     TaPay getByOrderNo(String orderNo);
16
 
16
 
17
-    void notifyOrder(WxPayOrderNotifyV3Result.DecryptNotifyResult result);
17
+    void notifyOrder(WxPayOrderNotifyV3Result.DecryptNotifyResult result) throws Exception;
18
 
18
 
19
     void refund(String client, String clientId, TaOrder taOrder) throws Exception;
19
     void refund(String client, String clientId, TaOrder taOrder) throws Exception;
20
 
20
 
21
-    void refundNotifyOrder(WxPayRefundNotifyV3Result.DecryptNotifyResult result);
21
+    void refundNotifyOrder(WxPayRefundNotifyV3Result.DecryptNotifyResult result) throws Exception;
22
 }
22
 }

+ 4
- 0
src/main/java/com/yunzhi/nanyang/service/ITaWithdrawalService.java View File

1
 package com.yunzhi.nanyang.service;
1
 package com.yunzhi.nanyang.service;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.yunzhi.nanyang.entity.TaWithdrawal;
4
 import com.yunzhi.nanyang.entity.TaWithdrawal;
4
 import com.baomidou.mybatisplus.extension.service.IService;
5
 import com.baomidou.mybatisplus.extension.service.IService;
5
 
6
 
7
+import java.time.LocalDateTime;
8
+
6
 /**
9
 /**
7
  * <p>
10
  * <p>
8
  * 提现表 服务类
11
  * 提现表 服务类
13
  */
16
  */
14
 public interface ITaWithdrawalService extends IBaseService<TaWithdrawal> {
17
 public interface ITaWithdrawalService extends IBaseService<TaWithdrawal> {
15
 
18
 
19
+    IPage<TaWithdrawal> getPageBy(IPage<TaWithdrawal> pg, String orgId, LocalDateTime startDate, LocalDateTime endDate);
16
 }
20
 }

+ 4
- 1
src/main/java/com/yunzhi/nanyang/service/ITaWorkJobService.java View File

4
 import com.yunzhi.nanyang.entity.TaDispatch;
4
 import com.yunzhi.nanyang.entity.TaDispatch;
5
 import com.yunzhi.nanyang.entity.TaOrder;
5
 import com.yunzhi.nanyang.entity.TaOrder;
6
 import com.yunzhi.nanyang.entity.TaWorkJob;
6
 import com.yunzhi.nanyang.entity.TaWorkJob;
7
-import com.baomidou.mybatisplus.extension.service.IService;
7
+
8
+import java.time.LocalDateTime;
8
 
9
 
9
 /**
10
 /**
10
  * <p>
11
  * <p>
21
     IPage<TaWorkJob> getPageBy(IPage<TaWorkJob> pg, String userId);
22
     IPage<TaWorkJob> getPageBy(IPage<TaWorkJob> pg, String userId);
22
 
23
 
23
     TaWorkJob getDetailBy(String id);
24
     TaWorkJob getDetailBy(String id);
25
+
26
+    IPage<TaWorkJob> getAdminPageBy(IPage<TaWorkJob> pg, String orgId, LocalDateTime startDate, LocalDateTime endDate, Integer status, String orderNo, String machineryTypeId, String machineryId, String workerName);
24
 }
27
 }

+ 16
- 0
src/main/java/com/yunzhi/nanyang/service/ITdBankService.java View File

1
+package com.yunzhi.nanyang.service;
2
+
3
+import com.yunzhi.nanyang.entity.TdBank;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+
6
+/**
7
+ * <p>
8
+ * 银行 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2022-04-10
13
+ */
14
+public interface ITdBankService extends IService<TdBank> {
15
+
16
+}

+ 6
- 0
src/main/java/com/yunzhi/nanyang/service/impl/TaAccountLogServiceImpl.java View File

1
 package com.yunzhi.nanyang.service.impl;
1
 package com.yunzhi.nanyang.service.impl;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.yunzhi.nanyang.entity.TaAccountLog;
4
 import com.yunzhi.nanyang.entity.TaAccountLog;
4
 import com.yunzhi.nanyang.mapper.TaAccountLogMapper;
5
 import com.yunzhi.nanyang.mapper.TaAccountLogMapper;
5
 import com.yunzhi.nanyang.service.ITaAccountLogService;
6
 import com.yunzhi.nanyang.service.ITaAccountLogService;
6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
8
+import com.yunzhi.nanyang.vo.AccountRecord;
7
 import org.springframework.stereotype.Service;
9
 import org.springframework.stereotype.Service;
8
 
10
 
9
 /**
11
 /**
17
 @Service
19
 @Service
18
 public class TaAccountLogServiceImpl extends BaseServiceImpl<TaAccountLogMapper, TaAccountLog> implements ITaAccountLogService {
20
 public class TaAccountLogServiceImpl extends BaseServiceImpl<TaAccountLogMapper, TaAccountLog> implements ITaAccountLogService {
19
 
21
 
22
+    @Override
23
+    public IPage<AccountRecord> getPageBy(IPage<AccountRecord> pg) {
24
+        return baseMapper.getPageBy(pg);
25
+    }
20
 }
26
 }

+ 85
- 1
src/main/java/com/yunzhi/nanyang/service/impl/TaAccountServiceImpl.java View File

1
 package com.yunzhi.nanyang.service.impl;
1
 package com.yunzhi.nanyang.service.impl;
2
 
2
 
3
+import com.yunzhi.nanyang.common.Constants;
4
+import com.yunzhi.nanyang.common.StringUtils;
3
 import com.yunzhi.nanyang.entity.TaAccount;
5
 import com.yunzhi.nanyang.entity.TaAccount;
6
+import com.yunzhi.nanyang.entity.TaAccountLog;
7
+import com.yunzhi.nanyang.entity.TaWithdrawal;
8
+import com.yunzhi.nanyang.mapper.TaAccountLogMapper;
4
 import com.yunzhi.nanyang.mapper.TaAccountMapper;
9
 import com.yunzhi.nanyang.mapper.TaAccountMapper;
10
+import com.yunzhi.nanyang.mapper.TaWithdrawalMapper;
5
 import com.yunzhi.nanyang.service.ITaAccountService;
11
 import com.yunzhi.nanyang.service.ITaAccountService;
6
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
12
+import org.springframework.beans.factory.annotation.Autowired;
7
 import org.springframework.stereotype.Service;
13
 import org.springframework.stereotype.Service;
14
+import org.springframework.transaction.annotation.Transactional;
15
+
16
+import java.time.LocalDateTime;
8
 
17
 
9
 /**
18
 /**
10
  * <p>
19
  * <p>
17
 @Service
26
 @Service
18
 public class TaAccountServiceImpl extends BaseServiceImpl<TaAccountMapper, TaAccount> implements ITaAccountService {
27
 public class TaAccountServiceImpl extends BaseServiceImpl<TaAccountMapper, TaAccount> implements ITaAccountService {
19
 
28
 
29
+    @Autowired
30
+    TaWithdrawalMapper taWithdrawalMapper;
31
+
32
+    @Autowired
33
+    TaAccountLogMapper taAccountLogMapper;
34
+
35
+    @Override
36
+    public TaAccount getUserAccount(String userId) throws Exception {
37
+        if (StringUtils.isEmpty(userId)) return null;
38
+
39
+        TaAccount taAccount = getExistBy("user_id", userId, false, false);
40
+        if (null == taAccount) {
41
+            taAccount = new TaAccount();
42
+            taAccount.setUserId(userId);
43
+            save(taAccount);
44
+        }
45
+
46
+        return taAccount;
47
+    }
48
+
49
+    @Override
50
+    public boolean checkAmount(String orgId, Integer money, Boolean isIncluded) throws Exception {
51
+        TaAccount taAccount = getUserAccount(orgId);
52
+        if (null == money || money <= 0) {
53
+            throw new Exception("校验提款金额失败");
54
+        }
55
+
56
+        // 计算所有未审批金额
57
+        Integer totalMoney = taWithdrawalMapper.getTotalMoney(orgId, Constants.AUDIT_READY);
58
+        if (null == totalMoney) {
59
+            totalMoney = 0;
60
+        }
61
+
62
+        int amount = money;
63
+        if (null != isIncluded && isIncluded) {
64
+            amount += totalMoney;
65
+        }
66
+
67
+        return taAccount.getAmounts() > amount;
68
+    }
69
+
70
+    @Transactional(rollbackFor = Exception.class)
71
+    @Override
72
+    public boolean withdraw(TaWithdrawal taWithdrawal) throws Exception {
73
+        TaAccount taAccount = getUserAccount(taWithdrawal.getOrgId());
74
+
75
+        if (taAccount.getAmounts() < taWithdrawal.getMoney()) {
76
+            throw new Exception("账户余额不足");
77
+        }
78
+
79
+        TaAccountLog taAccountLog = new TaAccountLog();
80
+        taAccountLog.setAccountId(taAccount.getAccountId());
81
+        taAccountLog.setFeeType(Constants.ACCOUNT_EXPEND);
82
+        taAccountLog.setChargeType(Constants.ACCOUNT_WITHDRAW);
83
+        taAccountLog.setMoney(taWithdrawal.getMoney());
84
+        taAccountLog.setOrderId(taWithdrawal.getWithdrawalId());
85
+        taAccountLog.setCreateDate(LocalDateTime.now());
86
+
87
+        if (taAccountLogMapper.insert(taAccountLog) < 1) {
88
+            return false;
89
+        }
90
+
91
+        // 余额减少
92
+        int row = baseMapper.updateColumn(taAccount.getAccountId(), "amounts", taAccountLog.getFeeType() * Math.abs(taAccountLog.getMoney()) );
93
+        if (row < 1) {
94
+            throw new Exception("更新账户余额异常");
95
+        }
96
+        // 支出增加
97
+        row = baseMapper.updateColumn(taAccount.getAccountId(), "paid_fee", Math.abs(taAccountLog.getMoney()) );
98
+        if (row < 1) {
99
+            throw new Exception("更新账户支出异常");
100
+        }
101
+
102
+        return true;
103
+    }
20
 }
104
 }

+ 20
- 0
src/main/java/com/yunzhi/nanyang/service/impl/TaBankCardServiceImpl.java View File

1
+package com.yunzhi.nanyang.service.impl;
2
+
3
+import com.yunzhi.nanyang.entity.TaBankCard;
4
+import com.yunzhi.nanyang.mapper.TaBankCardMapper;
5
+import com.yunzhi.nanyang.service.ITaBankCardService;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 银行卡 服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2022-04-08
16
+ */
17
+@Service
18
+public class TaBankCardServiceImpl extends BaseServiceImpl<TaBankCardMapper, TaBankCard> implements ITaBankCardService {
19
+
20
+}

+ 2
- 2
src/main/java/com/yunzhi/nanyang/service/impl/TaDispatchServiceImpl.java View File

21
 public class TaDispatchServiceImpl extends BaseServiceImpl<TaDispatchMapper, TaDispatch> implements ITaDispatchService {
21
 public class TaDispatchServiceImpl extends BaseServiceImpl<TaDispatchMapper, TaDispatch> implements ITaDispatchService {
22
 
22
 
23
     @Override
23
     @Override
24
-    public IPage<TaOrder> getPageBy(IPage<TaOrder> pg, String orgId, String typeId, String machineryId, LocalDateTime start, LocalDateTime end, String phone, String status) {
25
-        return baseMapper.getPageBy(pg, orgId, typeId, machineryId, start, end, phone, status);
24
+    public IPage<TaOrder> getPageBy(IPage<TaOrder> pg, String orgId, String typeId, String machineryId, LocalDateTime start, LocalDateTime end, String phone, String status, Boolean isWarn) {
25
+        return baseMapper.getPageBy(pg, orgId, typeId, machineryId, start, end, phone, status, isWarn);
26
     }
26
     }
27
 }
27
 }

+ 26
- 2
src/main/java/com/yunzhi/nanyang/service/impl/TaOrderServiceImpl.java View File

35
     }
35
     }
36
 
36
 
37
     @Override
37
     @Override
38
-    public IPage<TaOrder> getAdminPage(IPage<TaOrder> pg, SysUser sysUser, String orgId, String machineryId, String typeId, String personName, String phone, Integer payStatus, Integer dispatchStatus, Integer workStatus, Integer isEvaluated) {
38
+    public IPage<TaOrder> getAdminPage(IPage<TaOrder> pg,
39
+                                       String userId,
40
+                                       String orgId,
41
+                                       String orderNo,
42
+                                       String machineryId,
43
+                                       String typeId,
44
+                                       String personName,
45
+                                       String phone,
46
+                                       Integer payStatus,
47
+                                       Integer dispatchStatus,
48
+                                       Integer workStatus,
49
+                                       Integer isEvaluated,
50
+                                       Boolean isWarn) {
39
 
51
 
40
-        return baseMapper.getAdminPage(pg, null == sysUser ? null : sysUser.getUserId(), orgId, machineryId, typeId, personName, phone, payStatus, dispatchStatus, workStatus, isEvaluated);
52
+        return baseMapper.getAdminPage(pg,
53
+                userId,
54
+                orgId,
55
+                orderNo,
56
+                machineryId,
57
+                typeId,
58
+                personName,
59
+                phone,
60
+                payStatus,
61
+                dispatchStatus,
62
+                workStatus,
63
+                isEvaluated,
64
+                isWarn);
41
     }
65
     }
42
 
66
 
43
     @Override
67
     @Override

+ 45
- 12
src/main/java/com/yunzhi/nanyang/service/impl/TaPayServiceImpl.java View File

13
 import com.yunzhi.nanyang.common.DateUtils;
13
 import com.yunzhi.nanyang.common.DateUtils;
14
 import com.yunzhi.nanyang.common.StringUtils;
14
 import com.yunzhi.nanyang.common.StringUtils;
15
 import com.yunzhi.nanyang.common.WxPayUtils;
15
 import com.yunzhi.nanyang.common.WxPayUtils;
16
+import com.yunzhi.nanyang.entity.TaAccount;
17
+import com.yunzhi.nanyang.entity.TaAccountLog;
16
 import com.yunzhi.nanyang.entity.TaOrder;
18
 import com.yunzhi.nanyang.entity.TaOrder;
17
 import com.yunzhi.nanyang.entity.TaPay;
19
 import com.yunzhi.nanyang.entity.TaPay;
18
-import com.yunzhi.nanyang.mapper.TaOrderMapper;
19
-import com.yunzhi.nanyang.mapper.TaPayMapper;
20
-import com.yunzhi.nanyang.mapper.TaPersonMapper;
20
+import com.yunzhi.nanyang.mapper.*;
21
+import com.yunzhi.nanyang.service.ITaAccountService;
21
 import com.yunzhi.nanyang.service.ITaPayService;
22
 import com.yunzhi.nanyang.service.ITaPayService;
22
 import lombok.extern.slf4j.Slf4j;
23
 import lombok.extern.slf4j.Slf4j;
23
 import org.springframework.beans.factory.annotation.Autowired;
24
 import org.springframework.beans.factory.annotation.Autowired;
30
 @Service
31
 @Service
31
 public class TaPayServiceImpl extends BaseServiceImpl<TaPayMapper, TaPay> implements ITaPayService {
32
 public class TaPayServiceImpl extends BaseServiceImpl<TaPayMapper, TaPay> implements ITaPayService {
32
 
33
 
34
+    @Autowired
35
+    ITaAccountService iTaAccountService;
33
 
36
 
34
     @Autowired
37
     @Autowired
35
     TaPersonMapper taPersonMapper;
38
     TaPersonMapper taPersonMapper;
40
     @Autowired
43
     @Autowired
41
     WxPayUtils wxPayUtils;
44
     WxPayUtils wxPayUtils;
42
 
45
 
46
+    @Autowired
47
+    TaAccountLogMapper taAccountLogMapper;
48
+
49
+    @Autowired
50
+    TaAccountMapper taAccountMapper;
51
+
43
     @Override
52
     @Override
44
     public WxPayUnifiedOrderV3Result.JsapiResult createPay(String client, String clientId, TaOrder taOrder) throws Exception {
53
     public WxPayUnifiedOrderV3Result.JsapiResult createPay(String client, String clientId, TaOrder taOrder) throws Exception {
45
         TaPay taPay = getByOrderNo(taOrder.getOrderNo());
54
         TaPay taPay = getByOrderNo(taOrder.getOrderNo());
86
                     updateById(taPay);
95
                     updateById(taPay);
87
                 }
96
                 }
88
                 taOrderMapper.updatePayStatus(taPay.getOrderId(), Constants.PAY_PAID);
97
                 taOrderMapper.updatePayStatus(taPay.getOrderId(), Constants.PAY_PAID);
98
+                // 插入账户流水
99
+                insertAccount(taPay, taOrder.getOrgId(), Constants.ACCOUNT_INCOME, Constants.ACCOUNT_ORDER_PAY);
89
             }
100
             }
90
 
101
 
91
             throw e;
102
             throw e;
124
     }
135
     }
125
 
136
 
126
     @Override
137
     @Override
127
-    public void notifyOrder(WxPayOrderNotifyV3Result.DecryptNotifyResult result) {
138
+    public void notifyOrder(WxPayOrderNotifyV3Result.DecryptNotifyResult result) throws Exception {
128
         TaPay orderPay = getByOrderNo(result.getOutTradeNo());
139
         TaPay orderPay = getByOrderNo(result.getOutTradeNo());
129
         if (orderPay.getStatus() != Constants.PAY_READY) {
140
         if (orderPay.getStatus() != Constants.PAY_READY) {
130
             return;
141
             return;
139
 
150
 
140
         // 更新订单状态
151
         // 更新订单状态
141
         if (isSuccess) {
152
         if (isSuccess) {
153
+            TaOrder taOrder = taOrderMapper.selectById(orderPay.getOrderId());
142
             taOrderMapper.updatePayStatus(orderPay.getOrderId(), Constants.PAY_PAID);
154
             taOrderMapper.updatePayStatus(orderPay.getOrderId(), Constants.PAY_PAID);
143
-        }
144
 
155
 
145
-        // 插入账户流水
146
-        // 暂无
156
+            // 插入账户流水
157
+            insertAccount(orderPay, taOrder.getOrgId(), Constants.ACCOUNT_INCOME, Constants.ACCOUNT_ORDER_PAY);
158
+        }
147
     }
159
     }
148
 
160
 
149
     @Override
161
     @Override
194
     }
206
     }
195
 
207
 
196
     @Override
208
     @Override
197
-    public void refundNotifyOrder(WxPayRefundNotifyV3Result.DecryptNotifyResult result) {
209
+    public void refundNotifyOrder(WxPayRefundNotifyV3Result.DecryptNotifyResult result) throws Exception {
198
         TaPay taPay = getByOrderNo(result.getOutRefundNo());
210
         TaPay taPay = getByOrderNo(result.getOutRefundNo());
199
         if (null == taPay) {
211
         if (null == taPay) {
200
             log.error("退款通知处理失败: 单号 " + result.getOutRefundNo());
212
             log.error("退款通知处理失败: 单号 " + result.getOutRefundNo());
220
             taOrder.setIsRefund(1);
232
             taOrder.setIsRefund(1);
221
             taOrder.setStatus(Constants.ORDER_CANCEL);
233
             taOrder.setStatus(Constants.ORDER_CANCEL);
222
             taOrderMapper.updateById(taOrder);
234
             taOrderMapper.updateById(taOrder);
223
-        }
224
-
225
-        // 插入账户流水
226
-        // 暂无
227
 
235
 
236
+            // 插入账户流水
237
+            insertAccount(taPay, taOrder.getOrgId(),Constants.ACCOUNT_EXPEND, Constants.ACCOUNT_ORDER_REFUND);
238
+        }
228
     }
239
     }
229
 
240
 
241
+    private void insertAccount(TaPay taPay, String orgId, Integer feeType, String chargeType) throws Exception {
242
+        TaAccount taAccount = iTaAccountService.getUserAccount(orgId);
243
+        String accountId = taAccount.getAccountId();
244
+
245
+        TaAccountLog accountLog = new TaAccountLog();
246
+        accountLog.setAccountId(accountId);
247
+        accountLog.setFeeType(feeType);
248
+        accountLog.setChargeType(chargeType);
249
+        accountLog.setMoney(taPay.getCharges());
250
+        accountLog.setOrderId(taPay.getOrderId());
251
+        accountLog.setPayId(taPay.getPayId());
252
+        accountLog.setCreateDate(LocalDateTime.now());
253
+        taAccountLogMapper.insert(accountLog);
254
+
255
+        // 累计余额
256
+        taAccountMapper.updateColumn(accountId, "amounts", Math.abs(taPay.getCharges()) * feeType);
257
+
258
+        // 累计支出
259
+        if (feeType == Constants.ACCOUNT_EXPEND) {
260
+            taAccountMapper.updateColumn(accountId, "paid_fee", Math.abs(taPay.getCharges()));
261
+        }
262
+    }
230
 
263
 
231
 }
264
 }

+ 7
- 3
src/main/java/com/yunzhi/nanyang/service/impl/TaPersonServiceImpl.java View File

34
         if (null == taPerson) return;
34
         if (null == taPerson) return;
35
 
35
 
36
         try {
36
         try {
37
-            if (!StringUtils.isEmpty(taPerson.getPhone()) && StringUtils.isEmpty(taPerson.getUserId())) {
38
-                // 尝试去绑定农机手人员
37
+            if (!StringUtils.isEmpty(taPerson.getPhone())) {
39
                 SysUser sysUser = sysUserMapper.selectByPhone(taPerson.getPhone());
38
                 SysUser sysUser = sysUserMapper.selectByPhone(taPerson.getPhone());
40
-                if (null != sysUser) {
39
+                if (null != sysUser && sysUser.getUserId().equals(taPerson.getUserId())) {
40
+                    taPerson.setIsOrgManager(sysUser.getIsOrgManager());
41
+                }
42
+
43
+                // 尝试去绑定农机手人员
44
+                if (StringUtils.isEmpty(taPerson.getUserId())) {
41
                     taPerson.setUserId(sysUser.getUserId());
45
                     taPerson.setUserId(sysUser.getUserId());
42
                     updateById(taPerson);
46
                     updateById(taPerson);
43
                 }
47
                 }

+ 7
- 0
src/main/java/com/yunzhi/nanyang/service/impl/TaWithdrawalServiceImpl.java View File

1
 package com.yunzhi.nanyang.service.impl;
1
 package com.yunzhi.nanyang.service.impl;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.yunzhi.nanyang.entity.TaWithdrawal;
4
 import com.yunzhi.nanyang.entity.TaWithdrawal;
4
 import com.yunzhi.nanyang.mapper.TaWithdrawalMapper;
5
 import com.yunzhi.nanyang.mapper.TaWithdrawalMapper;
5
 import com.yunzhi.nanyang.service.ITaWithdrawalService;
6
 import com.yunzhi.nanyang.service.ITaWithdrawalService;
6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
 import org.springframework.stereotype.Service;
8
 import org.springframework.stereotype.Service;
8
 
9
 
10
+import java.time.LocalDateTime;
11
+
9
 /**
12
 /**
10
  * <p>
13
  * <p>
11
  * 提现表 服务实现类
14
  * 提现表 服务实现类
17
 @Service
20
 @Service
18
 public class TaWithdrawalServiceImpl extends BaseServiceImpl<TaWithdrawalMapper, TaWithdrawal> implements ITaWithdrawalService {
21
 public class TaWithdrawalServiceImpl extends BaseServiceImpl<TaWithdrawalMapper, TaWithdrawal> implements ITaWithdrawalService {
19
 
22
 
23
+    @Override
24
+    public IPage<TaWithdrawal> getPageBy(IPage<TaWithdrawal> pg, String orgId, LocalDateTime startDate, LocalDateTime endDate) {
25
+        return baseMapper.getPageBy(pg, orgId, startDate, endDate);
26
+    }
20
 }
27
 }

+ 13
- 1
src/main/java/com/yunzhi/nanyang/service/impl/TaWorkJobServiceImpl.java View File

7
 import com.yunzhi.nanyang.entity.TaWorkJob;
7
 import com.yunzhi.nanyang.entity.TaWorkJob;
8
 import com.yunzhi.nanyang.mapper.TaWorkJobMapper;
8
 import com.yunzhi.nanyang.mapper.TaWorkJobMapper;
9
 import com.yunzhi.nanyang.service.ITaWorkJobService;
9
 import com.yunzhi.nanyang.service.ITaWorkJobService;
10
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
11
 import org.springframework.stereotype.Service;
10
 import org.springframework.stereotype.Service;
12
 
11
 
13
 import java.time.LocalDateTime;
12
 import java.time.LocalDateTime;
55
     public TaWorkJob getDetailBy(String id) {
54
     public TaWorkJob getDetailBy(String id) {
56
         return baseMapper.getDetailBy(id);
55
         return baseMapper.getDetailBy(id);
57
     }
56
     }
57
+
58
+    @Override
59
+    public IPage<TaWorkJob> getAdminPageBy(IPage<TaWorkJob> pg,
60
+                                           String orgId,
61
+                                           LocalDateTime startDate,
62
+                                           LocalDateTime endDate,
63
+                                           Integer status,
64
+                                           String orderNo,
65
+                                           String machineryTypeId,
66
+                                           String machineryId,
67
+                                           String workerName) {
68
+        return baseMapper.getAdminPageBy(pg, orgId, startDate, endDate, status, orderNo, machineryTypeId, machineryId, workerName);
69
+    }
58
 }
70
 }

+ 20
- 0
src/main/java/com/yunzhi/nanyang/service/impl/TdBankServiceImpl.java View File

1
+package com.yunzhi.nanyang.service.impl;
2
+
3
+import com.yunzhi.nanyang.entity.TdBank;
4
+import com.yunzhi.nanyang.mapper.TdBankMapper;
5
+import com.yunzhi.nanyang.service.ITdBankService;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 银行 服务实现类
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2022-04-10
16
+ */
17
+@Service
18
+public class TdBankServiceImpl extends ServiceImpl<TdBankMapper, TdBank> implements ITdBankService {
19
+
20
+}

+ 34
- 0
src/main/java/com/yunzhi/nanyang/vo/AccountRecord.java View File

1
+package com.yunzhi.nanyang.vo;
2
+
3
+import com.yunzhi.nanyang.entity.TaAccountLog;
4
+import io.swagger.annotations.ApiModel;
5
+import io.swagger.annotations.ApiModelProperty;
6
+import lombok.Data;
7
+
8
+import java.time.LocalDateTime;
9
+
10
+@Data
11
+@ApiModel(description = "账户流水")
12
+public class AccountRecord extends TaAccountLog {
13
+
14
+    @ApiModelProperty(value = "下单人ID")
15
+    private String personId;
16
+
17
+    @ApiModelProperty(value = "下单人名称")
18
+    private String personName;
19
+
20
+    @ApiModelProperty(value = "下单人手机")
21
+    private String phone;
22
+
23
+    @ApiModelProperty(value = "商品描述")
24
+    private String description;
25
+
26
+    @ApiModelProperty(value = "支付时间")
27
+    private LocalDateTime payDate;
28
+
29
+    @ApiModelProperty(value = "订单ID")
30
+    private String realOrderId;
31
+
32
+    @ApiModelProperty(value = "订单号")
33
+    private String orderNo;
34
+}

+ 6
- 4
src/main/resources/mapper/SysMenuMapper.xml View File

9
             1 AS can_access
9
             1 AS can_access
10
         </if>
10
         </if>
11
         <if test="!isAdmin">
11
         <if test="!isAdmin">
12
-            IF ( m.role_id IS NULL, 0, 1 ) AS can_access
12
+            IF ( s.role_id IS NULL, 0, 1 ) AS can_access
13
         </if>
13
         </if>
14
         FROM
14
         FROM
15
             sys_menu t
15
             sys_menu t
16
         <if test="!isAdmin">
16
         <if test="!isAdmin">
17
-                LEFT JOIN sys_role_permission s ON s.permission_id = t.menu_id
18
-                LEFT JOIN sys_user_role m ON m.role_id = s.role_id
19
-                AND m.user_id = #{userId}
17
+            LEFT JOIN (
18
+                SELECT a.*
19
+                FROM sys_role_permission a
20
+                INNER JOIN sys_user_role b ON a.role_id = b.role_id AND b.user_id = #{userId}
21
+            ) s ON s.permission_id = t.menu_id
20
         </if>
22
         </if>
21
         WHERE
23
         WHERE
22
             t.`status` = 1
24
             t.`status` = 1

+ 18
- 0
src/main/resources/mapper/TaAccountLogMapper.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
 <mapper namespace="com.yunzhi.nanyang.mapper.TaAccountLogMapper">
3
 <mapper namespace="com.yunzhi.nanyang.mapper.TaAccountLogMapper">
4
 
4
 
5
+    <select id="getPageBy" resultType="com.yunzhi.nanyang.vo.AccountRecord">
6
+        SELECT
7
+            t.*,
8
+            n.person_id,
9
+            n.nick_name as person_name,
10
+            n.phone,
11
+            m.order_id as real_order_id,
12
+            m.order_no,
13
+            s.description,
14
+            s.pay_date
15
+        FROM
16
+            ta_account_log t
17
+                INNER JOIN ta_pay s ON t.pay_id = s.pay_id
18
+                INNER JOIN ta_order m ON s.order_id = m.order_id
19
+                INNER JOIN ta_person n ON m.person_id = n.person_id
20
+        ORDER BY
21
+            t.create_date DESC
22
+    </select>
5
 </mapper>
23
 </mapper>

+ 5
- 0
src/main/resources/mapper/TaAccountMapper.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
 <mapper namespace="com.yunzhi.nanyang.mapper.TaAccountMapper">
3
 <mapper namespace="com.yunzhi.nanyang.mapper.TaAccountMapper">
4
 
4
 
5
+    <update id="updateColumn">
6
+        update ta_account
7
+        set ${columnName} = IFNULL(${columnName}, 0) + ${value}
8
+        where account_id = #{accountId}
9
+    </update>
5
 </mapper>
10
 </mapper>

+ 5
- 0
src/main/resources/mapper/TaBankCardMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.yunzhi.nanyang.mapper.TaBankCardMapper">
4
+
5
+</mapper>

+ 4
- 0
src/main/resources/mapper/TaDispatchMapper.xml View File

51
         <if test="phone != null and phone != ''">
51
         <if test="phone != null and phone != ''">
52
             AND m.phone LIKE CONCAT( '%', #{phone}, '%' )
52
             AND m.phone LIKE CONCAT( '%', #{phone}, '%' )
53
         </if>
53
         </if>
54
+        <if test="isWarn">
55
+            AND t.dispatch_status = 0
56
+            AND t.work_status = 0
57
+        </if>
54
         ORDER BY
58
         ORDER BY
55
             t.dispatch_status ASC,
59
             t.dispatch_status ASC,
56
             t.create_date desc
60
             t.create_date desc

+ 15
- 0
src/main/resources/mapper/TaOrderMapper.xml View File

11
     <select id="getAdminPage" resultType="com.yunzhi.nanyang.entity.TaOrder">
11
     <select id="getAdminPage" resultType="com.yunzhi.nanyang.entity.TaOrder">
12
         SELECT DISTINCT
12
         SELECT DISTINCT
13
             t.*,
13
             t.*,
14
+        <if test="isWarn">
15
+            d.worker_name as work_name,
16
+        </if>
14
             m.`name` as org_name,
17
             m.`name` as org_name,
15
             n.nick_name as person_name,
18
             n.nick_name as person_name,
16
             n.phone as phone
19
             n.phone as phone
22
             </if>
25
             </if>
23
             INNER JOIN ta_org m ON m.org_id = t.org_id
26
             INNER JOIN ta_org m ON m.org_id = t.org_id
24
             INNER JOIN ta_person n ON n.person_id = t.person_id
27
             INNER JOIN ta_person n ON n.person_id = t.person_id
28
+        <if test="isWarn">
29
+            LEFT JOIN ta_dispatch d ON d.order_id = t.order_id AND d.`status` &gt; -1
30
+        </if>
25
         WHERE
31
         WHERE
26
             t.`status` &gt; 0
32
             t.`status` &gt; 0
33
+        <if test="isWarn">
34
+            AND TO_DAYS(t.appointment_date) = TO_DAYS(now())
35
+            AND t.pay_status = 1
36
+            AND t.dispatch_status = 1
37
+            AND t.work_status = 0
38
+        </if>
27
         <if test="orgId != null and orgId != ''">
39
         <if test="orgId != null and orgId != ''">
28
             AND t.org_id = #{orgId}
40
             AND t.org_id = #{orgId}
29
         </if>
41
         </if>
42
+        <if test="orderNo != null and orderNo != ''">
43
+            AND t.order_no LIKE CONCAT( '%', #{orderNo}, '%' )
44
+        </if>
30
         <if test="machineryId != null and machineryId != ''">
45
         <if test="machineryId != null and machineryId != ''">
31
             AND t.machinery_id = #{machineryId}
46
             AND t.machinery_id = #{machineryId}
32
         </if>
47
         </if>

+ 30
- 0
src/main/resources/mapper/TaWithdrawalMapper.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
 <mapper namespace="com.yunzhi.nanyang.mapper.TaWithdrawalMapper">
3
 <mapper namespace="com.yunzhi.nanyang.mapper.TaWithdrawalMapper">
4
 
4
 
5
+    <select id="getPageBy" resultType="com.yunzhi.nanyang.entity.TaWithdrawal">
6
+        SELECT
7
+            t.*,
8
+            s.`name` as org_name
9
+        FROM ta_withdrawal t
10
+        INNER JOIN ta_org s ON s.org_id = t.org_id
11
+        WHERE t.status &gt; -1
12
+            <if test="orgId != null and orgId != ''">
13
+                AND t.org_id = #{orgId}
14
+            </if>
15
+            <if test="startDate != null">
16
+                AND t.create_date &gt;= #{startDate}
17
+            </if>
18
+        <if test="endDate != null">
19
+            AND t.create_date &lt;= #{endDate}
20
+        </if>
21
+            ORDER BY t.create_date DESC
22
+    </select>
23
+    <select id="getTotalMoney" resultType="java.lang.Integer">
24
+        SELECT
25
+            SUM( t.money )
26
+        FROM
27
+            ta_withdrawal t
28
+        WHERE
29
+            t.org_id = #{orgId}
30
+            AND t.status &gt; -1
31
+          <if test="auditStatus != null">
32
+              AND t.audit_status = #{auditStatus}
33
+          </if>
34
+    </select>
5
 </mapper>
35
 </mapper>

+ 31
- 0
src/main/resources/mapper/TaWorkJobMapper.xml View File

9
             n.nick_name AS person_name,
9
             n.nick_name AS person_name,
10
             n.phone,
10
             n.phone,
11
             s.machinery_name,
11
             s.machinery_name,
12
+            s.org_name,
13
+            s.worker_name,
14
+            s.type_id as machinery_type_id,
15
+            s.type_name as machinery_type_name,
16
+            m.order_no,
12
             m.appointment_date,
17
             m.appointment_date,
13
             m.create_date AS order_date,
18
             m.create_date AS order_date,
14
             m.address,
19
             m.address,
36
         WHERE
41
         WHERE
37
             t.job_id = #{id}
42
             t.job_id = #{id}
38
     </select>
43
     </select>
44
+    <select id="getAdminPageBy" resultType="com.yunzhi.nanyang.entity.TaWorkJob">
45
+        <include refid="getSummaryOfWork"></include>
46
+        WHERE
47
+        t.`status` = #{status}
48
+        <if test="orgId != null and orgId != ''">
49
+            AND t.org_id = #{orgId}
50
+        </if>
51
+        <if test="machineryId != null and machineryId != ''">
52
+            AND t.machinery_id = #{machineryId}
53
+        </if>
54
+        <if test="startDate != null and endDate != null">
55
+            AND t.end_date &gt;= #{startDate}
56
+            AND t.start_date &lt;= #{endDate}
57
+        </if>
58
+        <if test="orderNo != null and orderNo != ''">
59
+            AND m.order_no LIKE CONCAT('%', #{orderNo}, '%')
60
+        </if>
61
+        <if test="machineryTypeId != null and machineryTypeId != ''">
62
+            AND s.type_id = #{machineryTypeId}
63
+        </if>
64
+        <if test="workerName != null and workerName != ''">
65
+            AND s.worker_name LIKE CONCAT('%', #{workerName}, '%')
66
+        </if>
67
+        ORDER BY
68
+        t.create_date DESC
69
+    </select>
39
 </mapper>
70
 </mapper>

+ 5
- 0
src/main/resources/mapper/TdBankMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.yunzhi.nanyang.mapper.TdBankMapper">
4
+
5
+</mapper>