Helius
2021-06-16 5728be2af515b2200e782aa201ca5d4d67d9ea47
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
package com.ibeetl.admin.console.web;
 
import com.google.gson.Gson;
import com.ibeetl.admin.console.model.PromoterModel;
import com.ibeetl.admin.console.model.UserModel;
import com.ibeetl.admin.console.service.CuserConsoleService;
import com.ibeetl.admin.console.service.RedisService;
import com.ibeetl.admin.console.service.XzxSysAddressLevelInfoService;
import com.ibeetl.admin.core.annotation.Function;
import com.ibeetl.admin.core.entity.CoreOrg;
import com.ibeetl.admin.core.entity.CoreUser;
import com.ibeetl.admin.core.rbac.UserLoginInfo;
import com.ibeetl.admin.core.service.CorePlatformService;
import com.ibeetl.admin.core.service.CoreUserService;
import com.ibeetl.admin.core.util.HttpRequestLocal;
import com.ibeetl.admin.core.util.PlatformException;
import com.ibeetl.admin.core.util.TokenUtils;
import com.ibeetl.admin.core.util.fileexport.FileExportUtil;
import com.ibeetl.admin.core.web.JsonResult;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
 
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
 
/**
 * 用户管理
 */
//@Controller
@RestController
public class CuserConsoleController {
 
    private static final String MODEL = "/admin/cuser";
    private final Logger log = LoggerFactory.getLogger(this.getClass());
 
    @Autowired
    CuserConsoleService service;
    @Autowired
    CoreUserService userService;
    @Autowired
    HttpRequestLocal httpRequestLocal;
    @Autowired
    CorePlatformService platformService;
    @Autowired
    RedisService redisService;
    @Autowired
    XzxSysAddressLevelInfoService xzxSysAddressLevelInfoService;
 
 
 
    // 用户查询
    @GetMapping(MODEL + "/index.do")
    @Function("Cuser")
    ModelAndView cuserIndex(){
        ModelAndView view = new ModelAndView("/admin/cuser/cuserQuery.html");
        return view;
    }
    /**
     * 查询
     * @param userType
     * @param name
     * @param phone
     * @param page
     * @param limit
     * @return
     */
    @PostMapping(MODEL + "/query/queryCuserList.json")
    @Function("Cuser")
    @ResponseBody
    Map<String, Object> queryCuserList(String userType, String name, String phone, String page, String limit){
        return service.queryCuserList(userType, name, phone, page, limit);
    }
 
    @GetMapping(MODEL + "/query/queryCuserDetailIndex.do")
    @Function("Cuser")
    public ModelAndView queryCuserDetailIndex(String userId, String phone, String userType){
        if(StringUtils.isEmpty(userId) && StringUtils.isEmpty(userType)){
            userType = "1";
            UserModel userModel = service.queryCuserByUsertype(phone, userType,null);
            if(userModel != null){
                userId = userModel.getUserId();
            }
        }
        ModelAndView view = new ModelAndView("/admin/cuser/cuserDetail.html");
        view.addObject("userId", userId)
                .addObject("phone", phone)
                .addObject("userType", userType);
        return view;
    }
 
    /**
     * 用户详情数据
     * @param userId
     * @param phone
     * @param userType
     * @return
     */
    @PostMapping(MODEL + "/query/queryCuserDetail.json")
    @Function("Cuser")
    @ResponseBody
    Map<String, Object> queryCuserDetail(String userId, String phone, String userType){
        return service.queryCuserDetail(userId, phone, userType,10000,1);
    }
 
    /**
     * 根据用户ID查询订单
     * @param userId
     * @param orderStatus
     * @param page
     * @param limit
     * @return
     */
    @PostMapping(MODEL + "/query/queryCuserOrder.json")
    @Function("Cuser")
    @ResponseBody
    Map<String, Object> queryCuserOrder(String userId, String orderStatus, String userType, int page, int limit){
        //return service.queryCuserOrder(userId, orderStatus, userType, page, limit);
          return null;
    }
 
    /**
     * 根据用户ID查询用户的充值和体现记录
     * @param userId
     * @param payType
     * @param tStatus
     * @param page
     * @param limit
     * @return
     */
    @PostMapping(MODEL + "/query/queryCuserMoneyLog.json")
    @Function("Cuser")
    @ResponseBody
    Map<String, Object> queryCuserMoneyLog(String userId, String payType, String tStatus, String xStatus, int page, int limit){
        return service.queryCuserMoneyLog(userId, payType, tStatus,xStatus, page, limit);
    }
 
    //==================
 
    // 身份设定
 
    @GetMapping(MODEL + "/editrole/etindex.do")
    @Function("cuser.edit")
    ModelAndView index(){
        ModelAndView view = new ModelAndView("/admin/cuser/cuserEdit.html");
        return view;
    }
 
    /**
     * 身份设定查询
     * @param phone
     * @return
     */
    @PostMapping(MODEL + "/editrole/queryCuserByPhone.json")
    @Function("cuser.edit")
    @ResponseBody
    Map<String, Object> queryCuserByPhone(String phone, String page, String limit){
 
        return service.queryCuserByPhoneList(phone,page,limit);
    }
 
