Merge branch 'refs/heads/dev'
This commit is contained in:
commit
5963f18425
|
|
@ -215,9 +215,10 @@ public class PayController {
|
|||
public Result returnOrder(@RequestHeader("token") String token,
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType,
|
||||
@RequestBody List<TbOrderDetail> list
|
||||
@RequestBody List<TbOrderDetail> list,
|
||||
@RequestParam("pwd") String pwd
|
||||
){
|
||||
return payService.returnOrder(list,token);
|
||||
return payService.returnOrder(list,token,pwd);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ public class TbProductSku implements Serializable {
|
|||
|
||||
private BigDecimal strategyPrice;
|
||||
|
||||
private Integer suit;
|
||||
|
||||
private Double stockNumber;
|
||||
|
||||
private String coverImg;
|
||||
|
|
@ -50,6 +52,7 @@ public class TbProductSku implements Serializable {
|
|||
private Long updatedAt;
|
||||
|
||||
private Integer isPauseSale = 0;
|
||||
private Integer isDel;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ public class TbmerchantAccount implements Serializable {
|
|||
|
||||
private String headImg;
|
||||
|
||||
private String pwd;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
|
|
@ -214,4 +216,12 @@ public class TbmerchantAccount implements Serializable {
|
|||
public void setHeadImg(String headImg) {
|
||||
this.headImg = headImg == null ? null : headImg.trim();
|
||||
}
|
||||
|
||||
public String getPwd() {
|
||||
return pwd;
|
||||
}
|
||||
|
||||
public void setPwd(String pwd) {
|
||||
this.pwd = pwd;
|
||||
}
|
||||
}
|
||||
|
|
@ -37,8 +37,6 @@ public class SignInterceptor implements HandlerInterceptor {
|
|||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||
throws Exception {
|
||||
|
||||
|
||||
|
||||
String requestURI = request.getRequestURI();
|
||||
|
||||
if (HttpMethod.OPTIONS.toString().equals(request.getMethod())) {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import java.math.RoundingMode;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class MemberService {
|
||||
|
|
@ -73,6 +74,9 @@ public class MemberService {
|
|||
@Value("${thirdPay.callBack}")
|
||||
private String callBack;
|
||||
|
||||
@Autowired
|
||||
TbmerchantAccountMapper tbmerchantAccountMapper;
|
||||
|
||||
public Result queryMember(String shopId, String phone, int page, int pageSize) {
|
||||
|
||||
PageHelperUtil.startPage(page, pageSize);
|
||||
|
|
@ -519,10 +523,29 @@ public class MemberService {
|
|||
|| !map.containsKey("shopId") || ObjectUtil.isEmpty(map.get("shopId"))
|
||||
|| !map.containsKey("memberId") || ObjectUtil.isEmpty(map.get("memberId"))
|
||||
|| !map.containsKey("amount") || ObjectUtil.isEmpty(map.get("amount"))
|
||||
||!map.containsKey("pwd")||ObjectUtil.isEmpty(map.get("pwd"))
|
||||
) {
|
||||
return Result.fail(CodeEnum.PARAM);
|
||||
}
|
||||
|
||||
|
||||
String accountId= TokenUtil.parseParamFromToken(token).getString("accountId");
|
||||
|
||||
TbmerchantAccount account= tbmerchantAccountMapper.selectByPrimaryKey(Integer.valueOf(accountId));
|
||||
if(Objects.isNull(account)){
|
||||
return Result.fail(CodeEnum.ACCOUNTEIXST);
|
||||
}
|
||||
|
||||
|
||||
if(Objects.isNull(account.getPwd())||ObjectUtil.isEmpty(account.getPwd())){
|
||||
return Result.fail(CodeEnum.PWDNOSET);
|
||||
}
|
||||
|
||||
if(!account.getPwd().equals(MD5Util.encrypt(map.get("pwd").toString().concat(account.getAccount()).concat(account.getId().toString())))){
|
||||
return Result.fail(CodeEnum.PWDERROE);
|
||||
}
|
||||
|
||||
|
||||
String memberId = String.valueOf(map.get("memberId"));
|
||||
|
||||
String shopId = String.valueOf(map.get("shopId"));
|
||||
|
|
|
|||
|
|
@ -113,17 +113,27 @@ public class OrderService {
|
|||
return Result.fail(CodeEnum.PRODUCTSKUERROR);
|
||||
}
|
||||
|
||||
String message = redisUtil.getMessage(RedisCst.ORDER_PRODUCT_NUM + cartId);
|
||||
|
||||
|
||||
String exists = redisUtil.getMessage(RedisCst.ORDER_CART_EXISTS + cartId);
|
||||
|
||||
// 首次加入购物车,并且拥有起售数,设置为起售数
|
||||
if (exists == null && skuWithBLOBs.getSuit() != null && skuWithBLOBs.getSuit() != 0) {
|
||||
number = skuWithBLOBs.getSuit();
|
||||
// 低于起售,删除商品
|
||||
}else if (exists != null && skuWithBLOBs.getSuit() != null && skuWithBLOBs.getSuit() != 0 && number < skuWithBLOBs.getSuit()){
|
||||
redisUtil.deleteByKey(RedisCst.ORDER_CART_EXISTS + cartId);
|
||||
delCart(masterId, cartId);
|
||||
return Result.success(CodeEnum.SUCCESS, masterId);
|
||||
}
|
||||
|
||||
if("1".equals(product.getIsStock().toString())){
|
||||
if ("1".equals(product.getIsDistribute().toString())) {
|
||||
if((message == null && product.getStockNumber()-number<0) ||
|
||||
(product.getStockNumber()-number<0 && message != null && Integer.parseInt(message) < number)){
|
||||
if(product.getStockNumber()-number<0){
|
||||
return Result.fail(CodeEnum.STOCKERROR);
|
||||
}
|
||||
} else if (product.getId().intValue()==Integer.valueOf(skuWithBLOBs.getProductId()).intValue()){
|
||||
if((message == null && skuWithBLOBs.getStockNumber()-number<0) ||
|
||||
(skuWithBLOBs.getStockNumber()-number<0 && message != null && Integer.parseInt(message) < number)){
|
||||
if(skuWithBLOBs.getStockNumber()-number<0){
|
||||
return Result.fail(CodeEnum.STOCKERROR);
|
||||
}
|
||||
}
|
||||
|
|
@ -162,6 +172,7 @@ public class OrderService {
|
|||
cart.setTotalNumber(number);
|
||||
cart.setUuid(uuid);
|
||||
cashierCartMapper.updateByPrimaryKeySelective(cart);
|
||||
|
||||
} else {
|
||||
List<TbCashierCart> list = cashierCartMapper.selectALlByMasterId(masterId, "create");
|
||||
TbCashierCart cashierCart = cashierCartMapper.selectByDetail(masterId, productId, shopId, skuId.toString(), DateUtils.getDay(), uuid);
|
||||
|
|
@ -223,8 +234,10 @@ public class OrderService {
|
|||
}
|
||||
|
||||
cart=cashierCart;
|
||||
redisUtil.saveMessage(RedisCst.ORDER_CART_EXISTS + cart.getId(), "1", 60 * 60 * 24);
|
||||
}
|
||||
|
||||
redisUtil.saveMessage(RedisCst.ORDER_CART_EXISTS + cart.getId(), "1", 60 * 60 * 24);
|
||||
|
||||
|
||||
// skuWithBLOBs.setStockNumber(skuWithBLOBs.getStockNumber()-number);
|
||||
|
|
@ -263,7 +276,7 @@ public class OrderService {
|
|||
shopOpenIds.forEach(item -> {
|
||||
wechatUtil.sendStockWarnMsg(shopInfo.getShopName(), product.getName(),
|
||||
product.getIsDistribute() == 1 ? String.valueOf(product.getStockNumber()-num) : String.valueOf(productSku.getStockNumber() - num),
|
||||
"耗材库存不足,请及时补充。", item.getOpenId());
|
||||
"商品库存不足,请及时补充。", item.getOpenId());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -351,6 +364,13 @@ public class OrderService {
|
|||
// skuWithBLOBs.setUpdatedAt(System.currentTimeMillis());
|
||||
// tbProductSkuMapper.updateByPrimaryKey(skuWithBLOBs);
|
||||
// }
|
||||
// 数量减少, 返还库存
|
||||
String message = redisUtil.getMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
|
||||
redisUtil.deleteByKey(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
|
||||
|
||||
if (message != null) {
|
||||
productService.incrStock(cashierCart.getProductId(), cashierCart.getSkuId(), Integer.parseInt(message));
|
||||
}
|
||||
|
||||
List<String> skuIds=new ArrayList<>();
|
||||
skuIds.add(cashierCart.getSkuId());
|
||||
|
|
@ -504,13 +524,13 @@ public class OrderService {
|
|||
} else {
|
||||
productService.decrStock(cashierCart.getProductId(), cashierCart.getSkuId(), cashierCart.getNumber() - lastNum);
|
||||
}
|
||||
redisUtil.saveMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId(), cashierCart.getNumber().toString(), 24 * 60*60*1000);
|
||||
redisUtil.saveMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId(), cashierCart.getNumber().toString(), 24 * 60*60);
|
||||
|
||||
}
|
||||
|
||||
// 首次添加的商品
|
||||
}else {
|
||||
redisUtil.saveMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId(), cashierCart.getNumber().toString(), 24 * 60*60*1000);
|
||||
redisUtil.saveMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId(), cashierCart.getNumber().toString(), 24 * 60*60);
|
||||
// 修改库存
|
||||
productService.decrStock(cashierCart.getProductId(), cashierCart.getSkuId(), cashierCart.getNumber());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,6 +113,10 @@ public class PayService {
|
|||
private String callBack;
|
||||
|
||||
|
||||
@Autowired
|
||||
TbmerchantAccountMapper tbmerchantAccountMapper;
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
System.out.printf("%.2f%n", new BigDecimal(1).setScale(2, RoundingMode.DOWN));
|
||||
|
|
@ -718,10 +722,27 @@ public class PayService {
|
|||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result returnOrder(List<TbOrderDetail> list, String token) {
|
||||
public Result returnOrder(List<TbOrderDetail> list, String token,String pwd) {
|
||||
if (ObjectUtil.isEmpty(list) || list.size() <= 0) {
|
||||
return Result.fail(CodeEnum.PARAM);
|
||||
}
|
||||
//
|
||||
// String accountId= TokenUtil.parseParamFromToken(token).getString("accountId");
|
||||
//
|
||||
// TbmerchantAccount account= tbmerchantAccountMapper.selectByPrimaryKey(Integer.valueOf(accountId));
|
||||
// if(Objects.isNull(account)){
|
||||
// return Result.fail(CodeEnum.ACCOUNTEIXST);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if(Objects.isNull(account.getPwd())||ObjectUtil.isEmpty(account.getPwd())){
|
||||
// return Result.fail(CodeEnum.PWDNOSET);
|
||||
// }
|
||||
//
|
||||
// if(!account.getPwd().equals(MD5Util.encrypt(pwd.concat(account.getAccount()).concat(account.getId().toString())))){
|
||||
// return Result.fail(CodeEnum.PWDERROE);
|
||||
// }
|
||||
|
||||
|
||||
Integer orderId = list.get(0).getOrderId();
|
||||
|
||||
|
|
|
|||
|
|
@ -98,8 +98,11 @@ public enum CodeEnum {
|
|||
|
||||
CONSERROR("100036",false,"商品已售罄","fail"),
|
||||
|
||||
PWDNOSET("100037",false,"操作密码未设置","fail"),
|
||||
|
||||
|
||||
PWDERROE("100038",false,"操作密码错误","fail"),
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -19,4 +19,5 @@ public class RedisCst {
|
|||
|
||||
public static final String ORDER_MESSAGE="ORDER:MESSAGE:";
|
||||
public static final String ORDER_PRODUCT_NUM = "ORDER_NUM:";
|
||||
public static final String ORDER_CART_EXISTS = "ORDER_CART_EXISTS:";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
<result column="stock_number" jdbcType="DOUBLE" property="stockNumber" />
|
||||
<result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
|
||||
<result column="warn_line" jdbcType="INTEGER" property="warnLine" />
|
||||
<result column="suit" jdbcType="INTEGER" property="suit" />
|
||||
<result column="weight" jdbcType="DOUBLE" property="weight" />
|
||||
<result column="volume" jdbcType="REAL" property="volume" />
|
||||
<result column="real_sales_number" jdbcType="DOUBLE" property="realSalesNumber" />
|
||||
|
|
@ -29,15 +30,15 @@
|
|||
<result column="spec_snap" jdbcType="LONGVARCHAR" property="specSnap" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, shop_id, bar_code, product_id, origin_price, cost_price, member_price, meal_price,
|
||||
sale_price, guide_price, strategy_price, stock_number, cover_img, warn_line, weight,
|
||||
volume, real_sales_number, first_shared, second_shared, created_at, updated_at
|
||||
id, shop_id, bar_code, product_id, origin_price, cost_price, member_price, meal_price,
|
||||
sale_price, guide_price, strategy_price, stock_number, cover_img, warn_line, weight,
|
||||
volume, real_sales_number, first_shared, second_shared, created_at, updated_at,suit
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
spec_info, spec_snap
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
|
|
@ -49,21 +50,21 @@
|
|||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductSkuWithBLOBs">
|
||||
insert into tb_product_sku (id, shop_id, bar_code,
|
||||
product_id, origin_price, cost_price,
|
||||
member_price, meal_price, sale_price,
|
||||
guide_price, strategy_price, stock_number,
|
||||
cover_img, warn_line, weight,
|
||||
volume, real_sales_number, first_shared,
|
||||
second_shared, created_at, updated_at,
|
||||
insert into tb_product_sku (id, shop_id, bar_code,
|
||||
product_id, origin_price, cost_price,
|
||||
member_price, meal_price, sale_price,
|
||||
guide_price, strategy_price, stock_number,
|
||||
cover_img, warn_line, weight,
|
||||
volume, real_sales_number, first_shared,
|
||||
second_shared, created_at, updated_at,
|
||||
spec_info, spec_snap)
|
||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=VARCHAR}, #{barCode,jdbcType=VARCHAR},
|
||||
#{productId,jdbcType=VARCHAR}, #{originPrice,jdbcType=DECIMAL}, #{costPrice,jdbcType=DECIMAL},
|
||||
#{memberPrice,jdbcType=DECIMAL}, #{mealPrice,jdbcType=DECIMAL}, #{salePrice,jdbcType=DECIMAL},
|
||||
#{guidePrice,jdbcType=DECIMAL}, #{strategyPrice,jdbcType=DECIMAL}, #{stockNumber,jdbcType=DOUBLE},
|
||||
#{coverImg,jdbcType=VARCHAR}, #{warnLine,jdbcType=INTEGER}, #{weight,jdbcType=DOUBLE},
|
||||
#{volume,jdbcType=REAL}, #{realSalesNumber,jdbcType=DOUBLE}, #{firstShared,jdbcType=DECIMAL},
|
||||
#{secondShared,jdbcType=DECIMAL}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT},
|
||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=VARCHAR}, #{barCode,jdbcType=VARCHAR},
|
||||
#{productId,jdbcType=VARCHAR}, #{originPrice,jdbcType=DECIMAL}, #{costPrice,jdbcType=DECIMAL},
|
||||
#{memberPrice,jdbcType=DECIMAL}, #{mealPrice,jdbcType=DECIMAL}, #{salePrice,jdbcType=DECIMAL},
|
||||
#{guidePrice,jdbcType=DECIMAL}, #{strategyPrice,jdbcType=DECIMAL}, #{stockNumber,jdbcType=DOUBLE},
|
||||
#{coverImg,jdbcType=VARCHAR}, #{warnLine,jdbcType=INTEGER}, #{weight,jdbcType=DOUBLE},
|
||||
#{volume,jdbcType=REAL}, #{realSalesNumber,jdbcType=DOUBLE}, #{firstShared,jdbcType=DECIMAL},
|
||||
#{secondShared,jdbcType=DECIMAL}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT},
|
||||
#{specInfo,jdbcType=LONGVARCHAR}, #{specSnap,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductSkuWithBLOBs">
|
||||
|
|
@ -344,7 +345,7 @@
|
|||
</update>
|
||||
|
||||
<select id="selectByShopIdAndProductIdAndSpec" resultMap="ResultMapWithBLOBs">
|
||||
select * from tb_product_sku where shop_id=#{shopId} and product_id=#{productId}
|
||||
select * from tb_product_sku where shop_id=#{shopId} and product_id=#{productId} and is_del=0
|
||||
|
||||
<if test="spec != null and spec !=''">
|
||||
and spec_snap = #{spec}
|
||||
|
|
@ -364,4 +365,4 @@
|
|||
</foreach>
|
||||
|
||||
</update>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
<result column="msg_able" jdbcType="TINYINT" property="msgAble" />
|
||||
<result column="created_at" jdbcType="BIGINT" property="createdAt" />
|
||||
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
|
||||
|
||||
<result column="pwd" jdbcType="VARCHAR" property="pwd" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbmerchantAccount">
|
||||
<result column="head_img" jdbcType="LONGVARCHAR" property="headImg" />
|
||||
|
|
@ -29,7 +31,7 @@
|
|||
<sql id="Base_Column_List">
|
||||
id, account, password, merchant_id, shop_id, shop_snap, is_admin, is_mercantile,
|
||||
name, sex, email, telephone, status, sort, role_id, last_login_at, mp_open_id, msg_able,
|
||||
created_at, updated_at
|
||||
created_at, updated_at,pwd
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
head_img
|
||||
|
|
|
|||
Loading…
Reference in New Issue