Quellcode durchsuchen

完成 经纪人

魏熙美 vor 6 Jahren
Ursprung
Commit
d3cf166c92

+ 33
- 2
src/main/java/com.huiju.welcome/controller/TaCustomerTransferController.java Datei anzeigen

@@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.welcome.common.base.BaseController;
7 7
 import com.huiju.welcome.common.base.ResponseBean;
8
+import com.huiju.welcome.model.SysUser;
8 9
 import com.huiju.welcome.model.TaCustomer;
9 10
 import com.huiju.welcome.model.TaCustomerTransfer;
10 11
 import com.huiju.welcome.model.TdGoodsType;
12
+import com.huiju.welcome.service.ISysUserService;
11 13
 import com.huiju.welcome.service.ITaCustomerService;
12 14
 import com.huiju.welcome.service.ITaCustomerTransferService;
13 15
 import io.swagger.annotations.ApiImplicitParams;
@@ -17,6 +19,7 @@ import org.slf4j.LoggerFactory;
17 19
 import org.springframework.beans.factory.annotation.Autowired;
18 20
 import org.springframework.web.bind.annotation.*;
19 21
 
22
+import javax.servlet.http.HttpSession;
20 23
 import java.time.LocalDateTime;
21 24
 
22 25
 
@@ -38,6 +41,8 @@ public class TaCustomerTransferController extends BaseController {
38 41
     public ITaCustomerTransferService iTaCustomerTransferService;
39 42
     @Autowired
40 43
     public ITaCustomerService iTaCustomerService;
44
+    @Autowired
45
+    public ISysUserService iSysUserService;
41 46
 
42 47
 
43 48
     /**
@@ -46,9 +51,22 @@ public class TaCustomerTransferController extends BaseController {
46 51
      * @return
47 52
      */
48 53
     @RequestMapping(value="/taCustomerTransfer/add",method= RequestMethod.POST)
49
-    public ResponseBean tpShopImgAdd(@RequestBody TaCustomerTransfer taCustomerTransfer){
54
+    public ResponseBean tpShopImgAdd(@RequestBody TaCustomerTransfer taCustomerTransfer, HttpSession session){
50 55
         ResponseBean responseBean = new ResponseBean();
51 56
         try {
57
+            Integer formUserId = (Integer) session.getAttribute("token-id");
58
+            TaCustomer customer = iTaCustomerService.getById(taCustomerTransfer.getCustomerId());
59
+            SysUser toUser = iSysUserService.getById(taCustomerTransfer.getToUserId());
60
+            SysUser fromUser = iSysUserService.getById(formUserId);
61
+
62
+            taCustomerTransfer.setFromUserId(formUserId);
63
+            taCustomerTransfer.setFromUserName(fromUser.getUsername());
64
+            taCustomerTransfer.setCustomerId(taCustomerTransfer.getCustomerId());
65
+            taCustomerTransfer.setCustomerName(customer.getCustomerName());
66
+            taCustomerTransfer.setToUserId(taCustomerTransfer.getToUserId());
67
+            taCustomerTransfer.setToUserName(toUser.getUsername());
68
+
69
+
52 70
             taCustomerTransfer.setTransferTime(LocalDateTime.now());
53 71
             Boolean flag = iTaCustomerTransferService.save(taCustomerTransfer);
54 72
             Boolean flagUpdate = false;
@@ -95,9 +113,22 @@ public class TaCustomerTransferController extends BaseController {
95 113
      * @return
96 114
      */
97 115
     @RequestMapping(value="/taCustomerTransfer/update",method= RequestMethod.PUT)
98
-    public ResponseBean tpShopImgUpdate(@RequestBody TaCustomerTransfer taCustomerTransfer){
116
+    public ResponseBean tpShopImgUpdate(@RequestBody TaCustomerTransfer taCustomerTransfer, HttpSession session){
99 117
         ResponseBean responseBean = new ResponseBean();
100 118
         try {
119
+
120
+            Integer formUserId = (Integer) session.getAttribute("token-id");
121
+            TaCustomer customer = iTaCustomerService.getById(taCustomerTransfer.getCustomerId());
122
+            SysUser toUser = iSysUserService.getById(taCustomerTransfer.getToUserId());
123
+            SysUser fromUser = iSysUserService.getById(formUserId);
124
+
125
+            taCustomerTransfer.setFromUserId(formUserId);
126
+            taCustomerTransfer.setFromUserName(fromUser.getUsername());
127
+            taCustomerTransfer.setCustomerId(taCustomerTransfer.getCustomerId());
128
+            taCustomerTransfer.setCustomerName(customer.getCustomerName());
129
+            taCustomerTransfer.setToUserId(taCustomerTransfer.getToUserId());
130
+            taCustomerTransfer.setToUserName(toUser.getUsername());
131
+
101 132
             if (iTaCustomerTransferService.updateById(taCustomerTransfer)){
102 133
                 responseBean.addSuccess("success");
103 134
             }else {

+ 3
- 2
src/main/java/com.huiju.welcome/controller/TaMainUsherRecordController.java Datei anzeigen

@@ -216,8 +216,9 @@ public class TaMainUsherRecordController extends BaseController {
216 216
                                  @RequestParam(defaultValue = "10") int pageSize,
217 217
                                  @RequestParam(value = "customerName" ,required = false)String customerName,
218 218
                                  @RequestParam(value = "phone" ,required = false)String phone,
219
-                                 @RequestParam(value = "platNumber" ,required = false)String platNumber){
220
-        ResponseBean result = iTaMainUsherRecordService.customerPage(pageNum, pageSize,customerName,phone,platNumber);
219
+                                 @RequestParam(value = "platNumber" ,required = false)String platNumber,
220
+                                 @RequestParam(value = "agentUserId", required = false) Integer agentUserId){
221
+        ResponseBean result = iTaMainUsherRecordService.customerPage(pageNum, pageSize,customerName,phone,platNumber, agentUserId);
221 222
         return result;
222 223
     }
223 224
 }

+ 1
- 1
src/main/java/com.huiju.welcome/mapper/TaCustomerMapper.java Datei anzeigen

@@ -20,7 +20,7 @@ import java.util.List;
20 20
 public interface TaCustomerMapper extends BaseMapper<TaCustomer> {
21 21
 
22 22
     TaCustomer getCustomerOf(@Param("personId") Integer personId, @Param("realId") Integer realId);
23
-    IPage<TaCustomer> customerPage(IPage<TaCustomer> pg, @Param("customerName") String customerName, @Param("phone") String phone, @Param("platNumber") String platNumber);
23
+    IPage<TaCustomer> customerPage(IPage<TaCustomer> pg, @Param("customerName") String customerName, @Param("phone") String phone, @Param("platNumber") String platNumber, @Param("agentUserId") Integer agentUserId);
24 24
 
25 25
     List<TaCustomer> getSomeCustMayBe(@Param("plateNumber") String plateNumber, @Param("phone") String phone);
26 26
 

+ 18
- 0
src/main/java/com.huiju.welcome/model/TaCustomer.java Datei anzeigen

@@ -187,4 +187,22 @@ public class TaCustomer implements Serializable {
187 187
      * 身份证号
188 188
      */
189 189
     private String idcard;
190
+
191
+    /**
192
+     * 经纪人名称
193
+     */
194
+    @TableField(exist = false)
195
+    private String agentUserName;
196
+
197
+    /**
198
+     * 经纪人ID
199
+     */
200
+    @TableField(exist = false)
201
+    private Integer agentUserId;
202
+
203
+    /**
204
+     * 关联经纪人的编号表ID
205
+     */
206
+    @TableField(exist = false)
207
+    private Integer transferId;
190 208
 }

+ 1
- 1
src/main/java/com.huiju.welcome/service/ITaMainUsherRecordService.java Datei anzeigen

@@ -33,7 +33,7 @@ public interface ITaMainUsherRecordService extends IService<TaMainUsherRecord> {
33 33
      * 查询客户列表
34 34
      * @return
35 35
      */
36
-    ResponseBean customerPage(int pageNum, int pageSize, String customerName, String phone, String platNumber);
36
+    ResponseBean customerPage(int pageNum, int pageSize, String customerName, String phone, String platNumber, Integer agentUserId);
37 37
 
38 38
     boolean newRecordByMiniapp(TaMainUsherRecord taMainUsherRecord) throws Exception;
39 39
 

+ 4
- 1
src/main/java/com.huiju.welcome/service/impl/SysRoleServiceImpl.java Datei anzeigen

@@ -16,6 +16,7 @@ import com.huiju.welcome.utils.StatusUtils;
16 16
 import org.apache.commons.lang3.StringUtils;
17 17
 import org.springframework.beans.factory.annotation.Autowired;
18 18
 import org.springframework.stereotype.Service;
19
+import org.springframework.util.CollectionUtils;
19 20
 
20 21
 import java.time.LocalDateTime;
21 22
 import java.util.ArrayList;
@@ -95,7 +96,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
95 96
         List<SysRoleMenu> sysRoleMenuList = Arrays.asList(menuIdArray).stream()
96 97
                 .map(e -> new SysRoleMenu(role.getRoleId(), e + ""))
97 98
                 .collect(Collectors.toList());
98
-        sysRoleMenuMapper.insertBeach(sysRoleMenuList);
99
+        if (!CollectionUtils.isEmpty(sysRoleMenuList)) {
100
+            sysRoleMenuMapper.insertBeach(sysRoleMenuList);
101
+        }
99 102
 
100 103
         responseBean.addSuccess("操作成功!");
101 104
         return responseBean;

+ 4
- 2
src/main/java/com.huiju.welcome/service/impl/TaMainUsherRecordServiceImpl.java Datei anzeigen

@@ -229,10 +229,12 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
229 229
             miniApp.sendTPLMessage(tplId, openid, page, dt2);
230 230
         }
231 231
     }
232
-    public ResponseBean customerPage(int pageNum, int pageSize, String customerName, String phone, String platNumber) {
232
+
233
+    @Override
234
+    public ResponseBean customerPage(int pageNum, int pageSize, String customerName, String phone, String platNumber, Integer agentUserId) {
233 235
         ResponseBean response = new ResponseBean();
234 236
         IPage<TaCustomer> pg = new Page<>(pageNum, pageSize);
235
-        IPage<TaCustomer> result = taCustomerMapper.customerPage(pg,customerName,phone,platNumber);
237
+        IPage<TaCustomer> result = taCustomerMapper.customerPage(pg,customerName,phone,platNumber,agentUserId);
236 238
         response.addSuccess(result);
237 239
         return response;
238 240
     }

+ 13
- 4
src/main/resources/mapper/TaCustomerMapper.xml Datei anzeigen

@@ -19,18 +19,27 @@
19 19
             LIMIT 1
20 20
     </select>
21 21
     <select id="customerPage" resultType="com.huiju.welcome.model.TaCustomer">
22
-        select * from ta_customer
22
+        select
23
+        *,
24
+        tct.to_user_name as agentUserName,
25
+        tct.to_user_id as agentUserId,
26
+        tct.transfer_id as transferId
27
+        from ta_customer tac
28
+        left join ta_customer_transfer tct on tac.customer_id = tct.customer_id
23 29
         <where>
24 30
             <if test="customerName !=null and customerName != ''">
25
-                and customer_name LIKE CONCAT('%',#{customerName},'%')
31
+                and tac.customer_name LIKE CONCAT('%',#{customerName},'%')
26 32
             </if>
27 33
 
28 34
             <if test="phone !=null and phone != ''">
29
-                and phone LIKE CONCAT('%',#{phone},'%')
35
+                and tac.phone LIKE CONCAT('%',#{phone},'%')
30 36
             </if>
31 37
 
32 38
             <if test="platNumber !=null and platNumber != ''">
33
-                and   plate_number LIKE CONCAT('%',#{platNumber},'%')
39
+                and   tac.plate_number LIKE CONCAT('%',#{platNumber},'%')
40
+            </if>
41
+            <if test="agentUserId != null">
42
+                and tct.to_user_id = #{agentUserId}
34 43
             </if>
35 44
         </where>
36 45
         order by create_date desc