Merge remote-tracking branch 'origin/dev' into hph

# Conflicts:
#	src/main/java/com/chaozhanggui/system/cashierservice/service/CartService.java
This commit is contained in:
牛叉闪闪 2024-07-22 13:55:53 +08:00
commit fd293f2df0
33 changed files with 784 additions and 418 deletions

View File

@ -60,7 +60,9 @@ public class LoginFilter implements Filter {
// 点歌部分不需要登录 // 点歌部分不需要登录
"/cashierService/song/detail", "/cashierService/song/detail",
"/cashierService/song/record", "/cashierService/song/record",
"/cashierService/song" "/cashierService/song",
"/cashierService/song/singing",
"/cashierService/login/test"
); );
@Autowired @Autowired

View File

@ -96,19 +96,15 @@ public class LoginContoller {
* @return * @return
*/ */
@RequestMapping("/wx/custom/login") @RequestMapping("/wx/custom/login")
public Result wxCustomLogin(HttpServletRequest request, @RequestBody Map<String, String> map public Result wxCustomLogin(HttpServletRequest request, @RequestBody Map<String, String> map) {
// ,
// @RequestParam(value = "rawData", required = false) String rawData,
// @RequestParam(value = "signature", required = false) String signature
) {
if (ObjectUtil.isNull(map) || ObjectUtil.isEmpty(map) || !map.containsKey("code") || ObjectUtil.isEmpty(map.get("code"))) { if (ObjectUtil.isNull(map) || ObjectUtil.isEmpty(map) || !map.containsKey("code") || ObjectUtil.isEmpty(map.get("code"))) {
Result.fail("code不能为空"); Result.fail("code不能为空");
} }
String code = map.get("code").toString(); String code = map.get("code").toString();
String rawData = map.get("rawData"); String rawData = map.get("rawData");
String signature = map.get("signature"); // String signature = map.get("signature");
String encryptedData = map.get("encryptedData"); // String encryptedData = map.get("encryptedData");
String ivStr = map.get("iv"); // String ivStr = map.get("iv");
// String phone = map.get("phone"); // String phone = map.get("phone");
// 用户非敏感信息rawData // 用户非敏感信息rawData
// 签名signature // 签名signature
@ -118,26 +114,26 @@ public class LoginContoller {
JSONObject SessionKeyOpenId = WechatUtil.getSessionKeyOrOpenId(code, customAppId, customSecrete); JSONObject SessionKeyOpenId = WechatUtil.getSessionKeyOrOpenId(code, customAppId, customSecrete);
// 3.接收微信接口服务 获取返回的参数 // 3.接收微信接口服务 获取返回的参数
String openid = SessionKeyOpenId.getString("openid"); String openid = SessionKeyOpenId.getString("openid");
String sessionKey = SessionKeyOpenId.getString("session_key"); // String sessionKey = SessionKeyOpenId.getString("session_key");
// 4.校验签名 小程序发送的签名signature与服务器端生成的签名signature2 = sha1(rawData + sessionKey) // 4.校验签名 小程序发送的签名signature与服务器端生成的签名signature2 = sha1(rawData + sessionKey)
String signature2 = DigestUtils.sha1Hex(rawData + sessionKey); // String signature2 = DigestUtils.sha1Hex(rawData + sessionKey);
if (!signature.equals(signature2)) { // if (!signature.equals(signature2)) {
return Result.fail("签名校验失败"); // return Result.fail("签名校验失败");
} // }
String phone = ""; // String phone = "";
try{ // try{
String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr); // String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr);
if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) { // if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) {
phone =JSONObject.parseObject(data).get("phoneNumber").toString(); // phone =JSONObject.parseObject(data).get("phoneNumber").toString();
} // }
}catch (Exception e){ // }catch (Exception e){
log.info("登录传参:获取手机号失败{}",e.getMessage()); // log.info("登录传参:获取手机号失败{}",e.getMessage());
} // }
String nickName = rawDataJson.getString("nickName"); String nickName = rawDataJson.getString("nickName");
String avatarUrl = rawDataJson.getString("avatarUrl"); String avatarUrl = rawDataJson.getString("avatarUrl");
try { try {
return loginService.wxCustomLogin(openid, avatarUrl, nickName, phone, IpUtil.getIpAddr(request)); return loginService.wxCustomLogin(openid, avatarUrl, nickName, "", IpUtil.getIpAddr(request));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -154,7 +150,37 @@ public class LoginContoller {
* @return * @return
*/ */
// @RequestMapping("getPhoneNumber") // @RequestMapping("getPhoneNumber")
public Result getPhoneNumber(@RequestBody Map<String, String> map) { // public Result getPhoneNumber(@RequestBody Map<String, String> map) {
//
// if (ObjectUtil.isNull(map) || ObjectUtil.isEmpty(map) || !map.containsKey("code") || ObjectUtil.isEmpty(map.get("code"))) {
// Result.fail("code不能为空");
// }
// String code = map.get("code").toString();
//
// String encryptedData = map.get("encryptedData");
//
// String ivStr = map.get("iv");
// if (StringUtils.isBlank(encryptedData) || StringUtils.isBlank(ivStr)) {
// return Result.fail("请授权后使用");
// }
//
// JSONObject SessionKeyOpenId = WechatUtil.getSessionKeyOrOpenId(code, customAppId, customSecrete);
// // 3.接收微信接口服务 获取返回的参数
// String openid = SessionKeyOpenId.getString("openid");
// String sessionKey = SessionKeyOpenId.getString("session_key");
// String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr);
// try {
// if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) {
// log.info("登录传参 获取手机号成功 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,JSONObject.parseObject(data).get("phoneNumber"));
// return Result.success(CodeEnum.SUCCESS, JSONObject.parseObject(data).get("phoneNumber"));
// }
// } catch (Exception e){
// log.info("登录传参 获取手机号失败 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,data);
// }
// return Result.fail("获取手机号失败,请重试!");
// }
@RequestMapping("getPhoneNumber")
public Result getPhoneNumber(@RequestHeader String openId,@RequestBody Map<String, String> map) {
if (ObjectUtil.isNull(map) || ObjectUtil.isEmpty(map) || !map.containsKey("code") || ObjectUtil.isEmpty(map.get("code"))) { if (ObjectUtil.isNull(map) || ObjectUtil.isEmpty(map) || !map.containsKey("code") || ObjectUtil.isEmpty(map.get("code"))) {
Result.fail("code不能为空"); Result.fail("code不能为空");
@ -175,10 +201,14 @@ public class LoginContoller {
String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr); String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr);
try { try {
if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) { if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) {
if (!map.containsKey("shopId") || ObjectUtil.isEmpty(map.get("shopId"))) {
return Result.success(CodeEnum.SUCCESS, JSONObject.parseObject(data).get("phoneNumber"));
}
log.info("登录传参 获取手机号成功 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,JSONObject.parseObject(data).get("phoneNumber")); log.info("登录传参 获取手机号成功 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,JSONObject.parseObject(data).get("phoneNumber"));
return Result.success(CodeEnum.SUCCESS, JSONObject.parseObject(data).get("phoneNumber")); return loginService.upPhone(openId,JSONObject.parseObject(data).get("phoneNumber").toString(),map.get("shopId").toString());
} }
} catch (Exception e){ } catch (Exception e){
// e.printStackTrace();
log.info("登录传参 获取手机号失败 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,data); log.info("登录传参 获取手机号失败 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,data);
} }
return Result.fail("获取手机号失败,请重试!"); return Result.fail("获取手机号失败,请重试!");

View File

@ -55,15 +55,9 @@ public class NotifyController {
JSONObject object=JSONUtil.parseObj(map.get("bizData").toString()); JSONObject object=JSONUtil.parseObj(map.get("bizData").toString());
if(ObjectUtil.isNotEmpty(object)&&object.containsKey("state")){ if(ObjectUtil.isNotEmpty(object)&&object.containsKey("state")){
if("TRADE_SUCCESS".equals(object.get("state").toString())){ if("TRADE_SUCCESS".equals(object.get("state").toString())){
JSONObject extParam = object.getJSONObject("extParam");
String orderNo=object.get("mchOrderNo").toString(); String orderNo=object.get("mchOrderNo").toString();
if (ObjectUtil.isNotEmpty(extParam)&&ObjectUtil.isNotNull(extParam)&&PayTypeConstant.MINI_PAY.equals(extParam.getStr("payType"))) { String tradeNo=object.get("payOrderId").toString();
log.info("接收到微信点歌支付成功回调,订单编号:{}", orderNo); return payService.fstMemberInSuccess(orderNo,tradeNo);
return payService.songPaySuccess(orderNo, extParam.getStr("orderNo"));
}else {
String tradeNo=object.get("payOrderId").toString();
return payService.fstMemberInSuccess(orderNo,tradeNo);
}
} }
} }
} }
@ -159,8 +153,9 @@ public class NotifyController {
if (ObjectUtil.isNotEmpty(map) && map.containsKey("code") && "000000".equals(map.get("code") + "")) { if (ObjectUtil.isNotEmpty(map) && map.containsKey("code") && "000000".equals(map.get("code") + "")) {
JSONObject object = JSONUtil.parseObj(map.get("bizData")); JSONObject object = JSONUtil.parseObj(map.get("bizData"));
if (ObjectUtil.isNotEmpty(object) && object.containsKey("state") && "TRADE_SUCCESS".equals(object.getStr("state"))) { if (ObjectUtil.isNotEmpty(object) && object.containsKey("state") && "TRADE_SUCCESS".equals(object.getStr("state"))) {
String tradeNo=object.get("payOrderId").toString();
String orderNo = object.getStr("mchOrderNo"); String orderNo = object.getStr("mchOrderNo");
return payService.songOrderSuccess(orderNo, DateUtils.getTime(new Date())); return payService.songOrderSuccess(orderNo, tradeNo);
} }
} }
return null; return null;

View File

@ -50,10 +50,7 @@ public class OrderController {
@RequestParam Integer size, @RequestParam String status){ @RequestParam Integer size, @RequestParam String status){
return orderService.orderList(userId,page,size,status); return orderService.orderList(userId,page,size,status);
} }
@GetMapping("/testMessage")
private void testMessage(@RequestParam("tableId") String tableId, @RequestParam("message") String message) throws IOException {
orderService.testMessage(tableId,message);
}
@GetMapping("/tradeIntegral") @GetMapping("/tradeIntegral")
private Result tradeIntegral(@RequestParam("userId") String userId, @RequestParam("id") String id) throws IOException, ParseException { private Result tradeIntegral(@RequestParam("userId") String userId, @RequestParam("id") String id) throws IOException, ParseException {
return orderService.tradeIntegral(userId,id); return orderService.tradeIntegral(userId,id);

View File

@ -1,5 +1,6 @@
package com.chaozhanggui.system.cashierservice.controller; package com.chaozhanggui.system.cashierservice.controller;
import com.chaozhanggui.system.cashierservice.annotation.LimitSubmit;
import com.chaozhanggui.system.cashierservice.entity.dto.SongOrderDTO; import com.chaozhanggui.system.cashierservice.entity.dto.SongOrderDTO;
import com.chaozhanggui.system.cashierservice.service.TbShopSongService; import com.chaozhanggui.system.cashierservice.service.TbShopSongService;
import com.chaozhanggui.system.cashierservice.sign.Result; import com.chaozhanggui.system.cashierservice.sign.Result;
@ -52,15 +53,35 @@ public class ShopSongController {
@GetMapping("/record") @GetMapping("/record")
public Result getRecord( public Result getRecord(
@RequestHeader("openId") String openId, @RequestHeader("openId") String openId,
@RequestParam("shopId") Integer shopId,
@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size, @RequestParam(defaultValue = "10") Integer size,
@RequestParam(required = false) Integer state, @RequestParam(required = false) Integer state,
@RequestParam(defaultValue = "true") boolean isDesc @RequestParam(defaultValue = "true") boolean isDesc
) { ) {
return Result.successWithData(shopSongService.getRecord(openId, page, size, state, isDesc)); return Result.successWithData(shopSongService.getRecord(openId, page, size, state, isDesc,shopId));
}
/**
* 获取正在播放的歌曲
* @param openId 用户id
* @return 歌曲信息
*/
@GetMapping("/singing")
public Result getSinging(
@RequestHeader("openId") String openId
) {
return Result.successWithData(shopSongService.getSinging(openId));
} }
/**
* 创建订单
* @param openId 用户信息
* @param songOrderDTO 订单信息
* @return result
*/
@LimitSubmit(key = "song_order_pay:#openId")
@PostMapping @PostMapping
public Result createOrder( public Result createOrder(
@RequestHeader("openId") String openId, @RequestHeader("openId") String openId,

View File

@ -82,82 +82,86 @@ public class UserContoller {
// return jsonObject; // return jsonObject;
// } // }
@GetMapping("/shopUserInfo") @GetMapping("/shopUserInfo")
public Result shopUserInfo(@RequestParam("userId") String userId ,@RequestHeader("openId") String openId,@RequestParam("shopId") String shopId ) throws Exception { public Result shopUserInfo(@RequestParam("userId") String userId, @RequestHeader("openId") String openId, @RequestParam("shopId") String shopId) throws Exception {
TbShopUser shopUser=new TbShopUser(); TbShopUser shopUser = new TbShopUser();
TbShopInfo tbShopInfo = shopInfoMapper.selectByPrimaryKey(Integer.valueOf(shopId)); TbShopInfo tbShopInfo = shopInfoMapper.selectByPrimaryKey(Integer.valueOf(shopId));
if (StringUtils.isNotBlank(shopId) && !shopId.equals("null")) { if (StringUtils.isNotBlank(shopId) && !shopId.equals("null")) {
shopUser = shopUserMapper.selectByUserIdAndShopId(userId, shopId); shopUser = shopUserMapper.selectByUserIdAndShopId(userId, shopId);
if (ObjectUtil.isEmpty(shopUser)) { if (ObjectUtil.isEmpty(shopUser)) {
TbUserInfo tbUserInfo = userInfoMapper.selectByPrimaryKey(Integer.valueOf(userId)); TbUserInfo tbUserInfo = userInfoMapper.selectByPrimaryKey(Integer.valueOf(userId));
shopUser = shopUserMapper.selectByPhoneAndShopId(tbUserInfo.getTelephone(), shopId); // shopUser = shopUserMapper.selectByPhoneAndShopId(tbUserInfo.getTelephone(), shopId);
if(ObjectUtil.isEmpty(shopUser)){ // if(ObjectUtil.isEmpty(shopUser)){
shopUser=new TbShopUser(); shopUser = new TbShopUser();
shopUser.setName(tbUserInfo.getNickName()); shopUser.setName(tbUserInfo.getNickName());
shopUser.setSex(tbUserInfo.getSex()); shopUser.setSex(tbUserInfo.getSex());
shopUser.setBirthDay(tbUserInfo.getBirthDay()); shopUser.setBirthDay(tbUserInfo.getBirthDay());
shopUser.setLevel(Byte.parseByte("1")); shopUser.setLevel(Byte.parseByte("1"));
String dynamicCode = RandomUtil.randomNumbers(8); String dynamicCode = RandomUtil.randomNumbers(8);
shopUser.setCode(dynamicCode); shopUser.setCode(dynamicCode);
shopUser.setTelephone(tbUserInfo.getTelephone()); shopUser.setTelephone(tbUserInfo.getTelephone());
shopUser.setAmount(BigDecimal.ZERO); shopUser.setAmount(BigDecimal.ZERO);
shopUser.setIsVip(Byte.parseByte("0")); shopUser.setIsVip(Byte.parseByte("0"));
shopUser.setCreditAmount(BigDecimal.ZERO); shopUser.setCreditAmount(BigDecimal.ZERO);
shopUser.setConsumeAmount(BigDecimal.ZERO); shopUser.setConsumeAmount(BigDecimal.ZERO);
shopUser.setConsumeNumber(0); shopUser.setConsumeNumber(0);
shopUser.setLevelConsume(BigDecimal.ZERO); shopUser.setLevelConsume(BigDecimal.ZERO);
shopUser.setStatus(Byte.parseByte("1")); shopUser.setStatus(Byte.parseByte("1"));
shopUser.setShopId(shopId); shopUser.setShopId(shopId);
shopUser.setUserId(userId); shopUser.setUserId(userId);
shopUser.setMiniOpenId(openId); shopUser.setMiniOpenId(openId);
shopUser.setCreatedAt(System.currentTimeMillis()); shopUser.setCreatedAt(System.currentTimeMillis());
shopUser.setUpdatedAt(System.currentTimeMillis()); shopUser.setUpdatedAt(System.currentTimeMillis());
shopUserMapper.insert(shopUser); shopUserMapper.insert(shopUser);
}else { // }else {
shopUser.setUserId(userId); // shopUser.setUserId(userId);
shopUser.setUpdatedAt(System.currentTimeMillis()); // shopUser.setUpdatedAt(System.currentTimeMillis());
shopUserMapper.updateByPrimaryKey(shopUser); // shopUserMapper.updateByPrimaryKey(shopUser);
} // }
} }
}else { } else {
shopUser.setAmount(BigDecimal.ZERO); shopUser.setAmount(BigDecimal.ZERO);
} }
shopUser.setShopName(tbShopInfo.getShopName()); if (tbShopInfo != null) {
return Result.success(CodeEnum.SUCCESS,shopUser); shopUser.setShopName(tbShopInfo.getShopName());
}else {
shopUser.setShopName("");
}
return Result.success(CodeEnum.SUCCESS, shopUser);
} }
@GetMapping("/userCoupon") @GetMapping("/userCoupon")
public Result userCoupon(@RequestParam("userId") String userId ,@RequestParam("orderNum") BigDecimal orderNum ) throws Exception { public Result userCoupon(@RequestParam("userId") String userId, @RequestParam("orderNum") BigDecimal orderNum) throws Exception {
int num = userService.userCoupon(userId,orderNum); int num = userService.userCoupon(userId, orderNum);
return Result.success(CodeEnum.SUCCESS,num); return Result.success(CodeEnum.SUCCESS, num);
} }
@PostMapping("/modityIntegral") @PostMapping("/modityIntegral")
public JSONObject modityIntegral(@RequestHeader String token,@RequestBody IntegralVo integralVo ) throws Exception { public JSONObject modityIntegral(@RequestHeader String token, @RequestBody IntegralVo integralVo) throws Exception {
JSONObject jsonObject = TokenUtil.parseParamFromToken(token); JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
String userSign = jsonObject.getString("userSign"); String userSign = jsonObject.getString("userSign");
return userService.modityIntegral(integralVo,userSign); return userService.modityIntegral(integralVo, userSign);
} }
@PostMapping("/userIntegral") @PostMapping("/userIntegral")
public JSONObject userIntegral(@RequestHeader String token,@RequestBody IntegralFlowVo integralFlowVo ) throws Exception { public JSONObject userIntegral(@RequestHeader String token, @RequestBody IntegralFlowVo integralFlowVo) throws Exception {
JSONObject jsonObject = TokenUtil.parseParamFromToken(token); JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
String userSign = jsonObject.getString("userSign"); String userSign = jsonObject.getString("userSign");
return userService.userIntegral(integralFlowVo,userSign); return userService.userIntegral(integralFlowVo, userSign);
} }
@PostMapping("/userAllIntegral") @PostMapping("/userAllIntegral")
public JSONObject userAllIntegral(@RequestBody IntegralFlowVo integralFlowVo ) throws Exception { public JSONObject userAllIntegral(@RequestBody IntegralFlowVo integralFlowVo) throws Exception {
// JSONObject jsonObject = TokenUtil.parseParamFromToken(token); // JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
// String userSign = jsonObject.getString("userSign"); // String userSign = jsonObject.getString("userSign");
return userService.userAllIntegral(integralFlowVo,"userSign"); return userService.userAllIntegral(integralFlowVo, "userSign");
} }
@PostMapping("/userAll") @PostMapping("/userAll")
public JSONObject userAll(@RequestBody IntegralFlowVo integralFlowVo ) throws Exception { public JSONObject userAll(@RequestBody IntegralFlowVo integralFlowVo) throws Exception {
// JSONObject jsonObject = TokenUtil.parseParamFromToken(token); // JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
// String userSign = jsonObject.getString("userSign"); // String userSign = jsonObject.getString("userSign");
return userService.userAll(integralFlowVo,"userSign"); return userService.userAll(integralFlowVo, "userSign");
} }
} }

View File

@ -19,6 +19,7 @@ public interface TbProductMapper {
TbProduct selectById(Integer id); TbProduct selectById(Integer id);
List<TbProduct> selectByIdIn(@Param("ids") String ids); List<TbProduct> selectByIdIn(@Param("ids") String ids);
List<TbProduct> selectByIdInAndCheck(@Param("ids") String ids);
List<TbProduct> selectByIds(@Param("list") List<String> ids); List<TbProduct> selectByIds(@Param("list") List<String> ids);
Integer selectByQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId); Integer selectByQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId);

View File

@ -5,6 +5,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbProductSkuWithBLOBs;
import com.chaozhanggui.system.cashierservice.entity.vo.HomeVO; import com.chaozhanggui.system.cashierservice.entity.vo.HomeVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update; import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -15,19 +16,11 @@ import java.util.List;
public interface TbProductSkuMapper { public interface TbProductSkuMapper {
int deleteByPrimaryKey(Integer id); int deleteByPrimaryKey(Integer id);
int insert(TbProductSkuWithBLOBs record);
int insertSelective(TbProductSkuWithBLOBs record);
TbProductSkuWithBLOBs selectByPrimaryKey(Integer id); TbProductSkuWithBLOBs selectByPrimaryKey(Integer id);
Integer selectBySpecSnap(@Param("shopId")String shopId,@Param("tableId") Integer tableId,@Param("specSnap") String specSnap); Integer selectBySpecSnap(@Param("shopId")String shopId,@Param("tableId") Integer tableId,@Param("specSnap") String specSnap);
int updateByPrimaryKeySelective(TbProductSkuWithBLOBs record);
List<HomeVO> selectSale(); List<HomeVO> selectSale();
List<HomeVO> selectDay(); List<HomeVO> selectDay();
int updateByPrimaryKeyWithBLOBs(TbProductSkuWithBLOBs record);
int updateByPrimaryKey(TbProductSku record);
TbProductSkuWithBLOBs selectByShopIdAndProductIdAndSpec(@Param("shopId") String shopId, @Param("productId") String productId, @Param("spec") String spec); TbProductSkuWithBLOBs selectByShopIdAndProductIdAndSpec(@Param("shopId") String shopId, @Param("productId") String productId, @Param("spec") String spec);
@ -46,4 +39,7 @@ public interface TbProductSkuMapper {
@Update("update tb_product_sku set stock_number=stock_number-#{num} WHERE id=#{id}") @Update("update tb_product_sku set stock_number=stock_number-#{num} WHERE id=#{id}")
int decrStockUnCheck(@Param("id") String id, @Param("num") Integer num); int decrStockUnCheck(@Param("id") String id, @Param("num") Integer num);
@Select("select * from tb_product_sku where is_grounding=1 and is_del=0 and product_id=#{id}")
List<TbProductSku> selectGroundingByProId(@Param("id") Integer id);
} }

View File

@ -26,8 +26,8 @@ public interface TbShopOpenIdMapper {
int updateByPrimaryKey(TbShopOpenId record); int updateByPrimaryKey(TbShopOpenId record);
@Select("select * from tb_shop_open_id where open_id=#{openId}") @Select("select * from tb_shop_open_id where open_id=#{openId} and shop_id=#{shopId} limit 1")
TbShopOpenId countByOpenId(@Param("openId") String openId); TbShopOpenId countByOpenId(@Param("openId") String openId, @Param("shopId") Integer shopId);
@Select("select * from tb_shop_open_id where shop_id=#{shopId} and status=1") @Select("select * from tb_shop_open_id where shop_id=#{shopId} and status=1")
List<TbShopOpenId> selectByShopId(@Param("shopId") Integer shopId); List<TbShopOpenId> selectByShopId(@Param("shopId") Integer shopId);

View File

@ -11,7 +11,7 @@ import java.util.Map;
/** /**
* @author Administrator * @author Administrator
* @description 针对表tb_shop_song_order的数据库操作Mapper * @description 针对表tb_shop_song_order的数据库操作Mapper
* @createDate 2024-07-09 15:23:30 * @createDate 2024-07-11 09:24:20
* @Entity com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder * @Entity com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder
*/ */
public interface TbShopSongOrderMapper { public interface TbShopSongOrderMapper {
@ -29,15 +29,23 @@ public interface TbShopSongOrderMapper {
int updateByPrimaryKey(TbShopSongOrder record); int updateByPrimaryKey(TbShopSongOrder record);
@Select("<script>SELECT\n" + @Select("<script>SELECT\n" +
" b.img, b.name, b.origin_singer originSinger, b.price, a.from_name fromName, a.to_name toName, a.note\n" + " a.id orderId, b.img, b.name, b.origin_singer originSinger, b.price, a.from_name fromName, a.to_name toName, a.note,a.create_time,a.state\n" +
" FROM\n" +
" tb_shop_song_order AS a\n" +
" LEFT JOIN tb_shop_song AS b ON a.song_id = b.id\n" +
" WHERE\n" +
" a.open_id = #{openId} and a.shop_id=#{shopId} " +
" <if test=\"state!=null\">AND a.state = #{state}</if> order by a.state asc, a.create_time desc</script>")
List<Map<String, Object>> selectByUserId(@Param("openId") String openId, @Param("state") Integer state, Integer shopId);
@Select(" SELECT\n" +
" *\n" +
" FROM\n" + " FROM\n" +
" tb_shop_song_order AS a\n" + " tb_shop_song_order AS a\n" +
" LEFT JOIN tb_shop_song AS b ON a.song_id = b.id\n" + " LEFT JOIN tb_shop_song AS b ON a.song_id = b.id\n" +
" WHERE\n" + " WHERE\n" +
" a.open_id = #{openId}\n" + " a.open_id = #{openId}\n" +
" <if test=\"state!=null\">AND a.state = #{state}</if></script>") " AND a.id=#{id}")
List<Map<String, Object>> selectByUserId(@Param("openId") String openId, @Param("state") Integer state);
Map<String, Object> selectByUserIdAndId(@Param("openId") String openId, @Param("id") Integer id); Map<String, Object> selectByUserIdAndId(@Param("openId") String openId, @Param("id") Integer id);
@Select("select * from fycashier.tb_shop_song_order where order_no=#{orderNo};") @Select("select * from fycashier.tb_shop_song_order where order_no=#{orderNo};")
@ -47,4 +55,18 @@ public interface TbShopSongOrderMapper {
"WHERE create_time < NOW() - INTERVAL 10 MINUTE AND state=-1;\n") "WHERE create_time < NOW() - INTERVAL 10 MINUTE AND state=-1;\n")
int deleteExpireOrder(); int deleteExpireOrder();
@Select("SELECT\n" +
" a.id orderId,b.img, b.name, b.origin_singer originSinger, b.price, a.from_name fromName, a.to_name toName, a.note, a.create_time,a.state\n" +
" FROM\n" +
" tb_shop_song_order AS a\n" +
" LEFT JOIN tb_shop_song AS b ON a.song_id = b.id\n" +
" WHERE\n" +
" a.open_id = #{openId} and a.state in (1, 2, 3) and a.shop_id=#{shopId} order by a.state asc, a.create_time desc")
List<Map<String, Object>> selectActiveOrderByUserId(@Param("openId") String openId, Integer shopId);
@Select("SELECT a.song_name songName, a.id, b.img FROM `tb_shop_song_order` as a left join tb_shop_song as b on a.song_id=b.id where state=2 limit 1")
Map<String, Object> selectSinging();
@Select("select id from tb_shop_song_order where (state=1 or state=2) and shop_id=#{id} order by create_time asc")
List<TbShopSongOrder> selectWaitAll(@Param("id") Integer shopId);
} }

View File

@ -30,6 +30,7 @@ public interface TbShopUserMapper {
TbShopUser selectByUserIdAndShopId(@Param("userId") String userId,@Param("shopId") String shopId); TbShopUser selectByUserIdAndShopId(@Param("userId") String userId,@Param("shopId") String shopId);
TbShopUser selectByPhoneAndShopId(@Param("phone") String phone,@Param("shopId") String shopId); TbShopUser selectByPhoneAndShopId(@Param("phone") String phone,@Param("shopId") String shopId);
TbShopUser selectPCByPhoneAndShopId(@Param("phone") String phone,@Param("shopId") String shopId);
List<TbShopUser> selectAllByUserId(@Param("userId") String userId); List<TbShopUser> selectAllByUserId(@Param("userId") String userId);

View File

@ -135,6 +135,7 @@ public class TbProduct implements Serializable {
private String groupCategoryId; private String groupCategoryId;
private Integer stockNumber; private Integer stockNumber;
private Integer suit;
public String getImages() { public String getImages() {
@ -663,4 +664,12 @@ public class TbProduct implements Serializable {
public Integer getStockNumber() { public Integer getStockNumber() {
return this.stockNumber; return this.stockNumber;
} }
public Integer getSuit() {
return suit;
}
public void setSuit(Integer suit) {
this.suit = suit;
}
} }

View File

@ -24,6 +24,8 @@ public class TbProductSku implements Serializable {
private BigDecimal guidePrice; private BigDecimal guidePrice;
private Integer suit;
private BigDecimal strategyPrice; private BigDecimal strategyPrice;
private Double stockNumber; private Double stockNumber;
@ -47,9 +49,28 @@ public class TbProductSku implements Serializable {
private Long updatedAt; private Long updatedAt;
private Integer isPauseSale = 0; private Integer isPauseSale = 0;
private Integer isDel;
private Integer isGrounding;
private String specSnap;
public String getSpecSnap() {
return specSnap;
}
public void setSpecSnap(String specSnap) {
this.specSnap = specSnap;
}
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public Integer getIsGrounding() {
return isGrounding;
}
public void setIsGrounding(Integer isGrounding) {
this.isGrounding = isGrounding;
}
public Integer getId() { public Integer getId() {
return id; return id;
} }
@ -186,6 +207,14 @@ public class TbProductSku implements Serializable {
this.realSalesNumber = realSalesNumber; this.realSalesNumber = realSalesNumber;
} }
public Integer getSuit() {
return suit;
}
public void setSuit(Integer suit) {
this.suit = suit;
}
public BigDecimal getFirstShared() { public BigDecimal getFirstShared() {
return firstShared; return firstShared;
} }
@ -225,4 +254,12 @@ public class TbProductSku implements Serializable {
public void setIsPauseSale(Integer isPauseSale) { public void setIsPauseSale(Integer isPauseSale) {
this.isPauseSale = isPauseSale; this.isPauseSale = isPauseSale;
} }
public Integer getIsDel() {
return isDel;
}
public void setIsDel(Integer isDel) {
this.isDel = isDel;
}
} }

View File

@ -6,13 +6,13 @@ import java.util.Date;
import lombok.Data; import lombok.Data;
/** /**
* *
* @TableName tb_shop_song_order * @TableName tb_shop_song_order
*/ */
@Data @Data
public class TbShopSongOrder implements Serializable { public class TbShopSongOrder implements Serializable {
/** /**
* *
*/ */
private Integer id; private Integer id;
@ -27,7 +27,7 @@ public class TbShopSongOrder implements Serializable {
private String songName; private String songName;
/** /**
* 用户id * 用户openId
*/ */
private String openId; private String openId;
@ -81,6 +81,11 @@ public class TbShopSongOrder implements Serializable {
*/ */
private BigDecimal realMoney; private BigDecimal realMoney;
/**
* 平台订单号
*/
private String payOrderId;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Override @Override
@ -108,7 +113,8 @@ public class TbShopSongOrder implements Serializable {
&& (this.getToName() == null ? other.getToName() == null : this.getToName().equals(other.getToName())) && (this.getToName() == null ? other.getToName() == null : this.getToName().equals(other.getToName()))
&& (this.getNote() == null ? other.getNote() == null : this.getNote().equals(other.getNote())) && (this.getNote() == null ? other.getNote() == null : this.getNote().equals(other.getNote()))
&& (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId())) && (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId()))
&& (this.getRealMoney() == null ? other.getRealMoney() == null : this.getRealMoney().equals(other.getRealMoney())); && (this.getRealMoney() == null ? other.getRealMoney() == null : this.getRealMoney().equals(other.getRealMoney()))
&& (this.getPayOrderId() == null ? other.getPayOrderId() == null : this.getPayOrderId().equals(other.getPayOrderId()));
} }
@Override @Override
@ -129,6 +135,7 @@ public class TbShopSongOrder implements Serializable {
result = prime * result + ((getNote() == null) ? 0 : getNote().hashCode()); result = prime * result + ((getNote() == null) ? 0 : getNote().hashCode());
result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode()); result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode());
result = prime * result + ((getRealMoney() == null) ? 0 : getRealMoney().hashCode()); result = prime * result + ((getRealMoney() == null) ? 0 : getRealMoney().hashCode());
result = prime * result + ((getPayOrderId() == null) ? 0 : getPayOrderId().hashCode());
return result; return result;
} }
@ -152,8 +159,9 @@ public class TbShopSongOrder implements Serializable {
sb.append(", note=").append(note); sb.append(", note=").append(note);
sb.append(", shopId=").append(shopId); sb.append(", shopId=").append(shopId);
sb.append(", realMoney=").append(realMoney); sb.append(", realMoney=").append(realMoney);
sb.append(", payOrderId=").append(payOrderId);
sb.append(", serialVersionUID=").append(serialVersionUID); sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
} }
} }

View File

@ -160,54 +160,6 @@ public class PushToClientChannelHandlerAdapter extends NettyChannelHandlerAdapte
}); });
} }
/**
* @param message 发送的消息内容
* @param shopId 店铺Id
// * @param clientId 客户端Id
// * @param userFlag 为true 单发给clientId
* 为false 群发 shopId为空 发给所有人
*/
// @Async
// public void AppSendInfo(String message, String shopId,String clientId, boolean userFlag) {
// log.info("netty连接client 发送消息 shopId:{} clientId:{} userFlag:{} message:{}",shopId,clientId,userFlag, JSONUtil.toJSONString(message));
// if (userFlag) {
// if (webSocketMap.containsKey(shopId)) {
// ConcurrentHashMap<String, ChannelHandlerContext> webSockets = webSocketMap.get(shopId);
// if(!webSockets.isEmpty()){
// if (StringUtils.isNotBlank(clientId)) {
// ChannelHandlerContext ctx = webSockets.get(clientId);
// if (ctx != null) {
// sendMesToApp(message,ctx);
// }
// }
// }
// }
// } else {
// if (StringUtils.isEmpty(shopId)) {
// // 向所有用户发送信息
// for (ConcurrentHashMap<String, ChannelHandlerContext> value : webSocketMap.values()) {
// for (ChannelHandlerContext ctx : value.values()) {
// sendMesToApp(message,ctx);
// }
// }
// } else if (webSocketMap.containsKey(shopId)) {
// ConcurrentHashMap<String, ChannelHandlerContext> webSockets = webSocketMap.get(shopId);
// if((!webSockets.isEmpty() && !webSockets.keySet().isEmpty())) {
// for (String user : webSockets.keySet()) {
// ChannelHandlerContext ctx = webSockets.get(user);
// if (ctx != null) {
// log.info("netty连接client 发送消息 桌码群发 clientId:{}",user);
// sendMesToApp(message,ctx);
// }else {
// log.info("netty连接client 发送消息 桌码群发 clientId:{} 失败",user);
// }
// }
// }else {
// log.info("netty连接client 发送消息 桌码群发 clientId:{} 失败",clientId);
// }
// }
// }
// }
public void AppSendInfoV1(String shopId, String orderNo, JSONObject message) { public void AppSendInfoV1(String shopId, String orderNo, JSONObject message) {
log.info("netty连接client 发送消息 shopId:{} clientId:{} userFlag:{} message:{}", shopId, message.get("orderInfo")); log.info("netty连接client 发送消息 shopId:{} clientId:{} userFlag:{} message:{}", shopId, message.get("orderInfo"));
retryQueue.computeIfAbsent(shopId, k -> new ConcurrentLinkedQueue<>()).offer(message); retryQueue.computeIfAbsent(shopId, k -> new ConcurrentLinkedQueue<>()).offer(message);

View File

@ -59,4 +59,7 @@ public interface RabbitConstants {
public static final String CONS_MSG_COLLECT_ROUTINGKEY_PUT = "cons_msg_collect_routingkey_put"; public static final String CONS_MSG_COLLECT_ROUTINGKEY_PUT = "cons_msg_collect_routingkey_put";
// 库存记录交换机
String EXCHANGE_STOCK_RECORD = "exchange.stock.record";
String ROUTING_STOCK_RECORD_SALE = "routing.stock.record.sale";
} }

View File

@ -24,4 +24,6 @@ public class RedisCst {
public static final String OUT_NUMBER="ORDER:NUMBER:"; public static final String OUT_NUMBER="ORDER:NUMBER:";
// 创建订单锁 // 创建订单锁
public static final String CREATE_ORDER_LOCK = "CREATE_ORDER_LOCK:"; public static final String CREATE_ORDER_LOCK = "CREATE_ORDER_LOCK:";
public static final String SEND_STOCK_WARN_MSG = "SEND_STOCK_WARN_MSG:";
public static final String SONG_PAY_LOCK = "song_pay_lock:";
} }

View File

@ -288,7 +288,6 @@ public class CartService {
// log.error("长链接错误 createCart{}", e.getMessage()); // log.error("长链接错误 createCart{}", e.getMessage());
// } // }
// } // }
public void createCart(JSONObject jsonObject) { public void createCart(JSONObject jsonObject) {
try { try {
String tableId = jsonObject.getString("tableId"); String tableId = jsonObject.getString("tableId");
@ -311,10 +310,24 @@ public class CartService {
Integer buyNum = jsonObject.getInteger("num"); Integer buyNum = jsonObject.getInteger("num");
String skuId = jsonObject.getString("skuId"); String skuId = jsonObject.getString("skuId");
// 判断商品是否已下架
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = productSkuMapper.selectByPrimaryKey(Integer.valueOf(skuId));
if (tbProductSkuWithBLOBs ==null || tbProductSkuWithBLOBs.getIsGrounding().equals(0)) {
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("status", "fail");
jsonObject1.put("msg", "此商品已下架");
jsonObject1.put("data", new ArrayList<>());
jsonObject1.put("reqData", jsonObject);
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, jsonObject.getString("userId"), true);
log.error("商品已下架 skuId:{}", skuId);
return;
}
if (tbProduct.getIsStock() == 1) { if (tbProduct.getIsStock() == 1) {
// 1:共享库存 0:独立库存 // 1:共享库存 0:独立库存
if (Integer.valueOf(tbProduct.getIsDistribute()).equals(1)) { if (Integer.valueOf(tbProduct.getIsDistribute()).equals(1)) {
if (tbProduct.getIsPauseSale() == 1 || tbProduct.getStockNumber() - buyNum < 0) {//是否售罄 if (tbProduct.getIsPauseSale() == 1 || tbProduct.getStockNumber() < buyNum ) {//是否售罄
JSONObject jsonObject1 = new JSONObject(); JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("status", "fail"); jsonObject1.put("status", "fail");
jsonObject1.put("msg", "该商品已售罄"); jsonObject1.put("msg", "该商品已售罄");
@ -326,8 +339,7 @@ public class CartService {
throw new MsgException("该商品已售罄"); throw new MsgException("该商品已售罄");
} }
} else { } else {
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = productSkuMapper.selectByPrimaryKey(Integer.valueOf(skuId)); if (tbProductSkuWithBLOBs.getIsPauseSale() == 1 || tbProductSkuWithBLOBs.getStockNumber() < buyNum ) {//是否售罄
if(tbProductSkuWithBLOBs.getIsPauseSale() == 1 || tbProductSkuWithBLOBs.getStockNumber() - buyNum < 0){//是否售罄
JSONObject jsonObject1 = new JSONObject(); JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("status", "fail"); jsonObject1.put("status", "fail");
jsonObject1.put("msg", "该商品已售罄"); jsonObject1.put("msg", "该商品已售罄");
@ -360,6 +372,10 @@ public class CartService {
if (cashierCart.getSkuId().equals(skuId)) { if (cashierCart.getSkuId().equals(skuId)) {
cashierCart.setTotalNumber(cashierCart.getTotalNumber() + buyNum); cashierCart.setTotalNumber(cashierCart.getTotalNumber() + buyNum);
cashierCart.setNumber(cashierCart.getNumber() + buyNum); cashierCart.setNumber(cashierCart.getNumber() + buyNum);
if (buyNum < 0 && tbProductSkuWithBLOBs.getSuit() != null && tbProductSkuWithBLOBs.getSuit() > 1 && cashierCart.getNumber() < tbProductSkuWithBLOBs.getSuit()) {
cashierCartMapper.deleteByPrimaryKey(cashierCart.getId());
continue;
}
if (cashierCart.getNumber() > 0) { if (cashierCart.getNumber() > 0) {
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee()))); cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
cashierCart.setUpdatedAt(Instant.now().toEpochMilli()); cashierCart.setUpdatedAt(Instant.now().toEpochMilli());
@ -460,9 +476,16 @@ public class CartService {
) { ) {
List<TbShopOpenId> shopOpenIds = shopOpenIdMapper.selectByShopId(Integer.valueOf(product.getShopId())); List<TbShopOpenId> shopOpenIds = shopOpenIdMapper.selectByShopId(Integer.valueOf(product.getShopId()));
shopOpenIds.forEach(item -> { shopOpenIds.forEach(item -> {
wechatUtil.sendStockWarnMsg(shopInfo.getShopName(), product.getName(), String message = redisUtil.getMessage(RedisCst.SEND_STOCK_WARN_MSG + product.getId() + ":" + item.getOpenId());
product.getIsDistribute() == 1 ? String.valueOf(product.getStockNumber() - num) : String.valueOf(productSku.getStockNumber() - num), if (message == null) {
"耗材库存不足,请及时补充。", item.getOpenId()); wechatUtil.sendStockWarnMsg(shopInfo.getShopName(), product.getName(),
product.getIsDistribute() == 1 ? String.valueOf(product.getStockNumber() - num) : String.valueOf(productSku.getStockNumber() - num),
"商品库存不足,请及时补充。", item.getOpenId());
redisUtil.saveMessage(RedisCst.SEND_STOCK_WARN_MSG + product.getId() + ":" + item.getOpenId(), product.getId().toString(), 60 * 30L);
}else {
log.info("{}已在30分钟内推送过消息跳过发送", item.getOpenId());
}
}); });
} }
} }
@ -491,9 +514,33 @@ public class CartService {
throw new MsgException("该商品规格不存在"); throw new MsgException("该商品规格不存在");
} }
TbCashierCart cashierCart = new TbCashierCart(); TbCashierCart cashierCart = new TbCashierCart();
if (productSku.getSuit() != null && productSku.getSuit() > 1) {
if (product.getIsStock() == 1) {
boolean isSale = false;
// 1:共享库存 0:独立库存
if (Integer.valueOf(product.getIsDistribute()).equals(1)) {
if (productSku.getSuit() > product.getStockNumber()) isSale = true;
} else {
if (productSku.getSuit() > productSku.getStockNumber()) isSale = true;
}
if (isSale) {
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("status", "fail");
jsonObject1.put("msg", "该商品库存不足");
jsonObject1.put("data", new ArrayList<>());
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, userId.toString(), true);
log.error("购物车添加商品异常,该商品起售库存不足:{}", productId);
throw new MsgException("该商品起售库存不足");
}
}
cashierCart.setNumber(productSku.getSuit());
cashierCart.setTotalNumber(productSku.getSuit());
} else {
cashierCart.setNumber(num);
cashierCart.setTotalNumber(num);
}
cashierCart.setProductId(productId); cashierCart.setProductId(productId);
cashierCart.setSkuId(skuId); cashierCart.setSkuId(skuId);
cashierCart.setNumber(num);
cashierCart.setCoverImg(product.getCoverImg()); cashierCart.setCoverImg(product.getCoverImg());
cashierCart.setName(product.getName()); cashierCart.setName(product.getName());
cashierCart.setCategoryId(product.getCategoryId()); cashierCart.setCategoryId(product.getCategoryId());
@ -508,7 +555,6 @@ public class CartService {
cashierCart.setSalePrice(productSku.getSalePrice()); cashierCart.setSalePrice(productSku.getSalePrice());
cashierCart.setCreatedAt(Instant.now().toEpochMilli()); cashierCart.setCreatedAt(Instant.now().toEpochMilli());
cashierCart.setUpdatedAt(Instant.now().toEpochMilli()); cashierCart.setUpdatedAt(Instant.now().toEpochMilli());
cashierCart.setTotalNumber(num);
cashierCart.setPackFee(BigDecimal.ZERO); cashierCart.setPackFee(BigDecimal.ZERO);
cashierCart.setRefundNumber(0); cashierCart.setRefundNumber(0);
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(productSku.getSalePrice().add(cashierCart.getPackFee()))); cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(productSku.getSalePrice().add(cashierCart.getPackFee())));
@ -534,6 +580,7 @@ public class CartService {
try { try {
String shopId = jsonObject.getString("shopId"); String shopId = jsonObject.getString("shopId");
String tableId = jsonObject.getString("tableId"); String tableId = jsonObject.getString("tableId");
String remark = StringUtils.isBlank(jsonObject.getString("remark"))?"":jsonObject.getString("remark");
String key = tableId + "-" + shopId; String key = tableId + "-" + 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<>();
@ -561,6 +608,16 @@ public class CartService {
TbProductSkuWithBLOBs tbProduct = productSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId())); TbProductSkuWithBLOBs tbProduct = productSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
TbProduct tbProduct1 = tbProductMapper.selectById(Integer.valueOf(tbProduct.getProductId())); TbProduct tbProduct1 = tbProductMapper.selectById(Integer.valueOf(tbProduct.getProductId()));
// 判断商品是否已下架
if (tbProduct.getIsGrounding().equals(0)) {
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("status", "fail");
jsonObject1.put("msg", "商品已下架:" + tbProduct1.getName());
jsonObject1.put("data", new ArrayList<>());
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, jsonObject.getString("userId"), true);
return;
}
log.info("下单,开始校验库存预警,购物车id:{}", cashierCart.getId()); log.info("下单,开始校验库存预警,购物车id:{}", cashierCart.getId());
CompletableFuture.runAsync(() -> checkWarnLineAndSendMsg(tbProduct, tbProduct1, cashierCart.getNumber())); CompletableFuture.runAsync(() -> checkWarnLineAndSendMsg(tbProduct, tbProduct1, cashierCart.getNumber()));
@ -570,10 +627,10 @@ public class CartService {
try { try {
if (tbProduct1.getIsStock() == 1) { if (tbProduct1.getIsStock() == 1) {
productService.updateStock(tbProduct.getProductId(), tbProduct.getId(), cashierCart.getNumber(), tbProduct1.getIsDistribute() == 1); productService.updateStock(tbProduct.getProductId(), tbProduct.getId(), cashierCart.getNumber(), tbProduct1.getIsDistribute() == 1);
}else { } else {
productService.updateStockAndNoCheck(tbProduct.getProductId(), tbProduct.getId(), cashierCart.getNumber(), tbProduct1.getIsDistribute() == 1); productService.updateStockAndNoCheck(tbProduct.getProductId(), tbProduct.getId(), cashierCart.getNumber(), tbProduct1.getIsDistribute() == 1);
} }
}catch (Exception e) { } catch (Exception e) {
JSONObject jsonObject1 = new JSONObject(); JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("status", "fail"); jsonObject1.put("status", "fail");
jsonObject1.put("msg", "商品库存不足" + tbProduct1.getName()); jsonObject1.put("msg", "商品库存不足" + tbProduct1.getName());
@ -583,9 +640,9 @@ public class CartService {
} }
// 发送判断耗材是否耗尽消息 // 发送判断耗材是否耗尽消息
JSONObject objectMsg=new JSONObject(); JSONObject objectMsg = new JSONObject();
objectMsg.put("skuId",Integer.valueOf(cashierCart.getSkuId())); objectMsg.put("skuId", Integer.valueOf(cashierCart.getSkuId()));
objectMsg.put("shopId",Integer.valueOf(cashierCart.getShopId())); objectMsg.put("shopId", Integer.valueOf(cashierCart.getShopId()));
producer.con_msg(objectMsg.toString()); producer.con_msg(objectMsg.toString());
totalAmount = totalAmount.add(cashierCart.getTotalAmount()); totalAmount = totalAmount.add(cashierCart.getTotalAmount());
@ -728,7 +785,7 @@ public class CartService {
orderInfo.setProductAmount(saleAmount); orderInfo.setProductAmount(saleAmount);
orderInfo.setIsBuyCoupon(isBuyYhq); orderInfo.setIsBuyCoupon(isBuyYhq);
orderInfo.setIsUseCoupon(isuseYhq); orderInfo.setIsUseCoupon(isuseYhq);
// orderInfo.setRemark(StringUtils.isBlank(jsonObject.getString("remark"))?"":jsonObject.getString("remark")); orderInfo.setRemark(remark);
orderInfoMapper.updateByPrimaryKeySelective(orderInfo); orderInfoMapper.updateByPrimaryKeySelective(orderInfo);
} else { } else {
@ -739,6 +796,7 @@ public class CartService {
orderInfo.setIsBuyCoupon(isBuyYhq); orderInfo.setIsBuyCoupon(isBuyYhq);
orderInfo.setIsUseCoupon(isuseYhq); orderInfo.setIsUseCoupon(isuseYhq);
orderInfo.setUserCouponAmount(couponAmount); orderInfo.setUserCouponAmount(couponAmount);
orderInfo.setRemark(remark);
JSONObject object = new JSONObject(); JSONObject object = new JSONObject();
String outNumber = redisUtil.getMessage(RedisCst.OUT_NUMBER.concat(jsonObject.getString("shopId"))); String outNumber = redisUtil.getMessage(RedisCst.OUT_NUMBER.concat(jsonObject.getString("shopId")));
@ -777,7 +835,16 @@ public class CartService {
object.put("updatedAt", System.currentTimeMillis()); object.put("updatedAt", System.currentTimeMillis());
object.put("orderId", orderId + ""); object.put("orderId", orderId + "");
} }
// 发送mq消息
JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("orderId", orderInfo.getId());
jsonObject2.put("type", "create");
log.info("开始发送mq消息消耗耗材消息内容{}", jsonObject2);
producer.cons(jsonObject2.toString());
redisUtil.saveMessage(RedisCst.TABLE_CART.concat(jsonObject.getString("tableId")).concat("-").concat(shopId), array.toJSONString()); redisUtil.saveMessage(RedisCst.TABLE_CART.concat(jsonObject.getString("tableId")).concat("-").concat(shopId), array.toJSONString());
orderInfo.setDetailList(orderDetails); orderInfo.setDetailList(orderDetails);
JSONObject jsonObject1 = new JSONObject(); JSONObject jsonObject1 = new JSONObject();
@ -799,13 +866,6 @@ public class CartService {
redisUtil.saveMessage(RedisCst.ORDER_EXPIRED.concat(orderId.toString()), orderId.toString(), 60 * 16L); redisUtil.saveMessage(RedisCst.ORDER_EXPIRED.concat(orderId.toString()), orderId.toString(), 60 * 16L);
// 发送mq消息
JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("orderId", orderId);
jsonObject2.put("type", "create");
log.info("开始发送mq消息消耗耗材消息内容{}", jsonObject2);
producer.cons(jsonObject2.toString());
} catch (Exception e) { } catch (Exception e) {
log.info("长链接错误 addCart{}", e.getMessage()); log.info("长链接错误 addCart{}", e.getMessage());
e.printStackTrace(); e.printStackTrace();

View File

@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.dao.*; import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*; import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.redis.RedisCst; import com.chaozhanggui.system.cashierservice.redis.RedisCst;
@ -76,7 +77,7 @@ public class LoginService {
} }
// 为商家绑定openid // 为商家绑定openid
if (shopOpenIdMapper.countByOpenId(openId) == null) { if (shopOpenIdMapper.countByOpenId(openId, Integer.valueOf(shopId)) == null) {
TbShopOpenId shopOpenId = new TbShopOpenId(); TbShopOpenId shopOpenId = new TbShopOpenId();
shopOpenId.setOpenId(openId); shopOpenId.setOpenId(openId);
shopOpenId.setCreateTime(DateUtil.date()); shopOpenId.setCreateTime(DateUtil.date());
@ -88,124 +89,168 @@ public class LoginService {
} }
public Result wxCustomLogin(String openId,String headImage,String nickName,String telephone,String ip) {
@Transactional(rollbackFor = Exception.class) TbUserInfo userInfo= tbUserInfoMapper.selectByOpenId(openId);
public Result wxCustomLogin(String openId, String headImage, String nickName, String telephone, String ip) throws Exception { if(ObjectUtil.isNull(userInfo)){
TbUserInfo userInfo = new TbUserInfo(); userInfo=new TbUserInfo();
if(StringUtils.isNotBlank(telephone)){ userInfo.setAmount(BigDecimal.ZERO);
userInfo = tbUserInfoMapper.selectByPhone(telephone); userInfo.setChargeAmount(BigDecimal.ZERO);
if (ObjectUtil.isNull(userInfo)) { userInfo.setLineOfCredit(BigDecimal.ZERO);
userInfo = tbUserInfoMapper.selectByOpenId(openId); userInfo.setConsumeNumber(0);
if (ObjectUtil.isNull(userInfo)) { userInfo.setConsumeAmount(BigDecimal.ZERO);
userInfo = new TbUserInfo(); userInfo.setTotalScore(0);
userInfo.setAmount(BigDecimal.ZERO); userInfo.setLockScore(0);
userInfo.setChargeAmount(BigDecimal.ZERO); userInfo.setHeadImg(ObjectUtil.isNotNull(headImage)?headImage:"");
userInfo.setLineOfCredit(BigDecimal.ZERO); userInfo.setNickName(ObjectUtil.isNotNull(nickName)?nickName:"微信用户");
userInfo.setConsumeNumber(0); userInfo.setTelephone(ObjectUtil.isNotNull(telephone)?telephone:"");
userInfo.setConsumeAmount(BigDecimal.ZERO); userInfo.setMiniAppOpenId(openId);
userInfo.setTotalScore(0); userInfo.setStatus(Byte.parseByte("1"));
userInfo.setLockScore(0); userInfo.setParentType("PERSON");
userInfo.setHeadImg("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240411/a2be5869bfa24d72a4782f695cc53ed1.png"); userInfo.setIsResource(Byte.parseByte("0"));
userInfo.setNickName(ObjectUtil.isNotNull(nickName) ? nickName : "微信用户"); userInfo.setIsOnline(Byte.parseByte("0"));
userInfo.setTelephone(telephone); userInfo.setIsVip(Byte.parseByte("0"));
userInfo.setMiniAppOpenId(openId); userInfo.setSourcePath("WECHAT-APP");
userInfo.setStatus(Byte.parseByte("1")); userInfo.setIsAttentionMp(Byte.parseByte("0"));
userInfo.setParentType("PERSON"); userInfo.setSearchWord("||微信用户");
userInfo.setIsResource(Byte.parseByte("0")); userInfo.setIsPwd("0");
userInfo.setIsOnline(Byte.parseByte("0")); userInfo.setPwd(MD5Utils.md5("123456"));
userInfo.setIsVip(Byte.parseByte("0")); userInfo.setCreatedAt(System.currentTimeMillis());
userInfo.setSourcePath("WECHAT-APP"); userInfo.setLastLogInAt(System.currentTimeMillis());
userInfo.setIsAttentionMp(Byte.parseByte("0")); userInfo.setUpdatedAt(System.currentTimeMillis());
userInfo.setSearchWord("||微信用户"); tbUserInfoMapper.insert(userInfo);
userInfo.setIsPwd("0");
userInfo.setPwd(MD5Utils.md5("123456"));
userInfo.setLastLogInAt(System.currentTimeMillis());
userInfo.setCreatedAt(System.currentTimeMillis());
userInfo.setUpdatedAt(System.currentTimeMillis());
tbUserInfoMapper.insert(userInfo);
List<TbShopUser> tbShopUsers = tbShopUserMapper.selectByPhone(telephone);
if (!CollectionUtils.isEmpty(tbShopUsers)) {
for (TbShopUser tbShopUser : tbShopUsers) {
tbShopUser.setUserId(userInfo.getId() + "");
tbShopUser.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.updateByPrimaryKey(tbShopUser);
}
}
}else {
userInfo.setTelephone(telephone);
userInfo.setUpdatedAt(System.currentTimeMillis());
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
List<TbShopUser> tbShopUsers = tbShopUserMapper.selectByPhone(telephone);
if (!CollectionUtils.isEmpty(tbShopUsers)) {
for (TbShopUser tbShopUser : tbShopUsers) {
tbShopUser.setUserId(null);
tbShopUser.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.updateByPrimaryKey(tbShopUser);
}
}
}
}else {
if(!userInfo.getMiniAppOpenId().equals(openId)){
userInfo.setMiniAppOpenId(openId);
userInfo.setUpdatedAt(System.currentTimeMillis());
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
}
}
}else { }else {
userInfo = tbUserInfoMapper.selectByOpenId(openId); userInfo.setUpdatedAt(System.currentTimeMillis());
if(ObjectUtil.isNull(userInfo)){ userInfo.setLastLogInAt(System.currentTimeMillis());
userInfo = new TbUserInfo(); tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
userInfo.setAmount(BigDecimal.ZERO);
userInfo.setChargeAmount(BigDecimal.ZERO);
userInfo.setLineOfCredit(BigDecimal.ZERO);
userInfo.setConsumeNumber(0);
userInfo.setConsumeAmount(BigDecimal.ZERO);
userInfo.setTotalScore(0);
userInfo.setLockScore(0);
userInfo.setHeadImg("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240411/a2be5869bfa24d72a4782f695cc53ed1.png");
userInfo.setNickName(ObjectUtil.isNotNull(nickName) ? nickName : "微信用户");
userInfo.setTelephone(telephone);
userInfo.setMiniAppOpenId(openId);
userInfo.setStatus(Byte.parseByte("1"));
userInfo.setParentType("PERSON");
userInfo.setIsResource(Byte.parseByte("0"));
userInfo.setIsOnline(Byte.parseByte("0"));
userInfo.setIsVip(Byte.parseByte("0"));
userInfo.setSourcePath("WECHAT-APP");
userInfo.setIsAttentionMp(Byte.parseByte("0"));
userInfo.setSearchWord("||微信用户");
userInfo.setIsPwd("0");
userInfo.setPwd(MD5Utils.md5("123456"));
userInfo.setLastLogInAt(System.currentTimeMillis());
userInfo.setCreatedAt(System.currentTimeMillis());
userInfo.setUpdatedAt(System.currentTimeMillis());
tbUserInfoMapper.insert(userInfo);
}
} }
//生成token 信息 //生成token 信息
String token = TokenUtil.generateToken(userInfo.getId(), userInfo.getMiniAppOpenId(), userInfo.getTelephone(), userInfo.getNickName()); String token = TokenUtil.generateToken(userInfo.getId(), userInfo.getMiniAppOpenId(), userInfo.getTelephone(), userInfo.getNickName());
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
try { map.put("token", token);
map.put("token", token); map.put("userInfo", userInfo);
map.put("userInfo", userInfo); redisUtil.saveMessage(RedisCst.ONLINE_USER.concat(openId), JSON.toJSONString(map), 60 * 60 * 24 * 30L);
redisUtil.saveMessage(RedisCst.ONLINE_USER.concat(openId), JSON.toJSONString(map),60*60*24*30L); log.info("登录传参 结果:" + JSONUtil.toJSONString(map));
//redis里 获取要关注的公众号信息 return Result.success(CodeEnum.SUCCESS, map);
//userInfo 某字段存储关注公众号的标识
// userInfo.get
//公众号 appid
//展示描述
//图标
// map.put("", );
log.info("登录传参 结果:" + JSONUtil.toJSONString(map));
return Result.success(CodeEnum.SUCCESS, map);
} catch (Exception e) {
e.printStackTrace();
}
return Result.fail("登录失败");
} }
// @Transactional(rollbackFor = Exception.class)
// public Result wxCustomLogin(String openId, String headImage, String nickName, String telephone, String ip) throws Exception {
// TbUserInfo userInfo = new TbUserInfo();
// if(StringUtils.isNotBlank(telephone)){
// userInfo = tbUserInfoMapper.selectByPhone(telephone);
// if (ObjectUtil.isNull(userInfo)) {
// userInfo = tbUserInfoMapper.selectByOpenId(openId);
// if (ObjectUtil.isNull(userInfo)) {
// userInfo = new TbUserInfo();
// userInfo.setAmount(BigDecimal.ZERO);
// userInfo.setChargeAmount(BigDecimal.ZERO);
// userInfo.setLineOfCredit(BigDecimal.ZERO);
// userInfo.setConsumeNumber(0);
// userInfo.setConsumeAmount(BigDecimal.ZERO);
// userInfo.setTotalScore(0);
// userInfo.setLockScore(0);
// userInfo.setHeadImg("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240411/a2be5869bfa24d72a4782f695cc53ed1.png");
// userInfo.setNickName(ObjectUtil.isNotNull(nickName) ? nickName : "微信用户");
// userInfo.setTelephone(telephone);
// userInfo.setMiniAppOpenId(openId);
// userInfo.setStatus(Byte.parseByte("1"));
// userInfo.setParentType("PERSON");
// userInfo.setIsResource(Byte.parseByte("0"));
// userInfo.setIsOnline(Byte.parseByte("0"));
// userInfo.setIsVip(Byte.parseByte("0"));
// userInfo.setSourcePath("WECHAT-APP");
// userInfo.setIsAttentionMp(Byte.parseByte("0"));
// userInfo.setSearchWord("||微信用户");
// userInfo.setIsPwd("0");
// userInfo.setPwd(MD5Utils.md5("123456"));
// userInfo.setLastLogInAt(System.currentTimeMillis());
// userInfo.setCreatedAt(System.currentTimeMillis());
// userInfo.setUpdatedAt(System.currentTimeMillis());
// tbUserInfoMapper.insert(userInfo);
// List<TbShopUser> tbShopUsers = tbShopUserMapper.selectByPhone(telephone);
// if (!CollectionUtils.isEmpty(tbShopUsers)) {
// for (TbShopUser tbShopUser : tbShopUsers) {
// tbShopUser.setUserId(userInfo.getId() + "");
// tbShopUser.setUpdatedAt(System.currentTimeMillis());
// tbShopUserMapper.updateByPrimaryKey(tbShopUser);
// }
// }
// }else {
// userInfo.setTelephone(telephone);
// userInfo.setUpdatedAt(System.currentTimeMillis());
// tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
// List<TbShopUser> tbShopUsers = tbShopUserMapper.selectByPhone(telephone);
// if (!CollectionUtils.isEmpty(tbShopUsers)) {
// for (TbShopUser tbShopUser : tbShopUsers) {
// tbShopUser.setUserId(null);
// tbShopUser.setUpdatedAt(System.currentTimeMillis());
// tbShopUserMapper.updateByPrimaryKey(tbShopUser);
// }
// }
// }
// }else {
// if(!userInfo.getMiniAppOpenId().equals(openId)){
// userInfo.setMiniAppOpenId(openId);
// userInfo.setUpdatedAt(System.currentTimeMillis());
// tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
// }
// }
// }else {
// userInfo = tbUserInfoMapper.selectByOpenId(openId);
// if(ObjectUtil.isNull(userInfo)){
// userInfo = new TbUserInfo();
// userInfo.setAmount(BigDecimal.ZERO);
// userInfo.setChargeAmount(BigDecimal.ZERO);
// userInfo.setLineOfCredit(BigDecimal.ZERO);
// userInfo.setConsumeNumber(0);
// userInfo.setConsumeAmount(BigDecimal.ZERO);
// userInfo.setTotalScore(0);
// userInfo.setLockScore(0);
// userInfo.setHeadImg("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240411/a2be5869bfa24d72a4782f695cc53ed1.png");
// userInfo.setNickName(ObjectUtil.isNotNull(nickName) ? nickName : "微信用户");
// userInfo.setTelephone(telephone);
// userInfo.setMiniAppOpenId(openId);
// userInfo.setStatus(Byte.parseByte("1"));
// userInfo.setParentType("PERSON");
// userInfo.setIsResource(Byte.parseByte("0"));
// userInfo.setIsOnline(Byte.parseByte("0"));
// userInfo.setIsVip(Byte.parseByte("0"));
// userInfo.setSourcePath("WECHAT-APP");
// userInfo.setIsAttentionMp(Byte.parseByte("0"));
// userInfo.setSearchWord("||微信用户");
// userInfo.setIsPwd("0");
// userInfo.setPwd(MD5Utils.md5("123456"));
// userInfo.setLastLogInAt(System.currentTimeMillis());
// userInfo.setCreatedAt(System.currentTimeMillis());
// userInfo.setUpdatedAt(System.currentTimeMillis());
// tbUserInfoMapper.insert(userInfo);
// }
// }
// //生成token 信息
// String token = TokenUtil.generateToken(userInfo.getId(), userInfo.getMiniAppOpenId(), userInfo.getTelephone(), userInfo.getNickName());
//
// Map<String, Object> map = new HashMap<>();
// try {
// map.put("token", token);
// map.put("userInfo", userInfo);
// redisUtil.saveMessage(RedisCst.ONLINE_USER.concat(openId), JSON.toJSONString(map),60*60*24*30L);
// //redis里 获取要关注的公众号信息
// //userInfo 某字段存储关注公众号的标识
//// userInfo.get
// //公众号 appid
// //展示描述
// //图标
//// map.put("", );
// log.info("登录传参 结果:" + JSONUtil.toJSONString(map));
// return Result.success(CodeEnum.SUCCESS, map);
// } catch (Exception e) {
// e.printStackTrace();
//
// }
// return Result.fail("登录失败");
// }
/** /**
* APP注册 * APP注册
* *
@ -366,6 +411,63 @@ public class LoginService {
return Result.success(CodeEnum.ENCRYPT, tbUserInfo); return Result.success(CodeEnum.ENCRYPT, tbUserInfo);
} }
@Transactional
public Result upPhone(String openId, String phone, String shopId) {
TbUserInfo userInfo = tbUserInfoMapper.selectByOpenId(openId);
boolean isup = false;
if(StringUtils.isNotBlank(userInfo.getTelephone())){
List<TbShopUser> tbShopUsers = tbShopUserMapper.selectByPhone(userInfo.getTelephone());
for (TbShopUser tbShopUser : tbShopUsers) {
if (tbShopUser.getShopId().equals(shopId)) {
isup = true;
}
tbShopUser.setTelephone(phone);
tbShopUser.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.updateByPrimaryKey(tbShopUser);
}
if(!isup){
registerShopUser(userInfo,shopId);
}
}else {
TbShopUser shopUser = tbShopUserMapper.selectByUserIdAndShopId(userInfo.getId().toString(), shopId);
if (shopUser != null) {
shopUser.setTelephone(phone);
shopUser.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.updateByPrimaryKey(shopUser);
}else {
registerShopUser(userInfo,shopId);
}
}
userInfo.setTelephone(phone);
userInfo.setUpdatedAt(System.currentTimeMillis());
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
return Result.success(CodeEnum.SUCCESS);
}
public void registerShopUser(TbUserInfo userInfo,String shopId) {
TbShopUser shopUser = new TbShopUser();
shopUser.setName(userInfo.getNickName());
shopUser.setSex(userInfo.getSex());
shopUser.setBirthDay(userInfo.getBirthDay());
shopUser.setLevel(Byte.parseByte("1"));
String dynamicCode = RandomUtil.randomNumbers(8);
shopUser.setCode(dynamicCode);
shopUser.setTelephone(userInfo.getTelephone());
shopUser.setAmount(BigDecimal.ZERO);
shopUser.setIsVip(Byte.parseByte("0"));
shopUser.setCreditAmount(BigDecimal.ZERO);
shopUser.setConsumeAmount(BigDecimal.ZERO);
shopUser.setConsumeNumber(0);
shopUser.setLevelConsume(BigDecimal.ZERO);
shopUser.setStatus(Byte.parseByte("1"));
shopUser.setShopId(shopId);
shopUser.setUserId(userInfo.getId().toString());
shopUser.setMiniOpenId(userInfo.getMiniAppOpenId());
shopUser.setCreatedAt(System.currentTimeMillis());
shopUser.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.insert(shopUser);
}
public Result upPass(String userId, String oldPass, String newPass) { public Result upPass(String userId, String oldPass, String newPass) {
TbUserInfo tbUserInfo = tbUserInfoMapper.selectByPrimaryKey(Integer.valueOf(userId)); TbUserInfo tbUserInfo = tbUserInfoMapper.selectByPrimaryKey(Integer.valueOf(userId));
if (!tbUserInfo.getPassword().equals(oldPass)) { if (!tbUserInfo.getPassword().equals(oldPass)) {

View File

@ -248,18 +248,6 @@ public class OrderService {
} }
public void testMessage(String tableId, String message) throws IOException {
// AppWebSocketServer.AppSendInfo(message,tableId);
// redisUtil.seckill(tableId,message);
// AppWebSocketServer.onClosed(tableId);
List<TbProductSku> list = productSkuMapper.selectAll();
for (TbProductSku productSku : list) {
// productSku.setStockNumber(200.00);
redisUtil.saveMessage("PRODUCT:" + productSku.getShopId() + ":" + productSku.getId(), "10000");
}
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Result tradeIntegral(String userId, String id) throws ParseException { public Result tradeIntegral(String userId, String id) throws ParseException {
updateIntegral(userId, id); updateIntegral(userId, id);

View File

@ -147,6 +147,8 @@ public class PayService {
TbActivateMapper tbActivateMapper; TbActivateMapper tbActivateMapper;
private final TbShopSongOrderService shopSongOrderService; private final TbShopSongOrderService shopSongOrderService;
@Autowired
private MQUtils mQUtils;
public PayService(@Qualifier("tbShopSongOrderServiceImpl") TbShopSongOrderService shopSongOrderService) { public PayService(@Qualifier("tbShopSongOrderServiceImpl") TbShopSongOrderService shopSongOrderService) {
this.shopSongOrderService = shopSongOrderService; this.shopSongOrderService = shopSongOrderService;
@ -268,7 +270,9 @@ public class PayService {
} }
PublicResp<WxScanPayResp> publicResp = thirdPayService.scanpay(thirdUrl, thirdApply.getAppId(), PublicResp<WxScanPayResp> publicResp = thirdPayService.scanpay(thirdUrl, thirdApply.getAppId(),
reqbody, reqbody, payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue(), "WECHAT", thirdApply.getSmallAppid(), openId, ip, DateUtils.getsdfTimesSS(), thirdApply.getStoreId(), callFSTBack, null, thirdApply.getAppToken()); reqbody, reqbody,
payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue(),
"WECHAT", thirdApply.getSmallAppid(), openId, ip, DateUtils.getsdfTimesSS(), thirdApply.getStoreId(), callFSTBack, null, thirdApply.getAppToken());
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) { if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
if ("000000".equals(publicResp.getCode())) { if ("000000".equals(publicResp.getCode())) {
WxScanPayResp wxScanPayResp = publicResp.getObjData(); WxScanPayResp wxScanPayResp = publicResp.getObjData();
@ -878,6 +882,12 @@ public class PayService {
producer.printMechine(orderInfo.getId() + ""); producer.printMechine(orderInfo.getId() + "");
sendOrderToClient(orderInfo); sendOrderToClient(orderInfo);
redisUtil.deleteByKey(RedisCst.ORDER_EXPIRED.concat(orderInfo.getId().toString())); redisUtil.deleteByKey(RedisCst.ORDER_EXPIRED.concat(orderInfo.getId().toString()));
// 发送mq消息并保存库存记录
JSONObject data = new JSONObject();
data.put("orderId", orderInfo.getId());
data.put("plat", "miniApp");
mQUtils.sendStockSaleMsg(data);
return "SUCCESS"; return "SUCCESS";
} }
@ -923,6 +933,12 @@ public class PayService {
producer.printCoupons(coupons.toJSONString()); producer.printCoupons(coupons.toJSONString());
sendOrderToClient(orderInfo); sendOrderToClient(orderInfo);
redisUtil.deleteByKey(RedisCst.ORDER_EXPIRED.concat(orderInfo.getId().toString())); redisUtil.deleteByKey(RedisCst.ORDER_EXPIRED.concat(orderInfo.getId().toString()));
// 发送mq消息并保存库存记录
JSONObject data = new JSONObject();
data.put("orderId", orderInfo.getId());
data.put("plat", "miniApp");
mQUtils.sendStockSaleMsg(data);
return "SUCCESS"; return "SUCCESS";
} }
@ -1205,30 +1221,7 @@ public class PayService {
PushToClientChannelHandlerAdapter.getInstance().AppSendInfoV1(orderInfo.getShopId(), orderInfo.getOrderNo(), client); PushToClientChannelHandlerAdapter.getInstance().AppSendInfoV1(orderInfo.getShopId(), orderInfo.getOrderNo(), client);
} }
/**
* 点歌支付成功
*
* @param mchOrderNo 商户订单编号
* @param orderNo
* @return
*/
public String songPaySuccess(String mchOrderNo, String orderNo) {
TbMemberIn memberIn = tbMemberInMapper.selectByOrderNo(mchOrderNo);
if (ObjectUtil.isEmpty(memberIn)) {
return "充值记录不存在";
}
if (!"7".equals(memberIn.getStatus())) {
return "订单已处理";
}
memberIn.setTradeNo(orderNo);
memberIn.setStatus("0");
memberIn.setUpdateTime(new Date());
tbMemberInMapper.updateByPrimaryKeySelective(memberIn);
shopSongOrderService.successPay(orderNo);
return "success";
}
public Result paySongOrder(String openId, String shopId, Integer orderId, String ip, TbMerchantThirdApply thirdApply) throws JsonProcessingException { public Result paySongOrder(String openId, String shopId, Integer orderId, String ip, TbMerchantThirdApply thirdApply) throws JsonProcessingException {
if (ObjectUtil.isEmpty(openId) || Objects.isNull(openId)) { if (ObjectUtil.isEmpty(openId) || Objects.isNull(openId)) {
@ -1237,7 +1230,7 @@ public class PayService {
TbShopSongOrder songOrder = tbShopSongOrderMapper.selectByPrimaryKey(Long.valueOf(orderId)); TbShopSongOrder songOrder = tbShopSongOrderMapper.selectByPrimaryKey(Long.valueOf(orderId));
if (songOrder.getState() != 0 && songOrder.getState() != -1) { if (songOrder == null || songOrder.getState() != 0 && songOrder.getState() != -1) {
return Result.fail("订单状态异常,不允许支付"); return Result.fail("订单状态异常,不允许支付");
} }
@ -1287,14 +1280,14 @@ public class PayService {
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String songOrderSuccess(String mchOrderNo, String orderNo) { public String songOrderSuccess(String mchOrderNo, String tradeNo) {
TbShopSongOrder songOrder = tbShopSongOrderMapper.selectByOrderNo(mchOrderNo); TbShopSongOrder songOrder = tbShopSongOrderMapper.selectByOrderNo(mchOrderNo);
if (ObjectUtil.isEmpty(songOrder)) { if (ObjectUtil.isEmpty(songOrder)) {
return "订单信息不存在"; return "订单信息不存在";
} }
log.info("更新点歌订单:{}", songOrder); log.info("更新点歌订单:{}", songOrder);
shopSongOrderService.successPay(mchOrderNo); shopSongOrderService.successPay(mchOrderNo, tradeNo);
return "SUCCESS"; return "SUCCESS";
} }

View File

@ -2,8 +2,10 @@ package com.chaozhanggui.system.cashierservice.service;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.dao.*; import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*; import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto; import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
@ -76,8 +78,8 @@ public class ProductService {
try{ try{
if (ObjectUtil.isEmpty(shopUser)) { if (ObjectUtil.isEmpty(shopUser)) {
TbUserInfo tbUserInfo = tbUserInfoMapper.selectByPrimaryKey(Integer.valueOf(userId)); TbUserInfo tbUserInfo = tbUserInfoMapper.selectByPrimaryKey(Integer.valueOf(userId));
shopUser = tbShopUserMapper.selectByPhoneAndShopId(tbUserInfo.getTelephone(), shopId); // shopUser = tbShopUserMapper.selectByPhoneAndShopId(tbUserInfo.getTelephone(), shopId);
if(ObjectUtil.isEmpty(shopUser)){ // if(ObjectUtil.isEmpty(shopUser)){
shopUser=new TbShopUser(); shopUser=new TbShopUser();
shopUser.setName(tbUserInfo.getNickName()); shopUser.setName(tbUserInfo.getNickName());
shopUser.setSex(tbUserInfo.getSex()); shopUser.setSex(tbUserInfo.getSex());
@ -99,11 +101,11 @@ public class ProductService {
shopUser.setCreatedAt(System.currentTimeMillis()); shopUser.setCreatedAt(System.currentTimeMillis());
shopUser.setUpdatedAt(System.currentTimeMillis()); shopUser.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.insert(shopUser); tbShopUserMapper.insert(shopUser);
}else { // }else {
shopUser.setUserId(userId); // shopUser.setUserId(userId);
shopUser.setUpdatedAt(System.currentTimeMillis()); // shopUser.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.updateByPrimaryKey(shopUser); // tbShopUserMapper.updateByPrimaryKey(shopUser);
} // }
}else { }else {
shopUser.setUpdatedAt(System.currentTimeMillis()); shopUser.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.updateByPrimaryKey(shopUser); tbShopUserMapper.updateByPrimaryKey(shopUser);
@ -138,12 +140,53 @@ public class ProductService {
if (ObjectUtil.isNotEmpty(in) && ObjectUtil.isNotNull(in)) { if (ObjectUtil.isNotEmpty(in) && ObjectUtil.isNotNull(in)) {
List<TbProduct> products = tbProductMapper.selectByIdIn(in); // List<TbProduct> products = tbProductMapper.selectByIdIn(in);
List<TbProduct> products = tbProductMapper.selectByIdInAndCheck(in);
if (ObjectUtil.isNotEmpty(products) && products.size() > 0) { if (ObjectUtil.isNotEmpty(products) && products.size() > 0) {
products.parallelStream().forEach(it -> { products.parallelStream().forEach(it -> {
Integer sum = tbProductMapper.selectByQcode(code, it.getId(), it.getShopId()); Integer sum = tbProductMapper.selectByQcode(code, it.getId(), it.getShopId());
it.setCartNumber(sum == null ? "0" : String.valueOf(sum)); it.setCartNumber(sum == null ? "0" : String.valueOf(sum));
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectGroundingByProId(it.getId());
TbProductSkuResult skuResult = tbProductSkuResultMapper.selectByPrimaryKey(it.getId()); TbProductSkuResult skuResult = tbProductSkuResultMapper.selectByPrimaryKey(it.getId());
HashSet<String> specSet = new HashSet<>();
tbProductSkus.forEach(item -> {
String specSnap = item.getSpecSnap();
if (specSnap != null) {
specSet.addAll(Arrays.asList(specSnap.split(",")));
}
});
String tagSnap = skuResult != null ? skuResult.getTagSnap() : null;
if (tagSnap != null) {
JSONArray tagSnaps = JSONObject.parseArray(tagSnap);
JSONObject snapJSON;
JSONArray finalSnap = new JSONArray();
String finalValues = "";
for (Object snap : tagSnaps) {
snapJSON = (JSONObject) snap;
String values = snapJSON.getString("value");
if (StrUtil.isNotBlank(values)) {
String[] valueList = values.split(",");
for (String value : valueList) {
if (specSet.contains(value)) {
finalValues = finalValues + (value) + ",";
}
}
if (StrUtil.isNotBlank(finalValues)) {
finalValues = StrUtil.removeSuffix(finalValues, ",");
snapJSON.put("value", finalValues);
finalSnap.add(snapJSON);
}
}
}
skuResult.setTagSnap(finalSnap.toJSONString());
}
it.setProductSkuResult(skuResult); it.setProductSkuResult(skuResult);
}); });
g.setProducts(products); g.setProducts(products);

View File

@ -7,7 +7,7 @@ package com.chaozhanggui.system.cashierservice.service;
*/ */
public interface TbShopSongOrderService { public interface TbShopSongOrderService {
void successPay(String orderNo); void successPay(String orderNo, String tradeNo);
void clearExpireOrder(); void clearExpireOrder();
} }

View File

@ -25,7 +25,7 @@ public interface TbShopSongService {
*/ */
PageInfo<?> all(Integer shopId, Integer page, Integer size, String keyWord, boolean isDesc); PageInfo<?> all(Integer shopId, Integer page, Integer size, String keyWord, boolean isDesc);
Object getRecord(String openId, Integer page, Integer size, Integer state, boolean isDesc); Object getRecord(String openId, Integer page, Integer size, Integer state, boolean isDesc, Integer shopId);
/** /**
* 创建订单 * 创建订单
@ -44,4 +44,11 @@ public interface TbShopSongService {
* @return 订单信息 * @return 订单信息
*/ */
Map<String, Object> getDetail(String openId, Integer id); Map<String, Object> getDetail(String openId, Integer id);
/**
* 正在演唱的歌曲
* @param openId 用户id
* @return 歌曲信息
*/
Object getSinging(String openId);
} }

View File

@ -26,13 +26,14 @@ public class TbShopSongOrderServiceImpl
} }
@Override @Override
public void successPay(String orderNo) { public void successPay(String orderNo, String tradeNo) {
TbShopSongOrder shopSongOrder = shopSongOrderMapper.selectByOrderNo(orderNo); TbShopSongOrder shopSongOrder = shopSongOrderMapper.selectByOrderNo(orderNo);
if (shopSongOrder.getState().equals(1)) { if (shopSongOrder.getState().equals(1)) {
log.warn("点歌支付成功,重复支付,订单编号:{}", orderNo); log.warn("点歌支付成功,重复支付,订单编号:{}", orderNo);
return; return;
} }
shopSongOrder.setState(1); shopSongOrder.setState(1);
shopSongOrder.setPayOrderId(tradeNo);
shopSongOrder.setRealMoney(shopSongOrder.getPayMoney()); shopSongOrder.setRealMoney(shopSongOrder.getPayMoney());
shopSongOrderMapper.updateByPrimaryKeySelective(shopSongOrder); shopSongOrderMapper.updateByPrimaryKeySelective(shopSongOrder);
shopSongMapper.incrNum(1, shopSongOrder.getSongId()); shopSongMapper.incrNum(1, shopSongOrder.getSongId());

View File

@ -9,6 +9,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbShopSong;
import com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder; import com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder;
import com.chaozhanggui.system.cashierservice.entity.dto.SongOrderDTO; import com.chaozhanggui.system.cashierservice.entity.dto.SongOrderDTO;
import com.chaozhanggui.system.cashierservice.exception.MsgException; import com.chaozhanggui.system.cashierservice.exception.MsgException;
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
import com.chaozhanggui.system.cashierservice.service.PayService; import com.chaozhanggui.system.cashierservice.service.PayService;
import com.chaozhanggui.system.cashierservice.service.TbShopSongOrderService; import com.chaozhanggui.system.cashierservice.service.TbShopSongOrderService;
import com.chaozhanggui.system.cashierservice.service.TbShopSongService; import com.chaozhanggui.system.cashierservice.service.TbShopSongService;
@ -20,6 +21,8 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -27,9 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Map;
/** /**
* @author Administrator * @author Administrator
@ -39,6 +40,7 @@ import java.util.Map;
@Service @Service
public class TbShopSongServiceImpl implements TbShopSongService{ public class TbShopSongServiceImpl implements TbShopSongService{
private static final Logger log = LoggerFactory.getLogger(TbShopSongServiceImpl.class);
private final RedisTemplate<String, Object> redisTemplate; private final RedisTemplate<String, Object> redisTemplate;
private final TbShopSongOrderService shopSongOrderService; private final TbShopSongOrderService shopSongOrderService;
@ -65,19 +67,36 @@ public class TbShopSongServiceImpl implements TbShopSongService{
@Override @Override
public PageInfo<TbShopSong> all(Integer shopId, Integer page, Integer size, String keyWord, boolean isDesc) { public PageInfo<TbShopSong> all(Integer shopId, Integer page, Integer size, String keyWord, boolean isDesc) {
PageHelper.startPage(page, size); PageHelper.startPage(page, size);
List<TbShopSong> shopSongs = shopSongMapper.selectAllAndSearch(shopId, keyWord); List<TbShopSong> shopSongs;
try {
shopSongs = shopSongMapper.selectAllAndSearch(shopId, keyWord);
}catch (Exception e) {
log.warn("查询歌曲列表出现异常", e);
shopSongs = new ArrayList<>();
}
return new PageInfo<>(shopSongs); return new PageInfo<>(shopSongs);
} }
@Override @Override
public Object getRecord(String openId, Integer page, Integer size, Integer state, boolean isDesc) { public Object getRecord(String openId, Integer page, Integer size, Integer state, boolean isDesc, Integer shopId) {
PageHelper.startPage(page, size); PageHelper.startPage(page, size);
List<Map<String, Object>> songOrders = shopSongOrderMapper.selectByUserId(openId, state); List<Map<String, Object>> songOrders;
if (state == null) {
songOrders = shopSongOrderMapper.selectActiveOrderByUserId(openId, shopId);
}else {
songOrders = shopSongOrderMapper.selectByUserId(openId, state, shopId);
}
LinkedHashMap<String, Integer> rank = new LinkedHashMap<>();
List<TbShopSongOrder> tbShopSongOrders = shopSongOrderMapper.selectWaitAll(shopId);
for (int i = 0; i < tbShopSongOrders.size(); i++) {
rank.put(tbShopSongOrders.get(i).getId().toString(), i);
}
ArrayList<Map<String, Object>> infos = new ArrayList<>(); ArrayList<Map<String, Object>> infos = new ArrayList<>();
for (int i = 0; i < songOrders.size(); i++) { for (int i = 0; i < songOrders.size(); i++) {
Map<String, Object> toMap = songOrders.get(i); Map<String, Object> toMap = songOrders.get(i);
toMap.put("preCount", i); toMap.put("preCount", rank.get(String.valueOf(songOrders.get(i).get("orderId"))));
infos.add(toMap); infos.add(toMap);
} }
return new PageInfo<>(infos); return new PageInfo<>(infos);
@ -99,8 +118,8 @@ public class TbShopSongServiceImpl implements TbShopSongService{
shopSongOrder.setClientType(0); shopSongOrder.setClientType(0);
shopSongOrder.setSongName(song.getName()); shopSongOrder.setSongName(song.getName());
shopSongOrder.setState(-1); shopSongOrder.setState(-1);
shopSongOrder.setFromName(shopSongOrder.getFromName()); shopSongOrder.setFromName(songOrderDTO.getFromName());
shopSongOrder.setToName(shopSongOrder.getToName()); shopSongOrder.setToName(songOrderDTO.getToName());
shopSongOrder.setNote(songOrderDTO.getNote()); shopSongOrder.setNote(songOrderDTO.getNote());
shopSongOrder.setShopId(songOrderDTO.getShopId()); shopSongOrder.setShopId(songOrderDTO.getShopId());
shopSongOrder.setPayMoney(song.getPrice()); shopSongOrder.setPayMoney(song.getPrice());
@ -128,6 +147,20 @@ public class TbShopSongServiceImpl implements TbShopSongService{
} }
return map; return map;
} }
@Override
public Object getSinging(String openId) {
Map<String, Object> map = shopSongOrderMapper.selectSinging();
if (map == null) {
return new HashMap<String, Object>(){{
put("songName", "");
put("id", "");
put("img", "");
}};
}else {
return map;
}
}
} }

View File

@ -173,7 +173,7 @@ public class TaskScheduler {
return randomMilliseconds; return randomMilliseconds;
} }
@Scheduled(fixedRate = 60000) @Scheduled(fixedRate = 60000 * 60)
public void clearSongOrder() { public void clearSongOrder() {
log.info("定时任务执行,清楚过期歌曲订单"); log.info("定时任务执行,清楚过期歌曲订单");
shopSongOrderService.clearExpireOrder(); shopSongOrderService.clearExpireOrder();

View File

@ -0,0 +1,26 @@
package com.chaozhanggui.system.cashierservice.util;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.rabbit.RabbitConstants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class MQUtils {
private final RabbitTemplate rabbitTemplate;
public MQUtils(RabbitTemplate rabbitTemplate) {
this.rabbitTemplate = rabbitTemplate;
}
private <T> void sendMsg(String exchange, String routingKey, T data, String note) {
log.info("开始发送{}mq消息, exchange: {}, routingKey: {}, data: {}", note, exchange, routingKey, data);
rabbitTemplate.convertAndSend(exchange, routingKey, JSONObject.toJSONString(data));
}
public <T> void sendStockSaleMsg(T data) {
sendMsg(RabbitConstants.EXCHANGE_STOCK_RECORD, RabbitConstants.ROUTING_STOCK_RECORD_SALE, data, "商品售出增加库存记录");
}
}

View File

@ -920,10 +920,28 @@
</update> </update>
<select id="selectByIdIn" resultMap="BaseResultMap"> <select id="selectByIdIn" resultMap="BaseResultMap">
select * select min( sku.suit ) as suit,tb.*
from tb_product from tb_product tb
where id in (${ids}) and is_show_mall =1 order by sort asc LEFT JOIN tb_product_sku sku ON tb.id = sku.product_id
</select> where tb.id in (${ids}) and is_show_mall =1 and sku.is_del = 0
group by tb.id
order by tb.sort asc
</select>
<select id="selectByIdInAndCheck" resultMap="BaseResultMap">
select min( sku.suit ) as suit,tb.*
from tb_product tb
LEFT JOIN tb_product_sku sku ON tb.id = sku.product_id
where tb.id in (${ids}) and is_show_mall =1 and sku.is_del = 0 and sku.is_grounding=1
group by tb.id
order by tb.sort asc
</select>
<!-- <select id="selectByIdIn" resultMap="BaseResultMap">-->
<!-- select *-->
<!-- from tb_product-->
<!-- where id in (${ids}) and is_show_mall =1 order by sort asc-->
<!-- </select>-->
<select id="selectById" resultType="com.chaozhanggui.system.cashierservice.entity.TbProduct"> <select id="selectById" resultType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />

View File

@ -12,6 +12,7 @@
<result column="meal_price" jdbcType="DECIMAL" property="mealPrice" /> <result column="meal_price" jdbcType="DECIMAL" property="mealPrice" />
<result column="sale_price" jdbcType="DECIMAL" property="salePrice" /> <result column="sale_price" jdbcType="DECIMAL" property="salePrice" />
<result column="guide_price" jdbcType="DECIMAL" property="guidePrice" /> <result column="guide_price" jdbcType="DECIMAL" property="guidePrice" />
<result column="suit" jdbcType="INTEGER" property="suit" />
<result column="strategy_price" jdbcType="DECIMAL" property="strategyPrice" /> <result column="strategy_price" jdbcType="DECIMAL" property="strategyPrice" />
<result column="stock_number" jdbcType="DOUBLE" property="stockNumber" /> <result column="stock_number" jdbcType="DOUBLE" property="stockNumber" />
<result column="cover_img" jdbcType="VARCHAR" property="coverImg" /> <result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
@ -24,6 +25,8 @@
<result column="created_at" jdbcType="BIGINT" property="createdAt" /> <result column="created_at" jdbcType="BIGINT" property="createdAt" />
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" /> <result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
<result column="is_pause_sale" jdbcType="INTEGER" property="isPauseSale" /> <result column="is_pause_sale" jdbcType="INTEGER" property="isPauseSale" />
<result column="is_del" jdbcType="INTEGER" property="isDel" />
<result column="is_grounding" jdbcType="INTEGER" property="isGrounding" />
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbProductSkuWithBLOBs"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbProductSkuWithBLOBs">
<result column="spec_info" jdbcType="LONGVARCHAR" property="specInfo" /> <result column="spec_info" jdbcType="LONGVARCHAR" property="specInfo" />
@ -31,8 +34,8 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, shop_id, bar_code, product_id, origin_price, cost_price, member_price, meal_price, 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, sale_price, guide_price,suit, strategy_price, stock_number, cover_img, warn_line, weight,
volume, real_sales_number, first_shared, second_shared, created_at, updated_at, is_pause_sale volume, real_sales_number, first_shared, second_shared, created_at, updated_at, is_pause_sale ,is_del,is_grounding
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
spec_info, spec_snap spec_info, spec_snap
@ -359,7 +362,7 @@
</update> </update>
<select id="selectByShopIdAndProductIdAndSpec" resultMap="ResultMapWithBLOBs"> <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 !=''"> <if test="spec != null and spec !=''">
and spec_snap = #{spec} and spec_snap = #{spec}

View File

@ -8,7 +8,7 @@
<id property="id" column="id" jdbcType="INTEGER"/> <id property="id" column="id" jdbcType="INTEGER"/>
<result property="songId" column="song_id" jdbcType="INTEGER"/> <result property="songId" column="song_id" jdbcType="INTEGER"/>
<result property="songName" column="song_name" jdbcType="VARCHAR"/> <result property="songName" column="song_name" jdbcType="VARCHAR"/>
<result property="openId" column="open_id" jdbcType="INTEGER"/> <result property="openId" column="open_id" jdbcType="VARCHAR"/>
<result property="payMoney" column="pay_money" jdbcType="DECIMAL"/> <result property="payMoney" column="pay_money" jdbcType="DECIMAL"/>
<result property="state" column="state" jdbcType="TINYINT"/> <result property="state" column="state" jdbcType="TINYINT"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
@ -19,6 +19,7 @@
<result property="note" column="note" jdbcType="VARCHAR"/> <result property="note" column="note" jdbcType="VARCHAR"/>
<result property="shopId" column="shop_id" jdbcType="INTEGER"/> <result property="shopId" column="shop_id" jdbcType="INTEGER"/>
<result property="realMoney" column="real_money" jdbcType="DECIMAL"/> <result property="realMoney" column="real_money" jdbcType="DECIMAL"/>
<result property="payOrderId" column="pay_order_id" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
@ -26,19 +27,19 @@
open_id,pay_money,state, open_id,pay_money,state,
create_time,client_type,order_no, create_time,client_type,order_no,
from_name,to_name,note, from_name,to_name,note,
shop_id,real_money shop_id,real_money,pay_order_id
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from tb_shop_song_order from tb_shop_song_order
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from tb_shop_song_order delete from tb_shop_song_order
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</delete> </delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder" useGeneratedKeys="true"> <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder" useGeneratedKeys="true">
insert into tb_shop_song_order insert into tb_shop_song_order
@ -46,12 +47,14 @@
,open_id,pay_money,state ,open_id,pay_money,state
,create_time,client_type,order_no ,create_time,client_type,order_no
,from_name,to_name,note ,from_name,to_name,note
,shop_id,real_money) ,shop_id,real_money,pay_order_id
)
values (#{id,jdbcType=INTEGER},#{songId,jdbcType=INTEGER},#{songName,jdbcType=VARCHAR} values (#{id,jdbcType=INTEGER},#{songId,jdbcType=INTEGER},#{songName,jdbcType=VARCHAR}
,#{openId,jdbcType=INTEGER},#{payMoney,jdbcType=DECIMAL},#{state,jdbcType=TINYINT} ,#{openId,jdbcType=VARCHAR},#{payMoney,jdbcType=DECIMAL},#{state,jdbcType=TINYINT}
,#{createTime,jdbcType=TIMESTAMP},#{clientType,jdbcType=TINYINT},#{orderNo,jdbcType=VARCHAR} ,#{createTime,jdbcType=TIMESTAMP},#{clientType,jdbcType=TINYINT},#{orderNo,jdbcType=VARCHAR}
,#{fromName,jdbcType=VARCHAR},#{toName,jdbcType=VARCHAR},#{note,jdbcType=VARCHAR} ,#{fromName,jdbcType=VARCHAR},#{toName,jdbcType=VARCHAR},#{note,jdbcType=VARCHAR}
,#{shopId,jdbcType=INTEGER},#{realMoney,jdbcType=DECIMAL}) ,#{shopId,jdbcType=INTEGER},#{realMoney,jdbcType=DECIMAL},#{payOrderId,jdbcType=VARCHAR}
)
</insert> </insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder" useGeneratedKeys="true"> <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder" useGeneratedKeys="true">
insert into tb_shop_song_order insert into tb_shop_song_order
@ -70,12 +73,13 @@
<if test="note != null">note,</if> <if test="note != null">note,</if>
<if test="shopId != null">shop_id,</if> <if test="shopId != null">shop_id,</if>
<if test="realMoney != null">real_money,</if> <if test="realMoney != null">real_money,</if>
<if test="payOrderId != null">pay_order_id,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id,jdbcType=INTEGER},</if> <if test="id != null">#{id,jdbcType=INTEGER},</if>
<if test="songId != null">#{songId,jdbcType=INTEGER},</if> <if test="songId != null">#{songId,jdbcType=INTEGER},</if>
<if test="songName != null">#{songName,jdbcType=VARCHAR},</if> <if test="songName != null">#{songName,jdbcType=VARCHAR},</if>
<if test="openId != null">#{openId,jdbcType=INTEGER},</if> <if test="openId != null">#{openId,jdbcType=VARCHAR},</if>
<if test="payMoney != null">#{payMoney,jdbcType=DECIMAL},</if> <if test="payMoney != null">#{payMoney,jdbcType=DECIMAL},</if>
<if test="state != null">#{state,jdbcType=TINYINT},</if> <if test="state != null">#{state,jdbcType=TINYINT},</if>
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
@ -86,6 +90,7 @@
<if test="note != null">#{note,jdbcType=VARCHAR},</if> <if test="note != null">#{note,jdbcType=VARCHAR},</if>
<if test="shopId != null">#{shopId,jdbcType=INTEGER},</if> <if test="shopId != null">#{shopId,jdbcType=INTEGER},</if>
<if test="realMoney != null">#{realMoney,jdbcType=DECIMAL},</if> <if test="realMoney != null">#{realMoney,jdbcType=DECIMAL},</if>
<if test="payOrderId != null">#{payOrderId,jdbcType=VARCHAR},</if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder"> <update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder">
@ -98,7 +103,7 @@
song_name = #{songName,jdbcType=VARCHAR}, song_name = #{songName,jdbcType=VARCHAR},
</if> </if>
<if test="openId != null"> <if test="openId != null">
open_id = #{openId,jdbcType=INTEGER}, open_id = #{openId,jdbcType=VARCHAR},
</if> </if>
<if test="payMoney != null"> <if test="payMoney != null">
pay_money = #{payMoney,jdbcType=DECIMAL}, pay_money = #{payMoney,jdbcType=DECIMAL},
@ -130,15 +135,18 @@
<if test="realMoney != null"> <if test="realMoney != null">
real_money = #{realMoney,jdbcType=DECIMAL}, real_money = #{realMoney,jdbcType=DECIMAL},
</if> </if>
<if test="payOrderId != null">
pay_order_id = #{payOrderId,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder"> <update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder">
update tb_shop_song_order update tb_shop_song_order
set set
song_id = #{songId,jdbcType=INTEGER}, song_id = #{songId,jdbcType=INTEGER},
song_name = #{songName,jdbcType=VARCHAR}, song_name = #{songName,jdbcType=VARCHAR},
open_id = #{openId,jdbcType=INTEGER}, open_id = #{openId,jdbcType=VARCHAR},
pay_money = #{payMoney,jdbcType=DECIMAL}, pay_money = #{payMoney,jdbcType=DECIMAL},
state = #{state,jdbcType=TINYINT}, state = #{state,jdbcType=TINYINT},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
@ -148,18 +156,8 @@
to_name = #{toName,jdbcType=VARCHAR}, to_name = #{toName,jdbcType=VARCHAR},
note = #{note,jdbcType=VARCHAR}, note = #{note,jdbcType=VARCHAR},
shop_id = #{shopId,jdbcType=INTEGER}, shop_id = #{shopId,jdbcType=INTEGER},
real_money = #{realMoney,jdbcType=DECIMAL} real_money = #{realMoney,jdbcType=DECIMAL},
where id = #{id,jdbcType=INTEGER} pay_order_id = #{payOrderId,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update> </update>
<select id="selectByUserIdAndId" resultType="java.util.Map">
SELECT
*
FROM
tb_shop_song_order AS a
LEFT JOIN tb_shop_song AS b ON a.song_id = b.id
WHERE
a.open_id = #{openId}
AND a.id=#{id}
</select>
</mapper> </mapper>

View File

@ -51,6 +51,15 @@
where telephone = #{phone,jdbcType=VARCHAR} where telephone = #{phone,jdbcType=VARCHAR}
</select> </select>
<select id="selectByShopIdAndPhone" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tb_shop_user
where
shop_id=#{shopId}
and telephone = #{phone,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from tb_shop_user delete from tb_shop_user
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
@ -397,6 +406,10 @@
select * from tb_shop_user where telephone=#{phone} and shop_id=#{shopId} select * from tb_shop_user where telephone=#{phone} and shop_id=#{shopId}
</select> </select>
<select id="selectPCByPhoneAndShopId" resultMap="BaseResultMap">
select * from tb_shop_user where telephone=#{phone} and shop_id=#{shopId} and user_id is null
</select>
<select id="selectAllByUserId" resultMap="BaseResultMap"> <select id="selectAllByUserId" resultMap="BaseResultMap">
select * from tb_shop_user where user_id=#{userId} select * from tb_shop_user where user_id=#{userId}
</select> </select>
@ -424,9 +437,10 @@
tb_shop_user u tb_shop_user u
left join tb_shop_info i on u.shop_id=i.id left join tb_shop_info i on u.shop_id=i.id
WHERE WHERE
u.user_id = #{userId} u.user_id = #{userId}
and is_vip = 1
<if test="shopId != null and shopId !=''"> <if test="shopId != null and shopId !=''">
and shop_id = #{shopId} and shop_id = #{shopId}
</if> </if>
</select> </select>
</mapper> </mapper>

View File

@ -53,15 +53,15 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, amount, charge_amount, line_of_credit, consume_amount, consume_number, total_score, id, amount, charge_amount, line_of_credit, consume_amount, consume_number, total_score,
lock_score, card_no, card_password, level_id, head_img, nick_name, telephone, wx_ma_app_id, lock_score, card_no, card_password, level_id, head_img, nick_name, telephone, wx_ma_app_id,
birth_day, sex, mini_app_open_id, open_id, union_id, code, type, identify, status, birth_day, sex, mini_app_open_id, open_id, union_id, code, type, identify, status,
parent_id, parent_level, parent_type, project_id, merchant_id, is_resource, is_online, parent_id, parent_level, parent_type, project_id, merchant_id, is_resource, is_online,
is_vip, vip_effect_at, tips, source_path, is_sales_person, is_attention_mp, city, is_vip, vip_effect_at, tips, source_path, is_sales_person, is_attention_mp, city,
search_word, last_log_in_at, last_leave_at, created_at, updated_at, bind_parent_at, search_word, last_log_in_at, last_leave_at, created_at, updated_at, bind_parent_at,
grand_parent_id,password,is_pwd,pwd grand_parent_id,password,is_pwd,pwd
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from tb_user_info from tb_user_info
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
@ -73,35 +73,35 @@
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo" useGeneratedKeys="true" keyProperty="id">
insert into tb_user_info (id, amount, charge_amount, insert into tb_user_info (id, amount, charge_amount,
line_of_credit, consume_amount, consume_number, line_of_credit, consume_amount, consume_number,
total_score, lock_score, card_no, total_score, lock_score, card_no,
card_password, level_id, head_img, card_password, level_id, head_img,
nick_name, telephone, wx_ma_app_id, nick_name, telephone, wx_ma_app_id,
birth_day, sex, mini_app_open_id, birth_day, sex, mini_app_open_id,
open_id, union_id, code, open_id, union_id, code,
type, identify, status, type, identify, status,
parent_id, parent_level, parent_type, parent_id, parent_level, parent_type,
project_id, merchant_id, is_resource, project_id, merchant_id, is_resource,
is_online, is_vip, vip_effect_at, is_online, is_vip, vip_effect_at,
tips, source_path, is_sales_person, tips, source_path, is_sales_person,
is_attention_mp, city, search_word, is_attention_mp, city, search_word,
last_log_in_at, last_leave_at, created_at, last_log_in_at, last_leave_at, created_at,
updated_at, bind_parent_at, grand_parent_id,password,is_pwd,pwd updated_at, bind_parent_at, grand_parent_id,password,is_pwd,pwd
) )
values (#{id,jdbcType=INTEGER}, #{amount,jdbcType=DECIMAL}, #{chargeAmount,jdbcType=DECIMAL}, values (#{id,jdbcType=INTEGER}, #{amount,jdbcType=DECIMAL}, #{chargeAmount,jdbcType=DECIMAL},
#{lineOfCredit,jdbcType=DECIMAL}, #{consumeAmount,jdbcType=DECIMAL}, #{consumeNumber,jdbcType=INTEGER}, #{lineOfCredit,jdbcType=DECIMAL}, #{consumeAmount,jdbcType=DECIMAL}, #{consumeNumber,jdbcType=INTEGER},
#{totalScore,jdbcType=INTEGER}, #{lockScore,jdbcType=INTEGER}, #{cardNo,jdbcType=VARCHAR}, #{totalScore,jdbcType=INTEGER}, #{lockScore,jdbcType=INTEGER}, #{cardNo,jdbcType=VARCHAR},
#{cardPassword,jdbcType=VARCHAR}, #{levelId,jdbcType=VARCHAR}, #{headImg,jdbcType=VARCHAR}, #{cardPassword,jdbcType=VARCHAR}, #{levelId,jdbcType=VARCHAR}, #{headImg,jdbcType=VARCHAR},
#{nickName,jdbcType=VARCHAR}, #{telephone,jdbcType=VARCHAR}, #{wxMaAppId,jdbcType=VARCHAR}, #{nickName,jdbcType=VARCHAR}, #{telephone,jdbcType=VARCHAR}, #{wxMaAppId,jdbcType=VARCHAR},
#{birthDay,jdbcType=VARCHAR}, #{sex,jdbcType=TINYINT}, #{miniAppOpenId,jdbcType=VARCHAR}, #{birthDay,jdbcType=VARCHAR}, #{sex,jdbcType=TINYINT}, #{miniAppOpenId,jdbcType=VARCHAR},
#{openId,jdbcType=VARCHAR}, #{unionId,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, #{openId,jdbcType=VARCHAR}, #{unionId,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR}, #{identify,jdbcType=TINYINT}, #{status,jdbcType=TINYINT}, #{type,jdbcType=VARCHAR}, #{identify,jdbcType=TINYINT}, #{status,jdbcType=TINYINT},
#{parentId,jdbcType=VARCHAR}, #{parentLevel,jdbcType=VARCHAR}, #{parentType,jdbcType=VARCHAR}, #{parentId,jdbcType=VARCHAR}, #{parentLevel,jdbcType=VARCHAR}, #{parentType,jdbcType=VARCHAR},
#{projectId,jdbcType=VARCHAR}, #{merchantId,jdbcType=VARCHAR}, #{isResource,jdbcType=TINYINT}, #{projectId,jdbcType=VARCHAR}, #{merchantId,jdbcType=VARCHAR}, #{isResource,jdbcType=TINYINT},
#{isOnline,jdbcType=TINYINT}, #{isVip,jdbcType=TINYINT}, #{vipEffectAt,jdbcType=INTEGER}, #{isOnline,jdbcType=TINYINT}, #{isVip,jdbcType=TINYINT}, #{vipEffectAt,jdbcType=INTEGER},
#{tips,jdbcType=VARCHAR}, #{sourcePath,jdbcType=VARCHAR}, #{isSalesPerson,jdbcType=TINYINT}, #{tips,jdbcType=VARCHAR}, #{sourcePath,jdbcType=VARCHAR}, #{isSalesPerson,jdbcType=TINYINT},
#{isAttentionMp,jdbcType=TINYINT}, #{city,jdbcType=VARCHAR}, #{searchWord,jdbcType=VARCHAR}, #{isAttentionMp,jdbcType=TINYINT}, #{city,jdbcType=VARCHAR}, #{searchWord,jdbcType=VARCHAR},
#{lastLogInAt,jdbcType=BIGINT}, #{lastLeaveAt,jdbcType=BIGINT}, #{createdAt,jdbcType=BIGINT}, #{lastLogInAt,jdbcType=BIGINT}, #{lastLeaveAt,jdbcType=BIGINT}, #{createdAt,jdbcType=BIGINT},
#{updatedAt,jdbcType=BIGINT}, #{bindParentAt,jdbcType=BIGINT}, #{grandParentId,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{updatedAt,jdbcType=BIGINT}, #{bindParentAt,jdbcType=BIGINT}, #{grandParentId,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{isPwd,jdbcType=VARCHAR},#{pwd,jdbcType=VARCHAR} #{isPwd,jdbcType=VARCHAR},#{pwd,jdbcType=VARCHAR}
) )
@ -585,7 +585,7 @@
<select id="selectByOpenId" resultMap="BaseResultMap"> <select id="selectByOpenId" resultMap="BaseResultMap">
select * from tb_user_info where mini_app_open_id=#{openId} select * from tb_user_info where mini_app_open_id=#{openId} limit 1
</select> </select>
@ -595,4 +595,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>