parent
69b7ed77ec
commit
4c5fabfffb
|
|
@ -11,7 +11,7 @@ public @interface LimitSubmit {
|
|||
/**
|
||||
* 默认 10s
|
||||
*/
|
||||
int limit() default 30;
|
||||
int limit() default 5;
|
||||
|
||||
/**
|
||||
* 请求完成后 是否一直等待
|
||||
|
|
|
|||
|
|
@ -125,14 +125,14 @@ public class LoginContoller {
|
|||
if (!signature.equals(signature2)) {
|
||||
return Result.fail("签名校验失败");
|
||||
}
|
||||
String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr);
|
||||
String phone = "";
|
||||
try{
|
||||
String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr);
|
||||
if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) {
|
||||
phone =JSONObject.parseObject(data).get("phoneNumber").toString();
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.info("登录传参:获取手机号失败{}",data);
|
||||
log.info("登录传参:获取手机号失败{}",e.getMessage());
|
||||
}
|
||||
String nickName = rawDataJson.getString("nickName");
|
||||
String avatarUrl = rawDataJson.getString("avatarUrl");
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.dao;
|
|||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbParams;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopUser;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ShopUserListVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -31,7 +32,7 @@ public interface TbShopUserMapper {
|
|||
List<TbShopUser> selectAllByUserId(@Param("userId") String userId);
|
||||
|
||||
|
||||
List<Map<String,Object>> selectByUserId(@Param("userId") String userId,@Param("shopId") String shopId);
|
||||
List<ShopUserListVo> selectByUserId(@Param("userId") String userId, @Param("shopId") String shopId);
|
||||
|
||||
TbShopUser selectByOpenId(@Param("openId") String openId);
|
||||
|
||||
|
|
|
|||
|
|
@ -101,6 +101,29 @@ public class TbOrderInfo implements Serializable {
|
|||
private List<TbOrderDetail> detailList;
|
||||
private String winnnerNo;
|
||||
private String isWinner;
|
||||
|
||||
|
||||
//根据状态返回 需付款 已付款 未付款 已退
|
||||
private String description;
|
||||
|
||||
public void setDescription() {
|
||||
switch (status) {
|
||||
case "closed":
|
||||
this.description = "已付款";
|
||||
break;
|
||||
case "refund":
|
||||
this.description = "已退款";
|
||||
break;
|
||||
case "paying":
|
||||
case "unpaid":
|
||||
this.description = "需付款";
|
||||
break;
|
||||
default:
|
||||
this.description = "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public TbOrderInfo(){
|
||||
super();
|
||||
|
|
|
|||
|
|
@ -29,4 +29,9 @@ public class HomeDto extends HomeBaseDto {
|
|||
*/
|
||||
private Integer dateType = 1;
|
||||
|
||||
public void setOrderBy(Integer orderBy) {
|
||||
if(orderBy!=null){
|
||||
this.orderBy = orderBy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ public class OrderVo {
|
|||
private String orderNo;
|
||||
|
||||
private Long time;
|
||||
private Long expiredMinutes = 0l;
|
||||
private Long expiredSeconds = 0l;
|
||||
|
||||
private BigDecimal payAmount;
|
||||
private String orderType;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class ShopUserListVo {
|
||||
|
||||
private Long memberId;
|
||||
private Long shopId;
|
||||
private String shopName;
|
||||
private String chainName;
|
||||
private String logo;
|
||||
private String detail;
|
||||
private BigDecimal levelConsume;
|
||||
private BigDecimal amount;
|
||||
private String code;
|
||||
private Integer isVip;
|
||||
}
|
||||
|
|
@ -106,7 +106,7 @@ public class CartService1 {
|
|||
String skuNum = redisUtil.getMessage(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"));
|
||||
TbProduct tbProduct = productMapper.selectById(Integer.valueOf(productId));
|
||||
if (tbProduct.getIsStock() == 1) {
|
||||
if (Integer.valueOf(skuNum) < 1) {
|
||||
if (Integer.valueOf(skuNum) < 1 && jsonObject.getInteger("num") > 0) {
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
jsonObject1.put("status", "fail");
|
||||
jsonObject1.put("msg", "该商品库存已售罄");
|
||||
|
|
@ -116,11 +116,6 @@ public class CartService1 {
|
|||
throw new MsgException("该商品库存已售罄");
|
||||
}
|
||||
}
|
||||
if (jsonObject.getInteger("num") > 0) {
|
||||
redisUtil.getIncrNum(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), "1");
|
||||
} else {
|
||||
redisUtil.getIncrNum(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), "2");
|
||||
}
|
||||
|
||||
if (redisUtil.exists(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))));
|
||||
|
|
@ -130,6 +125,12 @@ public class CartService1 {
|
|||
jsonObject.getInteger("userId"), jsonObject.getInteger("num"), tableId, jsonObject.getString("shopId"));
|
||||
jsonArray.add(cashierCart);
|
||||
amount = amount.add(new BigDecimal(cashierCart.getNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
if (jsonObject.getInteger("num") > 0) {
|
||||
redisUtil.getIncrNum(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), "1");
|
||||
} else {
|
||||
redisUtil.getIncrNum(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), "2");
|
||||
}
|
||||
productSkuMapper.updateStockById(jsonObject.getString("skuId"), jsonObject.getInteger("num"));
|
||||
}
|
||||
} else {
|
||||
boolean flag = true;
|
||||
|
|
@ -139,8 +140,15 @@ public class CartService1 {
|
|||
if (cashierCart.getSkuId().equals(jsonObject.getString("skuId"))) {
|
||||
cashierCart.setTotalNumber(cashierCart.getTotalNumber() + jsonObject.getInteger("num"));
|
||||
cashierCart.setNumber(cashierCart.getNumber() + jsonObject.getInteger("num"));
|
||||
if (jsonObject.getInteger("num") > 0) {
|
||||
redisUtil.getIncrNum(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), "1");
|
||||
} else {
|
||||
redisUtil.getIncrNum(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), "2");
|
||||
}
|
||||
productSkuMapper.updateStockById(jsonObject.getString("skuId"), jsonObject.getInteger("num"));
|
||||
if (cashierCart.getNumber() > 0) {
|
||||
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
cashierCart.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
cashierCartMapper.updateByPrimaryKeySelective(cashierCart);
|
||||
} else {
|
||||
cashierCartMapper.deleteByPrimaryKey(cashierCart.getId());
|
||||
|
|
@ -156,6 +164,12 @@ public class CartService1 {
|
|||
jsonObject.getInteger("userId"), jsonObject.getInteger("num"), tableId, jsonObject.getString("shopId"));
|
||||
jsonArray.add(cashierCart);
|
||||
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
if (jsonObject.getInteger("num") > 0) {
|
||||
redisUtil.getIncrNum(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), "1");
|
||||
} else {
|
||||
redisUtil.getIncrNum(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), "2");
|
||||
}
|
||||
productSkuMapper.updateStockById(jsonObject.getString("skuId"), jsonObject.getInteger("num"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -164,9 +178,10 @@ public class CartService1 {
|
|||
jsonObject.getInteger("userId"), jsonObject.getInteger("num"), tableId, jsonObject.getString("shopId"));
|
||||
jsonArray.add(cashierCart);
|
||||
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
redisUtil.getIncrNum(RedisCst.PRODUCT + shopId + ":" + jsonObject.getString("skuId"), "1");
|
||||
productSkuMapper.updateStockById(jsonObject.getString("skuId"), jsonObject.getInteger("num"));
|
||||
}
|
||||
}
|
||||
productSkuMapper.updateStockById(jsonObject.getString("skuId"), jsonObject.getInteger("num"));
|
||||
redisUtil.saveMessage(RedisCst.TABLE_CART.concat(tableId).concat("-").concat(shopId), jsonArray.toJSONString());
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
jsonObject1.put("status", "success");
|
||||
|
|
|
|||
|
|
@ -195,6 +195,13 @@ public class OrderService {
|
|||
orderVo.setDetails(details);
|
||||
orderVo.setOrderNo(orderInfo.getOrderNo());
|
||||
orderVo.setTime(orderInfo.getCreatedAt());
|
||||
if (orderInfo.getStatus().equals("paying") || orderInfo.getStatus().equals("unpaid")) {
|
||||
Long totalSeconds = orderInfo.getCreatedAt() + 15 * 60 * 1000l - System.currentTimeMillis();
|
||||
if(totalSeconds>0){
|
||||
orderVo.setExpiredMinutes(totalSeconds/1000 / 60);
|
||||
orderVo.setExpiredSeconds(totalSeconds/1000 % 60);
|
||||
}
|
||||
}
|
||||
orderVo.setPayAmount(orderInfo.getOrderAmount());
|
||||
orderVo.setTableName(tbShopTable == null ? "" : tbShopTable.getName());
|
||||
orderVo.setOrderType(orderInfo.getOrderType());
|
||||
|
|
@ -214,6 +221,7 @@ public class OrderService {
|
|||
List<TbOrderInfo> tbOrderInfos = orderInfoMapper.selectByUserId(userId, status);
|
||||
|
||||
for (TbOrderInfo orderInfo : tbOrderInfos) {
|
||||
orderInfo.setDescription();
|
||||
List<TbOrderDetail> list = tbOrderDetailMapper.selectAllByOrderId(orderInfo.getId());
|
||||
int num = 0;
|
||||
for (TbOrderDetail orderDetail : list) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ReturnGroupOrderDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ShopUserListVo;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.model.PayReq;
|
||||
import com.chaozhanggui.system.cashierservice.model.TradeQueryReq;
|
||||
|
|
@ -147,6 +148,9 @@ public class PayService {
|
|||
if(!"unpaid".equals(orderInfo.getStatus())&&!"paying".equals(orderInfo.getStatus())){
|
||||
return Result.fail("订单状态异常,不允许支付");
|
||||
}
|
||||
if (System.currentTimeMillis() - orderInfo.getCreatedAt() > 60 * 15 * 1000) {
|
||||
return Result.fail("订单十五分钟内有效,当前已超时,请重新下单。");
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNull(orderInfo.getMerchantId())||ObjectUtil.isEmpty(orderInfo.getMerchantId())){
|
||||
return Result.fail("没有对应的商户");
|
||||
|
|
@ -303,6 +307,9 @@ public class PayService {
|
|||
if (ObjectUtil.isEmpty(orderInfo)) {
|
||||
return Result.fail("订单信息不存在");
|
||||
}
|
||||
if (System.currentTimeMillis() - orderInfo.getCreatedAt() > 60 * 15 * 1000) {
|
||||
return Result.fail("订单十五分钟内有效,当前已超时,请重新下单。");
|
||||
}
|
||||
|
||||
|
||||
TbUserInfo userInfo= tbUserInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getUserId()));
|
||||
|
|
@ -320,7 +327,7 @@ public class PayService {
|
|||
|
||||
|
||||
if (!"unpaid".equals(orderInfo.getStatus()) && !"paying".equals(orderInfo.getStatus()) ) {
|
||||
return Result.fail("订单出状态异常");
|
||||
return Result.fail("订单状态异常");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -717,6 +724,7 @@ public class PayService {
|
|||
log.info("发送打印数据");
|
||||
producer.printMechine(orderInfo.getId() + "");
|
||||
|
||||
redisUtil.deleteByKey(RedisCst.ORDER_EXPIRED.concat(orderInfo.getId().toString()));
|
||||
return Result.success(CodeEnum.SUCCESS,orderId);
|
||||
case "REFUND_ING":
|
||||
cartStatus="refunding";
|
||||
|
|
@ -871,7 +879,7 @@ public class PayService {
|
|||
|
||||
log.info("发送打印数据");
|
||||
producer.printMechine(orderInfo.getId() + "");
|
||||
|
||||
redisUtil.deleteByKey(RedisCst.ORDER_EXPIRED.concat(orderInfo.getId().toString()));
|
||||
return "SUCCESS";
|
||||
|
||||
}
|
||||
|
|
@ -916,6 +924,7 @@ public class PayService {
|
|||
coupons.put("type","buy");
|
||||
coupons.put("orderId",orderInfo.getId().toString());
|
||||
producer.printCoupons(coupons.toJSONString());
|
||||
redisUtil.deleteByKey(RedisCst.ORDER_EXPIRED.concat(orderInfo.getId().toString()));
|
||||
return "SUCCESS";
|
||||
|
||||
}
|
||||
|
|
@ -962,7 +971,7 @@ public class PayService {
|
|||
|
||||
public Result getShopByMember(String userId,String shopId,int page,int pageSize){
|
||||
PageHelper.startPage(page, pageSize);
|
||||
List<Map<String,Object>> list= tbShopUserMapper.selectByUserId(userId,shopId);
|
||||
List<ShopUserListVo> list= tbShopUserMapper.selectByUserId(userId,shopId);
|
||||
PageInfo pageInfo=new PageInfo(list);
|
||||
return Result.success(CodeEnum.SUCCESS,pageInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -218,7 +218,12 @@ public class ProductService {
|
|||
if (CollectionUtils.isEmpty(shopGroupInfoVos)) {
|
||||
return new PageInfo(shopGroupInfoVos);
|
||||
}
|
||||
List<Integer> productIds = shopGroupInfoVos.stream().map(ShopGroupInfoVo::getProId).collect(Collectors.toList());
|
||||
List<Integer> productIds = shopGroupInfoVos.stream()
|
||||
.filter(Objects::nonNull) // 过滤掉 null 的 ShopGroupInfoVo 对象
|
||||
.map(ShopGroupInfoVo::getProId)
|
||||
.filter(Objects::nonNull) // 过滤掉 null 的 ProId
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<String> stringList = productIds.stream()
|
||||
.map(Object::toString) // 将 Integer 对象映射为 String 对象
|
||||
.collect(Collectors.toList());
|
||||
|
|
@ -227,6 +232,9 @@ public class ProductService {
|
|||
//组装
|
||||
List<HomeVO> homeVOList = new ArrayList<>();
|
||||
for (ShopGroupInfoVo o : shopGroupInfoVos) {
|
||||
if (o.getProId() == null) {
|
||||
continue;
|
||||
}
|
||||
HomeVO homeVO = new HomeVO();
|
||||
homeVO.setId(o.getProId());
|
||||
homeVO.setShopName(o.getShopName());
|
||||
|
|
@ -291,6 +299,10 @@ public class ProductService {
|
|||
* @throws Exception
|
||||
*/
|
||||
public Result productInfo(Integer productId, String lat, String lng, String environment) throws Exception {
|
||||
if (StringUtils.isBlank(lat) || lat.equals("undefined")) {
|
||||
lat = "34.343207";
|
||||
lng = "108.939645";
|
||||
}
|
||||
CompletableFuture<TbProductWithBLOBs> product = CompletableFuture.supplyAsync(() ->
|
||||
tbProductMapper.selectByPrimaryKey(productId));
|
||||
CompletableFuture<List<TbProductSku>> productSku = CompletableFuture.supplyAsync(() ->
|
||||
|
|
|
|||
|
|
@ -961,6 +961,7 @@
|
|||
<where>
|
||||
info.`status`='1'
|
||||
AND pro.is_combo = '1'
|
||||
AND pro.type_enum = 'group'
|
||||
AND (info.cities = #{cities} or info.districts = #{cities})
|
||||
<if test="proName != null and proName != ''">
|
||||
AND pro.`name` LIKE concat('%',#{proName,jdbcType=VARCHAR},'%')
|
||||
|
|
@ -1008,6 +1009,8 @@
|
|||
LEFT JOIN tb_shop_info AS info ON info.id = `order`.shop_id
|
||||
<where>
|
||||
info.`status`='1'
|
||||
AND pro.is_combo = '1'
|
||||
AND pro.type_enum = 'group'
|
||||
AND (info.cities = #{cities} or info.districts = #{cities})
|
||||
<if test="proName != null and proName != ''">
|
||||
AND pro.`name` LIKE concat('%',#{proName,jdbcType=VARCHAR},'%')
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@
|
|||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateStockById">
|
||||
update tb_product_sku set stock_number = stock_number + #{num} where id = #{skuId}
|
||||
update tb_product_sku set stock_number = stock_number - #{num} where id = #{skuId}
|
||||
</update>
|
||||
<update id="updateAddStockById">
|
||||
update tb_product_sku set stock_number = stock_number + #{num} where id = #{skuId}
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@
|
|||
select * from tb_params where id = 1
|
||||
</select>
|
||||
|
||||
<select id="selectByUserId" resultType="java.util.Map">
|
||||
<select id="selectByUserId" resultType="com.chaozhanggui.system.cashierservice.entity.vo.ShopUserListVo">
|
||||
SELECT
|
||||
u.id as memberId,
|
||||
i.id as shopId,
|
||||
|
|
@ -410,7 +410,7 @@
|
|||
u.level_consume as levelConsume,
|
||||
u.amount,
|
||||
u.`code`,
|
||||
u.is_vip
|
||||
u.is_vip as isVip
|
||||
FROM
|
||||
tb_shop_user u
|
||||
left join tb_shop_info i on u.shop_id=i.id
|
||||
|
|
|
|||
Loading…
Reference in New Issue