刘帅
2026-09-20 a3bfafde009c644c21ee8c9971b436f4cd7481f1
cloud-server-account/src/main/java/com/dsh/account/controller/AppUserController.java
@@ -3,20 +3,15 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dsh.account.dto.BindDto;
import com.dsh.account.dto.IntroduceUserQuery;
import com.dsh.account.dto.SelectDto;
import com.dsh.account.dto.UpdateInfoDto;
import com.dsh.account.entity.IntroduceUser;
import com.dsh.account.entity.TAppGift;
import com.dsh.account.entity.TAppUser;
import com.dsh.account.entity.TCourseInfoRecord;
import com.dsh.account.entity.TStudent;
import com.dsh.account.entity.UserIntegralChanges;
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.ImageCaptchaVo;
import com.dsh.account.model.JoinPlayPaiVo;
import com.dsh.account.model.LoginSMSCodeVo;
import com.dsh.account.model.LoginWeChatVo;
@@ -24,21 +19,18 @@
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.service.*;
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;
@@ -47,12 +39,14 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestHeader;
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.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -69,6 +63,10 @@
    @Autowired
    private TAppUserService appUserService;
    @Autowired
    private ImageCaptchaService imageCaptchaService;
    @Autowired
    private VipClient vipClient;
    @Autowired
    private PayMoneyUtil payMoneyUtil;
@@ -85,6 +83,118 @@
    @Autowired
    private TAppGiftService appGiftService;
    @Autowired
    private UserIntegralChangesService userIntegralChangesService;
    @Autowired
    private UserAuditService userAuditService;
    /**
     * 查询用户头像昵称审核列表
     */
    @ResponseBody
    @PostMapping("/user/listAudit")
    public List<Map<String, Object>> listAudit(@RequestBody UserAuditDTO dto) {
        List<Map<String, Object>> maps = userAuditService.listAudit(dto);
        for (Map<String, Object> map : maps) {
            if (map.get("auditTime")!=null){
                // 将时间戳转换为YYYY-MM-DD HH:mm:ss
                String s = map.get("auditTime").toString().split("\\.")[0];
                map.put("auditTime", s);
            }
        }
        return maps;
    }
    @ResponseBody
    @PostMapping("/user/audit")
    public void audit(@RequestBody TUserAudit dto){
        TUserAudit userAudit = userAuditService.getById(dto.getId());
        TAppUser appUser = appUserService.getById(userAudit.getAppUserId());
        if (dto.getState()==2){
            // 审核通过 修改用户头像或昵称
            if (userAudit.getType()==1){
                appUser.setName(userAudit.getName());
            }else{
                appUser.setHeadImg(userAudit.getHeadImg());
            }
            appUserService.updateById(appUser);
            userAudit.setState(2);
            userAudit.setAuditTime(new Date());
            userAuditService.updateById(userAudit);
        }else{
            userAudit.setState(3);
            userAudit.setRemark(dto.getRemark());
            userAudit.setAuditTime(new Date());
            userAuditService.updateById(userAudit);
        }
    }
    @ResponseBody
    @PostMapping("/user/auditBatch")
    public void auditBatch(@RequestBody AuditBatchDTO dto){
        List<TUserAudit> list = userAuditService.lambdaQuery().in(TUserAudit::getId, dto.getIds())
                .list();
        Map<Integer, TAppUser> userMap = appUserService.lambdaQuery()
                .in(TAppUser::getId, list.stream().map(TUserAudit::getAppUserId)
                        .collect(Collectors.toList())).list()
                .stream().collect(Collectors.toMap(TAppUser::getId, e -> e));
        for (TUserAudit userAudit : list) {
            TAppUser appUser = userMap.get(userAudit.getAppUserId());
            if (dto.getState()==2){
                // 审核通过 修改用户头像或昵称
                if (userAudit.getType()==1){
                    appUser.setName(userAudit.getName());
                }else{
                    appUser.setHeadImg(userAudit.getHeadImg());
                }
                userAudit.setAuditTime(new Date());
                userAudit.setState(2);
                userAuditService.updateById(userAudit);
            }else{
                userAudit.setState(3);
                userAudit.setRemark("");
                userAudit.setAuditTime(new Date());
                userAuditService.updateById(userAudit);
            }
        }
    }
    /**
     * 获取审核详情
     */
    @ResponseBody
    @GetMapping("/user/getAuditById/{id}")
    public TUserAudit getAuditById(@PathVariable("id")Integer id) {
        return userAuditService.getById(id);
    }
    /**
     * 批量修改用户昵称和头像
     */
    @ResponseBody
    @PostMapping("/base/appUser/updateHeadImgAndName")
    public void updateHeadImgAndName() {
        List<TAppUser> list = appUserService.list();
        for (TAppUser appUser : list) {
            appUser.setHeadImg("https://we-park-life.oss-cn-beijing.aliyuncs.com/img/f7fbeaed277a45ab9591b70dc5699cab.jpg");
            String s = generateNickname(appUser.getId());
            appUser.setName(s);
        }
        appUserService.updateBatchById(list);
    }
    public static String generateNickname(Integer userId) {
        if (userId == null) {
            return null;
        }
        // 将用户ID转换为字符串
        String userIdStr = String.valueOf(userId);
        // 使用String.format确保总长度为6位,不足的前面补0
        String formattedId = String.format("%06d", Long.parseLong(userIdStr));
        // 返回"用户" + 格式化后的ID
        return "用户" + formattedId;
    }
    /**
     * 根据介绍有礼id查询当前活动参与次数
     */
