| package com.dsh.account.controller; | 
|   | 
| import com.alibaba.fastjson.JSONObject; | 
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
| import com.baomidou.mybatisplus.extension.api.R; | 
| import com.dsh.account.dto.*; | 
| import com.dsh.account.entity.*; | 
| import com.dsh.account.feignclient.other.VipClient; | 
| import com.dsh.account.model.AddAppUserVo; | 
| import com.dsh.account.model.AdvertisementChangeStateDTO; | 
| import com.dsh.account.model.AppUserByNameAndPhoneDTO; | 
| import com.dsh.account.model.AppUserIdsByCityName; | 
| import com.dsh.account.model.JoinPlayPaiVo; | 
| import com.dsh.account.model.LoginSMSCodeVo; | 
| import com.dsh.account.model.LoginWeChatVo; | 
| import com.dsh.account.model.QueryByNamePhone; | 
| import com.dsh.account.model.query.UserDetailsOfSearch; | 
| import com.dsh.account.model.query.appUserQuery.QueryAppUser; | 
| import com.dsh.account.model.vo.QueryAppUserVO; | 
| import com.dsh.account.service.IVipPaymentService; | 
| import com.dsh.account.service.TAppGiftService; | 
| import com.dsh.account.service.TAppUserService; | 
| import com.dsh.account.service.TCourseInfoRecordService; | 
| import com.dsh.account.service.TStudentService; | 
| import com.dsh.account.service.UserIntegralChangesService; | 
| import com.dsh.account.util.PayMoneyUtil; | 
| import com.dsh.account.util.ResultUtil; | 
| import com.dsh.account.util.TokenUtil; | 
| import com.dsh.account.util.ToolUtil; | 
| import com.dsh.account.util.wx.WxV3PayConfig; | 
| import com.dsh.account.vo.VipPaymentVO; | 
| import com.wechat.pay.contrib.apache.httpclient.util.AesUtil; | 
| import io.swagger.annotations.ApiImplicitParam; | 
| import io.swagger.annotations.ApiImplicitParams; | 
| import io.swagger.annotations.ApiOperation; | 
| import org.checkerframework.checker.guieffect.qual.UI; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.web.bind.annotation.GetMapping; | 
| import org.springframework.web.bind.annotation.PathVariable; | 
| import org.springframework.web.bind.annotation.PostMapping; | 
| import org.springframework.web.bind.annotation.RequestBody; | 
| import org.springframework.web.bind.annotation.RequestMapping; | 
| import org.springframework.web.bind.annotation.ResponseBody; | 
| import org.springframework.web.bind.annotation.RestController; | 
|   | 
| import javax.servlet.http.HttpServletRequest; | 
| import javax.servlet.http.HttpServletResponse; | 
| import java.io.BufferedReader; | 
| import java.io.PrintWriter; | 
| import java.nio.charset.StandardCharsets; | 
| import java.util.ArrayList; | 
| import java.util.Date; | 
| import java.util.List; | 
| import java.util.Map; | 
| import java.util.stream.Collectors; | 
|   | 
| /** | 
|  * @author zhibing.pu | 
|  * @date 2023/6/14 15:30 | 
|  */ | 
| @RestController | 
| @RequestMapping("") | 
| public class AppUserController { | 
|   | 
|     @Autowired | 
|     private TAppUserService appUserService; | 
|     @Autowired | 
|     private VipClient vipClient; | 
|   | 
|     @Autowired | 
|     private PayMoneyUtil payMoneyUtil; | 
|   | 
|     @Autowired | 
|     private IVipPaymentService vipPaymentService; | 
|   | 
|     @Autowired | 
|     private TokenUtil tokenUtil; | 
|   | 
|     @Autowired | 
|     private TCourseInfoRecordService courseInfoRecordService; | 
|   | 
|     @Autowired | 
|     private TAppGiftService appGiftService; | 
|   | 
|     @Autowired | 
|     private UserIntegralChangesService userIntegralChangesService; | 
|   | 
|     /** | 
|      * 根据介绍有礼id查询当前活动参与次数 | 
|      */ | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/getActivityPeoples") | 
|     public Integer getActivityPeoples(@RequestBody Integer activityId) { | 
|         int activityId1 = appGiftService.list(new QueryWrapper<TAppGift>().eq("activityId", activityId)) | 
|                 .size(); | 
|         return activityId1; | 
|     } | 
|   | 
|     /** | 
|      * 介绍有礼 -- 参与用户列表 | 
|      */ | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/queryIntroduceAll") | 
|     public List<IntroduceUser> queryIntroduceAll(@RequestBody IntroduceUserQuery query) { | 
|         return appGiftService.queryIntroduceAll(query); | 
|     } | 
|   | 
|     /** | 
|      * 获取所有用户 | 
|      */ | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/queryAppUserList") | 
|     public List<TAppUser> queryAppUserList(@RequestBody AppUserByNameAndPhoneDTO dto) { | 
|         return appUserService.queryAPPUserByNameAndPhone(dto); | 
|     } | 
|   | 
|     /** | 
|      * 根据用户姓名和电话模糊查询 | 
|      */ | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/queryAPPUserByNameAndPhone") | 
|     public List<TAppUser> queryAPPUserByNameAndPhone(@RequestBody AppUserByNameAndPhoneDTO dto) { | 
|         return appUserService.queryAPPUserByNameAndPhone(dto); | 
|     } | 
|   | 
|     /** | 
|      * 根据用户id获取用户信息 | 
|      * | 
|      * @param appUserId | 
|      * @return | 
|      */ | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/queryAppUser1") | 
|     public TAppUser queryAppUser1(@RequestBody Integer appUserId) { | 
|         TAppUser appUser = appUserService.getById(appUserId); | 
|         return appUser; | 
|     } | 
|   | 
|     /** | 
|      * 冻结/解冻 1=解冻 2=冻结 | 
|      */ | 
|     @RequestMapping("/base/appUser/changeState") | 
|     public Object changeState(@RequestBody AdvertisementChangeStateDTO dto) { | 
|         return appUserService.changeState(dto); | 
|     } | 
|   | 
|     /** | 
|      * 后台添加 | 
|      */ | 
|     @RequestMapping("/base/appUser/addAppUser1") | 
|     public Object addAppUser1(@RequestBody TAppUser query) { | 
|         // 修改 | 
|         if (query.getId() != null) { | 
|             TAppUser phone = appUserService.getOne(new QueryWrapper<TAppUser>().eq("phone", query.getPhone()).ne("id", query.getId())); | 
|             if (null != phone) { | 
|                 return 5001; | 
|             } | 
|         } else { | 
|             TAppUser phone = appUserService.getOne(new QueryWrapper<TAppUser>().eq("phone", query.getPhone())); | 
|             if (null != phone) { | 
|                 return 5001; | 
|             } | 
|         } | 
|         query.setIsVip(0); | 
|         query.setInsertTime(new Date()); | 
|         return appUserService.saveOrUpdate(query); | 
|     } | 
|   | 
|     /** | 
|      * 获取用户信息列表数据 | 
|      */ | 
|     @ResponseBody | 
|     @RequestMapping("/base/appUser/listAll") | 
|     public List<QueryAppUserVO> listAll(@RequestBody QueryAppUser query) { | 
|         List<QueryAppUserVO> queryAppUserVOS = appUserService.listAll(query); | 
|         ArrayList<QueryAppUserVO> res = new ArrayList<>(); | 
|   | 
|         if (query.getUserIds() != null && query.getUserIds().size() != 0) { | 
|             List<QueryAppUserVO> queryAppUserVOS1 = appUserService.listAll1(query); | 
|             queryAppUserVOS.addAll(queryAppUserVOS1); | 
|         } | 
|         List<QueryAppUserVO> collect = queryAppUserVOS.stream().distinct().collect(Collectors.toList()); | 
|         for (QueryAppUserVO vo : collect) { | 
|             // 会员到期时间小于当前时间或者会员到期时间为null 则会员过期 | 
|             if (vo.getVipEndTime() != null && vo.getVipEndTime().after(new Date())) { | 
|                 vo.setIsVip(1); | 
|             } else { | 
|                 vo.setIsVip(0); | 
|             } | 
|             if (query.getIsVip() != null && (!query.getIsVip().equals(""))) { | 
|                 if (vo.getIsVip() == query.getIsVip()) { | 
|                     res.add(vo); | 
|                 } | 
|             } else { | 
|                 res.add(vo); | 
|             } | 
|         } | 
|         return res; | 
|     } | 
|   | 
|     /** | 
|      * 根据用户手机号获取用户id | 
|      */ | 
|     @ResponseBody | 
|     @GetMapping("/base/appUser/getAppUserByPhone/{phone}") | 
|     public TAppUser getAppUserByPhone(@PathVariable("phone") String phone) { | 
|         TAppUser appUser = appUserService.getOne(new QueryWrapper<TAppUser>().eq("phone", phone) | 
|                 .eq("state", 1)); | 
|         return appUser; | 
|     } | 
|   | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/getSMSCode") | 
|     @ApiOperation(value = "获取短信验证码", tags = {"APP-登录注册"}) | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(value = "类型(1:登录,2:注册,3:修改密码,4:忘记密码)", name = "type", dataType = "int", required = true), | 
|             @ApiImplicitParam(value = "电话号码", name = "phone", dataType = "string", required = true) | 
|     }) | 
|     public ResultUtil getSMSCode(Integer type, String phone) { | 
|         if (ToolUtil.isEmpty(phone)) { | 
|             return ResultUtil.paranErr("phone"); | 
|         } | 
|         if (ToolUtil.isEmpty(type)) { | 
|             return ResultUtil.paranErr("type"); | 
|         } | 
|         try { | 
|             ResultUtil smsCode = appUserService.getSMSCode(type, phone); | 
|             return smsCode; | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|             return ResultUtil.runErr(); | 
|         } | 
|     } | 
|   | 
|   | 
|     @Autowired | 
|     private TStudentService studentService; | 
|   | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/logOff") | 
|     @ApiOperation(value = "注销", tags = {"注销"}) | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(value = "账号id", name = "appId", dataType = "int", required = true) | 
|     }) | 
|     public ResultUtil<String> logOff(Integer appId) { | 
|         try { | 
|   | 
|             appUserService.removeById(appId); | 
|             studentService.remove(new QueryWrapper<TStudent>().eq("appUserId", appId)); | 
|   | 
|             return ResultUtil.success("注销成功"); | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|             return ResultUtil.runErr(); | 
|         } | 
|     } | 
|   | 
|   | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/addAppUser") | 
|     @ApiOperation(value = "注册用户", tags = {"APP-登录注册"}) | 
|     @ApiImplicitParams({ | 
|     }) | 
|     public ResultUtil addAppUser(AddAppUserVo addAppUserVo) { | 
|         try { | 
|             return appUserService.addAppUser(addAppUserVo); | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|             return ResultUtil.runErr(); | 
|         } | 
|     } | 
|   | 
|   | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/loginPassword") | 
|     @ApiOperation(value = "账号密码登录", tags = {"APP-登录注册"}) | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(value = "电话号码", name = "phone", dataType = "string", required = true), | 
|             @ApiImplicitParam(value = "登录密码", name = "password", dataType = "string", required = true) | 
|     }) | 
|     public ResultUtil<String> loginPassword(String phone, String password) { | 
|         if (ToolUtil.isEmpty(phone)) { | 
|             return ResultUtil.paranErr("phone"); | 
|         } | 
|         if (ToolUtil.isEmpty(password)) { | 
|             return ResultUtil.paranErr("password"); | 
|         } | 
|         try { | 
|             return appUserService.loginPassword(phone, password); | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|             return ResultUtil.runErr(); | 
|         } | 
|     } | 
|   | 
|   | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/loginSMSCode") | 
|     @ApiOperation(value = "短信验证码登录", tags = {"APP-登录注册"}) | 
|     public ResultUtil<String> loginSMSCode(LoginSMSCodeVo loginSMSCodeVo) { | 
|         try { | 
|             return appUserService.loginSMSCode(loginSMSCodeVo); | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|             return ResultUtil.runErr(); | 
|         } | 
|     } | 
|   | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/bind") | 
|     @ApiOperation(value = "微信登录绑定手机号", tags = {"APP-登录注册"}) | 
|     @ApiImplicitParams({ | 
|     }) | 
|     public ResultUtil bind(BindDto dto) { | 
|         try { | 
|             return appUserService.bind(dto); | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|             return ResultUtil.runErr(); | 
|         } | 
|     } | 
|   | 
|   | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/loginWeChat") | 
|     @ApiOperation(value = "微信登录", tags = {"APP-登录注册"}) | 
|     @ApiImplicitParams({ | 
|     }) | 
|     public ResultUtil<String> loginWeChat(LoginWeChatVo loginWeChatVo) { | 
|         try { | 
|             return appUserService.loginWechat(loginWeChatVo); | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|             return ResultUtil.runErr(); | 
|         } | 
|     } | 
|   | 
|   | 
|     @ResponseBody | 
|     @PostMapping("/api/appUser/updateInfo") | 
|     @ApiOperation(value = "修改个人信息", tags = {"APP-登录注册"}) | 
|     @ApiImplicitParams({ | 
|     }) | 
|     public ResultUtil<String> updateInfo(UpdateInfoDto dto) { | 
|         try { | 
|             Integer uid = tokenUtil.getUserIdFormRedis(); | 
|             if (null == uid) { | 
|                 return ResultUtil.tokenErr(); | 
|             } | 
|             return appUserService.updateInfo(dto, uid); | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|             return ResultUtil.runErr(); | 
|         } | 
|     } | 
|   | 
|   | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/updatePassword") | 
|     @ApiOperation(value = "修改密码", tags = {"APP-登录注册"}) | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(value = "电话号码", name = "phone", dataType = "string", required = true), | 
|             @ApiImplicitParam(value = "短信验证码", name = "code", dataType = "string", required = true), | 
|             @ApiImplicitParam(value = "新密码", name = "password", dataType = "string", required = true) | 
|     }) | 
|     public ResultUtil updatePassword(String phone, String code, String password) { | 
|         if (ToolUtil.isEmpty(phone)) { | 
|             return ResultUtil.paranErr("phone"); | 
|         } | 
|         if (ToolUtil.isEmpty(code)) { | 
|             return ResultUtil.paranErr("code"); | 
|         } | 
|         if (ToolUtil.isEmpty(password)) { | 
|             return ResultUtil.paranErr("password"); | 
|         } | 
|         try { | 
|             return appUserService.updatePassword(phone, code, password); | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|             return ResultUtil.runErr(); | 
|         } | 
|     } | 
|   | 
|   | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/forgetPassword") | 
|     @ApiOperation(value = "忘记密码", tags = {"APP-登录注册"}) | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(value = "电话号码", name = "phone", dataType = "string", required = true), | 
|             @ApiImplicitParam(value = "短信验证码", name = "code", dataType = "string", required = true), | 
|             @ApiImplicitParam(value = "新密码", name = "password", dataType = "string", required = true) | 
|     }) | 
|     public ResultUtil forgetPassword(String phone, String code, String password) { | 
|         if (ToolUtil.isEmpty(phone)) { | 
|             return ResultUtil.paranErr("phone"); | 
|         } | 
|         if (ToolUtil.isEmpty(code)) { | 
|             return ResultUtil.paranErr("code"); | 
|         } | 
|         if (ToolUtil.isEmpty(password)) { | 
|             return ResultUtil.paranErr("password"); | 
|         } | 
|         try { | 
|             return appUserService.updatePassword(phone, code, password); | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|             return ResultUtil.runErr(); | 
|         } | 
|     } | 
|   | 
|   | 
|     @ResponseBody | 
|     @PostMapping("/api/appUser/queryJoinPlayPai") | 
|     @ApiOperation(value = "获取加入玩湃首页数据", tags = {"APP-加入玩湃"}) | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(value = "经度", name = "lon", dataType = "string", required = false), | 
|             @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = false), | 
|             @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") | 
|     }) | 
|     public ResultUtil<JoinPlayPaiVo> queryJoinPlayPai(String lon, String lat) { | 
|   | 
|         try { | 
|             Integer uid = tokenUtil.getUserIdFormRedis(); | 
|             if (null == uid) { | 
|                 return ResultUtil.tokenErr(); | 
|             } | 
|             JoinPlayPaiVo joinPlayPaiVo = appUserService.queryJoinPlayPai(uid, lon, lat); | 
|             return ResultUtil.success(joinPlayPaiVo); | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|             return ResultUtil.runErr(); | 
|         } | 
|     } | 
|   | 
|   | 
|     @ResponseBody | 
|     @PostMapping("/api/appUser/addVipPayment") | 
|     @ApiOperation(value = "购买年度会员", tags = {"APP-成为会员"}) | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(value = "支付方式(1=微信,2=支付宝)", name = "payType", dataType = "int", required = true), | 
|             @ApiImplicitParam(value = "会员卡id", name = "id", dataType = "int", required = true), | 
|             @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") | 
|     }) | 
|     public ResultUtil addVipPayment(Integer payType, Integer id) { | 
|         if (ToolUtil.isEmpty(payType)) { | 
|             return ResultUtil.paranErr("payType"); | 
|         } | 
|         try { | 
|             Integer uid = tokenUtil.getUserIdFormRedis(); | 
|             if (null == uid) { | 
|                 return ResultUtil.tokenErr(); | 
|             } | 
|             return vipPaymentService.addVipPayment(uid, payType, id); | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|             return ResultUtil.runErr(); | 
|         } | 
|     } | 
|   | 
|     @ResponseBody | 
|     @PostMapping("/api/appUser/vipPayment") | 
|     @ApiOperation(value = "页面数据展示", tags = {"APP-成为会员"}) | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") | 
|     }) | 
|     public ResultUtil<VipPaymentVO> vipPayment() { | 
|   | 
|         try { | 
|             Integer uid = tokenUtil.getUserIdFormRedis(); | 
|             if (null == uid) { | 
|                 return ResultUtil.tokenErr(); | 
|             } | 
|             TAppUser appUser = appUserService.getById(uid); | 
|             VipPaymentVO res = new VipPaymentVO(); | 
|             res.setHeadImg(appUser.getHeadImg()); | 
|             res.setName(appUser.getName()); | 
|             res.setVipEndTime(appUser.getVipEndTime()); | 
|             if (appUser.getVipEndTime() == null) { | 
|                 res.setIsVip(0); | 
|             } else if (appUser.getVipEndTime().before(new Date())) { | 
|                 res.setIsVip(0); | 
|             } else { | 
|                 res.setIsVip(1); | 
|             } | 
|             appUserService.updateById(appUser); | 
|             List<Vip> vips = vipClient.listAll(); | 
|             res.setVipList(vips); | 
|   | 
|             return ResultUtil.success(res); | 
|   | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|             return ResultUtil.runErr(); | 
|         } | 
|     } | 
|   | 
| // | 
| //    /** | 
| //     * 购买年度会员支付微信回调V3版本回调 | 
| //     * | 
| //     * @param request | 
| //     * @param response | 
| //     */ | 
| //    @ResponseBody | 
| //    @PostMapping("/base/appUser/addVipPaymentWeChatCallback1") | 
| //    public void addVipPaymentWeChatCallback1(HttpServletRequest request, HttpServletResponse response) { | 
| //        try { | 
| //            System.err.println("微信回调"); | 
| //            System.err.println("请求" + request); | 
| //            BufferedReader reader = request.getReader(); | 
| //            String string1 = reader.toString(); | 
| //            System.err.println("请求reader" + string1); | 
| //            StringBuilder requestBody = new StringBuilder(); | 
| //            String line; | 
| //            while ((line = reader.readLine()) != null) { | 
| //                requestBody.append(line); | 
| //            } | 
| //            System.err.println("全部请求体" + requestBody); | 
| //            JSONObject jsonObject = JSONObject.parseObject(requestBody.toString()); | 
| //            JSONObject resource = jsonObject.getJSONObject("resource"); | 
| // | 
| //            AesUtil aesUtil = new AesUtil(WxV3PayConfig.apiV3Key.getBytes(StandardCharsets.UTF_8)); | 
| //            String decryptedData = aesUtil.decryptToString(resource.getString("associated_data").getBytes(StandardCharsets.UTF_8), resource.getString("nonce").getBytes(StandardCharsets.UTF_8), | 
| //                    resource.getString("ciphertext")); | 
| //            System.err.println("微信解密的字符串信息" + decryptedData); | 
| //            JSONObject jsonInfo = (JSONObject) JSONObject.parse(decryptedData); | 
| //            String out_trade_no = jsonInfo.getString("out_trade_no"); | 
| //            String transaction_id = jsonInfo.getString("transaction_id"); | 
| //            String trade_state = jsonInfo.getString("trade_state"); | 
| //            if (trade_state.equals("SUCCESS")) { | 
| //                ResultUtil resultUtil = vipPaymentService.addVipPaymentCallback(out_trade_no, transaction_id); | 
| //                if (resultUtil.getCode() == 200) { | 
| //                    PrintWriter out = response.getWriter(); | 
| //                    out.write("SUCCESS"); | 
| //                    out.flush(); | 
| //                    out.close(); | 
| //                } | 
| //            } | 
| //        } catch (Exception e) { | 
| //            e.printStackTrace(); | 
| //        } | 
| //    } | 
|   | 
|     /** | 
|      * 购买年度会员支付微信回调 | 
|      * | 
|      * @param request | 
|      * @param response | 
|      */ | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/addVipPaymentWeChatCallback") | 
|     public void addVipPaymentWeChatCallback(HttpServletRequest request, HttpServletResponse response) { | 
|         try { | 
|             Map<String, String> map = payMoneyUtil.weixinpayCallback(request); | 
|             if (null != map) { | 
|                 String out_trade_no = map.get("out_trade_no"); | 
|                 String transaction_id = map.get("transaction_id"); | 
|                 String result = map.get("result"); | 
|                 ResultUtil resultUtil = vipPaymentService.addVipPaymentCallback(out_trade_no, transaction_id); | 
|                 if (resultUtil.getCode() == 200) { | 
|                     PrintWriter out = response.getWriter(); | 
|                     out.write(result); | 
|                     out.flush(); | 
|                     out.close(); | 
|                 } | 
|             } | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|         } | 
|     } | 
|   | 
|     /** | 
|      * 购买年度会员支付支付宝回调 | 
|      * | 
|      * @param request | 
|      * @param response | 
|      */ | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/addVipPaymentAliCallback") | 
|     public void addVipPaymentAliCallback(HttpServletRequest request, HttpServletResponse response) { | 
|         try { | 
|             Map<String, String> map = payMoneyUtil.alipayCallback(request); | 
|             if (null != map) { | 
|                 String out_trade_no = map.get("out_trade_no"); | 
|                 String trade_no = map.get("trade_no"); | 
|                 String appUserId = map.get("passback_params"); | 
|                 ResultUtil resultUtil = vipPaymentService.addVipPaymentCallback(out_trade_no, trade_no); | 
|                 if (resultUtil.getCode() == 200) { | 
|                     PrintWriter out = response.getWriter(); | 
|                     out.write("success"); | 
|                     out.flush(); | 
|                     out.close(); | 
|                 } | 
|             } | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|         } | 
|     } | 
|   | 
|   | 
|     /** | 
|      * 根据用户id获取用户信息 | 
|      * | 
|      * @param appUserId | 
|      * @return | 
|      */ | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/queryAppUser") | 
|     public TAppUser queryAppUser(@RequestBody Integer appUserId) { | 
|         try { | 
|             TAppUser appUser = appUserService.getById(appUserId); | 
|             return appUser; | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|             return null; | 
|         } | 
|     } | 
|   | 
|     /** | 
|      * 根据用户id获取用户信息 | 
|      * | 
|      * @param appUserIdList | 
|      * @return | 
|      */ | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/queryAppUserBatch") | 
|     List<TAppUser> queryAppUserBatch(@RequestBody List<Integer> appUserIdList) { | 
|         return appUserService.listByIds(appUserIdList); | 
|     } | 
|   | 
|   | 
|     /** | 
|      * 修改用户信息 | 
|      * | 
|      * @param appUser | 
|      */ | 
|     @ResponseBody | 
|     @PostMapping("/base/appUser/updateAppUser") | 
|     public void updateAppUser(@RequestBody TAppUser appUser) { | 
|         try { | 
|             TAppUser appUser1 = appUserService.getById(appUser.getId()); | 
|             appUserService.updateById(appUser); | 
|             if (appUser.getIntegral().compareTo(appUser1.getIntegral()) != 0) { | 
|                 UserIntegralChanges userIntegralChanges = new UserIntegralChanges(); | 
|                 userIntegralChanges.setAppUserId(appUser.getId()); | 
|                 userIntegralChanges.setOldIntegral(appUser1.getIntegral()); | 
|                 userIntegralChanges.setType(5); | 
|                 userIntegralChanges.setNewIntegral(appUser.getIntegral()); | 
|                 userIntegralChanges.setInsertTime(new Date()); | 
|                 userIntegralChanges.setCategory(2); | 
|                 userIntegralChangesService.save(userIntegralChanges); | 
|             } | 
|   | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|         } | 
|     } | 
|   | 
|   | 
|     @PostMapping("/base/appUser/getAllUser") | 
|     @ResponseBody | 
|     public List<TAppUser> getAllUser() { | 
|         try { | 
|             return appUserService.list(); | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|             return new ArrayList<>(); | 
|         } | 
|     } | 
|   | 
|     @PostMapping("/base/appUser/queryByNamePhone") | 
|     public List<TAppUser> queryByNamePhone(@RequestBody QueryByNamePhone queryByNamePhone) { | 
|         try { | 
|             LambdaQueryWrapper<TAppUser> tAppUserLambdaQueryWrapper = new LambdaQueryWrapper<>(); | 
|             if (ToolUtil.isNotEmpty(queryByNamePhone.getName())) { | 
|                 tAppUserLambdaQueryWrapper.like(TAppUser::getName, queryByNamePhone.getName()); | 
|             } | 
|             if (ToolUtil.isNotEmpty(queryByNamePhone.getPhone())) { | 
|                 tAppUserLambdaQueryWrapper.like(TAppUser::getPhone, queryByNamePhone.getPhone()); | 
|             } | 
|             List<TAppUser> list = appUserService.list(tAppUserLambdaQueryWrapper); | 
|             return list; | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|             return new ArrayList<>(); | 
|         } | 
|     } | 
|   | 
|     @PostMapping("/base/appUser/updateIntegral") | 
|     public Boolean updateIntegral(@RequestBody UpdateIntegral updateIntegral) { | 
|         TAppUser appUser = appUserService.getById(updateIntegral.getId()); | 
|         Integer integral = appUser.getIntegral(); | 
|         switch (updateIntegral.getChangeType()) { | 
|             case 1: | 
|                 integral = integral + updateIntegral.getIntegral(); | 
|                 break; | 
|             case 2: | 
|                 integral = integral - updateIntegral.getIntegral(); | 
|                 break; | 
|         } | 
|   | 
|         UserIntegralChanges userIntegralChanges = new UserIntegralChanges(); | 
|         userIntegralChanges.setAppUserId(updateIntegral.getId()); | 
|         userIntegralChanges.setType(1); | 
|         userIntegralChanges.setOldIntegral(appUser.getIntegral()); | 
|         userIntegralChanges.setNewIntegral(integral); | 
|         userIntegralChanges.setRemark(updateIntegral.getRemark()); | 
|         userIntegralChanges.setInsertTime(new Date()); | 
|         userIntegralChanges.setCategory(updateIntegral.getChangeType()); | 
|         userIntegralChangesService.save(userIntegralChanges); | 
|         appUser.setIntegral(integral); | 
|         appUserService.updateById(appUser); | 
|         return true; | 
|     } | 
|   | 
|     @PostMapping("/base/appUser/queryById") | 
|     public TAppUser queryById(@RequestBody Integer appUserId) { | 
|         try { | 
|             return appUserService.getById(appUserId); | 
|         } catch (Exception e) { | 
|             e.printStackTrace(); | 
|             return new TAppUser(); | 
|         } | 
|     } | 
|   | 
|   | 
|     /** | 
|      * 根据名称模糊搜索用户 | 
|      * | 
|      * @param name | 
|      * @return | 
|      */ | 
|     @ResponseBody | 
|     @PostMapping("/appUser/queryAppUserListByName") | 
|     public List<TAppUser> queryAppUserListByName(@RequestBody String name) { | 
|         return appUserService.list(new QueryWrapper<TAppUser>().eq("state", 1).like("name", name)); | 
|     } | 
|   | 
|   | 
|     @PostMapping("/appUser/addCourseInfoRecord") | 
|     public Boolean addCourseInfoRecord(@RequestBody TCourseInfoRecord tCourseInfoRecord) { | 
|         boolean save = courseInfoRecordService.save(tCourseInfoRecord); | 
|         return save; | 
|     } | 
|   | 
|     @PostMapping("/appUser/getSelects") | 
|     public List<SelectDto> getSelects(@RequestBody List<Integer> studentIds) { | 
|         List<SelectDto> selectDtos = appUserService.getSelects(studentIds); | 
|         System.out.println("=======selectDtos======>" + selectDtos); | 
|         return selectDtos; | 
|     } | 
|   | 
|   | 
|     @PostMapping("/appUser/queryAppUserByCityCode") | 
|     public List<TAppUser> queryAppUserByCityCode(@RequestBody String cityCode) { | 
|         return appUserService.list(new QueryWrapper<TAppUser>() | 
|                 .eq("state", 1) | 
|                 .eq("cityCode", cityCode) | 
|         ); | 
|     } | 
|   | 
|   | 
|     /** | 
|      * 根据城市code获取用户的id集合 | 
|      * | 
|      * @param cityCode 城市code | 
|      * @return | 
|      */ | 
|     @GetMapping("/appUser/getAppUserIds/{cityCode}") | 
|     public List<Integer> getAppUserIds(@PathVariable("cityCode") String cityCode) { | 
|         List<TAppUser> list = appUserService.list(new QueryWrapper<TAppUser>().eq("cityCode", cityCode).eq("state", 1)); | 
|         return list.stream().map(TAppUser::getId).collect(Collectors.toList()); | 
|     } | 
|   | 
|   | 
|     /** | 
|      * 根据省市名称所有用户 | 
|      * | 
|      * @param appUserIdsByCityName | 
|      * @return | 
|      */ | 
|     @PostMapping("/appUser/getAppUserIdsByCityName") | 
|     public List<Integer> getAppUserIdsByCityName(@RequestBody AppUserIdsByCityName appUserIdsByCityName) { | 
|         QueryWrapper<TAppUser> queryWrapper = new QueryWrapper<TAppUser>().eq("state", 1); | 
|         if (ToolUtil.isNotEmpty(appUserIdsByCityName.getProvince())) { | 
|             queryWrapper.like("province", appUserIdsByCityName.getProvince()); | 
|         } | 
|         if (ToolUtil.isNotEmpty(appUserIdsByCityName.getCity())) { | 
|             queryWrapper.like("city", appUserIdsByCityName.getCity()); | 
|         } | 
|         List<TAppUser> list = appUserService.list(queryWrapper); | 
|         return list.stream().map(TAppUser::getId).collect(Collectors.toList()); | 
|     } | 
|   | 
|   | 
|     @PostMapping("/appUser/queryAppUserByIds") | 
|     @ResponseBody | 
|     public List<TStudent> queryAppUserByIds(@RequestBody UserDetailsOfSearch search) { | 
|         LambdaQueryWrapper<TStudent> tAppUserLambdaQueryWrapper = new LambdaQueryWrapper<>(); | 
|         if (ToolUtil.isNotEmpty(search.getIdCard())) { | 
|             tAppUserLambdaQueryWrapper.eq(TStudent::getIdCard, search.getIdCard()); | 
|         } | 
|         if (ToolUtil.isNotEmpty(search.getPhone())) { | 
|             tAppUserLambdaQueryWrapper.eq(TStudent::getPhone, search.getPhone()); | 
|         } | 
|         if (ToolUtil.isNotEmpty(search.getName())) { | 
|             tAppUserLambdaQueryWrapper.eq(TStudent::getName, search.getName()); | 
|         } | 
|         tAppUserLambdaQueryWrapper.in(TStudent::getId, search.getUseIds()); | 
|         return studentService.list(tAppUserLambdaQueryWrapper); | 
|     } | 
| } |