Merge remote-tracking branch 'origin/yhq' into lyf

# Conflicts:
#	src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopInfo.java
#	src/main/java/com/chaozhanggui/system/cashierservice/entity/TbSystemCoupons.java
#	src/main/java/com/chaozhanggui/system/cashierservice/rabbit/RabbitConfig.java
#	src/main/java/com/chaozhanggui/system/cashierservice/rabbit/RabbitProducer.java
#	src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java
#	src/main/java/com/chaozhanggui/system/cashierservice/util/RandomUtil.java
#	src/main/resources/application-dev.yml
#	src/main/resources/application-dev2.yml
#	src/main/resources/application-prod.yml
#	src/main/resources/application-prod2.yml
#	src/main/resources/mapper/TbShopInfoMapper.xml
This commit is contained in:
2024-04-15 14:51:15 +08:00
73 changed files with 3810 additions and 563 deletions

View File

@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.IOException;
import java.text.ParseException;
@CrossOrigin(origins = "*")
@RestController
@@ -50,4 +51,44 @@ public class OrderController {
private void testMessage(@RequestParam("tableId") String tableId, @RequestParam("message") String message) throws IOException {
orderService.testMessage(tableId,message);
}
@GetMapping("/tradeIntegral")
private Result tradeIntegral(@RequestParam("userId") String userId, @RequestParam("id") String id) throws IOException, ParseException {
return orderService.tradeIntegral(userId,id);
}
// @GetMapping("/我的积分")
// private Result mineYhq(@RequestParam("userId") String userId) throws IOException {
// return orderService.mineYhq(userId);
// }
@GetMapping("/mineCoupons")
private Result mineCoupons(@RequestHeader String token,@RequestParam("userId") String userId,@RequestParam("status") String status,
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
@RequestParam(value = "size", required = false, defaultValue = "1") Integer size) throws IOException {
return orderService.mineCoupons(userId,status,page,size);
}
@GetMapping("/findCoupons")
private Result findCoupons(@RequestHeader String token,@RequestParam String type,
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
@RequestParam(value = "size", required = false, defaultValue = "1") Integer size) throws IOException {
return orderService.findCoupons(type,page,size);
}
@GetMapping("/findWiningUser")
private Result findWiningUser(){
return orderService.findWiningUser();
}
@GetMapping("/getYhqPara")
private Result getYhqPara(){
return orderService.getYhqPara();
}
@GetMapping("/getYhqDouble")
private Result getYhqDouble(@RequestParam Integer orderId){
return orderService.getYhqDouble(orderId);
}
@PostMapping("/yhqDouble")
private Result yhqDouble(@RequestParam Integer conponsId){
return orderService.yhqDouble(conponsId);
}
// @GetMapping("/testPay")
// private Result testPay(@RequestParam Integer orderId){
// return orderService.testPay(orderId);
// }
}

View File

@@ -0,0 +1,101 @@
package com.chaozhanggui.system.cashierservice.controller;
import cn.binarywang.wx.miniapp.util.crypt.WxMaCryptUtils;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.dao.TbMerchantAccountMapper;
import com.chaozhanggui.system.cashierservice.dao.TbShopUserMapper;
import com.chaozhanggui.system.cashierservice.dao.TbUserInfoMapper;
import com.chaozhanggui.system.cashierservice.entity.TbMerchantAccount;
import com.chaozhanggui.system.cashierservice.entity.TbShopUser;
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
import com.chaozhanggui.system.cashierservice.entity.dto.AuthUserDto;
import com.chaozhanggui.system.cashierservice.entity.dto.OnlineUserDto;
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralFlowVo;
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralVo;
import com.chaozhanggui.system.cashierservice.entity.vo.OrderVo;
import com.chaozhanggui.system.cashierservice.service.LoginService;
import com.chaozhanggui.system.cashierservice.service.OnlineUserService;
import com.chaozhanggui.system.cashierservice.service.UserService;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.IpUtil;
import com.chaozhanggui.system.cashierservice.util.MD5Utils;
import com.chaozhanggui.system.cashierservice.util.StringUtil;
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
import com.chaozhanggui.system.cashierservice.wxUtil.WechatUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
@CrossOrigin(origins = "*")
@RestController
@Slf4j
@RequestMapping("user")
public class UserContoller {
@Autowired
UserService userService;
@Autowired
private TbShopUserMapper shopUserMapper;
@Autowired
private TbUserInfoMapper userInfoMapper;
@GetMapping("/userInfo")
public JSONObject userInfo(@RequestParam("openId") String openId ) throws Exception {
TbUserInfo shopUser = userInfoMapper.selectByOpenId(openId);
JSONObject jsonObject = new JSONObject();
if (Objects.isNull(shopUser)){
jsonObject.put("status","fail");
jsonObject.put("msg","用户不存在");
return jsonObject;
}
String userSign = UUID.randomUUID().toString().replaceAll("-","");
String token = TokenUtil.generateJfToken(openId,userSign);
JSONObject object = new JSONObject();
object.put("token",token);
object.put("userSign",userSign);
object.put("num",shopUser.getTotalScore());
jsonObject.put("status","success");
jsonObject.put("msg","成功");
jsonObject.put("data",object);
return jsonObject;
}
@PostMapping("/modityIntegral")
public JSONObject modityIntegral(@RequestHeader String token,@RequestBody IntegralVo integralVo ) throws Exception {
JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
String userSign = jsonObject.getString("userSign");
return userService.modityIntegral(integralVo,userSign);
}
@PostMapping("/userIntegral")
public JSONObject userIntegral(@RequestHeader String token,@RequestBody IntegralFlowVo integralFlowVo ) throws Exception {
JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
String userSign = jsonObject.getString("userSign");
return userService.userIntegral(integralFlowVo,userSign);
}
@PostMapping("/userAllIntegral")
public JSONObject userAllIntegral(@RequestBody IntegralFlowVo integralFlowVo ) throws Exception {
// JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
// String userSign = jsonObject.getString("userSign");
return userService.userAllIntegral(integralFlowVo,"userSign");
}
@PostMapping("/userAll")
public JSONObject userAll(@RequestBody IntegralFlowVo integralFlowVo ) throws Exception {
// JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
// String userSign = jsonObject.getString("userSign");
return userService.userAll(integralFlowVo,"userSign");
}
}