@@ -134,6 +244,46 @@
    public TAppUser queryAppUser1(@RequestBody Integer appUserId) {
        TAppUser appUser = appUserService.getById(appUserId);
        return appUser;
    }
    /**
     * Internal-only data source for the management sensitive-data query.  The
     * caller is authenticated and authorised by the management service; its
     * Feign interceptor adds the header that permits the response to remain
     * unmasked for that single request.
     */
    @PostMapping("/internal/sensitive/app-user/{id}")
    public Map<String, Object> sensitiveAppUser(@PathVariable("id") Integer id,
                                                @RequestHeader(value = "X-Internal-Sensitive-Access", required = false) String access) {
        if (!"true".equalsIgnoreCase(access)) {
            throw new IllegalStateException("Sensitive data access is restricted to the management service");
        }
        TAppUser user = appUserService.getById(id);
        if (user == null) return null;
        Map<String, Object> result = new java.util.HashMap<String, Object>();
        result.put("id", user.getId());
        result.put("name", user.getName());
        result.put("phone", user.getPhone());
        result.put("idCard", user.getIdCard());
        return result;
    }
    /**
     * Internal data source used when an APP booking submits its displayed,
     * masked phone number.  Limit the response to the single field needed for
     * that booking; callers must use the internal sensitive-data header.
     */
    @PostMapping("/internal/sensitive/site-booking/app-user/{id}/phone")
    public Map<String, Object> siteBookingPhone(@PathVariable("id") Integer id,
                                                @RequestHeader(value = "X-Internal-Sensitive-Access", required = false) String access) {
        if (!"true".equalsIgnoreCase(access)) {
            throw new IllegalStateException("Sensitive data access is restricted to site booking");
        }
        TAppUser user = appUserService.getById(id);
        if (user == null) return null;
        Map<String, Object> result = new java.util.HashMap<String, Object>();
        result.put("phone", user.getPhone());
        return result;
    }
    /**
@@ -205,8 +355,34 @@
    @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));
                .eq("state", 1));
        return appUser;
    }
    @ResponseBody
    @PostMapping("/base/appUser/imageCaptcha")
    @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<ImageCaptchaVo> getImageCaptcha(Integer type, String phone, HttpServletRequest request) {
        if (!isValidPhone(phone)) {
            return ResultUtil.paranErr("phone");
        }
        if (!isValidSmsType(type)) {
            return ResultUtil.paranErr("type");
        }
        try {
            ImageCaptchaVo captcha = imageCaptchaService.create(phone, type, getClientIp(request));
            if (captcha == null) {
                return ResultUtil.error("图形验证码获取过于频繁,请稍后重试", null);
            }
            return ResultUtil.success(captcha);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
    @ResponseBody
@@ -214,22 +390,89 @@
    @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)
            @ApiImplicitParam(value = "电话号码", name = "phone", dataType = "string", required = true),
            @ApiImplicitParam(value = "图形验证码唯一标识", name = "captchaId", dataType = "string", required = true),
            @ApiImplicitParam(value = "图形验证码", name = "captchaCode", dataType = "string", required = true)
    })
    public ResultUtil getSMSCode(Integer type, String phone) {
        if (ToolUtil.isEmpty(phone)) {
    public ResultUtil getSMSCode(Integer type, String phone, String captchaId, String captchaCode,
                                 HttpServletRequest request) {
        if (!isValidPhone(phone)) {
            return ResultUtil.paranErr("phone");
        }
        if (ToolUtil.isEmpty(type)) {
        if (!isValidSmsType(type)) {
            return ResultUtil.paranErr("type");
        }
        if (ToolUtil.isEmpty(captchaId)|| ToolUtil.isEmpty(captchaCode) ) {
            return ResultUtil.error("系统维护中,注册或登录请联系场地管理员");
        }
        if (!imageCaptchaService.verifyAndConsume(captchaId, captchaCode, phone, type)) {
            return ResultUtil.error("图形验证码错误或已失效,请刷新后重试");
        }
        try {
            ResultUtil smsCode = appUserService.getSMSCode(type, phone);
            return smsCode;
            return appUserService.getSMSCode(type, phone, getClientIp(request));
        } catch (Exception e) {
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
    private boolean isValidPhone(String phone) {
        return phone != null && phone.matches("^1\\d{10}$");
    }
    private boolean isValidSmsType(Integer type) {
        return type != null && type >= 1 && type <= 4;
    }
    private String getClientIp(HttpServletRequest request) {
        String remoteAddress = request.getRemoteAddr();
        if (!isInternalProxyAddress(remoteAddress)) {
            return remoteAddress;
        }
        String forwardedFor = request.getHeader("X-Forwarded-For");
        if (ToolUtil.isNotEmpty(forwardedFor)) {
            String[] addresses = forwardedFor.split(",");
            for (int i = addresses.length - 1; i >= 0; i--) {
                String clientIp = addresses[i].trim();
                if (isValidIpText(clientIp) && !isInternalProxyAddress(clientIp)) {
                    return clientIp;
                }
            }
        }
        String realIp = request.getHeader("X-Real-IP");
        if (isValidIpText(realIp)) {
            return realIp.trim();
        }
        return remoteAddress;
    }
    private boolean isInternalProxyAddress(String ip) {
        if (ip == null) {
            return false;
        }
        if ("127.0.0.1".equals(ip) || "0:0:0:0:0:0:0:1".equals(ip) || "::1".equals(ip)
                || ip.startsWith("10.") || ip.startsWith("192.168.")) {
            return true;
        }
        if (ip.startsWith("172.")) {
            String[] parts = ip.split("\\.");
            if (parts.length == 4) {
                try {
                    int secondPart = Integer.parseInt(parts[1]);
                    return secondPart >= 16 && secondPart <= 31;
                } catch (NumberFormatException ignored) {
                    return false;
                }
            }
        }
        return false;
    }
    private boolean isValidIpText(String ip) {
        return ToolUtil.isNotEmpty(ip)
                && ip.length() <= 45
                && ip.trim().matches("[0-9a-fA-F:.]+");
    }
@@ -297,7 +540,6 @@
    @ResponseBody
    @PostMapping("/base/appUser/loginSMSCode")
    @ApiOperation(value = "短信验证码登录", tags = {"APP-登录注册"})
    public ResultUtil<String> loginSMSCode(LoginSMSCodeVo loginSMSCodeVo) {
        try {
            return appUserService.loginSMSCode(loginSMSCodeVo);
@@ -419,9 +661,10 @@
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<JoinPlayPaiVo> queryJoinPlayPai(String lon, String lat) {
        System.out.println("11122323232");
        try {
            Integer uid = tokenUtil.getUserIdFormRedis();
            System.out.println("55555"+uid);
            if (null == uid) {
                return ResultUtil.tokenErr();
            }
@@ -439,9 +682,10 @@
    @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) {
    public ResultUtil addVipPayment(Integer payType, Integer id) {
        if (ToolUtil.isEmpty(payType)) {
            return ResultUtil.paranErr("payType");
        }
@@ -450,59 +694,97 @@
            if (null == uid) {
                return ResultUtil.tokenErr();
            }
            return vipPaymentService.addVipPayment(uid, payType);
            return vipPaymentService.addVipPayment(uid, payType, id);
        } 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");
    @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() {
            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();
                }
        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();
//        }
//    }
    /**
     * 购买年度会员支付微信回调
     *
@@ -577,6 +859,7 @@
            return null;
        }
    }
    /**
     * 根据用户id获取用户信息
     *
@@ -585,12 +868,10 @@
     */
    @ResponseBody
    @PostMapping("/base/appUser/queryAppUserBatch")
    List<TAppUser> queryAppUserBatch(@RequestBody List<Integer> appUserIdList){
    List<TAppUser> queryAppUserBatch(@RequestBody List<Integer> appUserIdList) {
        return appUserService.listByIds(appUserIdList);
    }
    @Autowired
    private UserIntegralChangesService userIntegralChangesService;
    /**
     * 修改用户信息
@@ -602,8 +883,12 @@
    public void updateAppUser(@RequestBody TAppUser appUser) {
        try {
            TAppUser appUser1 = appUserService.getById(appUser.getId());
            // A management edit form may contain the displayed masked value.
            // Never persist that display value over the original identifier.
            if (appUser.getPhone() != null && appUser.getPhone().contains("*")) appUser.setPhone(appUser1.getPhone());
            if (appUser.getIdCard() != null && appUser.getIdCard().contains("*")) appUser.setIdCard(appUser1.getIdCard());
            appUserService.updateById(appUser);
            if(appUser.getIntegral().compareTo(appUser1.getIntegral()) != 0){
            if (appUser.getIntegral().compareTo(appUser1.getIntegral()) != 0) {
                UserIntegralChanges userIntegralChanges = new UserIntegralChanges();
                userIntegralChanges.setAppUserId(appUser.getId());
                userIntegralChanges.setOldIntegral(appUser1.getIntegral());
@@ -649,6 +934,33 @@
        }
    }
    @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 {
@@ -688,7 +1000,7 @@
    @PostMapping("/appUser/queryAppUserByCityCode")
    public List<TAppUser> queryAppUserByCityCode(@RequestBody String cityCode){
    public List<TAppUser> queryAppUserByCityCode(@RequestBody String cityCode) {
        return appUserService.list(new QueryWrapper<TAppUser>()
                .eq("state", 1)
                .eq("cityCode", cityCode)
@@ -696,14 +1008,14 @@
    }
    /**
     * 根据城市code获取用户的id集合
     *
     * @param cityCode 城市code
     * @return
     */
    @PostMapping("/appUser/getAppUserIds")
    public List<Integer> getAppUserIds(@RequestBody String cityCode){
    @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());
    }
