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 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 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 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 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 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> queryAllRole(){ return service.queryAllAPPRole(); } /** * 查询字典里面的角色 * @return */ @PostMapping(MODEL + "/editrole/queryAllProvince.json") @Function("Cuser") @ResponseBody List> 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 queryQromoterList(PromoterModel promoterModel){ return service.queryQromoterList(promoterModel); } /** * 查询推广员详情 * @param userId * @param phone * @param userType * @return */ @PostMapping(MODEL + "/qromoter/queryPromoterDetail.json") @Function("promoter") @ResponseBody Map 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 queryxxxx(String userId, String startTime, String endTime){ return service.queryxxxx(userId, startTime, endTime); } }