Compare commits
72 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c11a3f1df8 | |||
| 9a9e43ba71 | |||
| fd184ba835 | |||
| ce8dc138f9 | |||
| b3850469ec | |||
| 119b6ba9c7 | |||
| 7be5d2354f | |||
| 1ee3c33fa0 | |||
|
|
43c1505dbe | ||
|
|
7fb5322563 | ||
|
|
67671fcf6c | ||
|
|
941072171b | ||
| f6876e3f9c | |||
| 01c6e5753c | |||
|
|
75a8e9362f | ||
|
|
9bb60335b6 | ||
| e70d6b27b9 | |||
| 01da0ff8a5 | |||
| 1b1fe06844 | |||
| f16090f04e | |||
| 7232fb3173 | |||
| 0b511314fb | |||
| 870ed00e1c | |||
| 5c84d6ab95 | |||
| a8fff70798 | |||
| 1791b884e8 | |||
| 3ea5b8290e | |||
| 5646c50b4d | |||
| c745e254c0 | |||
| 26f455fcd1 | |||
| c0078222f5 | |||
| 37fffa0f98 | |||
| 7b09e827fd | |||
| 7b71eced36 | |||
| d264f79c9e | |||
| 58fa177785 | |||
| 3ae13b0b7e | |||
| fbb69e60d9 | |||
| 9fcee207d5 | |||
| 4a379d2730 | |||
|
|
b34eaa2894 | ||
| a316be436b | |||
| 878b21f7f6 | |||
|
|
2f1f8877fc | ||
|
|
be842bc1f6 | ||
|
|
5b95673507 | ||
|
|
5cdc276b0c | ||
| a11dcb5811 | |||
|
|
31a5c94adf | ||
| 9b868838f4 | |||
|
|
22c04c61f5 | ||
| 952a618175 | |||
| b435420d97 | |||
| 82b4f773e4 | |||
| 370f5c1b60 | |||
| 605b1778a4 | |||
| 09768ef42c | |||
| 878cc895d4 | |||
| 4b4394d070 | |||
| 48a6628acb | |||
| a4601fac99 | |||
| 57472bdf00 | |||
| 9a70d68d37 | |||
| 8ea20b8394 | |||
| dae3a75e0c | |||
| efd0d80dc3 | |||
| 3ab1629436 | |||
| 68d12fe2ed | |||
| 8281c2b9bc | |||
| 538fc8f91b | |||
|
|
0f4d9f0127 | ||
|
|
cbae826ce2 |
@@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbPlatformDictMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbShopExtendMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.WxMsgSubDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.DistrictVo;
|
||||
@@ -24,12 +25,14 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 通用接口
|
||||
@@ -50,6 +53,8 @@ public class CommonController {
|
||||
private TbPlatformDictMapper platformDictMapper;
|
||||
@Resource
|
||||
private FileService fileService;
|
||||
@Resource
|
||||
private TbShopExtendMapper extendMapper;
|
||||
|
||||
private final LoginService loginService;;
|
||||
|
||||
@@ -163,6 +168,12 @@ public class CommonController {
|
||||
return new Result(CodeEnum.SUCCESS, fileService.uploadFile(file));
|
||||
}
|
||||
|
||||
@RequestMapping("common/shopExtend")
|
||||
public Result getShopExtend(@RequestBody Map<String, String> map) {
|
||||
if (CollectionUtils.isEmpty(map) || !map.containsKey("shopId") || !map.containsKey("autokey")) return new Result(CodeEnum.SUCCESS);
|
||||
return new Result(CodeEnum.SUCCESS, extendMapper.queryByShopIdAndAutoKey(Integer.valueOf(map.get("shopId").toString()),map.get("autokey")));
|
||||
}
|
||||
|
||||
// 检查手机号格式是否正确的方法
|
||||
private boolean isValidPhoneNumber(String phone) {
|
||||
return phone.matches("^1[3-9]\\d{9}$");
|
||||
|
||||
@@ -125,8 +125,7 @@ public class LoginContoller {
|
||||
// try{
|
||||
// String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr);
|
||||
// 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){
|
||||
// log.info("登录传参:获取手机号失败{}",e.getMessage());
|
||||
// }
|
||||
@@ -201,11 +200,11 @@ public class LoginContoller {
|
||||
String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr);
|
||||
try {
|
||||
if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) {
|
||||
if (!map.containsKey("shopId") || ObjectUtil.isEmpty(map.get("shopId"))) {
|
||||
// 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"));
|
||||
return loginService.upPhone(openId,JSONObject.parseObject(data).get("phoneNumber").toString(),map.get("shopId").toString());
|
||||
// }
|
||||
// log.info("登录传参 获取手机号成功 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,JSONObject.parseObject(data).get("phoneNumber"));
|
||||
// return loginService.upPhone(openId,JSONObject.parseObject(data).get("phoneNumber").toString(),map.get("shopId").toString());
|
||||
}
|
||||
} catch (Exception e){
|
||||
// e.printStackTrace();
|
||||
@@ -277,6 +276,7 @@ public class LoginContoller {
|
||||
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||
userInfo.setId(Integer.valueOf(userId));
|
||||
userInfo.setUpdatedAt(System.currentTimeMillis());
|
||||
// log.info("更新用户信息 param,{}",JSONObject.toJSONString(userInfo));
|
||||
return loginService.upUserInfo(userInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,11 +66,6 @@ public class NotifyController {
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("test")
|
||||
public void test(@RequestParam String payOrderNO){
|
||||
payService.test(payOrderNO);
|
||||
}
|
||||
|
||||
@RequestMapping("notifyCallBack")
|
||||
public String notifyCallBack(HttpServletRequest request){
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopTable;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.OrderDto;
|
||||
import com.chaozhanggui.system.cashierservice.service.OrderService;
|
||||
@@ -10,6 +11,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.Map;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@@ -51,6 +53,14 @@ public class OrderController {
|
||||
return orderService.orderList(userId,page,size,status);
|
||||
}
|
||||
|
||||
@PostMapping("/rmOrder")
|
||||
private Result rmOrder(@RequestBody Map<String, Object> map){
|
||||
if (ObjectUtil.isEmpty(map) || map.size() <= 0 || !map.containsKey("orderId") || ObjectUtil.isEmpty(map.get("orderId"))) {
|
||||
return Result.fail("订单号不允许为空");
|
||||
}
|
||||
return orderService.rmOrder(Integer.valueOf(map.get("orderId").toString()));
|
||||
}
|
||||
|
||||
@GetMapping("/tradeIntegral")
|
||||
private Result tradeIntegral(@RequestParam("userId") String userId, @RequestParam("id") String id) throws IOException, ParseException {
|
||||
return orderService.tradeIntegral(userId,id);
|
||||
|
||||
@@ -50,12 +50,13 @@ public class ProductController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("queryProduct")
|
||||
public Result queryProduct(@RequestBody Map<String, String> map) {
|
||||
public Result queryProduct(@RequestHeader("id") String userId,@RequestBody Map<String, String> map) {
|
||||
|
||||
if (ObjectUtil.isEmpty(map) || map.size() <= 0 || !map.containsKey("shopId")) {
|
||||
return Result.fail("参数错误");
|
||||
}
|
||||
return productService.queryProduct(
|
||||
userId,
|
||||
map.get("shopId").toString(),
|
||||
(map.containsKey("productGroupId") && ObjectUtil.isNotEmpty(map.get("productGroupId"))) ? map.get("productGroupId").toString() : "");
|
||||
}
|
||||
@@ -81,9 +82,10 @@ public class ProductController {
|
||||
@RequestParam(value = "code", required = false) String code,
|
||||
@RequestParam("shopId") String shopId,
|
||||
@RequestParam("productId") String productId,
|
||||
@RequestParam("spec_tag") String spec_tag
|
||||
@RequestParam("spec_tag") String spec_tag,
|
||||
@RequestParam("isVip") String isVip
|
||||
) {
|
||||
return productService.queryProductSku(code,shopId, productId, spec_tag);
|
||||
return productService.queryProductSku(code,shopId, productId, spec_tag,isVip);
|
||||
}
|
||||
|
||||
@PostMapping("addCart")
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopAd;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.TbShopAdDto;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbShopAdService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (TbShopAd)表控制层
|
||||
*
|
||||
* @author GYJ
|
||||
* @since 2024-08-19 14:25:09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("tbShopAd")
|
||||
public class TbShopAdController {
|
||||
|
||||
private final TbShopAdService tbShopAdService;
|
||||
|
||||
public TbShopAdController(@Qualifier("tbShopAdServiceImpl") TbShopAdService tbShopAdService) {
|
||||
this.tbShopAdService = tbShopAdService;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
public Result list(@RequestParam(value = "shopId") Integer shopId) {
|
||||
List<TbShopAd> tbShopAds = tbShopAdService.shopAdList(shopId);
|
||||
return Result.success(CodeEnum.ENCRYPT, TbShopAdDto.convertShopAdDoToDtoList(tbShopAds));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.UserCouponDto;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbUserCouponsService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("userConpons")
|
||||
public class TbUserCouponsController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private TbUserCouponsService tbUserCouponsService;
|
||||
|
||||
/**
|
||||
* 查询优惠卷
|
||||
* @param conponDto
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("find")
|
||||
public Result queryByPage(@RequestBody UserCouponDto conponDto) {
|
||||
return tbUserCouponsService.queryByPage(conponDto);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbShopUser;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralFlowVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.OpenMemberVo;
|
||||
import com.chaozhanggui.system.cashierservice.service.UserService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
@@ -61,8 +62,28 @@ public class UserContoller {
|
||||
// jsonObject.put("data",object);
|
||||
// return jsonObject;
|
||||
// }
|
||||
|
||||
@PostMapping("/openMember")
|
||||
public Result openMember(@RequestBody OpenMemberVo memberVo){
|
||||
if(StringUtils.isBlank(memberVo.getTelephone())){
|
||||
return Result.fail("手机号不可为空");
|
||||
}
|
||||
return userService.openMember(memberVo);
|
||||
}
|
||||
|
||||
@PostMapping("/upVipPhont")
|
||||
public Result upVipPhont(@RequestBody OpenMemberVo memberVo){
|
||||
if(StringUtils.isBlank(memberVo.getTelephone())){
|
||||
return Result.fail("手机号不可为空");
|
||||
}
|
||||
return userService.upVipPhont(memberVo);
|
||||
}
|
||||
|
||||
@GetMapping("/shopUserInfo")
|
||||
public Result shopUserInfo(@RequestParam("userId") String userId, @RequestHeader("openId") String openId, @RequestParam("shopId") String shopId) throws Exception {
|
||||
if(shopId.equals("undefined")){
|
||||
return Result.fail("店铺信息错误,请联系管理员!");
|
||||
}
|
||||
TbShopUser shopUser = new TbShopUser();
|
||||
TbShopInfo tbShopInfo = new TbShopInfo();
|
||||
if (StringUtils.isNotBlank(shopId) && !shopId.equals("null")) {
|
||||
@@ -107,9 +128,12 @@ public class UserContoller {
|
||||
shopUser.setAmount(BigDecimal.ZERO);
|
||||
}
|
||||
if (tbShopInfo != null) {
|
||||
shopUser.setIsUser(tbShopInfo.getIsCustom());
|
||||
shopUser.setShopName(tbShopInfo.getShopName());
|
||||
}else {
|
||||
shopUser.setShopName("");
|
||||
shopUser.setLng(tbShopInfo.getLng());
|
||||
shopUser.setLat(tbShopInfo.getLat());
|
||||
shopUser.setAddress(tbShopInfo.getAddress());
|
||||
shopUser.setIsUser(tbShopInfo.getIsCustom());
|
||||
}
|
||||
return Result.success(CodeEnum.SUCCESS, shopUser);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateInRecord;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbProduct;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbUserCoupons;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.UserCouponVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 活动商品赠送表(TbActivateInRecord)表数据库访问层
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-08-22 11:13:40
|
||||
*/
|
||||
public interface TbActivateInRecordMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbActivateInRecord queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询数据
|
||||
*
|
||||
* @param tbActivateInRecord 查询条件
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<TbActivateInRecord> queryAll(TbActivateInRecord tbActivateInRecord);
|
||||
|
||||
List<TbProduct> queryByVipIdAndShopId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId);
|
||||
List<UserCouponVo> queryVipPro(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId,@Param("shopName")String shopName);
|
||||
int queryByVipIdAndShopIdAndProId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
|
||||
List<TbActivateInRecord> queryAllByVipIdAndShopIdAndProId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbActivateInRecord 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(TbActivateInRecord tbActivateInRecord);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<TbActivateInRecord> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<TbActivateInRecord> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbActivateInRecord 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(TbActivateInRecord tbActivateInRecord);
|
||||
|
||||
int updateOverNumById(@Param("id")Integer id,@Param("overNum")Integer overNum);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
}
|
||||
|
||||
@@ -11,19 +11,19 @@ import java.util.List;
|
||||
@Component
|
||||
@Mapper
|
||||
public interface TbActivateMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
// int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(TbActivate record);
|
||||
// int insert(TbActivate record);
|
||||
|
||||
int insertSelective(TbActivate record);
|
||||
// int insertSelective(TbActivate record);
|
||||
|
||||
TbActivate selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(TbActivate record);
|
||||
// int updateByPrimaryKeySelective(TbActivate record);
|
||||
|
||||
int updateByPrimaryKey(TbActivate record);
|
||||
// int updateByPrimaryKey(TbActivate record);
|
||||
|
||||
TbActivate selectByAmount(@Param("shopId") String shopId,@Param("amount") BigDecimal amount);
|
||||
|
||||
List<TbActivate> selectByShpopId(String shopId);
|
||||
List<TbActivate> selectByShopId(String shopId);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateOutRecord;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.UserCouponVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 活动赠送商品使用记录表(TbActivateOutRecord)表数据库访问层
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-08-22 11:21:56
|
||||
*/
|
||||
public interface TbActivateOutRecordMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbActivateOutRecord queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询数据
|
||||
*
|
||||
* @param tbActivateOutRecord 查询条件
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<TbActivateOutRecord> queryAll(TbActivateOutRecord tbActivateOutRecord);
|
||||
|
||||
List<UserCouponVo> queryVipPro(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId, @Param("shopName") String shopName);
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbActivateOutRecord 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(TbActivateOutRecord tbActivateOutRecord);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<TbActivateOutRecord> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<TbActivateOutRecord> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbActivateOutRecord 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(TbActivateOutRecord tbActivateOutRecord);
|
||||
|
||||
/**
|
||||
* 根据订单id 将数据状态变为
|
||||
* @param orderId 订单Id
|
||||
* @param status 状态
|
||||
* @return
|
||||
*/
|
||||
int updateByOrderIdAndStatus(@Param("orderId")Integer orderId,@Param("status")String status);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateProduct;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 活动赠送商品表(TbActivateProduct)表数据库访问层
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-08-20 15:14:55
|
||||
*/
|
||||
public interface TbActivateProductMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbActivateProduct queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询数据
|
||||
*
|
||||
* @param tbActivateProduct 查询条件
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<TbActivateProduct> queryAll(TbActivateProduct tbActivateProduct);
|
||||
|
||||
List<TbActivateProduct> queryAllByActivateId(Integer activateId);
|
||||
List<String> queryProsByActivateId(Integer activateId);
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbActivateProduct 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(TbActivateProduct tbActivateProduct);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<TbActivateProduct> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<TbActivateProduct> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbActivateProduct 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(TbActivateProduct tbActivateProduct);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbConsInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Mapper
|
||||
public interface TbConsInfoMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(TbConsInfo record);
|
||||
|
||||
int insertSelective(TbConsInfo record);
|
||||
|
||||
TbConsInfo selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(TbConsInfo record);
|
||||
|
||||
int updateByPrimaryKey(TbConsInfo record);
|
||||
|
||||
int countAll();
|
||||
|
||||
List<TbConsInfo> selectAllInfo();
|
||||
}
|
||||
@@ -11,6 +11,10 @@ import java.util.List;
|
||||
@Component
|
||||
@Mapper
|
||||
public interface TbOrderInfoMapper {
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*/
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(TbOrderInfo record);
|
||||
|
||||
@@ -10,23 +10,24 @@ import java.util.List;
|
||||
@Component
|
||||
@Mapper
|
||||
public interface TbProductGroupMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
// int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(TbProductGroup record);
|
||||
// int insert(TbProductGroup record);
|
||||
|
||||
int insertSelective(TbProductGroup record);
|
||||
// int insertSelective(TbProductGroup record);
|
||||
|
||||
TbProductGroup selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(TbProductGroup record);
|
||||
// int updateByPrimaryKeySelective(TbProductGroup record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(TbProductGroup record);
|
||||
// int updateByPrimaryKeyWithBLOBs(TbProductGroup record);
|
||||
|
||||
int updateByPrimaryKey(TbProductGroup record);
|
||||
// int updateByPrimaryKey(TbProductGroup record);
|
||||
|
||||
List<TbProductGroup> selectByIdAndShopId(@Param("code") String code);
|
||||
|
||||
List<TbProductGroup> selectByQrcode(@Param("qrCode") String qrCode,@Param("groupId") Integer groupId);
|
||||
List<TbProductGroup> selectByShopId(@Param("shopId") String shopId,@Param("groupId") Integer groupId);
|
||||
List<TbProductGroup> selectByProductId(@Param("shopId") String shopId,@Param("productId") String productId);
|
||||
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public interface TbProductMapper {
|
||||
|
||||
List<TbProduct> selectByIds(@Param("list") List<String> ids);
|
||||
Integer selectByQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId);
|
||||
Integer selectByCodeAndSkuId(@Param("code") String code,@Param("skuId") Integer skuId,@Param("shopId") String shopId);
|
||||
Integer selectByCodeAndSkuId(@Param("code") String code,@Param("skuId") Integer skuId,@Param("shopId") String shopId,@Param("isVip") String isVip);
|
||||
Integer selectByNewQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId,@Param("list") List<String> list);
|
||||
|
||||
List<ShopGroupInfoVo> selGroups(@Param("proName") String proName,@Param("type") String type,
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbProskuCon;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Mapper
|
||||
public interface TbProskuConMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(TbProskuCon record);
|
||||
|
||||
int insertSelective(TbProskuCon record);
|
||||
|
||||
TbProskuCon selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(TbProskuCon record);
|
||||
|
||||
int updateByPrimaryKey(TbProskuCon record);
|
||||
|
||||
|
||||
List<TbProskuCon> selectBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
||||
List<TbProskuCon> selectBySkuIdAndShopIdAngCheck(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
||||
|
||||
|
||||
List<Integer> selectIdBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
||||
|
||||
List<TbProskuCon> selectByShopIdAndSkuIdAndProductId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
|
||||
List<TbProskuCon> selectByShopIdAndSkuIdAndProductIdAndCheck(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopAd;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (TbShopAd)表数据库访问层
|
||||
*
|
||||
* @author GYJ
|
||||
* @since 2024-08-19 14:25:09
|
||||
*/
|
||||
public interface TbShopAdDao {
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @return 对象列表
|
||||
*/
|
||||
@Select("select * from fycashier.tb_shop_ad where (shop_id = #{songId} or shop_id = 1) and status=1")
|
||||
List<TbShopAd> shopAdList(Integer shopId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopExtend;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺扩展信息(TbShopExtend)表数据库访问层
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-08-21 09:40:25
|
||||
*/
|
||||
public interface TbShopExtendMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbShopExtend queryById(Integer id);
|
||||
|
||||
TbShopExtend queryByShopIdAndAutoKey(Integer shopId,String autokey);
|
||||
|
||||
/**
|
||||
* 查询数据
|
||||
*
|
||||
* @param tbShopExtend 查询条件
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<TbShopExtend> queryAll(TbShopExtend tbShopExtend);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbUserCoupons;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.UserCouponDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.UserCouponVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -18,6 +20,7 @@ public interface TbUserCouponsMapper {
|
||||
int insertSelective(TbUserCoupons record);
|
||||
|
||||
TbUserCoupons selectByPrimaryKey(Integer id);
|
||||
List<UserCouponVo> queryAllSelective(UserCouponDto record);
|
||||
|
||||
int updateByPrimaryKeySelective(TbUserCoupons record);
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TbActivate implements Serializable {
|
||||
private Integer id;
|
||||
@@ -18,6 +22,10 @@ public class TbActivate implements Serializable {
|
||||
|
||||
private String isDel;
|
||||
|
||||
//是否赠送商品 0否 1是
|
||||
private Integer isGiftPro;
|
||||
private List<String> gives;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
@@ -75,4 +83,24 @@ public class TbActivate implements Serializable {
|
||||
public void setIsDel(String isDel) {
|
||||
this.isDel = isDel == null ? null : isDel.trim();
|
||||
}
|
||||
|
||||
public Integer getIsGiftPro() {
|
||||
return isGiftPro;
|
||||
}
|
||||
|
||||
public void setIsGiftPro(Integer isGiftPro) {
|
||||
this.isGiftPro = isGiftPro;
|
||||
}
|
||||
|
||||
public List<String> getGives() {
|
||||
return gives;
|
||||
}
|
||||
|
||||
public void setGives(List<String> gives) {
|
||||
if(CollectionUtils.isEmpty(gives)){
|
||||
this.gives = new ArrayList<>();
|
||||
}else {
|
||||
this.gives = gives;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 活动商品赠送表(TbActivateInRecord)实体类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-08-22 11:13:40
|
||||
*/
|
||||
public class TbActivateInRecord implements Serializable {
|
||||
private static final long serialVersionUID = -35515830201618782L;
|
||||
|
||||
private Integer id;
|
||||
/**
|
||||
* 会员id
|
||||
*/
|
||||
private Integer vipUserId;
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Integer proId;
|
||||
/**
|
||||
* 赠送数量
|
||||
*/
|
||||
private Integer num;
|
||||
/**
|
||||
* 未使用数量
|
||||
*/
|
||||
private Integer overNum;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Integer shopId;
|
||||
/**
|
||||
* 来源活动id
|
||||
*/
|
||||
private Integer sourceActId;
|
||||
|
||||
private Integer sourceFlowId;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
public TbActivateInRecord(Integer vipUserId, Integer proId, Integer num, Integer shopId, Integer sourceActId,Integer sourceFlowId) {
|
||||
this.vipUserId = vipUserId;
|
||||
this.proId = proId;
|
||||
this.num = num;
|
||||
this.overNum = num;
|
||||
this.shopId = shopId;
|
||||
this.sourceActId = sourceActId;
|
||||
this.sourceFlowId = sourceFlowId;
|
||||
this.createTime=new Date();
|
||||
}
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getVipUserId() {
|
||||
return vipUserId;
|
||||
}
|
||||
|
||||
public void setVipUserId(Integer vipUserId) {
|
||||
this.vipUserId = vipUserId;
|
||||
}
|
||||
|
||||
public Integer getProId() {
|
||||
return proId;
|
||||
}
|
||||
|
||||
public void setProId(Integer proId) {
|
||||
this.proId = proId;
|
||||
}
|
||||
|
||||
public Integer getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(Integer num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public Integer getOverNum() {
|
||||
return overNum;
|
||||
}
|
||||
|
||||
public void setOverNum(Integer overNum) {
|
||||
this.overNum = overNum;
|
||||
}
|
||||
|
||||
public Integer getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
|
||||
public void setShopId(Integer shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
public Integer getSourceActId() {
|
||||
return sourceActId;
|
||||
}
|
||||
|
||||
public void setSourceActId(Integer sourceActId) {
|
||||
this.sourceActId = sourceActId;
|
||||
}
|
||||
|
||||
public Integer getSourceFlowId() {
|
||||
return sourceFlowId;
|
||||
}
|
||||
|
||||
public void setSourceFlowId(Integer sourceFlowId) {
|
||||
this.sourceFlowId = sourceFlowId;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 活动赠送商品使用记录表(TbActivateOutRecord)实体类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-08-22 11:21:56
|
||||
*/
|
||||
public class TbActivateOutRecord implements Serializable {
|
||||
private static final long serialVersionUID = -54399746948905097L;
|
||||
|
||||
private Integer id;
|
||||
/**
|
||||
* 商品赠送Id
|
||||
*/
|
||||
private Integer giveId;
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Integer proId;
|
||||
/**
|
||||
* 使用数量
|
||||
*/
|
||||
private Integer useNum;
|
||||
/**
|
||||
* 退单量
|
||||
*/
|
||||
private Integer refNum;
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
private String orderId;
|
||||
//新建: create, 完成: closed, 取消:cancel,
|
||||
private String status;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
public TbActivateOutRecord(Integer giveId, Integer proId, Integer useNum, String orderId, String status) {
|
||||
this.giveId = giveId;
|
||||
this.proId = proId;
|
||||
this.useNum = useNum;
|
||||
this.orderId = orderId;
|
||||
this.status = status;
|
||||
this.createTime = new Date();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getGiveId() {
|
||||
return giveId;
|
||||
}
|
||||
|
||||
public void setGiveId(Integer giveId) {
|
||||
this.giveId = giveId;
|
||||
}
|
||||
|
||||
public Integer getProId() {
|
||||
return proId;
|
||||
}
|
||||
|
||||
public void setProId(Integer proId) {
|
||||
this.proId = proId;
|
||||
}
|
||||
|
||||
public Integer getUseNum() {
|
||||
return useNum;
|
||||
}
|
||||
|
||||
public void setUseNum(Integer useNum) {
|
||||
this.useNum = useNum;
|
||||
}
|
||||
|
||||
public Integer getRefNum() {
|
||||
return refNum;
|
||||
}
|
||||
|
||||
public void setRefNum(Integer refNum) {
|
||||
this.refNum = refNum;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 活动赠送商品表(TbActivateProduct)实体类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-08-20 15:15:01
|
||||
*/
|
||||
public class TbActivateProduct implements Serializable {
|
||||
private static final long serialVersionUID = 592370528166603965L;
|
||||
|
||||
private Integer id;
|
||||
/**
|
||||
* 活动Id
|
||||
*/
|
||||
private Integer activateId;
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Integer productId;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer num;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getActivateId() {
|
||||
return activateId;
|
||||
}
|
||||
|
||||
public void setActivateId(Integer activateId) {
|
||||
this.activateId = activateId;
|
||||
}
|
||||
|
||||
public Integer getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Integer productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Integer getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(Integer num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ public class TbCashierCart implements Serializable {
|
||||
private Long updatedAt;
|
||||
private Integer userId;
|
||||
private String tableId;
|
||||
private Byte isVip;
|
||||
private TbProductSpec tbProductSpec;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class TbConsInfo implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
private Integer shopId;
|
||||
|
||||
private Integer conTypeId;
|
||||
|
||||
private String conTypeName;
|
||||
|
||||
private String conCode;
|
||||
|
||||
private String conName;
|
||||
|
||||
private BigDecimal stockNumber;
|
||||
|
||||
private String conUnit;
|
||||
|
||||
private BigDecimal lasterInStock;
|
||||
|
||||
private BigDecimal conWarning;
|
||||
|
||||
private BigDecimal stockConsume;
|
||||
|
||||
private String status;
|
||||
|
||||
private BigDecimal price;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private String isCheck;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
|
||||
public void setShopId(Integer shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
public Integer getConTypeId() {
|
||||
return conTypeId;
|
||||
}
|
||||
|
||||
public void setConTypeId(Integer conTypeId) {
|
||||
this.conTypeId = conTypeId;
|
||||
}
|
||||
|
||||
public String getConTypeName() {
|
||||
return conTypeName;
|
||||
}
|
||||
|
||||
public void setConTypeName(String conTypeName) {
|
||||
this.conTypeName = conTypeName == null ? null : conTypeName.trim();
|
||||
}
|
||||
|
||||
public String getConCode() {
|
||||
return conCode;
|
||||
}
|
||||
|
||||
public void setConCode(String conCode) {
|
||||
this.conCode = conCode == null ? null : conCode.trim();
|
||||
}
|
||||
|
||||
public String getConName() {
|
||||
return conName;
|
||||
}
|
||||
|
||||
public void setConName(String conName) {
|
||||
this.conName = conName == null ? null : conName.trim();
|
||||
}
|
||||
|
||||
public BigDecimal getStockNumber() {
|
||||
return stockNumber;
|
||||
}
|
||||
|
||||
public void setStockNumber(BigDecimal stockNumber) {
|
||||
this.stockNumber = stockNumber;
|
||||
}
|
||||
|
||||
public String getConUnit() {
|
||||
return conUnit;
|
||||
}
|
||||
|
||||
public void setConUnit(String conUnit) {
|
||||
this.conUnit = conUnit == null ? null : conUnit.trim();
|
||||
}
|
||||
|
||||
public BigDecimal getLasterInStock() {
|
||||
return lasterInStock;
|
||||
}
|
||||
|
||||
public void setLasterInStock(BigDecimal lasterInStock) {
|
||||
this.lasterInStock = lasterInStock;
|
||||
}
|
||||
|
||||
public BigDecimal getConWarning() {
|
||||
return conWarning;
|
||||
}
|
||||
|
||||
public void setConWarning(BigDecimal conWarning) {
|
||||
this.conWarning = conWarning;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public BigDecimal getStockConsume() {
|
||||
return stockConsume;
|
||||
}
|
||||
|
||||
public void setStockConsume(BigDecimal stockConsume) {
|
||||
this.stockConsume = stockConsume;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public String getIsCheck() {
|
||||
return isCheck;
|
||||
}
|
||||
|
||||
public void setIsCheck(String isCheck) {
|
||||
this.isCheck = isCheck;
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,8 @@ public class TbOrderDetail implements Serializable {
|
||||
|
||||
private Integer num;
|
||||
|
||||
private Byte isVip;
|
||||
|
||||
private String productName;
|
||||
private String status;
|
||||
|
||||
@@ -35,6 +37,7 @@ public class TbOrderDetail implements Serializable {
|
||||
|
||||
private BigDecimal priceAmount;
|
||||
private BigDecimal packAmount;
|
||||
private String remark;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,12 +101,16 @@ public class TbOrderInfo implements Serializable {
|
||||
private List<TbOrderDetail> detailList;
|
||||
private String winnnerNo;
|
||||
private String isWinner;
|
||||
private String shopName;
|
||||
|
||||
private String useType;
|
||||
|
||||
|
||||
//根据状态返回 需付款 已付款 未付款 已退
|
||||
private String description;
|
||||
|
||||
public void setDescription() {
|
||||
public void setDescription(String shopName) {
|
||||
this.shopName = shopName;
|
||||
switch (status) {
|
||||
case "closed":
|
||||
this.description = "已付款";
|
||||
@@ -186,4 +190,4 @@ public class TbOrderInfo implements Serializable {
|
||||
this.createdAt = System.currentTimeMillis();
|
||||
this.isAccepted = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,6 +137,9 @@ public class TbProduct implements Serializable {
|
||||
private Integer stockNumber;
|
||||
private Integer suit;
|
||||
|
||||
//是否可售 1 可售 0非可售
|
||||
private Integer isSale = 1;
|
||||
|
||||
|
||||
public String getImages() {
|
||||
return images;
|
||||
@@ -672,4 +675,12 @@ public class TbProduct implements Serializable {
|
||||
public void setSuit(Integer suit) {
|
||||
this.suit = suit;
|
||||
}
|
||||
|
||||
public Integer getIsSale() {
|
||||
return isSale;
|
||||
}
|
||||
|
||||
public void setIsSale(Integer isSale) {
|
||||
this.isSale = isSale;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,15 @@ public class TbProductGroup implements Serializable {
|
||||
|
||||
private String productIds;
|
||||
|
||||
//是否可售 1 可售 0非可售
|
||||
private Integer isSale = 1;
|
||||
//是否使用时间管控 0不使用 1使用
|
||||
private Integer useTime = 0;
|
||||
|
||||
private String saleStartTime;
|
||||
|
||||
private String saleEndTime;
|
||||
|
||||
|
||||
|
||||
@Transient
|
||||
@@ -144,4 +153,37 @@ public class TbProductGroup implements Serializable {
|
||||
public void setProductIds(String productIds) {
|
||||
this.productIds = productIds == null ? null : productIds.trim();
|
||||
}
|
||||
|
||||
|
||||
public Integer getUseTime() {
|
||||
return useTime;
|
||||
}
|
||||
|
||||
public void setUseTime(Integer useTime) {
|
||||
this.useTime = useTime;
|
||||
}
|
||||
|
||||
public String getSaleStartTime() {
|
||||
return saleStartTime;
|
||||
}
|
||||
|
||||
public void setSaleStartTime(String saleStartTime) {
|
||||
this.saleStartTime = saleStartTime;
|
||||
}
|
||||
|
||||
public String getSaleEndTime() {
|
||||
return saleEndTime;
|
||||
}
|
||||
|
||||
public void setSaleEndTime(String saleEndTime) {
|
||||
this.saleEndTime = saleEndTime;
|
||||
}
|
||||
|
||||
public Integer getIsSale() {
|
||||
return isSale;
|
||||
}
|
||||
|
||||
public void setIsSale(Integer isSale) {
|
||||
this.isSale = isSale;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class TbProskuCon implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
private Integer shopId;
|
||||
|
||||
private Integer productId;
|
||||
|
||||
private Integer productSkuId;
|
||||
|
||||
private Integer conInfoId;
|
||||
|
||||
private BigDecimal surplusStock;
|
||||
|
||||
private String status;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
|
||||
public void setShopId(Integer shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
public Integer getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Integer productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Integer getProductSkuId() {
|
||||
return productSkuId;
|
||||
}
|
||||
|
||||
public void setProductSkuId(Integer productSkuId) {
|
||||
this.productSkuId = productSkuId;
|
||||
}
|
||||
|
||||
public Integer getConInfoId() {
|
||||
return conInfoId;
|
||||
}
|
||||
|
||||
public void setConInfoId(Integer conInfoId) {
|
||||
this.conInfoId = conInfoId;
|
||||
}
|
||||
|
||||
public BigDecimal getSurplusStock() {
|
||||
return surplusStock;
|
||||
}
|
||||
|
||||
public void setSurplusStock(BigDecimal surplusStock) {
|
||||
this.surplusStock = surplusStock;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status == null ? null : status.trim();
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* (TbShopAd)实体类
|
||||
*
|
||||
* @author GYJ
|
||||
* @since 2024-08-19 14:25:09
|
||||
*/
|
||||
@Data
|
||||
public class TbShopAd implements Serializable {
|
||||
private static final long serialVersionUID = -34028307481923067L;
|
||||
/**
|
||||
* 自增id
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 店铺id,如果是通用广告则为0
|
||||
*/
|
||||
private Integer shopId;
|
||||
/**
|
||||
* 广告图片地址
|
||||
*/
|
||||
private String imgUrl;
|
||||
/**
|
||||
* 跳转页面路径
|
||||
*/
|
||||
private String linkPath;
|
||||
/**
|
||||
* 广告展示圆角
|
||||
*/
|
||||
private Integer borderRadius;
|
||||
/**
|
||||
* 弹窗展示位置:home首页,make_order点餐页
|
||||
*/
|
||||
private String showPosition;
|
||||
/**
|
||||
* 显示频率:only_one 仅首次展示, every_show 每次打开都展示,every_day 每天展示一次,three_day 每三天展示一次, seven_day 每七天展示一次, thirty_day 没30天展示一次
|
||||
*/
|
||||
private String frequency;
|
||||
/**
|
||||
* 广告状态:0未启用,1已启用
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 店铺扩展信息(TbShopExtend)实体类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-08-21 09:40:26
|
||||
*/
|
||||
public class TbShopExtend implements Serializable {
|
||||
private static final long serialVersionUID = -25782280496188600L;
|
||||
/**
|
||||
* 自增id
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 商户Id
|
||||
*/
|
||||
private Integer shopId;
|
||||
/**
|
||||
* img:图片;text:文本;
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 自定义key
|
||||
*/
|
||||
private String autokey;
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
private String value;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
|
||||
public void setShopId(Integer shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAutokey() {
|
||||
return autokey;
|
||||
}
|
||||
|
||||
public void setAutokey(String autokey) {
|
||||
this.autokey = autokey;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -111,6 +111,8 @@ public class TbShopInfo implements Serializable {
|
||||
private String cities;
|
||||
private String districts;
|
||||
|
||||
private String isCustom;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -63,7 +65,18 @@ public class TbShopUser implements Serializable {
|
||||
private Long updatedAt;
|
||||
|
||||
private String miniOpenId;
|
||||
private String shopName;
|
||||
private String shopName="";
|
||||
private String lat="";
|
||||
private String lng="";
|
||||
private String address="";
|
||||
|
||||
@Transient
|
||||
private String isUser;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -307,4 +320,36 @@ public class TbShopUser implements Serializable {
|
||||
public void setMiniOpenId(String miniOpenId) {
|
||||
this.miniOpenId = miniOpenId == null ? null : miniOpenId.trim();
|
||||
}
|
||||
|
||||
public String getIsUser() {
|
||||
return isUser;
|
||||
}
|
||||
|
||||
public void setIsUser(String isUser) {
|
||||
this.isUser = isUser;
|
||||
}
|
||||
|
||||
public String getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(String lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public String getLng() {
|
||||
return lng;
|
||||
}
|
||||
|
||||
public void setLng(String lng) {
|
||||
this.lng = lng;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,11 @@ public class TbShopUserFlow implements Serializable {
|
||||
|
||||
private String type;
|
||||
|
||||
|
||||
private String isReturn;
|
||||
|
||||
private String remark;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
@@ -86,4 +91,20 @@ public class TbShopUserFlow implements Serializable {
|
||||
public void setType(String type) {
|
||||
this.type = type == null ? null : type.trim();
|
||||
}
|
||||
|
||||
public String getIsReturn() {
|
||||
return isReturn;
|
||||
}
|
||||
|
||||
public void setIsReturn(String isReturn) {
|
||||
this.isReturn = isReturn;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,11 @@ import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class TbUserCoupons implements Serializable {
|
||||
public class TbUserCoupons implements Serializable{
|
||||
private Integer id;
|
||||
|
||||
private String userId;
|
||||
private String detail;
|
||||
private Integer orderId;
|
||||
|
||||
private BigDecimal couponsPrice;
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopAd;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author GYJ
|
||||
*/
|
||||
@Data
|
||||
public class TbShopAdDto {
|
||||
private Integer id;
|
||||
/**
|
||||
* 店铺id,如果是通用广告则为0
|
||||
*/
|
||||
private Integer shopId;
|
||||
/**
|
||||
* 广告图片地址
|
||||
*/
|
||||
private String imgUrl;
|
||||
/**
|
||||
* 跳转页面路径
|
||||
*/
|
||||
private String linkPath;
|
||||
/**
|
||||
* 广告展示圆角
|
||||
*/
|
||||
private Integer borderRadius;
|
||||
/**
|
||||
* 弹窗展示位置:home首页,make_order点餐页
|
||||
*/
|
||||
private String showPosition;
|
||||
/**
|
||||
* 显示频率:only_one 仅首次展示, every_show 每次打开都展示,every_day 每天展示一次,three_day 每三天展示一次, seven_day 每七天展示一次, thirty_day 没30天展示一次
|
||||
*/
|
||||
private String frequency;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Long updateTime;
|
||||
|
||||
public static List<TbShopAdDto> convertShopAdDoToDtoList(List<TbShopAd> adList) {
|
||||
return adList.stream().map(TbShopAdDto::convertShopAdDoToDto).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static TbShopAdDto convertShopAdDoToDto(TbShopAd ad) {
|
||||
TbShopAdDto dto = new TbShopAdDto();
|
||||
dto.setId(ad.getId());
|
||||
dto.setShopId(ad.getShopId());
|
||||
dto.setImgUrl(ad.getImgUrl());
|
||||
dto.setLinkPath(ad.getLinkPath());
|
||||
dto.setBorderRadius(ad.getBorderRadius());
|
||||
dto.setShowPosition(ad.getShowPosition());
|
||||
dto.setFrequency(ad.getFrequency());
|
||||
dto.setUpdateTime(ad.getUpdateTime().getTime());
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserCouponDto extends BasePageDto{
|
||||
private Integer userId;
|
||||
private Integer status;
|
||||
private Integer shopId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OpenMemberVo {
|
||||
private Integer id;
|
||||
private Integer shopId;
|
||||
private String telephone;
|
||||
private String nickName;
|
||||
private String birthDay;
|
||||
private String headImg;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class UserCouponVo {
|
||||
/**
|
||||
* 2 会员商品卷
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 卷描述
|
||||
*/
|
||||
private String detail;
|
||||
private String shopName;
|
||||
/**
|
||||
* 优惠金额
|
||||
*/
|
||||
private BigDecimal couponsPrice = BigDecimal.ZERO;
|
||||
/**
|
||||
* 多少可用
|
||||
*/
|
||||
private BigDecimal couponsAmount = BigDecimal.ZERO;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer num;
|
||||
/**
|
||||
* 卷状态 0 未使用
|
||||
*/
|
||||
private String status;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbProduct;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class VipProductsLimits extends TbProduct {
|
||||
|
||||
private Integer vipLimitNumber;
|
||||
|
||||
}
|
||||
@@ -146,7 +146,8 @@ public class DefaultExceptionAdvice {
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
@ExceptionHandler(MsgException.class)
|
||||
public ResponseEntity handleException(MsgException e) {
|
||||
LOGGER.error("业务异常", e);
|
||||
// LOGGER.error("业务异常", e);
|
||||
LOGGER.error("业务异常", e.getMessage());
|
||||
Result response = Result.fail(e.getMessage());
|
||||
response.setMsg(e.getMessage());
|
||||
return new ResponseEntity<>(response, HttpStatus.OK);
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.chaozhanggui.system.cashierservice.rabbit;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.model.CategoryInfo;
|
||||
import com.chaozhanggui.system.cashierservice.model.OrderDetailPO;
|
||||
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||
import com.chaozhanggui.system.cashierservice.util.FeieyunPrintUtil;
|
||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
||||
@@ -14,12 +17,15 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -47,6 +53,10 @@ public class PrintMechineConsumer {
|
||||
|
||||
@Autowired
|
||||
private TbOrderDetailMapper tbOrderDetailMapper;
|
||||
@Autowired
|
||||
private RedisTemplate<Object, Object> redisTemplate2;
|
||||
@Autowired
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@RabbitHandler
|
||||
public void listener(String message) {
|
||||
@@ -74,6 +84,9 @@ public class PrintMechineConsumer {
|
||||
return;
|
||||
}
|
||||
|
||||
log.info("打印机列表,{}", ArrayUtil.toString(list));
|
||||
log.info("待打印订单信息, {}", orderInfo);
|
||||
|
||||
list.parallelStream().forEach(tbPrintMachineWithBLOBs->{
|
||||
if (!"network".equals(tbPrintMachineWithBLOBs.getConnectionType())) {
|
||||
log.error("非网络打印机:{},{}",tbPrintMachineWithBLOBs.getAddress(),tbPrintMachineWithBLOBs.getConnectionType());
|
||||
@@ -182,10 +195,20 @@ public class PrintMechineConsumer {
|
||||
break;
|
||||
case "one": //一菜一品
|
||||
cashierCarts = tbCashierCartMapper.selectByOrderId(orderId,"final");
|
||||
log.info("一菜一品打印,待打印信息:{}", cashierCarts);
|
||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||
|
||||
|
||||
cashierCarts.parallelStream().forEach(it -> {
|
||||
|
||||
// 取餐号不为空为代客下单
|
||||
if ("postPay".equals(orderInfo.getUseType()) && StrUtil.isNotBlank(it.getMasterId())) {
|
||||
log.info("--------------------代客下单 打印一菜一品");
|
||||
printTicket(Integer.valueOf(orderId), categoryInfos, tbPrintMachineWithBLOBs, orderInfo);
|
||||
return;
|
||||
}
|
||||
log.info("--------------------非代客下单 打印一菜一品");
|
||||
|
||||
String categoryId;
|
||||
if(ObjectUtil.isEmpty(it.getCategoryId())){
|
||||
categoryId= tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||
@@ -220,6 +243,115 @@ public class PrintMechineConsumer {
|
||||
}
|
||||
}
|
||||
|
||||
private void printTicket(Integer orderId, List<CategoryInfo> categoryInfos, TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, TbOrderInfo orderInfo) {
|
||||
String printKey = RedisCst.ORDER_PRINT_PRO + orderId;
|
||||
AtomicReference<Set<Object>> printProductSet = new AtomicReference<>(redisTemplate2.opsForSet().members(printKey));
|
||||
List<TbOrderDetail> tbOrderDetails = tbOrderDetailMapper.selectAllByOrderId(orderId);
|
||||
log.info("--------------------订单detail列表: {}", tbOrderDetails);
|
||||
log.info("--------------------缓存打印printProductSet: {}", printProductSet);
|
||||
if (!tbOrderDetails.isEmpty()) {
|
||||
|
||||
// 重置打印数据
|
||||
redisTemplate2.delete(printKey);
|
||||
tbOrderDetails.forEach(it -> {
|
||||
log.info("开始打印一菜一品票据,:{}", it.getProductName());
|
||||
String categoryId = tbProductMapper.selectByPrimaryKey(it.getProductId()).getCategoryId();
|
||||
|
||||
long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
|
||||
log.info("获取当前类别是否未打印类别:{}", count);
|
||||
if (count > 0) {
|
||||
|
||||
// 统计已打数量
|
||||
int printerNum = 0;
|
||||
boolean isReturn = false;
|
||||
String key = RedisCst.ORDER_PRINT + orderId + ":" + it.getProductId() + ":" + it.getProductSkuId();
|
||||
String info = stringRedisTemplate.opsForValue().get(key);
|
||||
stringRedisTemplate.opsForValue().set(key, String.valueOf(it.getNum()), 60 * 60 * 24, TimeUnit.SECONDS);
|
||||
|
||||
log.info("--------------------已打印数量: {}", info);
|
||||
|
||||
// 删除已打印数据
|
||||
if (printProductSet.get() != null) {
|
||||
printProductSet.set(printProductSet.get().stream().filter(r -> {
|
||||
TbOrderDetail detail = (TbOrderDetail) r;
|
||||
return !detail.getProductSkuId().equals(it.getProductSkuId()) || !detail.getProductId().equals(it.getProductId());
|
||||
}).collect(Collectors.toSet()));
|
||||
}
|
||||
|
||||
|
||||
if (info != null) {
|
||||
isReturn = it.getNum() - Integer.parseInt(info) < 0;
|
||||
printerNum = it.getNum() - Integer.parseInt(info);
|
||||
}else {
|
||||
printerNum = it.getNum();
|
||||
}
|
||||
|
||||
log.info("--------------------isReturn: {}, 数量: {}", isReturn, printerNum);
|
||||
|
||||
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(it.getProductSkuId());
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
|
||||
// 将已打印信息加入redis
|
||||
it.setRemark(remark);
|
||||
redisTemplate2.opsForSet().add(printKey, it);
|
||||
redisTemplate2.expire(printKey, 24, TimeUnit.HOURS);
|
||||
|
||||
// 已打印不再打印
|
||||
if (info != null && printerNum == 0) {
|
||||
log.info("--------------------------订单已打印,跳过打印");
|
||||
return;
|
||||
}
|
||||
|
||||
String data;
|
||||
String voiceJson;
|
||||
if (isReturn) {
|
||||
|
||||
data = PrinterUtils.getPrintData("return",
|
||||
StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getMasterId() : orderInfo.getTableName(),
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), Math.abs(printerNum), remark);
|
||||
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
|
||||
|
||||
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
|
||||
} else {
|
||||
data = PrinterUtils.getPrintData("", orderInfo.getMasterId(),
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(),
|
||||
printerNum, remark);
|
||||
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// 已删除的商品打印退款信息
|
||||
if (printProductSet.get() != null) {
|
||||
printProductSet.get().forEach(item -> {
|
||||
log.info("已删除订单,打印退款票据, {}", item);
|
||||
TbOrderDetail orderDetail = (TbOrderDetail) item;
|
||||
String data = PrinterUtils.getPrintData("return",
|
||||
StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getMasterId() : orderInfo.getTableName(),
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum(), orderDetail.getRemark());
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
|
||||
String key = RedisCst.ORDER_PRINT + orderId + ":" + orderDetail.getProductId() + ":" + orderDetail.getProductSkuId();
|
||||
log.info("删除商品数量记录key, {}", key);
|
||||
stringRedisTemplate.delete(key);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -62,4 +62,10 @@ public interface RabbitConstants {
|
||||
// 库存记录交换机
|
||||
String EXCHANGE_STOCK_RECORD = "exchange.stock.record";
|
||||
String ROUTING_STOCK_RECORD_SALE = "routing.stock.record.sale";
|
||||
|
||||
|
||||
public static final String BALANCE_PUT="balance_put";
|
||||
public static final String BALANCE_QUEUE_PUT="balance_queue_put";
|
||||
|
||||
public static final String BALANCE_ROUTINGKEY_PUT="balance_routingkey_put";
|
||||
}
|
||||
|
||||
@@ -58,6 +58,15 @@ public class RabbitProducer implements RabbitTemplate.ConfirmCallback {
|
||||
rabbitTemplate.convertAndSend(RabbitConstants.CONS_MSG_COLLECT_PUT, RabbitConstants.CONS_MSG_COLLECT_ROUTINGKEY_PUT, content, correlationId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void balance(String content){
|
||||
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
|
||||
rabbitTemplate.convertAndSend(RabbitConstants.BALANCE_PUT, RabbitConstants.BALANCE_ROUTINGKEY_PUT, content, correlationId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
|
||||
logger.info(" 回调id:" + correlationData);
|
||||
|
||||
@@ -96,4 +96,11 @@ public class RedisConfig {
|
||||
template.setValueSerializer(new StringRedisSerializer(Charset.forName("UTF-8")));
|
||||
return template;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RedisTemplate<Object, Object> redisTemplate2(RedisConnectionFactory factory) {
|
||||
RedisTemplate<Object, Object> template = new RedisTemplate<>();
|
||||
template.setConnectionFactory(factory);
|
||||
return template;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,4 +26,13 @@ public class RedisCst {
|
||||
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:";
|
||||
public static final String ORDER_PRINT_PRO = "ORDER_PRINT_PRODUCT:";
|
||||
public static final String ORDER_PRINT = "ORDER_PRINT:";
|
||||
|
||||
static String CURRENT_TABLE_ORDER = "CURRENT_TABLE_ORDER:";
|
||||
|
||||
|
||||
public static String getCurrentOrderKey(String tableId, String shopId) {
|
||||
return CURRENT_TABLE_ORDER + shopId + ":" + tableId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,12 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
@@ -57,6 +59,9 @@ public class CartService {
|
||||
private TbMerchantAccountMapper merchantAccountMapper;
|
||||
@Autowired
|
||||
private TbUserInfoMapper userInfoMapper;
|
||||
@Autowired
|
||||
private TbShopUserMapper shopUserMapper;
|
||||
|
||||
@Autowired
|
||||
private TbOrderDetailMapper orderDetailMapper;
|
||||
@Autowired
|
||||
@@ -71,6 +76,10 @@ public class CartService {
|
||||
private final WxAccountUtil wxAccountUtil;
|
||||
|
||||
private final TbShopOpenIdMapper shopOpenIdMapper;
|
||||
@Resource
|
||||
private TbActivateInRecordService activateInRecordService;
|
||||
@Autowired
|
||||
private TbActivateOutRecordMapper outRecordMapper;
|
||||
|
||||
@Autowired
|
||||
private RabbitProducer producer;
|
||||
@@ -85,7 +94,16 @@ public class CartService {
|
||||
|
||||
private final RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
public CartService(TbUserShopMsgMapper tbUserShopMsgMapper, WechatUtil wechatUtil, WxAccountUtil wxAccountUtil, TbShopOpenIdMapper shopOpenIdMapper, ProductService productService, TbProductMapper tbProductMapper, RedisTemplate<String, Object> redisTemplate) {
|
||||
private final StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
|
||||
@Autowired
|
||||
private TbProskuConMapper tbProskuConMapper;
|
||||
|
||||
@Autowired
|
||||
TbConsInfoMapper tbConsInfoMapper;
|
||||
|
||||
public CartService(TbUserShopMsgMapper tbUserShopMsgMapper, WechatUtil wechatUtil, WxAccountUtil wxAccountUtil, TbShopOpenIdMapper shopOpenIdMapper, ProductService productService, TbProductMapper tbProductMapper, RedisTemplate<String, Object> redisTemplate, StringRedisTemplate stringRedisTemplate) {
|
||||
this.tbUserShopMsgMapper = tbUserShopMsgMapper;
|
||||
this.wechatUtil = wechatUtil;
|
||||
this.wxAccountUtil = wxAccountUtil;
|
||||
@@ -93,6 +111,7 @@ public class CartService {
|
||||
this.productService = productService;
|
||||
this.tbProductMapper = tbProductMapper;
|
||||
this.redisTemplate = redisTemplate;
|
||||
this.stringRedisTemplate = stringRedisTemplate;
|
||||
}
|
||||
|
||||
public void initCart(JSONObject jsonObject) {
|
||||
@@ -115,6 +134,7 @@ public class CartService {
|
||||
if (!CollectionUtils.isEmpty(tbCashierCarts)) {
|
||||
for (TbCashierCart cashierCart : tbCashierCarts) {
|
||||
array.add(cashierCart);
|
||||
if(cashierCart.getIsVip().equals((byte) 1)) continue;
|
||||
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
}
|
||||
redisUtil.saveMessage(RedisCst.TABLE_CART.concat(key), array.toString());
|
||||
@@ -141,8 +161,9 @@ public class CartService {
|
||||
String skuId = jsonObject.getString("skuId");
|
||||
Integer type = jsonObject.getInteger("type");
|
||||
Integer buyNum = jsonObject.getInteger("num");
|
||||
Integer isVip = jsonObject.getInteger("isVip");
|
||||
if (StringUtils.isBlank(tableId) || StringUtils.isBlank(shopId) || StringUtils.isBlank(productId)
|
||||
|| StringUtils.isBlank(skuId) || type==null || buyNum == null) {
|
||||
|| StringUtils.isBlank(skuId) || type == null || buyNum == null) {
|
||||
return Result.fail("参数缺失");
|
||||
}
|
||||
String key = tableId + "-" + shopId;
|
||||
@@ -153,24 +174,39 @@ public class CartService {
|
||||
}
|
||||
// 判断商品是否已下架
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = productSkuMapper.selectByPrimaryKey(Integer.valueOf(skuId));
|
||||
if (tbProductSkuWithBLOBs ==null || tbProductSkuWithBLOBs.getIsGrounding().equals(0)) {
|
||||
rmCart(jsonObject,skuId,key);
|
||||
if (tbProductSkuWithBLOBs == null || tbProductSkuWithBLOBs.getIsGrounding().equals(0)) {
|
||||
rmCart(jsonObject, skuId, key);
|
||||
return Result.fail("商品已下架");
|
||||
}
|
||||
if (tbProduct.getIsStock() == 1) {
|
||||
// 1:共享库存 0:独立库存
|
||||
if (Integer.valueOf(tbProduct.getIsDistribute()).equals(1)) {
|
||||
if (tbProduct.getIsPauseSale() == 1) {//是否售罄
|
||||
rmCart(jsonObject,skuId,key);
|
||||
rmCart(jsonObject, skuId, key);
|
||||
return Result.fail("该商品已售罄");
|
||||
}
|
||||
} else {
|
||||
if (tbProductSkuWithBLOBs.getIsPauseSale() == 1) {//是否售罄
|
||||
rmCart(jsonObject,skuId,key);
|
||||
rmCart(jsonObject, skuId, key);
|
||||
return Result.fail("该商品已售罄");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<TbProskuCon> proskuConList = tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(Integer.valueOf(skuId), Integer.valueOf(shopId), Integer.valueOf(productId));
|
||||
if (Objects.nonNull(proskuConList) && proskuConList.size() > 0) {
|
||||
for (TbProskuCon proskuCon : proskuConList) {
|
||||
if ("1".equals(proskuCon.getStatus())) {
|
||||
TbConsInfo consInfo = tbConsInfoMapper.selectByPrimaryKey(proskuCon.getConInfoId());
|
||||
if ("1".equals(consInfo.getIsCheck())) {
|
||||
if (N.gt(proskuCon.getSurplusStock(), consInfo.getStockNumber().abs().subtract(consInfo.getStockConsume().abs()))) {
|
||||
return Result.fail("商品:".concat(tbProduct.getName()).concat("对应的:").concat(consInfo.getConName()).concat("耗材不足"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
BigDecimal amount = BigDecimal.ZERO;
|
||||
try{
|
||||
@@ -179,7 +215,7 @@ public class CartService {
|
||||
if (Objects.isNull(array) || array.isEmpty()) {
|
||||
if (type == 1) {
|
||||
TbCashierCart cashierCart = addCart(productId, skuId,
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId);
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId,isVip);
|
||||
jsonArray.add(cashierCart);
|
||||
amount = amount.add(new BigDecimal(cashierCart.getNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
}
|
||||
@@ -188,15 +224,21 @@ public class CartService {
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject object = array.getJSONObject(i);
|
||||
TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(object.toJSONString(), TbCashierCart.class);
|
||||
if (cashierCart.getSkuId().equals(skuId)) {
|
||||
|
||||
if (cashierCart.getSkuId().equals(skuId) && cashierCart.getIsVip().intValue() == isVip) {
|
||||
cashierCart.setTotalNumber(buyNum);
|
||||
cashierCart.setNumber(buyNum);
|
||||
if (type == 0 && tbProductSkuWithBLOBs.getSuit() != null && tbProductSkuWithBLOBs.getSuit() > 1 && cashierCart.getNumber() < tbProductSkuWithBLOBs.getSuit()) {
|
||||
if (type == 0 && isVip == 0 && tbProductSkuWithBLOBs.getSuit() != null
|
||||
&& tbProductSkuWithBLOBs.getSuit() > 1 && cashierCart.getNumber() < tbProductSkuWithBLOBs.getSuit()) {
|
||||
cashierCartMapper.deleteByPrimaryKey(cashierCart.getId());
|
||||
continue;
|
||||
}
|
||||
if (cashierCart.getNumber() > 0) {
|
||||
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
if (isVip == 1) {
|
||||
cashierCart.setTotalAmount(BigDecimal.ZERO);
|
||||
} else {
|
||||
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
}
|
||||
cashierCart.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
cashierCartMapper.updateByPrimaryKeySelective(cashierCart);
|
||||
} else {
|
||||
@@ -210,7 +252,7 @@ public class CartService {
|
||||
}
|
||||
if (flag && type == 1) {
|
||||
TbCashierCart cashierCart = addCart(productId, skuId,
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId);
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId,isVip);
|
||||
jsonArray.add(cashierCart);
|
||||
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
}
|
||||
@@ -218,9 +260,11 @@ public class CartService {
|
||||
} else {
|
||||
if (type == 1) {
|
||||
TbCashierCart cashierCart = addCart(productId, skuId,
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId);
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId,isVip);
|
||||
jsonArray.add(cashierCart);
|
||||
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
if (isVip != 1) {
|
||||
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (MsgException e){
|
||||
@@ -238,7 +282,7 @@ public class CartService {
|
||||
jsonObject1.put("reqData", jsonObject);
|
||||
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, "", false);
|
||||
} catch (Exception e) {
|
||||
log.error("长链接错误 createCart{}", e.getMessage());
|
||||
log.error("长链接错误 createCart {}", e.getMessage());
|
||||
}
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
@@ -353,13 +397,13 @@ public class CartService {
|
||||
}
|
||||
}
|
||||
|
||||
private TbCashierCart addCart(String productId, String skuId, Integer userId, Integer num, String tableId, String shopId) throws Exception{
|
||||
private TbCashierCart addCart(String productId, String skuId, Integer userId, Integer num, String tableId, String shopId,Integer isVip) throws Exception{
|
||||
try {
|
||||
TbProduct product = productMapper.selectById(Integer.valueOf(productId));
|
||||
String key = tableId + "-" + shopId;
|
||||
TbProductSkuWithBLOBs productSku = productSkuMapper.selectByPrimaryKey(Integer.valueOf(skuId));
|
||||
TbCashierCart cashierCart = new TbCashierCart();
|
||||
if (productSku.getSuit() != null && productSku.getSuit() > 1) {
|
||||
if (productSku.getSuit() != null && productSku.getSuit() > 1 && isVip != 1) {
|
||||
if (product.getIsStock() == 1) {
|
||||
boolean isSale = false;
|
||||
// 1:共享库存 0:独立库存
|
||||
@@ -409,7 +453,14 @@ public class CartService {
|
||||
cashierCart.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
cashierCart.setPackFee(BigDecimal.ZERO);
|
||||
cashierCart.setRefundNumber(0);
|
||||
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(productSku.getSalePrice().add(cashierCart.getPackFee())));
|
||||
if(isVip==1){
|
||||
cashierCart.setIsVip(Byte.parseByte("1"));
|
||||
cashierCart.setTotalAmount(BigDecimal.ZERO);
|
||||
cashierCart.setSalePrice(BigDecimal.ZERO);
|
||||
}else {
|
||||
cashierCart.setIsVip(Byte.parseByte("0"));
|
||||
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(productSku.getSalePrice().add(cashierCart.getPackFee())));
|
||||
}
|
||||
cashierCartMapper.insert(cashierCart);
|
||||
|
||||
|
||||
@@ -422,7 +473,7 @@ public class CartService {
|
||||
|
||||
return cashierCart;
|
||||
} catch (Exception e) {
|
||||
log.error("长链接错误 addCart{}", e.getMessage());
|
||||
log.error("长链接错误 addCart {}", e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -453,9 +504,36 @@ public class CartService {
|
||||
if (tbUserInfo == null) {
|
||||
MsgException.throwException("生成订单失败");
|
||||
}
|
||||
TbShopUser tbShopUser = shopUserMapper.selectByUserIdAndShopId(userId, shopId);
|
||||
boolean isVip= false;
|
||||
if (tbShopUser != null && tbShopUser.getIsVip().equals((byte) 1)) {
|
||||
isVip=true;
|
||||
}
|
||||
//校验 库存 耗材
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject object = array.getJSONObject(i);
|
||||
TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(object.toJSONString(), TbCashierCart.class);
|
||||
if (cashierCart.getIsVip().equals((byte) 1)) {
|
||||
if (isVip) {
|
||||
int i1 = activateInRecordService.queryByVipIdAndShopIdAndProId(
|
||||
Integer.valueOf(tbShopUser.getId()), Integer.valueOf(shopId), Integer.valueOf(cashierCart.getProductId()));
|
||||
if (i1 < cashierCart.getTotalNumber()) {
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
jsonObject1.put("status", "fail");
|
||||
jsonObject1.put("msg", "会员商品[" + cashierCart.getName() + "],可下单数量为" + i1);
|
||||
jsonObject1.put("data", new ArrayList<>());
|
||||
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, jsonObject.getString("userId"), true);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
jsonObject1.put("status", "fail");
|
||||
jsonObject1.put("msg", "非会员用户不可下单会员商品");
|
||||
jsonObject1.put("data", new ArrayList<>());
|
||||
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, jsonObject.getString("userId"), true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
TbProductSkuWithBLOBs tbProduct = productSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
|
||||
TbProduct tbProduct1 = tbProductMapper.selectById(Integer.valueOf(tbProduct.getProductId()));
|
||||
|
||||
@@ -514,6 +592,7 @@ public class CartService {
|
||||
orderDetail.setPackAmount(cashierCart.getPackFee());
|
||||
orderDetail.setProductImg(cashierCart.getCoverImg());
|
||||
orderDetail.setStatus("unpaid");
|
||||
orderDetail.setIsVip(cashierCart.getIsVip());
|
||||
if (StringUtils.isNotEmpty(cashierCart.getOrderId())) {
|
||||
orderId = Integer.valueOf(cashierCart.getOrderId());
|
||||
}
|
||||
@@ -527,6 +606,8 @@ public class CartService {
|
||||
TbShopTable shopTable = shopTableMapper.selectQRcode(jsonObject.getString("tableId"));
|
||||
//生成订单
|
||||
TbOrderInfo orderInfo = orderInfoMapper.selectByPrimaryKey(orderId);
|
||||
|
||||
//优惠卷
|
||||
String isBuyYhq = "false";
|
||||
String isuseYhq = "false";
|
||||
if (jsonObject.containsKey("isYhq") && jsonObject.getString("isYhq").equals("1")) {
|
||||
@@ -574,28 +655,7 @@ public class CartService {
|
||||
couponAmount = userCoupons.getCouponsAmount();
|
||||
} else {
|
||||
TbUserCoupons userCoupons = userCouponsMapper.selectByPrimaryKey(couponsId);
|
||||
if (Objects.isNull(userCoupons) || !userCoupons.getStatus().equals("0")) {
|
||||
log.info("开始处理订单");
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
jsonObject1.put("status", "fail");
|
||||
jsonObject1.put("msg", "优惠券已使用");
|
||||
jsonObject1.put("type", jsonObject.getString("type"));
|
||||
jsonObject1.put("data", "");
|
||||
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, jsonObject.getString("userId"), true);
|
||||
log.info("消息推送");
|
||||
return;
|
||||
}
|
||||
if (N.gt(userCoupons.getCouponsAmount(), totalAmount)) {
|
||||
log.info("开始处理订单");
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
jsonObject1.put("status", "fail");
|
||||
jsonObject1.put("msg", "订单金额小于优惠价金额");
|
||||
jsonObject1.put("type", jsonObject.getString("type"));
|
||||
jsonObject1.put("data", "");
|
||||
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, jsonObject.getString("userId"), true);
|
||||
log.info("消息推送");
|
||||
return;
|
||||
}
|
||||
|
||||
totalAmount = totalAmount.subtract(userCoupons.getCouponsAmount());
|
||||
userCoupons.setStatus("1");
|
||||
userCoupons.setEndTime(DateUtils.getNewDate(new Date(), 5, 30));
|
||||
@@ -632,6 +692,7 @@ public class CartService {
|
||||
orderInfo.setIsBuyCoupon(isBuyYhq);
|
||||
orderInfo.setIsUseCoupon(isuseYhq);
|
||||
orderInfo.setRemark(remark);
|
||||
orderInfo.setUserId(userId);
|
||||
orderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
||||
|
||||
} else {
|
||||
@@ -643,6 +704,7 @@ public class CartService {
|
||||
orderInfo.setIsUseCoupon(isuseYhq);
|
||||
orderInfo.setUserCouponAmount(couponAmount);
|
||||
orderInfo.setRemark(remark);
|
||||
orderInfo.setUserId(userId);
|
||||
|
||||
JSONObject object = new JSONObject();
|
||||
String outNumber = redisUtil.getMessage(RedisCst.OUT_NUMBER.concat(jsonObject.getString("shopId")));
|
||||
@@ -671,9 +733,30 @@ public class CartService {
|
||||
orderDetail.setOrderId(orderId);
|
||||
orderDetailMapper.insert(orderDetail);
|
||||
}
|
||||
List<TbActivateOutRecord> outRecords = new ArrayList<>();
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject object = array.getJSONObject(i);
|
||||
TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(object.toJSONString(), TbCashierCart.class);
|
||||
if (cashierCart.getIsVip().equals((byte) 1)) {
|
||||
List<TbActivateInRecord> actInRecords = activateInRecordService.queryAllByVipIdAndShopIdAndProId(
|
||||
Integer.valueOf(tbShopUser.getId()), Integer.valueOf(orderInfo.getShopId()), Integer.valueOf(cashierCart.getProductId()));
|
||||
Integer totalNumber = cashierCart.getTotalNumber();
|
||||
for (TbActivateInRecord actInRecord : actInRecords) {
|
||||
if (totalNumber > 0) {
|
||||
if (actInRecord.getOverNum() > totalNumber) {
|
||||
TbActivateOutRecord outRecord = new TbActivateOutRecord(actInRecord.getId(), actInRecord.getProId(), totalNumber, orderInfo.getId().toString(), "create");
|
||||
outRecords.add(outRecord);
|
||||
activateInRecordService.updateOverNumById(actInRecord.getId(), actInRecord.getOverNum() - totalNumber);
|
||||
break;
|
||||
} else {
|
||||
TbActivateOutRecord outRecord = new TbActivateOutRecord(actInRecord.getId(), actInRecord.getProId(), actInRecord.getOverNum(), orderInfo.getId().toString(), "create");
|
||||
outRecords.add(outRecord);
|
||||
activateInRecordService.updateOverNumById(actInRecord.getId(), 0);
|
||||
totalNumber = totalNumber - actInRecord.getOverNum();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cashierCart.setUpdatedAt(System.currentTimeMillis());
|
||||
cashierCart.setOrderId(orderId + "");
|
||||
cashierCart.setStatus("closed");
|
||||
@@ -683,7 +766,7 @@ public class CartService {
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(!CollectionUtils.isEmpty(outRecords)) outRecordMapper.insertBatch(outRecords);
|
||||
// 发送mq消息
|
||||
JSONObject jsonObject2 = new JSONObject();
|
||||
jsonObject2.put("orderId", orderInfo.getId());
|
||||
@@ -725,7 +808,7 @@ public class CartService {
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info("长链接错误 addCart{}", e.getMessage());
|
||||
log.info("长链接错误 createOrder{}", e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -537,21 +537,23 @@ public class LoginService {
|
||||
) {
|
||||
return Result.fail("参数错误");
|
||||
}
|
||||
|
||||
TbUserInfo userInfo = tbUserInfoMapper.selectByPrimaryKey(Integer.valueOf(userId));
|
||||
boolean flag = validate(map.get("code").toString(), userInfo.getTelephone());
|
||||
if (!flag) {
|
||||
return Result.fail("验证码错误");
|
||||
String phone = userInfo.getTelephone();
|
||||
if (map.containsKey("vipId")) {
|
||||
TbShopUser tbShopUser = tbShopUserMapper.selectByPrimaryKey(map.get("vipId").toString());
|
||||
phone = tbShopUser.getTelephone();
|
||||
}
|
||||
if (StringUtils.isBlank(phone)) return Result.fail("设置密码失败,手机号获取为空");
|
||||
|
||||
boolean flag = validate(map.get("code").toString(), phone);
|
||||
|
||||
if (!flag) return Result.fail("验证码错误");
|
||||
|
||||
userInfo.setIsPwd("1");
|
||||
userInfo.setPwd(MD5Utils.md5(map.get("pwd").toString()));
|
||||
userInfo.setUpdatedAt(System.currentTimeMillis());
|
||||
tbUserInfoMapper.updateByPrimaryKey(userInfo);
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -581,11 +583,4 @@ public class LoginService {
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
System.out.println(RandomUtil.randomNumbers(10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,6 +212,14 @@ public class OrderService {
|
||||
return Result.success(CodeEnum.ENCRYPT, orderVo);
|
||||
}
|
||||
|
||||
public Result rmOrder(Integer orderId) {
|
||||
int i = orderInfoMapper.deleteByPrimaryKey(orderId);
|
||||
if (i > 0) {
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
return Result.fail("删除失败");
|
||||
}
|
||||
|
||||
|
||||
public Result orderList(Integer userId, Integer page, Integer size, String status) {
|
||||
// TbUserInfo tbUserInfo = userInfoMapper.selectByPrimaryKey(userId);
|
||||
@@ -220,9 +228,11 @@ public class OrderService {
|
||||
// }
|
||||
PageHelper.startPage(page, size);
|
||||
List<TbOrderInfo> tbOrderInfos = orderInfoMapper.selectByUserId(userId, status);
|
||||
|
||||
String shopName = "";
|
||||
for (TbOrderInfo orderInfo : tbOrderInfos) {
|
||||
orderInfo.setDescription();
|
||||
TbShopInfo tbShopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getShopId()));
|
||||
shopName = tbShopInfo.getShopName();
|
||||
orderInfo.setDescription(shopName);
|
||||
List<TbOrderDetail> list = tbOrderDetailMapper.selectAllByOrderId(orderInfo.getId());
|
||||
int num = 0;
|
||||
for (TbOrderDetail orderDetail : list) {
|
||||
|
||||
@@ -31,9 +31,11 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -71,6 +73,10 @@ public class PayService {
|
||||
|
||||
@Autowired
|
||||
TbShopPayTypeMapper tbShopPayTypeMapper;
|
||||
@Autowired
|
||||
private TbActivateProductMapper actProductMapper;
|
||||
@Resource
|
||||
private TbActivateInRecordMapper activateInRecordMapper;
|
||||
|
||||
@Autowired
|
||||
private TbShopSongOrderMapper tbShopSongOrderMapper;
|
||||
@@ -111,6 +117,10 @@ public class PayService {
|
||||
|
||||
@Autowired
|
||||
TbShopUserFlowMapper tbShopUserFlowMapper;
|
||||
@Resource
|
||||
private TbActivateInRecordService activateInRecordService;
|
||||
@Autowired
|
||||
private TbActivateOutRecordMapper outRecordMapper;
|
||||
|
||||
@Value("${thirdPay.payType}")
|
||||
private String thirdPayType;
|
||||
@@ -149,6 +159,8 @@ public class PayService {
|
||||
private final TbShopSongOrderService shopSongOrderService;
|
||||
@Autowired
|
||||
private MQUtils mQUtils;
|
||||
@Autowired
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
public PayService(@Qualifier("tbShopSongOrderServiceImpl") TbShopSongOrderService shopSongOrderService) {
|
||||
this.shopSongOrderService = shopSongOrderService;
|
||||
@@ -321,6 +333,7 @@ public class PayService {
|
||||
if (ObjectUtil.isEmpty(orderInfo)) {
|
||||
return Result.fail("订单信息不存在");
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() - orderInfo.getCreatedAt() > 60 * 15 * 1000) {
|
||||
return Result.fail("订单十五分钟内有效,当前已超时,请重新下单。");
|
||||
}
|
||||
@@ -372,11 +385,12 @@ public class PayService {
|
||||
TbShopUserFlow flow = new TbShopUserFlow();
|
||||
flow.setShopUserId(Integer.valueOf(user.getId()));
|
||||
flow.setBizCode("accountPay");
|
||||
flow.setBizName("会员储值卡支付");
|
||||
flow.setBizName("余额支付");
|
||||
flow.setType("-");
|
||||
flow.setAmount(orderInfo.getOrderAmount());
|
||||
flow.setBalance(user.getAmount());
|
||||
flow.setCreateTime(new Date());
|
||||
flow.setIsReturn("0");
|
||||
tbShopUserFlowMapper.insert(flow);
|
||||
|
||||
|
||||
@@ -393,7 +407,7 @@ public class PayService {
|
||||
tbOrderDetailMapper.updateStatusByOrderId(Integer.valueOf(orderId), "closed");
|
||||
|
||||
tbOrderDetailMapper.updateStatusByOrderIdAndStatus(Integer.valueOf(orderId), "closed");
|
||||
|
||||
outRecordMapper.updateByOrderIdAndStatus(orderInfo.getId(),"closed");
|
||||
log.info("更新购物车:{}", cartCount);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
@@ -411,6 +425,24 @@ public class PayService {
|
||||
data.put("orderId", orderInfo.getId());
|
||||
data.put("plat", "miniApp");
|
||||
mQUtils.sendStockSaleMsg(data);
|
||||
|
||||
|
||||
JSONObject baObj=new JSONObject();
|
||||
baObj.put("userId",userInfo.getId());
|
||||
baObj.put("shopId",user.getShopId());
|
||||
baObj.put("amount",orderInfo.getOrderAmount());
|
||||
baObj.put("balance",user.getAmount());
|
||||
baObj.put("type","消费");
|
||||
baObj.put("time",flow.getCreateTime());
|
||||
producer.balance(baObj.toString());
|
||||
|
||||
// 为代客下单清楚当前台桌最新订单
|
||||
String currentOrderKey = RedisCst.getCurrentOrderKey(orderInfo.getTableId(), orderInfo.getShopId());
|
||||
String currentOrderId = stringRedisTemplate.opsForValue().get(currentOrderKey);
|
||||
if (currentOrderId != null && currentOrderId.equals(orderId)) {
|
||||
stringRedisTemplate.delete(currentOrderKey);
|
||||
}
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, "1");
|
||||
}
|
||||
|
||||
@@ -457,6 +489,7 @@ public class PayService {
|
||||
flow.setAmount(orderInfo.getOrderAmount());
|
||||
flow.setBalance(user.getAmount());
|
||||
flow.setCreateTime(new Date());
|
||||
flow.setIsReturn("0");
|
||||
tbShopUserFlowMapper.insert(flow);
|
||||
|
||||
for (int i = 0; i < orderInfo.getNumber(); i++) {
|
||||
@@ -868,7 +901,7 @@ public class PayService {
|
||||
|
||||
//更新子单状态
|
||||
tbOrderDetailMapper.updateStatusByOrderIdAndStatus(orderInfo.getId(), "closed");
|
||||
|
||||
outRecordMapper.updateByOrderIdAndStatus(orderInfo.getId(),"closed");
|
||||
//修改主单状态
|
||||
orderInfo.setStatus("closed");
|
||||
orderInfo.setPayType("wx_lite");
|
||||
@@ -889,6 +922,13 @@ public class PayService {
|
||||
sendOrderToClient(orderInfo);
|
||||
redisUtil.deleteByKey(RedisCst.ORDER_EXPIRED.concat(orderInfo.getId().toString()));
|
||||
|
||||
// 为代客下单清除当前台桌最新订单
|
||||
String currentOrderKey = RedisCst.getCurrentOrderKey(orderInfo.getTableId(), orderInfo.getShopId());
|
||||
String currentOrderId = stringRedisTemplate.opsForValue().get(currentOrderKey);
|
||||
if (currentOrderId != null && currentOrderId.equals(orderInfo.getId().toString())) {
|
||||
stringRedisTemplate.delete(currentOrderKey);
|
||||
}
|
||||
|
||||
// 发送mq消息并保存库存记录
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("orderId", orderInfo.getId());
|
||||
@@ -922,7 +962,7 @@ public class PayService {
|
||||
orderInfo.setPayOrderNo(payOrderNO);
|
||||
orderInfo.setPayAmount(orderInfo.getOrderAmount());
|
||||
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
||||
|
||||
outRecordMapper.updateByOrderIdAndStatus(orderInfo.getId(),"closed");
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("token", 0);
|
||||
@@ -940,6 +980,13 @@ public class PayService {
|
||||
sendOrderToClient(orderInfo);
|
||||
redisUtil.deleteByKey(RedisCst.ORDER_EXPIRED.concat(orderInfo.getId().toString()));
|
||||
|
||||
// 为代客下单清楚当前台桌最新订单
|
||||
String currentOrderKey = RedisCst.getCurrentOrderKey(orderInfo.getTableId(), orderInfo.getShopId());
|
||||
String currentOrderId = stringRedisTemplate.opsForValue().get(currentOrderKey);
|
||||
if (currentOrderId != null && currentOrderId.equals(orderInfo.getId().toString())) {
|
||||
stringRedisTemplate.delete(currentOrderKey);
|
||||
}
|
||||
|
||||
// 发送mq消息并保存库存记录
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("orderId", orderInfo.getId());
|
||||
@@ -982,7 +1029,12 @@ public class PayService {
|
||||
|
||||
public Result getActivate(String shopId, int page, int pageSize) {
|
||||
PageHelper.startPage(page, pageSize);
|
||||
List<TbActivate> list = tbActivateMapper.selectByShpopId(shopId);
|
||||
List<TbActivate> list = tbActivateMapper.selectByShopId(shopId);
|
||||
for (TbActivate tbActivate : list) {
|
||||
if (tbActivate.getIsGiftPro() == 1) {
|
||||
tbActivate.setGives(actProductMapper.queryProsByActivateId(tbActivate.getId()));
|
||||
}
|
||||
}
|
||||
PageInfo pageInfo = new PageInfo(list);
|
||||
return Result.success(CodeEnum.SUCCESS, pageInfo);
|
||||
}
|
||||
@@ -1078,43 +1130,59 @@ public class PayService {
|
||||
flow.setAmount(memberIn.getAmount());
|
||||
flow.setBalance(tbShopUser.getAmount());
|
||||
flow.setCreateTime(new Date());
|
||||
flow.setIsReturn("0");
|
||||
tbShopUserFlowMapper.insert(flow);
|
||||
TbActivate activate = tbActivateMapper.selectByAmount(tbShopUser.getShopId(), memberIn.getAmount());
|
||||
//会员活动
|
||||
giveActivate(tbShopUser,memberIn.getAmount(),flow.getId());
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("shopId", memberIn.getShopId());
|
||||
jsonObject.put("type", "wxMemberIn");
|
||||
jsonObject.put("amount", memberIn.getAmount());
|
||||
producer.putOrderCollect(jsonObject.toJSONString());
|
||||
return "success";
|
||||
}
|
||||
|
||||
public BigDecimal giveActivate(TbShopUser tbShopUser, BigDecimal memAmount,Integer flowId){
|
||||
TbActivate activate = tbActivateMapper.selectByAmount(tbShopUser.getShopId(), memAmount);
|
||||
if (ObjectUtil.isNotEmpty(activate) && ObjectUtil.isNotNull(activate)) {
|
||||
if (activate.getIsGiftPro() != null && activate.getIsGiftPro() == 1) {
|
||||
List<TbActivateProduct> tbActivateProducts = actProductMapper.queryAllByActivateId(activate.getId());
|
||||
List<TbActivateInRecord> actGiveRecords = new ArrayList<>();
|
||||
for (TbActivateProduct actPro : tbActivateProducts) {
|
||||
TbActivateInRecord record = new TbActivateInRecord(Integer.valueOf(tbShopUser.getId()), actPro.getProductId(), actPro.getNum(), Integer.valueOf(tbShopUser.getShopId()), activate.getId(),flowId);
|
||||
actGiveRecords.add(record);
|
||||
}
|
||||
activateInRecordMapper.insertBatch(actGiveRecords);
|
||||
}
|
||||
BigDecimal amount = BigDecimal.ZERO;
|
||||
switch (activate.getHandselType()) {
|
||||
case "GD":
|
||||
amount = activate.getHandselNum();
|
||||
break;
|
||||
case "RATIO":
|
||||
amount = memberIn.getAmount().multiply(activate.getHandselNum());
|
||||
amount = memAmount.multiply(activate.getHandselNum());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
tbShopUser.setAmount(tbShopUser.getAmount().add(amount));
|
||||
tbShopUser.setUpdatedAt(System.currentTimeMillis());
|
||||
tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser);
|
||||
|
||||
flow = new TbShopUserFlow();
|
||||
TbShopUserFlow flow = new TbShopUserFlow();
|
||||
flow.setShopUserId(Integer.valueOf(tbShopUser.getId()));
|
||||
flow.setBizCode("scanMemberAwardIn");
|
||||
flow.setBizName("会员充值奖励");
|
||||
flow.setBizName("充值活动奖励");
|
||||
flow.setType("+");
|
||||
flow.setAmount(amount);
|
||||
flow.setBalance(tbShopUser.getAmount());
|
||||
flow.setCreateTime(new Date());
|
||||
flow.setIsReturn("0");
|
||||
tbShopUserFlowMapper.insert(flow);
|
||||
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("shopId", memberIn.getShopId());
|
||||
jsonObject.put("type", "wxMemberIn");
|
||||
jsonObject.put("amount", memberIn.getAmount());
|
||||
producer.putOrderCollect(jsonObject.toJSONString());
|
||||
|
||||
return amount;
|
||||
}
|
||||
return "success";
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1160,42 +1228,28 @@ public class PayService {
|
||||
flow.setAmount(memberIn.getAmount());
|
||||
flow.setBalance(tbShopUser.getAmount());
|
||||
flow.setCreateTime(new Date());
|
||||
flow.setRemark(payOrderNO);
|
||||
flow.setIsReturn("0");
|
||||
tbShopUserFlowMapper.insert(flow);
|
||||
|
||||
TbActivate activate = tbActivateMapper.selectByAmount(tbShopUser.getShopId(), memberIn.getAmount());
|
||||
if (ObjectUtil.isNotEmpty(activate) && ObjectUtil.isNotNull(activate)) {
|
||||
BigDecimal amount = BigDecimal.ZERO;
|
||||
switch (activate.getHandselType()) {
|
||||
case "GD":
|
||||
amount = activate.getHandselNum();
|
||||
break;
|
||||
case "RATIO":
|
||||
amount = memberIn.getAmount().multiply(activate.getHandselNum());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
tbShopUser.setAmount(tbShopUser.getAmount().add(amount));
|
||||
tbShopUser.setUpdatedAt(System.currentTimeMillis());
|
||||
tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser);
|
||||
|
||||
flow = new TbShopUserFlow();
|
||||
flow.setShopUserId(Integer.valueOf(tbShopUser.getId()));
|
||||
flow.setBizCode("scanMemberAwardIn");
|
||||
flow.setType("+");
|
||||
flow.setBizName("充值活动奖励");
|
||||
flow.setAmount(amount);
|
||||
flow.setBalance(tbShopUser.getAmount());
|
||||
flow.setCreateTime(new Date());
|
||||
tbShopUserFlowMapper.insert(flow);
|
||||
}
|
||||
|
||||
|
||||
//会员活动
|
||||
BigDecimal awardAmount= giveActivate(tbShopUser,memberIn.getAmount(),flow.getId());
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("shopId", memberIn.getShopId());
|
||||
jsonObject.put("type", "wxMemberIn");
|
||||
jsonObject.put("amount", memberIn.getAmount());
|
||||
producer.putOrderCollect(jsonObject.toJSONString());
|
||||
|
||||
|
||||
|
||||
JSONObject baObj=new JSONObject();
|
||||
baObj.put("userId", tbShopUser.getUserId());
|
||||
baObj.put("shopId",tbShopUser.getShopId());
|
||||
baObj.put("amount",ObjectUtil.isNull(awardAmount)?memberIn.getAmount():memberIn.getAmount().add(awardAmount));
|
||||
baObj.put("balance",tbShopUser.getAmount());
|
||||
baObj.put("type","充值");
|
||||
baObj.put("time",flow.getCreateTime());
|
||||
producer.balance(baObj.toString());
|
||||
|
||||
return "SUCCESS";
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.chaozhanggui.system.cashierservice.util.*;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.util.concurrent.AtomicDouble;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -26,6 +27,10 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -70,6 +75,14 @@ public class ProductService {
|
||||
@Autowired
|
||||
private TbUserInfoMapper tbUserInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private TbProskuConMapper tbProskuConMapper;
|
||||
|
||||
@Autowired
|
||||
private TbConsInfoMapper tbConsInfoMapper;
|
||||
@Resource
|
||||
private TbActivateInRecordService activateInRecordService;
|
||||
|
||||
public Result queryShopIdByTableCode(String userId, String openId, String code, String lat, String lng) {
|
||||
if (StringUtils.isBlank(code)) return Result.fail("桌码信息为空");
|
||||
if (StringUtils.isBlank(lat) || lat.equals("undefined")) {
|
||||
@@ -131,30 +144,41 @@ public class ProductService {
|
||||
return Result.success(CodeEnum.SUCCESS, concurrentMap);
|
||||
}
|
||||
|
||||
public Result queryProduct(String shopId, String productGroupId) {
|
||||
public Result queryProduct(String userId,String shopId, String productGroupId) {
|
||||
ConcurrentMap<String, Object> concurrentMap = new ConcurrentHashMap<>();
|
||||
Integer id = ObjectUtil.isNotEmpty(productGroupId) ? Integer.valueOf(productGroupId) : null;
|
||||
//招牌菜
|
||||
List<TbProduct> tbProducts = tbProductMapper.selectIsSpecialty(Integer.valueOf(shopId));
|
||||
concurrentMap.put("hots", handleDate(tbProducts));
|
||||
concurrentMap.put("hots", handleDate(tbProducts,true,1,false));
|
||||
List<TbProductGroup> groupList = tbProductGroupMapper.selectByShopId(shopId, id);
|
||||
if (ObjectUtil.isNotEmpty(groupList) && groupList.size() > 0) {
|
||||
//热销
|
||||
TbProductGroup hot = new TbProductGroup();
|
||||
hot.setName("热销");
|
||||
List<TbProduct> hots = tbProductMapper.selectHot(shopId);
|
||||
hot.setProducts(handleDate(hots));
|
||||
hot.setProducts(handleDate(hots,true,1,false));
|
||||
//商品
|
||||
groupList.parallelStream().forEach(g -> {
|
||||
if (g.getUseTime()==1) g.setIsSale(getIsSale(g.getSaleStartTime(),g.getSaleEndTime()));
|
||||
String in = g.getProductIds().substring(1, g.getProductIds().length() - 1);
|
||||
if (ObjectUtil.isNotEmpty(in) && ObjectUtil.isNotNull(in)) {
|
||||
// List<TbProduct> products = tbProductMapper.selectByIdIn(in);
|
||||
List<TbProduct> products = tbProductMapper.selectByIdInAndCheck(in);
|
||||
g.setProducts(handleDate(products));
|
||||
g.setProducts(handleDate(products,false,g.getIsSale(),false));
|
||||
} else {
|
||||
g.setProducts(new ArrayList<>());
|
||||
}
|
||||
});
|
||||
groupList.sort(Comparator.comparingInt(TbProductGroup::getIsSale).reversed());
|
||||
TbShopUser tbShopUser = tbShopUserMapper.selectByUserIdAndShopId(userId, shopId);
|
||||
if (tbShopUser != null) {
|
||||
TbProductGroup vipProGroup = new TbProductGroup();
|
||||
vipProGroup.setName("会员商品");
|
||||
List<TbProduct> vipPros = activateInRecordService.queryByVipIdAndShopId(Integer.valueOf(tbShopUser.getId()), Integer.valueOf(shopId));
|
||||
if(!CollectionUtils.isEmpty(vipPros)){
|
||||
vipProGroup.setProducts(handleDate(vipPros, true, 1, true));
|
||||
groupList.add(0, vipProGroup);
|
||||
}
|
||||
}
|
||||
groupList.add(0, hot);
|
||||
concurrentMap.put("productInfo", groupList);
|
||||
}
|
||||
@@ -162,6 +186,44 @@ public class ProductService {
|
||||
return Result.success(CodeEnum.SUCCESS, concurrentMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否在可售时间内
|
||||
* @param startTimeStr HH:mm
|
||||
* @param endTimeStr HH:mm
|
||||
* @return 1 可售 0 不可售
|
||||
*/
|
||||
public Integer getIsSale(String startTimeStr,String endTimeStr) {
|
||||
// 定义时间格式
|
||||
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm");
|
||||
// 解析时间字符串为 LocalTime 对象
|
||||
LocalTime startTime = LocalTime.parse(startTimeStr, timeFormatter);
|
||||
LocalTime endTime = LocalTime.parse(endTimeStr, timeFormatter);
|
||||
// 获取当前日期
|
||||
LocalDate today = LocalDate.now();
|
||||
// 创建 LocalDateTime 对象
|
||||
LocalDateTime startDateTime = LocalDateTime.of(today, startTime);
|
||||
LocalDateTime endDateTime = LocalDateTime.of(today, endTime);
|
||||
// 如果结束时间早于开始时间,说明时间段跨日
|
||||
if (endDateTime.isBefore(startDateTime)) {
|
||||
endDateTime = endDateTime.plusDays(1);
|
||||
}
|
||||
// 获取当前日期时间
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if (now.isBefore(startDateTime)) {
|
||||
// 将当前时间加上24小时(一天),进行比较
|
||||
LocalDateTime nowPlus24 = now.plusHours(24);
|
||||
//当前时间 小于开始时间,且结束时间小于开始时间
|
||||
if (nowPlus24.isBefore(endDateTime)) {
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (now.isBefore(endDateTime)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Object querySpec(QuerySpecDTO querySpecDTO) {
|
||||
TbProduct tbProduct = tbProductMapper.selectById(querySpecDTO.getProductId());
|
||||
if (tbProduct == null) {
|
||||
@@ -171,7 +233,8 @@ public class ProductService {
|
||||
|
||||
// 重组有效规格数据
|
||||
String tagSnap = skuResult != null ? skuResult.getTagSnap() : null;
|
||||
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectGroundingByProId(querySpecDTO.getProductId());
|
||||
// List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectGroundingByProId(querySpecDTO.getProductId());
|
||||
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectSku(String.valueOf(querySpecDTO.getProductId()));
|
||||
|
||||
JSONArray finalSnap = new JSONArray();
|
||||
// if (tagSnap != null) {
|
||||
@@ -253,11 +316,17 @@ public class ProductService {
|
||||
}
|
||||
|
||||
ArrayList<HashMap<String, Object>> specList = new ArrayList<>();
|
||||
HashMap<String, TbProductSku> unGroundingMap = new HashMap<>();
|
||||
tbProductSkus.forEach(item -> {
|
||||
HashMap<String, Object> itemMap = new HashMap<>();
|
||||
itemMap.put("specSnap", item.getSpecSnap());
|
||||
itemMap.put("skuId", item.getId());
|
||||
specList.add(itemMap);
|
||||
if (item.getIsGrounding() == 1) {
|
||||
HashMap<String, Object> itemMap = new HashMap<>();
|
||||
itemMap.put("specSnap", item.getSpecSnap());
|
||||
itemMap.put("skuId", item.getId());
|
||||
itemMap.put("info", item);
|
||||
specList.add(itemMap);
|
||||
}else {
|
||||
unGroundingMap.put(item.getSpecSnap(), item);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -267,6 +336,14 @@ public class ProductService {
|
||||
for (HashMap<String, Object> spec : specList) {
|
||||
if (res.equals(spec.get("specSnap").toString())) {
|
||||
spec.put("isGrounding", true);
|
||||
TbProductSku sku = (TbProductSku) spec.get("info");
|
||||
if (sku != null) {
|
||||
tbProduct.setIsPauseSale(tbProduct.getIsDistribute() == 1 ? tbProduct.getIsPauseSale() : sku.getIsPauseSale().byteValue());
|
||||
checkPauseSale(tbProduct, new ArrayList<>(Collections.singletonList(sku)), true);
|
||||
spec.put("isPauseSale", tbProduct.getIsPauseSale());
|
||||
}else {
|
||||
spec.put("isPauseSale", 1);
|
||||
}
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@@ -276,6 +353,14 @@ public class ProductService {
|
||||
itemMap.put("specSnap", res);
|
||||
itemMap.put("skuId", null);
|
||||
itemMap.put("isGrounding", false);
|
||||
TbProductSku sku = unGroundingMap.get("specSnap");
|
||||
if (sku != null) {
|
||||
tbProduct.setIsPauseSale(tbProduct.getIsDistribute() == 1 ? tbProduct.getIsPauseSale() : sku.getIsPauseSale().byteValue());
|
||||
checkPauseSale(tbProduct, Collections.singletonList(sku), true);
|
||||
itemMap.put("isPauseSale", tbProduct.getIsPauseSale());
|
||||
}else {
|
||||
itemMap.put("isPauseSale", 1);
|
||||
}
|
||||
otherVal.add(itemMap);
|
||||
}
|
||||
}
|
||||
@@ -296,18 +381,37 @@ public class ProductService {
|
||||
}
|
||||
}
|
||||
|
||||
public List<TbProduct> handleDate(List<TbProduct> products){
|
||||
/**
|
||||
* 组装商品
|
||||
* @param products 商品列表
|
||||
* @param check 是否校验可售
|
||||
* @return
|
||||
*/
|
||||
public List<TbProduct> handleDate(List<TbProduct> products,boolean check,Integer isSale,boolean isVip){
|
||||
if (!CollectionUtils.isEmpty(products)) {
|
||||
products.parallelStream().forEach(it -> {
|
||||
if(check){
|
||||
List<TbProductGroup> tbProductGroups = tbProductGroupMapper.selectByProductId(it.getShopId(), it.getId().toString());
|
||||
for (TbProductGroup g : tbProductGroups) {
|
||||
if (g.getUseTime()==1) {
|
||||
if (getIsSale(g.getSaleStartTime(), g.getSaleEndTime()) == 0) {
|
||||
it.setIsSale(0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
it.setIsSale(isSale);
|
||||
}
|
||||
TbShopUnit tbShopUnit = unitMapper.selectByPrimaryKey(Integer.valueOf(it.getUnitId()));
|
||||
it.setUnitSnap(tbShopUnit != null ? tbShopUnit.getName() : "");
|
||||
//购物车数量
|
||||
it.setCartNumber("0");
|
||||
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectGroundingByProId(it.getId());
|
||||
TbProductSkuResult skuResult = tbProductSkuResultMapper.selectByPrimaryKey(it.getId());
|
||||
//判断库存及耗材
|
||||
checkPauseSale(it,tbProductSkus, false);
|
||||
|
||||
// 上下架对应的sku
|
||||
// HashSet<String> specSet = new HashSet<>();
|
||||
AtomicDouble sum = new AtomicDouble(0.0);
|
||||
BigDecimal lowerPrice = null;
|
||||
for (TbProductSku item : tbProductSkus) {
|
||||
@@ -317,11 +421,6 @@ public class ProductService {
|
||||
if (lowerPrice == null || lowerPrice.compareTo(item.getSalePrice()) > 0) {
|
||||
lowerPrice = item.getSalePrice();
|
||||
}
|
||||
|
||||
String specSnap = item.getSpecSnap();
|
||||
// if (specSnap != null) {
|
||||
// specSet.addAll(Arrays.asList(specSnap.split(",")));
|
||||
// }
|
||||
}
|
||||
//销量
|
||||
it.setStockNumber(sum.intValue());
|
||||
@@ -330,33 +429,11 @@ public class ProductService {
|
||||
}
|
||||
//售价
|
||||
it.setLowPrice(lowerPrice);
|
||||
// String tagSnap = skuResult != null ? skuResult.getTagSnap() : null;
|
||||
// if (tagSnap != null) {
|
||||
// JSONArray tagSnaps = JSONObject.parseArray(tagSnap);
|
||||
// JSONObject snapJSON;
|
||||
// JSONArray finalSnap = new JSONArray();
|
||||
// for (Object snap : tagSnaps) {
|
||||
// snapJSON = (JSONObject) snap;
|
||||
// String values = snapJSON.getString("value");
|
||||
// String finalValues = "";
|
||||
// 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);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// //sku Result
|
||||
// skuResult.setTagSnap(finalSnap.toJSONString());
|
||||
// }
|
||||
it.setProductSkuResult(skuResult);
|
||||
if (isVip) {
|
||||
it.setLowPrice(BigDecimal.ZERO);
|
||||
it.setIsVip(Byte.parseByte("1"));
|
||||
}
|
||||
});
|
||||
return products;
|
||||
}else {
|
||||
@@ -364,9 +441,63 @@ public class ProductService {
|
||||
}
|
||||
}
|
||||
|
||||
public void checkPauseSale(TbProduct tbProduct, List<TbProductSku> skus, boolean isSingle) {
|
||||
if (tbProduct.getIsStock() == 1) {//库存开关 1开启
|
||||
if (Integer.valueOf(tbProduct.getIsDistribute()).equals(1)) {//共享库存 1开启
|
||||
if (tbProduct.getStockNumber() != null && tbProduct.getStockNumber() <= 0) {
|
||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
return;
|
||||
}
|
||||
|
||||
public Result queryProductSku(String code, String shopId, String productId, String spec_tag) {
|
||||
if (ObjectUtil.isEmpty(shopId) || ObjectUtil.isEmpty(productId)) {
|
||||
if (isSingle && tbProduct.getIsPauseSale() == 1) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (isSingle && !skus.stream().filter(res -> res.getIsPauseSale().equals(1)).collect(Collectors.toList()).isEmpty()) {
|
||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
return;
|
||||
}
|
||||
|
||||
if (!tbProduct.getTypeEnum().equals("sku")) {
|
||||
if (skus.stream().anyMatch(sku -> sku.getStockNumber() != null && sku.getStockNumber() <= 0)){
|
||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
skus.removeIf(sku -> sku.getStockNumber() != null && sku.getStockNumber() <= 0);
|
||||
if (CollectionUtils.isEmpty(skus)) {
|
||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
Iterator<TbProductSku> iterator = skus.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TbProductSku tbProductSku = iterator.next();
|
||||
List<TbProskuCon> proskuConList = tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(Integer.valueOf(tbProductSku.getId()), Integer.valueOf(tbProductSku.getShopId()), Integer.valueOf(tbProductSku.getProductId()));
|
||||
if (Objects.nonNull(proskuConList) && proskuConList.size() > 0) {
|
||||
for (TbProskuCon proskuCon : proskuConList) {
|
||||
if ("1".equals(proskuCon.getStatus())) {
|
||||
TbConsInfo consInfo = tbConsInfoMapper.selectByPrimaryKey(proskuCon.getConInfoId());
|
||||
if ("1".equals(consInfo.getIsCheck())) {
|
||||
if (N.gt(proskuCon.getSurplusStock(), consInfo.getStockNumber().abs().subtract(consInfo.getStockConsume().abs()))) {
|
||||
iterator.remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isEmpty(skus)) {
|
||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Result queryProductSku(String code, String shopId, String productId, String spec_tag,String isVip) {
|
||||
if (ObjectUtil.isEmpty(shopId) || ObjectUtil.isEmpty(productId) || StringUtils.isEmpty(isVip)|| isVip.equals("undefined") ) {
|
||||
return Result.fail("参数错误");
|
||||
}
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByShopIdAndProductIdAndSpec(shopId, productId, spec_tag);
|
||||
@@ -379,7 +510,7 @@ public class ProductService {
|
||||
tbProductSkuWithBLOBs.setId(null);
|
||||
}else {
|
||||
if (StringUtils.isNotBlank(code)) {
|
||||
Integer sum = tbProductMapper.selectByCodeAndSkuId(code, tbProductSkuWithBLOBs.getId(), shopId);
|
||||
Integer sum = tbProductMapper.selectByCodeAndSkuId(code, tbProductSkuWithBLOBs.getId(), shopId,isVip);
|
||||
tbProductSkuWithBLOBs.setNumber(sum);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateInRecord;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbProduct;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 活动商品赠送表(TbActivateInRecord)表服务接口
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-08-22 11:13:40
|
||||
*/
|
||||
public interface TbActivateInRecordService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbActivateInRecord queryById(Integer id);
|
||||
|
||||
List<TbProduct> queryByVipIdAndShopId(Integer vipUserId, Integer shopId);
|
||||
int queryByVipIdAndShopIdAndProId(Integer vipUserId, Integer shopId,Integer productId);
|
||||
List<TbActivateInRecord> queryAllByVipIdAndShopIdAndProId(Integer vipUserId, Integer shopId,Integer productId);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbActivateInRecord 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbActivateInRecord insert(TbActivateInRecord tbActivateInRecord);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbActivateInRecord 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbActivateInRecord update(TbActivateInRecord tbActivateInRecord);
|
||||
|
||||
int updateOverNumById(Integer id,Integer overNum);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateOutRecord;
|
||||
|
||||
/**
|
||||
* 活动赠送商品使用记录表(TbActivateOutRecord)表服务接口
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-08-22 11:21:56
|
||||
*/
|
||||
public interface TbActivateOutRecordService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbActivateOutRecord queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbActivateOutRecord 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbActivateOutRecord insert(TbActivateOutRecord tbActivateOutRecord);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbActivateOutRecord 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbActivateOutRecord update(TbActivateOutRecord tbActivateOutRecord);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateProduct;
|
||||
|
||||
/**
|
||||
* 活动赠送商品表(TbActivateProduct)表服务接口
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-08-20 15:15:01
|
||||
*/
|
||||
public interface TbActivateProductService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbActivateProduct queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbActivateProduct 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbActivateProduct insert(TbActivateProduct tbActivateProduct);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbActivateProduct 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbActivateProduct update(TbActivateProduct tbActivateProduct);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopAd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (TbShopAd)表服务接口
|
||||
*
|
||||
* @author GYJ
|
||||
* @since 2024-08-19 14:25:17
|
||||
*/
|
||||
public interface TbShopAdService {
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @return 查询结果
|
||||
*/
|
||||
List<TbShopAd> shopAdList(Integer shopId);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.UserCouponDto;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
|
||||
/**
|
||||
* (TbUserCoupons)表服务接口
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-09-02 13:38:20
|
||||
*/
|
||||
public interface TbUserCouponsService {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param tbUserCoupons 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
Result queryByPage(UserCouponDto tbUserCoupons);
|
||||
|
||||
}
|
||||
@@ -1,20 +1,28 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||
import cn.hutool.extra.qrcode.QrConfig;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbReleaseFlow;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopUser;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralFlowVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.OpenMemberVo;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.*;
|
||||
import com.chaozhanggui.system.cashierservice.wxUtil.WxAccountUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.core.io.Resource;
|
||||
@@ -263,4 +271,59 @@ public class UserService {
|
||||
|
||||
return fileService.uploadFileByInputStream("png", new ByteArrayInputStream(outputStream.toByteArray()));
|
||||
}
|
||||
|
||||
public Result openMember(OpenMemberVo memberVo) {
|
||||
TbShopUser tbShopUser = shopUserMapper.selectByUserIdAndShopId(memberVo.getId().toString(), memberVo.getShopId().toString());
|
||||
if (tbShopUser != null) {
|
||||
tbShopUser.setName(StringUtils.isNotBlank(memberVo.getNickName()) ? memberVo.getNickName() : null);
|
||||
tbShopUser.setHeadImg(StringUtils.isNotBlank(memberVo.getHeadImg()) ? memberVo.getHeadImg() : null);
|
||||
tbShopUser.setTelephone(memberVo.getTelephone());
|
||||
tbShopUser.setBirthDay(StringUtils.isNotBlank(memberVo.getBirthDay()) ? memberVo.getBirthDay() : null);
|
||||
tbShopUser.setIsVip(Byte.parseByte("1"));
|
||||
shopUserMapper.updateByPrimaryKeySelective(tbShopUser);
|
||||
} else {
|
||||
TbUserInfo tbUserInfo = userInfoMapper.selectByPrimaryKey(memberVo.getId());
|
||||
tbShopUser = shopUserMapper.selectPCByPhoneAndShopId(memberVo.getTelephone(), memberVo.getShopId().toString());
|
||||
if (tbShopUser != null) {
|
||||
tbShopUser.setName(StringUtils.isNotBlank(memberVo.getNickName()) ? memberVo.getNickName() : null);
|
||||
tbShopUser.setHeadImg(StringUtils.isNotBlank(memberVo.getHeadImg()) ? memberVo.getHeadImg() : null);
|
||||
tbShopUser.setTelephone(memberVo.getTelephone());
|
||||
tbShopUser.setBirthDay(StringUtils.isNotBlank(memberVo.getBirthDay()) ? memberVo.getBirthDay() : null);
|
||||
tbShopUser.setUserId(tbUserInfo.getId().toString());
|
||||
tbShopUser.setMiniOpenId(tbUserInfo.getMiniAppOpenId());
|
||||
shopUserMapper.updateByPrimaryKeySelective(tbShopUser);
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
tbShopUser = new TbShopUser();
|
||||
tbShopUser.setName(StringUtils.isNotBlank(memberVo.getNickName()) ? memberVo.getNickName() : null);
|
||||
tbShopUser.setSex(Byte.parseByte("1"));
|
||||
tbShopUser.setBirthDay(StringUtils.isNotBlank(memberVo.getBirthDay()) ? memberVo.getBirthDay() : null);
|
||||
tbShopUser.setLevel(Byte.parseByte("1"));
|
||||
String dynamicCode = RandomUtil.randomNumbers(8);
|
||||
tbShopUser.setCode(dynamicCode);
|
||||
tbShopUser.setTelephone(memberVo.getTelephone());
|
||||
tbShopUser.setAmount(BigDecimal.ZERO);
|
||||
tbShopUser.setIsVip(Byte.parseByte("1"));
|
||||
tbShopUser.setCreditAmount(BigDecimal.ZERO);
|
||||
tbShopUser.setConsumeAmount(BigDecimal.ZERO);
|
||||
tbShopUser.setConsumeNumber(0);
|
||||
tbShopUser.setLevelConsume(BigDecimal.ZERO);
|
||||
tbShopUser.setStatus(Byte.parseByte("1"));
|
||||
tbShopUser.setShopId(memberVo.getShopId().toString());
|
||||
tbShopUser.setUserId(tbUserInfo.getId().toString());
|
||||
tbShopUser.setMiniOpenId(tbUserInfo.getMiniAppOpenId());
|
||||
tbShopUser.setCreatedAt(System.currentTimeMillis());
|
||||
tbShopUser.setUpdatedAt(System.currentTimeMillis());
|
||||
shopUserMapper.insertSelective(tbShopUser);
|
||||
}
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
public Result upVipPhont(OpenMemberVo memberVo) {
|
||||
TbShopUser shopUser = new TbShopUser();
|
||||
shopUser.setId(memberVo.getId().toString());
|
||||
shopUser.setTelephone(memberVo.getTelephone());
|
||||
shopUserMapper.updateByPrimaryKeySelective(shopUser);
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbActivateInRecordMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateInRecord;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbProduct;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbActivateInRecordService;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 活动商品赠送表(TbActivateInRecord)表服务实现类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-08-22 11:13:40
|
||||
*/
|
||||
@Service
|
||||
@Primary
|
||||
public class TbActivateInRecordServiceImpl implements TbActivateInRecordService {
|
||||
@Resource
|
||||
private TbActivateInRecordMapper tbActivateInRecordMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public TbActivateInRecord queryById(Integer id) {
|
||||
return this.tbActivateInRecordMapper.queryById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbProduct> queryByVipIdAndShopId(Integer vipUserId, Integer shopId) {
|
||||
return tbActivateInRecordMapper.queryByVipIdAndShopId(vipUserId, shopId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryByVipIdAndShopIdAndProId(Integer vipUserId, Integer shopId,Integer productId){
|
||||
return tbActivateInRecordMapper.queryByVipIdAndShopIdAndProId(vipUserId,shopId,productId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbActivateInRecord> queryAllByVipIdAndShopIdAndProId(Integer vipUserId, Integer shopId,Integer productId){
|
||||
return tbActivateInRecordMapper.queryAllByVipIdAndShopIdAndProId(vipUserId,shopId,productId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbActivateInRecord 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public TbActivateInRecord insert(TbActivateInRecord tbActivateInRecord) {
|
||||
this.tbActivateInRecordMapper.insert(tbActivateInRecord);
|
||||
return tbActivateInRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbActivateInRecord 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public TbActivateInRecord update(TbActivateInRecord tbActivateInRecord) {
|
||||
this.tbActivateInRecordMapper.update(tbActivateInRecord);
|
||||
return this.queryById(tbActivateInRecord.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateOverNumById(Integer id,Integer overNum){
|
||||
return tbActivateInRecordMapper.updateOverNumById(id,overNum);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Integer id) {
|
||||
return this.tbActivateInRecordMapper.deleteById(id) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateOutRecord;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbActivateOutRecordMapper;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbActivateOutRecordService;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 活动赠送商品使用记录表(TbActivateOutRecord)表服务实现类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-08-22 11:21:56
|
||||
*/
|
||||
@Service
|
||||
@Primary
|
||||
public class TbActivateOutRecordServiceImpl implements TbActivateOutRecordService {
|
||||
@Resource
|
||||
private TbActivateOutRecordMapper tbActivateOutRecordMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public TbActivateOutRecord queryById(Integer id) {
|
||||
return this.tbActivateOutRecordMapper.queryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbActivateOutRecord 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public TbActivateOutRecord insert(TbActivateOutRecord tbActivateOutRecord) {
|
||||
this.tbActivateOutRecordMapper.insert(tbActivateOutRecord);
|
||||
return tbActivateOutRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbActivateOutRecord 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public TbActivateOutRecord update(TbActivateOutRecord tbActivateOutRecord) {
|
||||
this.tbActivateOutRecordMapper.update(tbActivateOutRecord);
|
||||
return this.queryById(tbActivateOutRecord.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Integer id) {
|
||||
return this.tbActivateOutRecordMapper.deleteById(id) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbActivateProductMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateProduct;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbActivateProductService;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 活动赠送商品表(TbActivateProduct)表服务实现类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-08-20 15:15:02
|
||||
*/
|
||||
@Service
|
||||
@Primary
|
||||
public class TbActivateProductServiceImpl implements TbActivateProductService {
|
||||
@Resource
|
||||
private TbActivateProductMapper tbActivateProductMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public TbActivateProduct queryById(Integer id) {
|
||||
return this.tbActivateProductMapper.queryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbActivateProduct 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public TbActivateProduct insert(TbActivateProduct tbActivateProduct) {
|
||||
this.tbActivateProductMapper.insert(tbActivateProduct);
|
||||
return tbActivateProduct;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbActivateProduct 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public TbActivateProduct update(TbActivateProduct tbActivateProduct) {
|
||||
this.tbActivateProductMapper.update(tbActivateProduct);
|
||||
return this.queryById(tbActivateProduct.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Integer id) {
|
||||
return this.tbActivateProductMapper.deleteById(id) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbShopAdDao;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopAd;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbShopAdService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (TbShopAd)表服务实现类
|
||||
*
|
||||
* @author GYJ
|
||||
* @since 2024-08-19 14:25:17
|
||||
*/
|
||||
@Service
|
||||
public class TbShopAdServiceImpl implements TbShopAdService {
|
||||
@Autowired
|
||||
private TbShopAdDao tbShopAdDao;
|
||||
|
||||
@Override
|
||||
public List<TbShopAd> shopAdList(Integer shopId) {
|
||||
System.out.println("shopId = " + shopId);
|
||||
return tbShopAdDao.shopAdList(shopId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.UserCouponDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ShopUserListVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.UserCouponVo;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbUserCouponsService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (TbUserCoupons)表服务实现类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-09-02 13:38:20
|
||||
*/
|
||||
@Primary
|
||||
@Service
|
||||
public class TbUserCouponsServiceImpl implements TbUserCouponsService {
|
||||
@Resource
|
||||
private TbUserCouponsMapper tbUserCouponsMapper;
|
||||
@Resource
|
||||
private TbActivateInRecordMapper inRecordMapper;
|
||||
@Resource
|
||||
private TbActivateOutRecordMapper outRecordMapper;
|
||||
@Autowired
|
||||
private TbShopUserMapper tbShopUserMapper;
|
||||
@Autowired
|
||||
private TbShopInfoMapper tbShopInfoMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public Result queryByPage(UserCouponDto couponDto) {
|
||||
// PageHelper.startPage(couponDto.getPage(), couponDto.getSize());
|
||||
// List<TbUserCoupons> result = tbUserCouponsMapper.queryAllSelective(couponDto);
|
||||
// return new Result(CodeEnum.SUCCESS, new PageInfo<>(result));
|
||||
// List<UserCouponVo> result = tbUserCouponsMapper.queryAllSelective(couponDto);
|
||||
List<UserCouponVo> result = new ArrayList<>();
|
||||
List<ShopUserListVo> tbShopUsers = tbShopUserMapper.selectByUserId(couponDto.getUserId().toString(), couponDto.getShopId()==null?null:couponDto.getShopId().toString());
|
||||
if (!CollectionUtils.isEmpty(tbShopUsers)) {
|
||||
tbShopUsers.forEach(s -> {
|
||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(s.getShopId().intValue());
|
||||
if (couponDto.getStatus()==null || (couponDto.getStatus() != null && couponDto.getStatus() == 0)) {
|
||||
List<UserCouponVo> unuseCoupon = inRecordMapper.queryVipPro(s.getMemberId().intValue(), s.getShopId().intValue(),shopInfo.getShopName());
|
||||
result.addAll(unuseCoupon);
|
||||
}
|
||||
if (couponDto.getStatus()==null || (couponDto.getStatus() != null && couponDto.getStatus() == 1)) {
|
||||
List<UserCouponVo> useCoupon = outRecordMapper.queryVipPro(s.getMemberId().intValue(), s.getShopId().intValue(),shopInfo.getShopName());
|
||||
result.addAll(useCoupon);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return new Result(CodeEnum.SUCCESS, result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.util;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.chaozhanggui.system.cashierservice.model.OrderDetailPO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -14,6 +15,7 @@ import java.util.*;
|
||||
/**
|
||||
* 打印机
|
||||
*/
|
||||
@Slf4j
|
||||
public class PrinterUtils {
|
||||
//请求地址
|
||||
private static final String URL_STR = "https://ioe.car900.com/v1/openApi/dev/customPrint.json";
|
||||
@@ -83,6 +85,41 @@ public class PrinterUtils {
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 厨房打印机
|
||||
*
|
||||
* @param pickupNumber
|
||||
* @param date
|
||||
* @param productName
|
||||
* @param number
|
||||
* @param remark
|
||||
* @return
|
||||
*/
|
||||
public static String getPrintData(String type, String pickupNumber, String date, String productName, Integer number, String remark) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if ("return".equals(type)) {
|
||||
builder.append("<C><B>" + pickupNumber + "【退】</B></C><BR><BR>");
|
||||
} else {
|
||||
builder.append("<C><B>" + pickupNumber + "</B></C><BR><BR>");
|
||||
}
|
||||
|
||||
|
||||
builder.append("<S><L>时间: " + date + " </L></S><BR><BR><BR>");
|
||||
|
||||
if (productName.length() > 4 || remark.length() > 4) {
|
||||
builder.append("<CS:32>" + productName + " " + number + "</CS><BR>");
|
||||
builder.append("<CS:32>" + remark + " </CS><BR>");
|
||||
} else {
|
||||
builder.append("<B>" + productName + " " + number + "</B><BR>");
|
||||
builder.append("<B>" + remark + " </B><BR>");
|
||||
}
|
||||
builder.append("<OUT:150>");
|
||||
builder.append("<PCUT>");
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String getCashPrintData(OrderDetailPO detailPO,String type){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -162,7 +199,46 @@ public class PrinterUtils {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 打印票据
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void printTickets(String voiceJson, Integer actWay, Integer cn, String devName, String data) {
|
||||
log.info("开始请求云享印,请求数据:{}, {}", voiceJson, data);
|
||||
//设备名称
|
||||
//行为方式 1:只打印数据 2:只播放信息 3:打印数据并播放信息
|
||||
// actWay = 3;
|
||||
// //打印联数
|
||||
// int cn = 1;
|
||||
//打印内容
|
||||
//播报语音数据体,字段参考文档IOT_XY_API11001
|
||||
String time = String.valueOf(System.currentTimeMillis());
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
|
||||
Map<String, String> param = getToken(time, uuid);
|
||||
//参数
|
||||
MultiValueMap<String, Object> multiValueMap = new LinkedMultiValueMap<>();
|
||||
multiValueMap.add("token", param.get("TOKEN"));
|
||||
multiValueMap.add("devName", devName);
|
||||
multiValueMap.add("actWay", actWay);
|
||||
multiValueMap.add("cn", cn);
|
||||
multiValueMap.add("data", data);
|
||||
multiValueMap.add("voiceJson", voiceJson);
|
||||
multiValueMap.add("appId", APP_ID);
|
||||
multiValueMap.add("timestamp", time);
|
||||
multiValueMap.add("requestId", uuid);
|
||||
multiValueMap.add("userCode", USER_CODE);
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
HttpHeaders header = new HttpHeaders();
|
||||
header.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
||||
|
||||
HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(multiValueMap, header);
|
||||
String httpResponse = restTemplate.postForObject(URL_STR,
|
||||
httpEntity, String.class);
|
||||
|
||||
System.out.println("map" + httpResponse);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -104,6 +104,11 @@ public class WxAccountUtil {
|
||||
}
|
||||
|
||||
public JSONObject sendStockWarnMsg(String shopName, String productName, Integer stock, String toUserOpenId, ShopWxMsgTypeEnum typeEnum, Integer shopId) {
|
||||
TbShopMsgState allState = shopMsgStateMapper.selectByType(ShopWxMsgTypeEnum.ALL_MSG.getType(), shopId);
|
||||
if (allState == null || allState.getState().equals(0)) {
|
||||
log.info("店铺未开启全局推送:{}", allState);
|
||||
return null;
|
||||
}
|
||||
TbShopMsgState shopMsgState = shopMsgStateMapper.selectByType(typeEnum.getType(), shopId);
|
||||
if (shopMsgState == null || shopMsgState.getState().equals(0)) {
|
||||
log.info("店铺未开启推送:{}", shopMsgState);
|
||||
|
||||
189
src/main/resources/mapper/TbActivateInRecordMapper.xml
Normal file
189
src/main/resources/mapper/TbActivateInRecordMapper.xml
Normal file
@@ -0,0 +1,189 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbActivateInRecordMapper">
|
||||
|
||||
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbActivateInRecord" id="TbActivateInRecordMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="vipUserId" column="vip_user_id" jdbcType="INTEGER"/>
|
||||
<result property="proId" column="pro_id" jdbcType="INTEGER"/>
|
||||
<result property="num" column="num" jdbcType="INTEGER"/>
|
||||
<result property="overNum" column="over_num" jdbcType="INTEGER"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="sourceActId" column="source_act_id" jdbcType="INTEGER"/>
|
||||
<result property="sourceFlowId" column="source_flow_id" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
, vip_user_id, pro_id, num, over_num, shop_id, source_act_id, source_flow_id, create_time, update_time </sql>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="TbActivateInRecordMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_activate_in_record
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="queryByVipIdAndShopId" resultType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
|
||||
SELECT
|
||||
tb_product.*, sum(tb_activate_in_record.over_num) as limitNumber
|
||||
FROM
|
||||
tb_activate_in_record
|
||||
LEFT JOIN tb_product ON tb_activate_in_record.pro_id = tb_product.id
|
||||
WHERE
|
||||
vip_user_id = #{vipUserId} and tb_activate_in_record.shop_id = #{shopId}
|
||||
group by tb_activate_in_record.pro_id
|
||||
</select>
|
||||
|
||||
<select id="queryVipPro" resultType="com.chaozhanggui.system.cashierservice.entity.vo.UserCouponVo">
|
||||
SELECT tb_product.name as detail,
|
||||
0 as status,
|
||||
sum(tb_activate_in_record.over_num) as num,
|
||||
<choose>
|
||||
<when test="shopName != null and shopName != ''">#{shopName}</when>
|
||||
<otherwise>''</otherwise>
|
||||
</choose> AS shopName,
|
||||
2 as type
|
||||
FROM tb_activate_in_record
|
||||
LEFT JOIN tb_product ON tb_activate_in_record.pro_id = tb_product.id
|
||||
WHERE vip_user_id = #{vipUserId}
|
||||
and tb_activate_in_record.shop_id = #{shopId}
|
||||
and num!=0
|
||||
group by tb_activate_in_record.pro_id
|
||||
</select>
|
||||
|
||||
<select id="queryByVipIdAndShopIdAndProId" resultType="INTEGER">
|
||||
SELECT
|
||||
sum(tb_activate_in_record.num)
|
||||
FROM
|
||||
tb_activate_in_record
|
||||
WHERE
|
||||
vip_user_id = #{vipUserId} and shop_id = #{shopId} and pro_id = #{productId}
|
||||
</select>
|
||||
|
||||
<select id="queryAllByVipIdAndShopIdAndProId" resultMap="TbActivateInRecordMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from tb_activate_in_record
|
||||
WHERE
|
||||
vip_user_id = #{vipUserId}
|
||||
and shop_id = #{shopId}
|
||||
and pro_id = #{productId}
|
||||
and over_num > 0
|
||||
order by create_time
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAll" resultMap="TbActivateInRecordMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_activate_in_record
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="vipUserId != null">
|
||||
and vip_user_id = #{vipUserId}
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
and pro_id = #{proId}
|
||||
</if>
|
||||
<if test="num != null">
|
||||
and num = #{num}
|
||||
</if>
|
||||
<if test="overNum != null">
|
||||
and over_num = #{overNum}
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
and shop_id = #{shopId}
|
||||
</if>
|
||||
<if test="sourceActId != null">
|
||||
and source_act_id = #{sourceActId}
|
||||
</if>
|
||||
<if test="sourceFlowId != null">
|
||||
and source_flow_id = #{sourceFlowId}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_activate_in_record(vip_user_id, pro_id, num, over_num, shop_id, source_act_id, source_flow_id,
|
||||
create_time, update_time)
|
||||
values (#{vipUserId}, #{proId}, #{num}, #{overNum}, #{shopId}, #{sourceActId}, #{sourceFlowId}, #{createTime},
|
||||
#{updateTime})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_activate_in_record(vip_user_id, pro_id, num, over_num, shop_id, source_act_id, source_flow_id,
|
||||
create_time, update_time)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.vipUserId}, #{entity.proId}, #{entity.num}, #{entity.overNum}, #{entity.shopId},
|
||||
#{entity.sourceActId}, #{entity.sourceFlowId}, #{entity.createTime}, #{entity.updateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update tb_activate_in_record
|
||||
<set>
|
||||
<if test="vipUserId != null">
|
||||
vip_user_id = #{vipUserId},
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
pro_id = #{proId},
|
||||
</if>
|
||||
<if test="num != null">
|
||||
num = #{num},
|
||||
</if>
|
||||
<if test="overNum != null">
|
||||
over_num = #{overNum},
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId},
|
||||
</if>
|
||||
<if test="sourceActId != null">
|
||||
source_act_id = #{sourceActId},
|
||||
</if>
|
||||
<if test="sourceFlowId != null">
|
||||
source_flow_id = #{sourceFlowId},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateOverNumById">
|
||||
update tb_activate_in_record
|
||||
set
|
||||
over_num = #{overNum}
|
||||
where id = #{id};
|
||||
</update>
|
||||
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from tb_activate_in_record
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
<result column="handsel_num" jdbcType="DECIMAL" property="handselNum" />
|
||||
<result column="handsel_type" jdbcType="VARCHAR" property="handselType" />
|
||||
<result column="is_del" jdbcType="VARCHAR" property="isDel" />
|
||||
<result column="is_gift_pro" jdbcType="INTEGER" property="isGiftPro" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, shop_id, min_num, max_num, handsel_num, handsel_type, is_del
|
||||
id, shop_id, min_num, max_num, handsel_num, handsel_type, is_del,is_gift_pro
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
@@ -116,10 +117,16 @@
|
||||
</update>
|
||||
|
||||
<select id="selectByAmount" resultMap="BaseResultMap">
|
||||
select * from tb_activate where shop_id=#{shopId} and is_del=0 and min_num <= #{amount} and max_num >= #{amount}
|
||||
</select>
|
||||
select *
|
||||
from tb_activate
|
||||
where shop_id = #{shopId}
|
||||
and is_del = 0
|
||||
and min_num <= #{amount}
|
||||
and max_num >= #{amount}
|
||||
order by max_num desc limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectByShpopId" resultMap="BaseResultMap">
|
||||
<select id="selectByShopId" resultMap="BaseResultMap">
|
||||
select * from tb_activate where shop_id=#{shopId}
|
||||
</select>
|
||||
</mapper>
|
||||
149
src/main/resources/mapper/TbActivateOutRecordMapper.xml
Normal file
149
src/main/resources/mapper/TbActivateOutRecordMapper.xml
Normal file
@@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbActivateOutRecordMapper">
|
||||
|
||||
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbActivateOutRecord" id="TbActivateOutRecordMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="giveId" column="give_id" jdbcType="INTEGER"/>
|
||||
<result property="proId" column="pro_id" jdbcType="INTEGER"/>
|
||||
<result property="useNum" column="use_num" jdbcType="INTEGER"/>
|
||||
<result property="refNum" column="ref_num" jdbcType="INTEGER"/>
|
||||
<result property="orderId" column="order_id" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
, give_id, pro_id, use_num, ref_num, order_id,status, create_time, update_time </sql>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="TbActivateOutRecordMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_activate_out_record
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryVipPro" resultType="com.chaozhanggui.system.cashierservice.entity.vo.UserCouponVo">
|
||||
SELECT tb_product.NAME AS detail,
|
||||
1 AS status,
|
||||
tb_activate_out_record.use_num AS num,
|
||||
<choose>
|
||||
<when test="shopName != null and shopName != ''">#{shopName}</when>
|
||||
<otherwise>''</otherwise>
|
||||
</choose>
|
||||
AS shopName,
|
||||
2 AS type
|
||||
FROM tb_activate_out_record
|
||||
LEFT JOIN tb_product ON tb_activate_out_record.pro_id = tb_product.id
|
||||
LEFT JOIN tb_activate_in_record ON tb_activate_in_record.id = tb_activate_out_record.give_id
|
||||
WHERE vip_user_id = #{vipUserId}
|
||||
AND tb_activate_in_record.shop_id = #{shopId}
|
||||
AND tb_activate_out_record.STATUS = 'closed'
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAll" resultMap="TbActivateOutRecordMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_activate_out_record
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="giveId != null">
|
||||
and give_id = #{giveId}
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
and pro_id = #{proId}
|
||||
</if>
|
||||
<if test="useNum != null">
|
||||
and use_num = #{useNum}
|
||||
</if>
|
||||
<if test="refNum != null">
|
||||
and ref_num = #{refNum}
|
||||
</if>
|
||||
<if test="orderId != null and orderId != ''">
|
||||
and order_id = #{orderId}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and status = #{status}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_activate_out_record(give_id, pro_id, use_num, ref_num, order_id, status, create_time, update_time)
|
||||
values (#{giveId}, #{proId}, #{useNum}, #{refNum}, #{orderId}, #{status} #{createTime}, #{updateTime})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_activate_out_record(give_id, pro_id, use_num, ref_num, order_id, status, create_time, update_time)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.giveId}, #{entity.proId}, #{entity.useNum}, #{entity.refNum}, #{entity.orderId},
|
||||
#{entity.status}, #{entity.createTime}, #{entity.updateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update tb_activate_out_record
|
||||
<set>
|
||||
<if test="giveId != null">
|
||||
give_id = #{giveId},
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
pro_id = #{proId},
|
||||
</if>
|
||||
<if test="useNum != null">
|
||||
use_num = #{useNum},
|
||||
</if>
|
||||
<if test="refNum != null">
|
||||
ref_num = #{refNum},
|
||||
</if>
|
||||
<if test="orderId != null and orderId != ''">
|
||||
order_id = #{orderId},
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateByOrderIdAndStatus">
|
||||
update tb_activate_out_record
|
||||
set
|
||||
status = 'closed'
|
||||
where order_id = #{orderId}
|
||||
</update>
|
||||
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from tb_activate_out_record
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
113
src/main/resources/mapper/TbActivateProductMapper.xml
Normal file
113
src/main/resources/mapper/TbActivateProductMapper.xml
Normal file
@@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbActivateProductMapper">
|
||||
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbActivateProduct" id="TbActivateProductMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="activateId" column="activate_id" jdbcType="INTEGER"/>
|
||||
<result property="productId" column="product_id" jdbcType="INTEGER"/>
|
||||
<result property="num" column="num" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, activate_id, product_id, num, create_time, update_time </sql>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="TbActivateProductMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_activate_product
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAll" resultMap="TbActivateProductMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_activate_product
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="activateId != null">
|
||||
and activate_id = #{activateId}
|
||||
</if>
|
||||
<if test="productId != null">
|
||||
and product_id = #{productId}
|
||||
</if>
|
||||
<if test="num != null">
|
||||
and num = #{num}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="queryAllByActivateId" resultMap="TbActivateProductMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from tb_activate_product
|
||||
where
|
||||
activate_id = #{activateId}
|
||||
</select>
|
||||
|
||||
<select id="queryProsByActivateId" resultType="java.lang.String">
|
||||
select CONCAT(tb_product.name, '*', SUM(tb_activate_product.num))
|
||||
from tb_activate_product
|
||||
LEFT JOIN tb_product ON tb_activate_product.product_id = tb_product.id
|
||||
where activate_id = #{activateId}
|
||||
group by tb_activate_product.product_id
|
||||
</select>
|
||||
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_activate_product(activate_id, product_id, num, create_time, update_time)
|
||||
values (#{activateId}, #{productId}, #{num}, #{createTime}, #{updateTime})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_activate_product(activate_id, product_id, num, create_time, update_time)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.activateId}, #{entity.productId}, #{entity.num}, #{entity.createTime}, #{entity.updateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update tb_activate_product
|
||||
<set>
|
||||
<if test="activateId != null">
|
||||
activate_id = #{activateId},
|
||||
</if>
|
||||
<if test="productId != null">
|
||||
product_id = #{productId},
|
||||
</if>
|
||||
<if test="num != null">
|
||||
num = #{num},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete from tb_activate_product where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -33,11 +33,12 @@
|
||||
<result column="pending_at" jdbcType="BIGINT" property="pendingAt"/>
|
||||
<result column="uuid" jdbcType="VARCHAR" property="uuid"/>
|
||||
<result column="sku_name" jdbcType="VARCHAR" property="skuName"/>
|
||||
<result column="is_vip" jdbcType="TINYINT" property="isVip" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, master_id, order_id, ref_order_id, total_amount, product_id, cover_img, is_sku,pack_fee,is_pack,is_gift,pending_at,
|
||||
sku_id, name, sale_price, number, total_number, refund_number, category_id, status,
|
||||
type, merchant_id, shop_id, created_at, updated_at, user_id, table_id,pack_fee,trade_day,uuid,sku_name
|
||||
type, merchant_id, shop_id, created_at, updated_at, user_id, table_id,pack_fee,trade_day,uuid,sku_name,is_vip
|
||||
</sql>
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
@@ -96,25 +97,28 @@
|
||||
<delete id="deleteBymasterId">
|
||||
delete from tb_cashier_cart where master_id = #{masterId} and shop_id = #{shopId} and status = #{status} and trade_day = #{day}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into tb_cashier_cart (id, master_id, order_id,
|
||||
ref_order_id, total_amount, product_id,
|
||||
cover_img, is_sku, sku_id,
|
||||
name, sale_price, number,
|
||||
total_number, refund_number, category_id,
|
||||
status, type, merchant_id,
|
||||
shop_id, created_at, updated_at, pack_fee,trade_day,is_pack,is_gift,table_id,user_id,sku_name
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER}, #{masterId,jdbcType=VARCHAR}, #{orderId,jdbcType=VARCHAR},
|
||||
#{refOrderId,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL}, #{productId,jdbcType=VARCHAR},
|
||||
#{coverImg,jdbcType=VARCHAR}, #{isSku,jdbcType=TINYINT}, #{skuId,jdbcType=VARCHAR},
|
||||
#{name,jdbcType=VARCHAR}, #{salePrice,jdbcType=DECIMAL}, #{number,jdbcType=REAL},
|
||||
#{totalNumber,jdbcType=REAL}, #{refundNumber,jdbcType=REAL}, #{categoryId,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT}, #{merchantId,jdbcType=VARCHAR},
|
||||
#{shopId,jdbcType=VARCHAR}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, #{packFee,jdbcType=DECIMAL}
|
||||
, #{tradeDay,jdbcType=VARCHAR}, #{isPack,jdbcType=VARCHAR}, #{isGift,jdbcType=VARCHAR}, #{tableId,jdbcType=VARCHAR}, #{userId,jdbcType=INTEGER},#{skuName,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
insert into tb_cashier_cart (id, master_id, order_id,
|
||||
ref_order_id, total_amount, product_id,
|
||||
cover_img, is_sku, sku_id,
|
||||
name, sale_price, number,
|
||||
total_number, refund_number, category_id,
|
||||
status, type, merchant_id,
|
||||
shop_id, created_at, updated_at, pack_fee, trade_day, is_pack, is_gift, table_id,
|
||||
user_id, sku_name, is_vip)
|
||||
values (#{id,jdbcType=INTEGER}, #{masterId,jdbcType=VARCHAR}, #{orderId,jdbcType=VARCHAR},
|
||||
#{refOrderId,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL}, #{productId,jdbcType=VARCHAR},
|
||||
#{coverImg,jdbcType=VARCHAR}, #{isSku,jdbcType=TINYINT}, #{skuId,jdbcType=VARCHAR},
|
||||
#{name,jdbcType=VARCHAR}, #{salePrice,jdbcType=DECIMAL}, #{number,jdbcType=REAL},
|
||||
#{totalNumber,jdbcType=REAL}, #{refundNumber,jdbcType=REAL}, #{categoryId,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT}, #{merchantId,jdbcType=VARCHAR},
|
||||
#{shopId,jdbcType=VARCHAR}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT},
|
||||
#{packFee,jdbcType=DECIMAL}
|
||||
, #{tradeDay,jdbcType=VARCHAR}, #{isPack,jdbcType=VARCHAR}, #{isGift,jdbcType=VARCHAR},
|
||||
#{tableId,jdbcType=VARCHAR}
|
||||
, #{userId,jdbcType=INTEGER}, #{skuName,jdbcType=VARCHAR}, #{isVip,jdbcType=TINYINT})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
||||
insert into tb_cashier_cart
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@@ -181,6 +185,9 @@
|
||||
<if test="updatedAt != null">
|
||||
updated_at,
|
||||
</if>
|
||||
<if test="isVip != null">
|
||||
is_vip,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
@@ -246,6 +253,9 @@
|
||||
<if test="updatedAt != null">
|
||||
#{updatedAt,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="isVip != null">
|
||||
#{isVip,jdbcType=TINYINT},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective"
|
||||
@@ -324,6 +334,9 @@
|
||||
<if test="isGift != null">
|
||||
is_gift = #{isGift,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="isVip != null">
|
||||
is_vip = #{isVip,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="isPack != null">
|
||||
is_pack = #{isPack,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
194
src/main/resources/mapper/TbConsInfoMapper.xml
Normal file
194
src/main/resources/mapper/TbConsInfoMapper.xml
Normal file
@@ -0,0 +1,194 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbConsInfoMapper">
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
|
||||
<result column="con_type_id" jdbcType="INTEGER" property="conTypeId" />
|
||||
<result column="con_type_name" jdbcType="VARCHAR" property="conTypeName" />
|
||||
<result column="con_code" jdbcType="VARCHAR" property="conCode" />
|
||||
<result column="con_name" jdbcType="VARCHAR" property="conName" />
|
||||
<result column="stock_number" jdbcType="DECIMAL" property="stockNumber" />
|
||||
<result column="price" jdbcType="DECIMAL" property="price" />
|
||||
<result column="stock_consume" jdbcType="DECIMAL" property="stockConsume" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="con_unit" jdbcType="VARCHAR" property="conUnit" />
|
||||
<result column="laster_in_stock" jdbcType="DECIMAL" property="lasterInStock" />
|
||||
<result column="con_warning" jdbcType="DECIMAL" property="conWarning" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="is_check" jdbcType="VARCHAR" property="isCheck" />
|
||||
|
||||
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, shop_id, con_type_id, con_type_name, con_code, con_name, stock_number,price,stock_consume,status, con_unit,
|
||||
laster_in_stock, con_warning, create_time, update_time,is_check
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_cons_info
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from tb_cons_info
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||
insert into tb_cons_info (id, shop_id, con_type_id,
|
||||
con_type_name, con_code, con_name,
|
||||
stock_number, con_unit, laster_in_stock,
|
||||
con_warning, create_time, update_time
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{conTypeId,jdbcType=INTEGER},
|
||||
#{conTypeName,jdbcType=VARCHAR}, #{conCode,jdbcType=VARCHAR}, #{conName,jdbcType=VARCHAR},
|
||||
#{stockNumber,jdbcType=DECIMAL}, #{conUnit,jdbcType=VARCHAR}, #{lasterInStock,jdbcType=DECIMAL},
|
||||
#{conWarning,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||
insert into tb_cons_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
shop_id,
|
||||
</if>
|
||||
<if test="conTypeId != null">
|
||||
con_type_id,
|
||||
</if>
|
||||
<if test="conTypeName != null">
|
||||
con_type_name,
|
||||
</if>
|
||||
<if test="conCode != null">
|
||||
con_code,
|
||||
</if>
|
||||
<if test="conName != null">
|
||||
con_name,
|
||||
</if>
|
||||
<if test="stockNumber != null">
|
||||
stock_number,
|
||||
</if>
|
||||
<if test="conUnit != null">
|
||||
con_unit,
|
||||
</if>
|
||||
<if test="lasterInStock != null">
|
||||
laster_in_stock,
|
||||
</if>
|
||||
<if test="conWarning != null">
|
||||
con_warning,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
#{shopId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="conTypeId != null">
|
||||
#{conTypeId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="conTypeName != null">
|
||||
#{conTypeName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="conCode != null">
|
||||
#{conCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="conName != null">
|
||||
#{conName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="stockNumber != null">
|
||||
#{stockNumber,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="conUnit != null">
|
||||
#{conUnit,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="lasterInStock != null">
|
||||
#{lasterInStock,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="conWarning != null">
|
||||
#{conWarning,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||
update tb_cons_info
|
||||
<set>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="conTypeId != null">
|
||||
con_type_id = #{conTypeId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="conTypeName != null">
|
||||
con_type_name = #{conTypeName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="conCode != null">
|
||||
con_code = #{conCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="conName != null">
|
||||
con_name = #{conName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="stockNumber != null">
|
||||
stock_number = #{stockNumber,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="conUnit != null">
|
||||
con_unit = #{conUnit,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="lasterInStock != null">
|
||||
laster_in_stock = #{lasterInStock,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="conWarning != null">
|
||||
con_warning = #{conWarning,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||
update tb_cons_info
|
||||
set shop_id = #{shopId,jdbcType=INTEGER},
|
||||
con_type_id = #{conTypeId,jdbcType=INTEGER},
|
||||
con_type_name = #{conTypeName,jdbcType=VARCHAR},
|
||||
con_code = #{conCode,jdbcType=VARCHAR},
|
||||
con_name = #{conName,jdbcType=VARCHAR},
|
||||
stock_number = #{stockNumber,jdbcType=DECIMAL},
|
||||
con_unit = #{conUnit,jdbcType=VARCHAR},
|
||||
laster_in_stock = #{lasterInStock,jdbcType=DECIMAL},
|
||||
con_warning = #{conWarning,jdbcType=DECIMAL},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
stock_consume=#{stockConsume,jdbcType=DECIMAL}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<select id="countAll" resultType="int">
|
||||
select count(id) from tb_cons_info
|
||||
</select>
|
||||
|
||||
<select id="selectAllInfo" resultType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||
select * from tb_cons_info order by id desc
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -8,6 +8,7 @@
|
||||
<result column="product_id" jdbcType="INTEGER" property="productId"/>
|
||||
<result column="product_sku_id" jdbcType="INTEGER" property="productSkuId"/>
|
||||
<result column="num" jdbcType="INTEGER" property="num"/>
|
||||
<result column="is_vip" jdbcType="TINYINT" property="isVip" />
|
||||
<result column="product_name" jdbcType="VARCHAR" property="productName"/>
|
||||
<result column="product_sku_name" jdbcType="VARCHAR" property="productSkuName"/>
|
||||
<result column="product_img" jdbcType="VARCHAR" property="productImg"/>
|
||||
@@ -20,7 +21,7 @@
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, order_id, shop_id, product_id, product_sku_id, num, product_name, product_sku_name,
|
||||
product_img, create_time, update_time, price, price_amount,status,pack_amount
|
||||
product_img, create_time, update_time, price, price_amount,status,pack_amount,is_vip
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
@@ -43,12 +44,12 @@
|
||||
product_id, product_sku_id, num,
|
||||
product_name, product_sku_name, product_img,
|
||||
create_time, update_time, price,
|
||||
price_amount,pack_amount,status)
|
||||
price_amount,pack_amount,status,is_vip)
|
||||
values (#{id,jdbcType=INTEGER}, #{orderId,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER},
|
||||
#{productId,jdbcType=INTEGER}, #{productSkuId,jdbcType=INTEGER}, #{num,jdbcType=INTEGER},
|
||||
#{productName,jdbcType=VARCHAR}, #{productSkuName,jdbcType=VARCHAR}, #{productImg,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{price,jdbcType=DECIMAL},
|
||||
#{priceAmount,jdbcType=DECIMAL},#{packAmount,jdbcType=DECIMAL},#{status,jdbcType=VARCHAR})
|
||||
#{priceAmount,jdbcType=DECIMAL},#{packAmount,jdbcType=DECIMAL},#{status,jdbcType=VARCHAR},#{isVip,jdbcType=TINYINT})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbOrderDetail">
|
||||
insert into tb_order_detail
|
||||
@@ -92,6 +93,9 @@
|
||||
<if test="priceAmount != null">
|
||||
price_amount,
|
||||
</if>
|
||||
<if test="isVip != null">
|
||||
is_vip,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
@@ -133,6 +137,9 @@
|
||||
<if test="priceAmount != null">
|
||||
#{priceAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="isVip != null">
|
||||
#{isVip,jdbcType=TINYINT},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective"
|
||||
@@ -154,6 +161,9 @@
|
||||
<if test="num != null">
|
||||
num = #{num,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isVip != null">
|
||||
is_vip = #{isVip,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="productName != null">
|
||||
product_name = #{productName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -197,6 +207,7 @@
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
price = #{price,jdbcType=DECIMAL},
|
||||
is_vip= #{isVip,jdbcType=TINYINT},
|
||||
price_amount = #{priceAmount,jdbcType=DECIMAL}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
@@ -51,53 +51,58 @@
|
||||
<result column="out_number" jdbcType="VARCHAR" property="outNumber"/>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, order_no, settlement_amount, pack_fee, origin_amount, product_amount, amount,
|
||||
refund_amount, pay_type, pay_amount, order_amount, freight_amount, discount_ratio,
|
||||
discount_amount, table_id, small_change, send_type, order_type, product_type, status,
|
||||
billing_id, merchant_id, shop_id, is_vip, member_id, user_id, product_score, deduct_score,
|
||||
user_coupon_id, user_coupon_amount, refund_able, paid_time, is_effect, is_group,
|
||||
id, order_no, settlement_amount, pack_fee, origin_amount, product_amount, amount,
|
||||
refund_amount, pay_type, pay_amount, order_amount, freight_amount, discount_ratio,
|
||||
discount_amount, table_id, small_change, send_type, order_type, product_type, status,
|
||||
billing_id, merchant_id, shop_id, is_vip, member_id, user_id, product_score, deduct_score,
|
||||
user_coupon_id, user_coupon_amount, refund_able, paid_time, is_effect, is_group,
|
||||
updated_at, `system_time`, created_at, is_accepted, pay_order_no,trade_day,`source`,
|
||||
remark,master_id,`table_name`,is_buy_coupon,is_use_coupon,out_number
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
*
|
||||
from tb_order_info
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from tb_order_info
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<!-- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">-->
|
||||
<!-- delete from tb_order_info-->
|
||||
<!-- where id = #{id,jdbcType=INTEGER}-->
|
||||
<!-- </delete>-->
|
||||
<update id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
update tb_order_info
|
||||
set is_del = 1
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbOrderInfo"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
insert into tb_order_info (id, order_no, settlement_amount,
|
||||
pack_fee, origin_amount, product_amount,
|
||||
amount, refund_amount, pay_type,
|
||||
pay_amount, order_amount, freight_amount,
|
||||
discount_ratio, discount_amount, table_id,
|
||||
small_change, send_type, order_type,
|
||||
product_type, status, billing_id,
|
||||
merchant_id, shop_id, is_vip,
|
||||
member_id, user_id, product_score,
|
||||
deduct_score, user_coupon_id, user_coupon_amount,
|
||||
refund_able, paid_time, is_effect,
|
||||
is_group, updated_at, system_time,
|
||||
insert into tb_order_info (id, order_no, settlement_amount,
|
||||
pack_fee, origin_amount, product_amount,
|
||||
amount, refund_amount, pay_type,
|
||||
pay_amount, order_amount, freight_amount,
|
||||
discount_ratio, discount_amount, table_id,
|
||||
small_change, send_type, order_type,
|
||||
product_type, status, billing_id,
|
||||
merchant_id, shop_id, is_vip,
|
||||
member_id, user_id, product_score,
|
||||
deduct_score, user_coupon_id, user_coupon_amount,
|
||||
refund_able, paid_time, is_effect,
|
||||
is_group, updated_at, system_time,
|
||||
created_at, is_accepted, pay_order_no,trade_day,source,remark,master_id,table_name,is_buy_coupon,is_use_coupon,out_number
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{settlementAmount,jdbcType=DECIMAL},
|
||||
#{packFee,jdbcType=DECIMAL}, #{originAmount,jdbcType=DECIMAL}, #{productAmount,jdbcType=DECIMAL},
|
||||
#{amount,jdbcType=DECIMAL}, #{refundAmount,jdbcType=DECIMAL}, #{payType,jdbcType=VARCHAR},
|
||||
#{payAmount,jdbcType=DECIMAL}, #{orderAmount,jdbcType=DECIMAL}, #{freightAmount,jdbcType=DECIMAL},
|
||||
#{discountRatio,jdbcType=DECIMAL}, #{discountAmount,jdbcType=DECIMAL}, #{tableId,jdbcType=VARCHAR},
|
||||
#{smallChange,jdbcType=DECIMAL}, #{sendType,jdbcType=VARCHAR}, #{orderType,jdbcType=VARCHAR},
|
||||
#{productType,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{billingId,jdbcType=VARCHAR},
|
||||
#{merchantId,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{isVip,jdbcType=TINYINT},
|
||||
#{memberId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{productScore,jdbcType=INTEGER},
|
||||
#{deductScore,jdbcType=INTEGER}, #{userCouponId,jdbcType=VARCHAR}, #{userCouponAmount,jdbcType=DECIMAL},
|
||||
#{refundAble,jdbcType=TINYINT}, #{paidTime,jdbcType=BIGINT}, #{isEffect,jdbcType=TINYINT},
|
||||
#{isGroup,jdbcType=TINYINT}, #{updatedAt,jdbcType=BIGINT}, #{systemTime,jdbcType=BIGINT},
|
||||
values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{settlementAmount,jdbcType=DECIMAL},
|
||||
#{packFee,jdbcType=DECIMAL}, #{originAmount,jdbcType=DECIMAL}, #{productAmount,jdbcType=DECIMAL},
|
||||
#{amount,jdbcType=DECIMAL}, #{refundAmount,jdbcType=DECIMAL}, #{payType,jdbcType=VARCHAR},
|
||||
#{payAmount,jdbcType=DECIMAL}, #{orderAmount,jdbcType=DECIMAL}, #{freightAmount,jdbcType=DECIMAL},
|
||||
#{discountRatio,jdbcType=DECIMAL}, #{discountAmount,jdbcType=DECIMAL}, #{tableId,jdbcType=VARCHAR},
|
||||
#{smallChange,jdbcType=DECIMAL}, #{sendType,jdbcType=VARCHAR}, #{orderType,jdbcType=VARCHAR},
|
||||
#{productType,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{billingId,jdbcType=VARCHAR},
|
||||
#{merchantId,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{isVip,jdbcType=TINYINT},
|
||||
#{memberId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{productScore,jdbcType=INTEGER},
|
||||
#{deductScore,jdbcType=INTEGER}, #{userCouponId,jdbcType=VARCHAR}, #{userCouponAmount,jdbcType=DECIMAL},
|
||||
#{refundAble,jdbcType=TINYINT}, #{paidTime,jdbcType=BIGINT}, #{isEffect,jdbcType=TINYINT},
|
||||
#{isGroup,jdbcType=TINYINT}, #{updatedAt,jdbcType=BIGINT}, #{systemTime,jdbcType=BIGINT},
|
||||
#{createdAt,jdbcType=BIGINT}, #{isAccepted,jdbcType=TINYINT}, #{payOrderNo,jdbcType=VARCHAR},
|
||||
#{tradeDay,jdbcType=VARCHAR}, #{source,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR},
|
||||
#{masterId,jdbcType=VARCHAR}, #{tableName,jdbcType=VARCHAR}, #{isBuyCoupon,jdbcType=VARCHAR}, #{isUseCoupon,jdbcType=VARCHAR},#{outNumber,jdbcType=VARCHAR}
|
||||
@@ -486,9 +491,10 @@
|
||||
<if test="isBuyCoupon != null">
|
||||
is_buy_coupon = #{isBuyCoupon,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isUseCoupon != null">
|
||||
is_use_coupon = #{isUseCoupon,jdbcType=VARCHAR},
|
||||
<if test="userId != null">
|
||||
user_id = #{userId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
@@ -549,6 +555,7 @@
|
||||
|
||||
where user_id = #{userId}
|
||||
and order_type='miniapp'
|
||||
and is_del != 1
|
||||
<if test="status != null and status != ''">
|
||||
<choose>
|
||||
<when test="status == 'unpaid'">
|
||||
@@ -576,4 +583,4 @@
|
||||
left join tb_user_info tui on tui.id = toi.user_id
|
||||
where toi.user_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
<result column="detail" jdbcType="VARCHAR" property="detail" />
|
||||
<result column="style" jdbcType="VARCHAR" property="style" />
|
||||
<result column="sort" jdbcType="INTEGER" property="sort" />
|
||||
<result column="use_time" jdbcType="INTEGER" property="useTime" />
|
||||
<result column="sale_start_time" jdbcType="INTEGER" property="saleStartTime" />
|
||||
<result column="sale_end_time" jdbcType="INTEGER" property="saleEndTime" />
|
||||
<result column="created_at" jdbcType="BIGINT" property="createdAt" />
|
||||
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
|
||||
</resultMap>
|
||||
@@ -18,7 +21,7 @@
|
||||
<result column="product_ids" jdbcType="LONGVARCHAR" property="productIds" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, name, merchant_id, shop_id, pic, is_show, detail, style, sort, created_at, updated_at
|
||||
id, name, merchant_id, shop_id, pic, is_show, detail, style, sort, created_at, updated_at , use_time, sale_start_time, sale_end_time
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
product_ids
|
||||
@@ -234,4 +237,9 @@
|
||||
</if>
|
||||
order by sort asc
|
||||
</select>
|
||||
|
||||
<select id="selectByProductId" resultMap="BaseResultMap">
|
||||
SELECT * FROM tb_product_group WHERE `shop_id` = #{shopId,jdbcType=VARCHAR} AND is_show = 1
|
||||
AND `product_ids` LIKE concat('%',#{productId,jdbcType=VARCHAR},'%')
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1009,6 +1009,7 @@
|
||||
AND t.sku_id = #{skuId}
|
||||
AND t.`status` = 'create'
|
||||
AND t.table_id = #{code}
|
||||
AND t.is_vip = #{isVip}
|
||||
</select>
|
||||
<select id="selectByNewQcode" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
|
||||
@@ -403,7 +403,7 @@
|
||||
FROM
|
||||
tb_product_sku
|
||||
WHERE
|
||||
product_id = #{productId}
|
||||
product_id = #{productId} and is_del=0
|
||||
</select>
|
||||
<select id="selectSale" resultType="com.chaozhanggui.system.cashierservice.entity.vo.HomeVO">
|
||||
SELECT
|
||||
|
||||
155
src/main/resources/mapper/TbProskuConMapper.xml
Normal file
155
src/main/resources/mapper/TbProskuConMapper.xml
Normal file
@@ -0,0 +1,155 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbProskuConMapper">
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
|
||||
<result column="product_id" jdbcType="INTEGER" property="productId" />
|
||||
<result column="product_sku_id" jdbcType="INTEGER" property="productSkuId" />
|
||||
<result column="con_info_id" jdbcType="INTEGER" property="conInfoId" />
|
||||
<result column="surplus_stock" jdbcType="DECIMAL" property="surplusStock" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, shop_id,product_id ,product_sku_id, con_info_id, surplus_stock, status, create_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_prosku_con
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from tb_prosku_con
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
|
||||
insert into tb_prosku_con (id, shop_id, product_sku_id,
|
||||
con_info_id, surplus_stock, status,
|
||||
create_time)
|
||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{productSkuId,jdbcType=INTEGER},
|
||||
#{conInfoId,jdbcType=INTEGER}, #{surplusStock,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
|
||||
insert into tb_prosku_con
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
shop_id,
|
||||
</if>
|
||||
<if test="productSkuId != null">
|
||||
product_sku_id,
|
||||
</if>
|
||||
<if test="conInfoId != null">
|
||||
con_info_id,
|
||||
</if>
|
||||
<if test="surplusStock != null">
|
||||
surplus_stock,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
#{shopId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="productSkuId != null">
|
||||
#{productSkuId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="conInfoId != null">
|
||||
#{conInfoId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="surplusStock != null">
|
||||
#{surplusStock,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
|
||||
update tb_prosku_con
|
||||
<set>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="productSkuId != null">
|
||||
product_sku_id = #{productSkuId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="conInfoId != null">
|
||||
con_info_id = #{conInfoId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="surplusStock != null">
|
||||
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
|
||||
update tb_prosku_con
|
||||
set shop_id = #{shopId,jdbcType=INTEGER},
|
||||
product_sku_id = #{productSkuId,jdbcType=INTEGER},
|
||||
con_info_id = #{conInfoId,jdbcType=INTEGER},
|
||||
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectBySkuIdAndShopId" resultMap="BaseResultMap">
|
||||
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and status=1
|
||||
</select>
|
||||
|
||||
<select id="selectBySkuIdAndShopIdAngCheck" resultMap="BaseResultMap">
|
||||
select a.* from tb_prosku_con as a
|
||||
left join tb_cons_info as b on a.con_info_id=b.id
|
||||
where a.product_sku_id=#{skuId} and a.shop_id=#{shopId} and a.status=1 and b.is_check=1
|
||||
</select>
|
||||
|
||||
<select id="selectIdBySkuIdAndShopId" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
p.con_info_id
|
||||
FROM
|
||||
tb_prosku_con p
|
||||
WHERE
|
||||
p.shop_id = #{shopId}
|
||||
AND p.product_sku_id = #{skuId}
|
||||
AND p.`status` = 1
|
||||
group by p.con_info_id
|
||||
</select>
|
||||
|
||||
<select id="selectByShopIdAndSkuIdAndProductId" resultMap="BaseResultMap">
|
||||
|
||||
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and product_id=#{productId} and status=1
|
||||
</select>
|
||||
|
||||
<select id="selectByShopIdAndSkuIdAndProductIdAndCheck" resultMap="BaseResultMap">
|
||||
|
||||
select a.* from tb_prosku_con as a
|
||||
left join tb_cons_info as b on a.con_info_id=b.id
|
||||
where a.product_sku_id=#{skuId} and a.shop_id=#{shopId} and a.product_id=#{productId} and a.status=1 and b.is_check=1
|
||||
</select>
|
||||
</mapper>
|
||||
22
src/main/resources/mapper/TbShopAdDao.xml
Normal file
22
src/main/resources/mapper/TbShopAdDao.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbShopAdDao">
|
||||
|
||||
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbShopAd" id="TbShopAdMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="imgUrl" column="img_url" jdbcType="VARCHAR"/>
|
||||
<result property="linkPath" column="link_path" jdbcType="VARCHAR"/>
|
||||
<result property="borderRadius" column="border_radius" jdbcType="INTEGER"/>
|
||||
<result property="showPosition" column="show_position" jdbcType="VARCHAR"/>
|
||||
<result property="frequency" column="frequency" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="INTEGER"/>
|
||||
<result property="sort" column="sort" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
72
src/main/resources/mapper/TbShopExtendMapper.xml
Normal file
72
src/main/resources/mapper/TbShopExtendMapper.xml
Normal file
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbShopExtendMapper">
|
||||
|
||||
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbShopExtend" id="TbShopExtendMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="type" column="type" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="autokey" column="autoKey" jdbcType="VARCHAR"/>
|
||||
<result property="value" column="value" jdbcType="VARCHAR"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
, shop_id, type, name, autoKey, value, update_time, create_time </sql>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="TbShopExtendMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_shop_extend
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="queryByShopIdAndAutoKey" resultMap="TbShopExtendMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_shop_extend
|
||||
where shop_id = #{shopId} and autoKey = #{autokey}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAll" resultMap="TbShopExtendMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_shop_extend
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
and shop_id = #{shopId}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
and type = #{type}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
and name = #{name}
|
||||
</if>
|
||||
<if test="autokey != null and autokey != ''">
|
||||
and autoKey = #{autokey}
|
||||
</if>
|
||||
<if test="value != null and value != ''">
|
||||
and value = #{value}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -52,6 +52,8 @@
|
||||
<result column="provinces" jdbcType="VARCHAR" property="provinces"/>
|
||||
<result column="cities" jdbcType="VARCHAR" property="cities"/>
|
||||
<result column="districts" jdbcType="VARCHAR" property="districts"/>
|
||||
|
||||
<result column="is_custom" jdbcType="VARCHAR" property="isCustom" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs"
|
||||
type="com.chaozhanggui.system.cashierservice.entity.TbShopInfo">
|
||||
@@ -64,7 +66,7 @@
|
||||
detail, lat, lng, mch_id, register_type, is_wx_ma_independent, address, city, type,
|
||||
industry, industry_name, business_start_day,business_end_day,business_time, post_time, post_amount_line, on_sale, settle_type,
|
||||
settle_time, enter_at, expire_at, status, average, order_wait_pay_minute, support_device_number,
|
||||
distribute_level, created_at, updated_at, proxy_id, shop_qrcode, tag,is_open_yhq,is_use_vip,provinces,cities,districts
|
||||
distribute_level, created_at, updated_at, proxy_id, shop_qrcode, tag,is_open_yhq,is_use_vip,provinces,cities,districts,is_custom
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
view
|
||||
|
||||
@@ -10,9 +10,11 @@
|
||||
<result column="biz_name" jdbcType="VARCHAR" property="bizName" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||
<result column="is_return" jdbcType="VARCHAR" property="isReturn" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, shop_user_id, amount, balance, biz_code, biz_name, create_time, type
|
||||
id, shop_user_id, amount, balance, biz_code, biz_name, create_time, type,is_return,remark
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
@@ -24,13 +26,13 @@
|
||||
delete from tb_shop_user_flow
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopUserFlow">
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopUserFlow" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||
insert into tb_shop_user_flow (id, shop_user_id, amount,
|
||||
balance, biz_code, biz_name,
|
||||
create_time, type)
|
||||
create_time, type,is_return,remark)
|
||||
values (#{id,jdbcType=INTEGER}, #{shopUserId,jdbcType=INTEGER}, #{amount,jdbcType=DECIMAL},
|
||||
#{balance,jdbcType=DECIMAL}, #{bizCode,jdbcType=VARCHAR}, #{bizName,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=TIMESTAMP}, #{type,jdbcType=VARCHAR})
|
||||
#{createTime,jdbcType=TIMESTAMP}, #{type,jdbcType=VARCHAR},#{isReturn,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopUserFlow">
|
||||
insert into tb_shop_user_flow
|
||||
@@ -130,6 +132,7 @@
|
||||
|
||||
SELECT
|
||||
f.*,
|
||||
u.`head_img`,
|
||||
u.`name`
|
||||
FROM
|
||||
tb_shop_user_flow f
|
||||
|
||||
@@ -414,6 +414,10 @@
|
||||
select * from tb_shop_user where user_id=#{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectVipByUserId" resultMap="BaseResultMap">
|
||||
select * from tb_shop_user where user_id=#{userId} and is_vip = 1
|
||||
</select>
|
||||
|
||||
<select id="selectByOpenId" resultType="com.chaozhanggui.system.cashierservice.entity.TbShopUser">
|
||||
select * from tb_shop_user where mini_open_id = #{openId}
|
||||
</select>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbUserCoupons">
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||
<result column="detail" jdbcType="VARCHAR" property="detail" />
|
||||
<result column="coupons_price" jdbcType="DECIMAL" property="couponsPrice" />
|
||||
<result column="coupons_amount" jdbcType="DECIMAL" property="couponsAmount" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
@@ -13,7 +14,7 @@
|
||||
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, user_id, coupons_price, coupons_amount, status, create_time, update_time, end_time,is_double
|
||||
id, user_id, detail, coupons_price, coupons_amount, status, create_time, update_time, end_time,is_double
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
@@ -21,6 +22,21 @@
|
||||
from tb_user_coupons
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<select id="queryAllSelective" resultMap="BaseResultMap">
|
||||
select
|
||||
detail,coupons_price as couponsPrice,coupons_amount as couponsAmount,status,1 as num,0 as type
|
||||
from tb_user_coupons
|
||||
<where>
|
||||
<if test="userId != null and userId != ''">
|
||||
and user_id = #{userId}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectByUserId" resultType="com.chaozhanggui.system.cashierservice.entity.TbUserCoupons">
|
||||
select * from tb_user_coupons where user_id = #{userId}
|
||||
<if test="status != null and status != ''">
|
||||
@@ -44,10 +60,10 @@
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserCoupons" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into tb_user_coupons (id, user_id, coupons_price,
|
||||
insert into tb_user_coupons (id, user_id, detail, coupons_price,
|
||||
coupons_amount, status, create_time,
|
||||
update_time, end_time,is_double)
|
||||
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR}, #{couponsPrice,jdbcType=DECIMAL},
|
||||
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR}, #{detail,jdbcType=VARCHAR}, #{couponsPrice,jdbcType=DECIMAL},
|
||||
#{couponsAmount,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{updateTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{isDouble,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
@@ -60,6 +76,9 @@
|
||||
<if test="userId != null">
|
||||
user_id,
|
||||
</if>
|
||||
<if test="detail != null">
|
||||
detail,
|
||||
</if>
|
||||
<if test="couponsPrice != null">
|
||||
coupons_price,
|
||||
</if>
|
||||
@@ -86,6 +105,9 @@
|
||||
<if test="userId != null">
|
||||
#{userId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="detail != null">
|
||||
#{detail,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="couponsPrice != null">
|
||||
#{couponsPrice,jdbcType=DECIMAL},
|
||||
</if>
|
||||
@@ -112,6 +134,9 @@
|
||||
<if test="userId != null">
|
||||
user_id = #{userId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="detail != null">
|
||||
detail = #{detail,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="couponsPrice != null">
|
||||
coupons_price = #{couponsPrice,jdbcType=DECIMAL},
|
||||
</if>
|
||||
@@ -137,6 +162,7 @@
|
||||
update tb_user_coupons
|
||||
set user_id = #{userId,jdbcType=VARCHAR},
|
||||
coupons_price = #{couponsPrice,jdbcType=DECIMAL},
|
||||
detail = #{detail,jdbcType=VARCHAR},
|
||||
coupons_amount = #{couponsAmount,jdbcType=DECIMAL},
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<result column="password" jdbcType="VARCHAR" property="password" />
|
||||
<result column="is_pwd" jdbcType="VARCHAR" property="isPwd" />
|
||||
<result column="pwd" jdbcType="VARCHAR" property="pwd" />
|
||||
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, amount, charge_amount, line_of_credit, consume_amount, consume_number, total_score,
|
||||
|
||||
Reference in New Issue
Block a user