@@ -711,16 +1023,17 @@
    /**
     * 根据省市名称所有用户
     *
     * @param appUserIdsByCityName
     * @return
     */
    @PostMapping("/appUser/getAppUserIdsByCityName")
    public List<Integer> getAppUserIdsByCityName(@RequestBody AppUserIdsByCityName appUserIdsByCityName){
    public List<Integer> getAppUserIdsByCityName(@RequestBody AppUserIdsByCityName appUserIdsByCityName) {
        QueryWrapper<TAppUser> queryWrapper = new QueryWrapper<TAppUser>().eq("state", 1);
        if(ToolUtil.isNotEmpty(appUserIdsByCityName.getProvince())){
        if (ToolUtil.isNotEmpty(appUserIdsByCityName.getProvince())) {
            queryWrapper.like("province", appUserIdsByCityName.getProvince());
        }
        if(ToolUtil.isNotEmpty(appUserIdsByCityName.getCity())){
        if (ToolUtil.isNotEmpty(appUserIdsByCityName.getCity())) {
            queryWrapper.like("city", appUserIdsByCityName.getCity());
        }
        List<TAppUser> list = appUserService.list(queryWrapper);
@@ -730,18 +1043,18 @@
    @PostMapping("/appUser/queryAppUserByIds")
    @ResponseBody
    public List<TStudent> queryAppUserByIds(@RequestBody UserDetailsOfSearch search){
    public List<TStudent> queryAppUserByIds(@RequestBody UserDetailsOfSearch search) {
        LambdaQueryWrapper<TStudent> tAppUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
        if(ToolUtil.isNotEmpty(search.getIdCard())){
        if (ToolUtil.isNotEmpty(search.getIdCard())) {
            tAppUserLambdaQueryWrapper.eq(TStudent::getIdCard, search.getIdCard());
        }
        if(ToolUtil.isNotEmpty(search.getPhone())){
        if (ToolUtil.isNotEmpty(search.getPhone())) {
            tAppUserLambdaQueryWrapper.eq(TStudent::getPhone, search.getPhone());
        }
        if(ToolUtil.isNotEmpty(search.getName())){
        if (ToolUtil.isNotEmpty(search.getName())) {
            tAppUserLambdaQueryWrapper.eq(TStudent::getName, search.getName());
        }
        tAppUserLambdaQueryWrapper.in(TStudent::getId,search.getUseIds());
        tAppUserLambdaQueryWrapper.in(TStudent::getId, search.getUseIds());
        return studentService.list(tAppUserLambdaQueryWrapper);
    }
}