    /**
     * 根据Id删除用户角色
     * @param id
     */
    @PostMapping(MODEL + "/editrole/delCuserById.json")
    @Function("cuser.edit")
    void delCuserById(String id, String phone, String userType){
        service.delCuserById(id, phone, userType);
    }
 
    /**
     * 添加用户角色
     * @param phone
     * @param userType
     * @return
     */
    /*@PostMapping(MODEL + "/editrole/addCuserRole.json")
    @Function("cuser.edit")
    @ResponseBody
    int addCuserRole(String phone, String userType,String password,String area,String name){
        return service.addCuserRole(phone, userType,password,area,name);
    }*/
 
    /**
     * 添加用户角色
     * @param phone
     * @param userType
     * @return
     */
    @PostMapping(MODEL + "/editrole/updateCuserRole.json")
    @Function("cuser.edit")
    @ResponseBody
    int updateCuserRole(String phone, String userType,String password,String area,String name){
        return service.updateCuserRole(phone, userType,password,area,name,null,null);
    }
 
    @PostMapping(MODEL + "/editrole/queryUserByPhone.json")
    @Function("cuser.edit")
    @ResponseBody
    int queryUserByPhone(String phone){
        return service.queryUserByPhone(phone);
    }
 
    /**
     * 查询字典里面的角色
     * @return
     */
    @PostMapping(MODEL + "/editrole/queryAllRole.json")
    @Function("Cuser")
    @ResponseBody
    List<Map<String, Object>> queryAllRole(){
        return service.queryAllAPPRole();
    }
 
    /**
     * 查询字典里面的角色
     * @return
     */
    @PostMapping(MODEL + "/editrole/queryAllProvince.json")
    @Function("Cuser")
    @ResponseBody
    List<Map<String, Object>> queryAllProvince(String level){
            return xzxSysAddressLevelInfoService.queryAllProvince(level);
    }
    /**
     * C端用户导出, 每次导出最多60000条
     * @param userType
     * @param name
     * @param phone
     */
    @GetMapping(MODEL + "/query/export.json")
    @Function("Cuser")
    @ResponseBody
    int exportCuser(String userType, String name, String phone, HttpServletResponse response){
        service.exportCuser(userType, name, phone, response);
        return 1;
    }
 
    /**
     * 根据用户ID更新name
     * @param userId
     * @param name
     * @return
     */
    @PostMapping(MODEL + "/update/updateUserName.json")
    @Function("cuser.edit")
    @ResponseBody
    int updateUserName(String userId, String name, String mobile){
        return service.updateUserName(userId, name, mobile);
    }
 
    /**
     *
     * @param userId
     * @param name
     * @param mobile
     * @return
     */
    @PostMapping(MODEL + "/update/updatePromoterName.json")
    @Function("cuser.edit")
    @ResponseBody
    int updatePromoterName(String userId, String name, String mobile){
        return service.updatePromoterName(userId, name, mobile);
    }
 
    // 推广员查询页面
    @GetMapping(MODEL + "/promoterIndex.do")
    @Function("promoter")
    ModelAndView promoterIndex(){
        ModelAndView view = new ModelAndView("/admin/cuser/promoterCuser.html");
        return view;
    }
    @GetMapping(MODEL + "/query/queryPromoterDetailIndex.do")
    public ModelAndView queryPromoterDetailIndex(String userId, String phone, String userType){
        if(StringUtils.isEmpty(phone)){
            UserModel userModel = service.queryUserById(userId);
            phone = userModel.getMobilePhone();
        }
        ModelAndView view = new ModelAndView("/admin/cuser/promoterDetail.html");
        view.addObject("userId", userId)
                .addObject("phone", phone)
                .addObject("userType", userType);
        return view;
    }
 
    /**
     * 查询推广员页面
     * @param promoterModel
     * @return
     */
    @PostMapping(MODEL + "/qromoter/queryQromoterList.json")
    @Function("promoter")
    @ResponseBody
    Map<String, Object> queryQromoterList(PromoterModel promoterModel){
        return service.queryQromoterList(promoterModel);
    }
 
    /**
     * 查询推广员详情
     * @param userId
     * @param phone
     * @param userType
     * @return
     */
    @PostMapping(MODEL + "/qromoter/queryPromoterDetail.json")
    @Function("promoter")
    @ResponseBody
    Map<String, Object> queryPromoterDetail(String userId, String phone, String userType){
        return service.queryPromoterDetail(userId, phone, userType);
    }
 
    /**
     * 忘记了
     * @param userId
     * @param startTime
     * @param endTime
     * @return
     */
    @PostMapping(MODEL + "/qromoter/queryxxxx.json")
    @Function("promoter")
    @ResponseBody
    Map<String, Object> queryxxxx(String userId, String startTime, String endTime){
        return service.queryxxxx(userId, startTime, endTime);
    }
 
 
}