我得免单订单状态
This commit is contained in:
@@ -42,6 +42,7 @@ public class LoginFilter implements Filter {
|
|||||||
"cashierService/location/**",//高德 获取行政区域
|
"cashierService/location/**",//高德 获取行政区域
|
||||||
"cashierService/home/homePageUp",//首页上半
|
"cashierService/home/homePageUp",//首页上半
|
||||||
"cashierService/home",//首页
|
"cashierService/home",//首页
|
||||||
|
"cashierService/order/testMessage",//首页
|
||||||
"cashierService/common/**",//通用接口
|
"cashierService/common/**",//通用接口
|
||||||
"cashierService/distirict/**",//首页其它接口
|
"cashierService/distirict/**",//首页其它接口
|
||||||
"cashierService/login/**",//登录部分接口不校验
|
"cashierService/login/**",//登录部分接口不校验
|
||||||
|
|||||||
@@ -271,7 +271,25 @@ public class LoginContoller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "modityPass")
|
||||||
|
public Result modityPass(@RequestHeader String token,@RequestBody UserPassDto passVo){
|
||||||
|
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||||
|
String newPass = MD5Utils.MD5Encode(passVo.getNewPass(), "utf-8");
|
||||||
|
if (ObjectUtil.isNull(passVo.getCode())) {
|
||||||
|
String oldPass = MD5Utils.MD5Encode(passVo.getOldPass(), "utf-8");
|
||||||
|
return loginService.upPass(userId,oldPass, newPass);
|
||||||
|
} else {
|
||||||
|
boolean tf = loginService.validate(passVo.getCode(), passVo.getPhone());
|
||||||
|
if (tf) {
|
||||||
|
TbUserInfo userInfo=new TbUserInfo();
|
||||||
|
userInfo.setId(Integer.valueOf(userId));
|
||||||
|
userInfo.setPassword(newPass);
|
||||||
|
return loginService.upUserInfo(userInfo);
|
||||||
|
} else {
|
||||||
|
return Result.fail("验证码输入有误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 用户注册
|
* 用户注册
|
||||||
* phone 手机号
|
* phone 手机号
|
||||||
|
|||||||
@@ -94,4 +94,8 @@ public class OrderController {
|
|||||||
private Result yhqDouble(@RequestParam Integer conponsId){
|
private Result yhqDouble(@RequestParam Integer conponsId){
|
||||||
return orderService.yhqDouble(conponsId);
|
return orderService.yhqDouble(conponsId);
|
||||||
}
|
}
|
||||||
|
@GetMapping("/kc")
|
||||||
|
private Result kc(){
|
||||||
|
return orderService.kc();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class TbWiningUser implements Serializable {
|
|||||||
this.orderAmount = orderAmount;
|
this.orderAmount = orderAmount;
|
||||||
this.isUser = isUser;
|
this.isUser = isUser;
|
||||||
this.tradeDay = tradeDay;
|
this.tradeDay = tradeDay;
|
||||||
this.isRefund = "false";
|
this.isRefund = "true";
|
||||||
this.refundAmount = BigDecimal.ZERO;
|
this.refundAmount = BigDecimal.ZERO;
|
||||||
this.refundPayType = "WX";
|
this.refundPayType = "WX";
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class CartConsumer {
|
|||||||
JSONObject jsonObject = JSON.parseObject(message);
|
JSONObject jsonObject = JSON.parseObject(message);
|
||||||
String tableId = jsonObject.getString("tableId");
|
String tableId = jsonObject.getString("tableId");
|
||||||
String shopId = jsonObject.getString("shopId");
|
String shopId = jsonObject.getString("shopId");
|
||||||
|
log.info("推送信息"+jsonObject.toJSONString());
|
||||||
if (jsonObject.getString("type").equals("addcart") ) {
|
if (jsonObject.getString("type").equals("addcart") ) {
|
||||||
if (!jsonObject.containsKey("num")) {
|
if (!jsonObject.containsKey("num")) {
|
||||||
throw new MsgException("商品数量错误");
|
throw new MsgException("商品数量错误");
|
||||||
|
|||||||
@@ -196,8 +196,7 @@ public class CartService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void createOrder(JSONObject jsonObject) throws IOException {
|
public void createOrder(JSONObject jsonObject) throws Exception {
|
||||||
try {
|
|
||||||
String shopId = jsonObject.getString("shopId");
|
String shopId = jsonObject.getString("shopId");
|
||||||
JSONArray array = JSON.parseArray(redisUtil.getMessage(RedisCst.TABLE_CART.concat(jsonObject.getString("tableId").concat("-").concat(shopId))));
|
JSONArray array = JSON.parseArray(redisUtil.getMessage(RedisCst.TABLE_CART.concat(jsonObject.getString("tableId").concat("-").concat(shopId))));
|
||||||
List<Integer> ids = new ArrayList<>();
|
List<Integer> ids = new ArrayList<>();
|
||||||
@@ -212,13 +211,13 @@ public class CartService {
|
|||||||
Integer orderId = 0;
|
Integer orderId = 0;
|
||||||
TbMerchantAccount tbMerchantAccount = merchantAccountMapper.selectByShopId(jsonObject.getString("shopId"));
|
TbMerchantAccount tbMerchantAccount = merchantAccountMapper.selectByShopId(jsonObject.getString("shopId"));
|
||||||
if (tbMerchantAccount == null) {
|
if (tbMerchantAccount == null) {
|
||||||
throw new MsgException("生成订单错误");
|
MsgException.throwException("生成订单错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
String userId = jsonObject.getString("userId");
|
String userId = jsonObject.getString("userId");
|
||||||
TbUserInfo tbUserInfo = userInfoMapper.selectByPrimaryKey(Integer.valueOf(userId));
|
TbUserInfo tbUserInfo = userInfoMapper.selectByPrimaryKey(Integer.valueOf(userId));
|
||||||
if (tbUserInfo == null) {
|
if (tbUserInfo == null) {
|
||||||
throw new MsgException("生成订单失败");
|
MsgException.throwException("生成订单失败");
|
||||||
}
|
}
|
||||||
for (int i = 0; i < array.size(); i++) {
|
for (int i = 0; i < array.size(); i++) {
|
||||||
JSONObject object = array.getJSONObject(i);
|
JSONObject object = array.getJSONObject(i);
|
||||||
@@ -408,9 +407,6 @@ public class CartService {
|
|||||||
|
|
||||||
jsonObject12.put("data", new JSONArray());
|
jsonObject12.put("data", new JSONArray());
|
||||||
AppWebSocketServer.AppSendInfo(jsonObject12, jsonObject.getString("tableId").concat("-").concat(shopId), false);
|
AppWebSocketServer.AppSendInfo(jsonObject12, jsonObject.getString("tableId").concat("-").concat(shopId), false);
|
||||||
} catch (Exception e) {
|
|
||||||
e.getMessage();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private TbOrderInfo getOrder(BigDecimal totalAmount, BigDecimal packAMount,
|
private TbOrderInfo getOrder(BigDecimal totalAmount, BigDecimal packAMount,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class IntegralService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TbOrderInfoMapper orderInfoMapper;
|
private TbOrderInfoMapper orderInfoMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TbCashierCartMapper cashierCartMapper;
|
private TbUserInfoMapper userInfoMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TbProductMapper productMapper;
|
private TbProductMapper productMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -65,6 +65,11 @@ public class IntegralService {
|
|||||||
integralFlow.setType("TRADEADD");
|
integralFlow.setType("TRADEADD");
|
||||||
integralFlow.setUserId(userCoupons.getUserId());
|
integralFlow.setUserId(userCoupons.getUserId());
|
||||||
integralFlowMapper.insert(integralFlow);
|
integralFlowMapper.insert(integralFlow);
|
||||||
|
TbUserInfo userInfo = userInfoMapper.selectByPrimaryKey(Integer.valueOf(userCoupons.getUserId()));
|
||||||
|
if (Objects.nonNull(userInfo)){
|
||||||
|
userInfo.setTotalScore(userInfo.getTotalScore() + integralFlow.getNum().intValue());
|
||||||
|
userInfoMapper.updateByPrimaryKeySelective(userInfo);
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
Integer orderId = jsonObject.getInteger("orderId");
|
Integer orderId = jsonObject.getInteger("orderId");
|
||||||
TbOrderInfo orderInfo = orderInfoMapper.selectByPrimaryKey(orderId);
|
TbOrderInfo orderInfo = orderInfoMapper.selectByPrimaryKey(orderId);
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ public class OrderService {
|
|||||||
List<TbProductSku> list = productSkuMapper.selectAll();
|
List<TbProductSku> list = productSkuMapper.selectAll();
|
||||||
for (TbProductSku productSku : list) {
|
for (TbProductSku productSku : list) {
|
||||||
// productSku.setStockNumber(200.00);
|
// productSku.setStockNumber(200.00);
|
||||||
redisUtil.saveMessage("PRODUCT:" + productSku.getShopId() + ":" + productSku.getId(), productSku.getStockNumber().intValue() + "");
|
redisUtil.saveMessage("PRODUCT:" + productSku.getShopId() + ":" + productSku.getId(), "10000");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -402,4 +402,12 @@ public class OrderService {
|
|||||||
}
|
}
|
||||||
return Result.success(CodeEnum.SUCCESS, pageInfo);
|
return Result.success(CodeEnum.SUCCESS, pageInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Result kc() {
|
||||||
|
List<TbProductSku> list = productSkuMapper.selectAll();
|
||||||
|
for (TbProductSku productSku:list){
|
||||||
|
redisUtil.saveMessage(RedisCst.PRODUCT + productSku.getShopId() + ":" +productSku.getId(),"10000");
|
||||||
|
}
|
||||||
|
return Result.success(CodeEnum.SUCCESS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class UserService {
|
|||||||
tbShopUser.setTotalScore(tbShopUser.getTotalScore() - num.intValue());
|
tbShopUser.setTotalScore(tbShopUser.getTotalScore() - num.intValue());
|
||||||
}
|
}
|
||||||
} else if (type.equals("add")) {
|
} else if (type.equals("add")) {
|
||||||
tbShopUser.setTotalScore(tbShopUser.getTotalScore() - num.intValue());
|
tbShopUser.setTotalScore(tbShopUser.getTotalScore() + num.intValue());
|
||||||
}
|
}
|
||||||
if (flag) {
|
if (flag) {
|
||||||
TbReleaseFlow releaseFlow = new TbReleaseFlow();
|
TbReleaseFlow releaseFlow = new TbReleaseFlow();
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ public class AppWebSocketServer {
|
|||||||
this.tableId = tableId;
|
this.tableId = tableId;
|
||||||
this.shopId = shopId;
|
this.shopId = shopId;
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
|
log.info("链接桌码:"+tableId);
|
||||||
try {
|
try {
|
||||||
TbShopTable shopTable = shopTableMapper.selectQRcode(tableId);
|
TbShopTable shopTable = shopTableMapper.selectQRcode(tableId);
|
||||||
if (Objects.isNull(shopTable)) {
|
if (Objects.isNull(shopTable)) {
|
||||||
@@ -185,7 +186,7 @@ public class AppWebSocketServer {
|
|||||||
@OnMessage
|
@OnMessage
|
||||||
public void onMessage(String message, Session session) {
|
public void onMessage(String message, Session session) {
|
||||||
|
|
||||||
System.out.println(message);
|
log.info("接收消息:"+message);
|
||||||
//可以群发消息
|
//可以群发消息
|
||||||
//消息保存到数据库、redis
|
//消息保存到数据库、redis
|
||||||
if (StringUtils.isNotBlank(message) && !message.equals("undefined")) {
|
if (StringUtils.isNotBlank(message) && !message.equals("undefined")) {
|
||||||
@@ -198,7 +199,8 @@ public class AppWebSocketServer {
|
|||||||
//追加发送人(防止串改)
|
//追加发送人(防止串改)
|
||||||
jsonObject.put("tableId", this.tableId);
|
jsonObject.put("tableId", this.tableId);
|
||||||
jsonObject.put("shopId", this.shopId);
|
jsonObject.put("shopId", this.shopId);
|
||||||
|
log.info("tableId:"+this.tableId);
|
||||||
|
log.info("shopId:"+this.shopId);
|
||||||
//这里采用责任链模式,每一个处理器对应一个前段发过来的请,这里还可以用工厂模式来生成对象
|
//这里采用责任链模式,每一个处理器对应一个前段发过来的请,这里还可以用工厂模式来生成对象
|
||||||
// ChangeHandler changeHandler = new ChangeHandler();
|
// ChangeHandler changeHandler = new ChangeHandler();
|
||||||
// CreateOrderHandler createOrderHandler = new CreateOrderHandler();
|
// CreateOrderHandler createOrderHandler = new CreateOrderHandler();
|
||||||
|
|||||||
@@ -590,5 +590,4 @@
|
|||||||
<select id="selectAll" resultType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo">
|
<select id="selectAll" resultType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo">
|
||||||
select * from tb_user_info
|
select * from tb_user_info
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user