团购卷卷码表

原订单列表逻辑
店铺营业时间
团购卷订单
团购卷卷码表
资源管理 字典管理
通用门店
个人中心
支付
This commit is contained in:
wangw 2024-05-13 17:51:30 +08:00
parent d391f136bf
commit 6f6d1c3a7b
69 changed files with 1533 additions and 666 deletions

View File

@ -41,9 +41,14 @@ public class LoginFilter implements Filter {
// "cashierService/location/**",//高德 获取行政区域
// "cashierService/home/homePageUp",//首页上半
// "cashierService/home",//首页
// "cashierService/distirict/subShopList",//首页
// "cashierService/product/productInfo",//商品详情
// "cashierService/login/**"//登录部分接口不校验
//
// "cashierService/distirict/**",//首页其它接口
// "cashierService/login/**",//登录部分接口不校验
// "cashierService/notify/**",//登录部分接口不校验
// "cashierService/product/queryShopIdByTableCode",
// "cashierService/product/queryProduct",
// "cashierService/product/productInfo",
// "notify/**"//登录部分接口不校验
);
@Autowired
@ -74,11 +79,11 @@ public class LoginFilter implements Filter {
//environment 环境标识 wx app 后续environment不可为空
String environment = request.getHeader("environment");
//token校验目前只对app生效
if (StringUtils.isBlank(environment) || !environment.equals("app")) {
chain.doFilter(req, resp);
return;
}
// //token校验目前只对app生效
// if (StringUtils.isBlank(environment) || !environment.equals("app")) {
// chain.doFilter(req, resp);
// return;
// }
// 判断用户TOKEN是否存在
String token = request.getHeader("token");

View File

@ -5,19 +5,28 @@ import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
import com.chaozhanggui.system.cashierservice.exception.MsgException;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.LocationUtils;
import com.chaozhanggui.system.cashierservice.util.RedisUtils;
import com.chaozhanggui.system.cashierservice.util.StringUtil;
import com.chaozhanggui.system.cashierservice.util.ValidateCodeUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.gson.*;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* 通用接口
*
* @author lyf
*/
@RestController
@ -37,6 +46,7 @@ public class CommonController {
/**
* 发送短信验证码
*
* @param phone
* @return
*/
@ -49,8 +59,8 @@ public class CommonController {
validateCodeUtil.requestValidateCodeAli(phone, random);
//存入缓存
try {
redisUtils.set(phone,random,ONE_MINUTE,TimeUnit.SECONDS);
}catch (Exception e){
redisUtils.set(phone, random, ONE_MINUTE, TimeUnit.SECONDS);
} catch (Exception e) {
throw new MsgException("验证码发送失败");
}
return Result.success(CodeEnum.SUCCESS);
@ -62,6 +72,32 @@ public class CommonController {
@GetMapping("/tbPlatformDict")
public Result getPlatformDict(@RequestParam String type, @RequestHeader String environment) {
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType(type, environment);
return Result.success(CodeEnum.SUCCESS,carouselList);
return Result.success(CodeEnum.SUCCESS, carouselList);
}
}
/**
* 行政区域查询
*
* @param keywords citycode市adcode区
* @return
*/
@GetMapping("location/district")
public Result createOrder(String keywords) throws JsonProcessingException {
String district = LocationUtils.district(keywords);
ObjectMapper mapper = new ObjectMapper();
// JSON 字符串解析为 JsonNode 对象
JsonNode jsonNode = mapper.readTree(district);
JsonNode districts = jsonNode.get("districts");
return Result.success(CodeEnum.SUCCESS, districts);
}
@GetMapping("location/getGPSByIp")
public Result getGPSByIp(String ip) throws JsonProcessingException {
String gpsInfo = LocationUtils.getGPSByIp(ip);
ObjectMapper mapper = new ObjectMapper();
JsonNode jsonNode = mapper.readTree(gpsInfo);
return Result.success(CodeEnum.SUCCESS, jsonNode);
}
}

View File

@ -1,8 +1,12 @@
package com.chaozhanggui.system.cashierservice.controller;
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderInfo;
import com.chaozhanggui.system.cashierservice.entity.dto.CreateGroupOrderDto;
import com.chaozhanggui.system.cashierservice.entity.dto.GroupOrderDto;
import com.chaozhanggui.system.cashierservice.entity.dto.OrderDto;
import com.chaozhanggui.system.cashierservice.service.GroupOrderCouponService;
import com.chaozhanggui.system.cashierservice.service.GroupOrderInfoService;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
import org.springframework.web.bind.annotation.*;
@ -22,6 +26,9 @@ public class GroupOrderInfoController {
@Resource
private GroupOrderInfoService tbGroupOrderInfoService;
@Resource
private GroupOrderCouponService orderCouponService;
/**
* 分页查询
*
@ -30,14 +37,35 @@ public class GroupOrderInfoController {
*/
@RequestMapping("list")
public Result queryByPage(@RequestHeader String token, GroupOrderDto param) {
// public Result queryByPage(GroupOrderDto param) {
// param.setUserId("21");
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
param.setUserId(userId);
return tbGroupOrderInfoService.queryByPage(param);
}
/**
* 通过id查询卷码
*/
@RequestMapping("getCoupon")
public Result queryCouponById(Integer id) {
return Result.success(CodeEnum.SUCCESS,orderCouponService.queryByOrderId(id));
}
/**
* 团购卷 下单
* @param token
* @param param
* @return
*/
@PostMapping("/creatGroupOrder")
public Result createOrder(@RequestHeader String token,@RequestBody CreateGroupOrderDto param){
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
String phone = TokenUtil.parseParamFromToken(token).getString("phone");
param.setUserId(Integer.valueOf(userId));
param.setPhone(phone);
return tbGroupOrderInfoService.insert(param);
}
/**
* 通过主键查询单条数据
*
@ -49,16 +77,6 @@ public class GroupOrderInfoController {
return tbGroupOrderInfoService.queryById(id,lng,lat);
}
/**
* 新增数据
*
* @param tbGroupOrderInfo 实体
* @return 新增结果
*/
@RequestMapping("add")
public Result add(TbGroupOrderInfo tbGroupOrderInfo) {
return tbGroupOrderInfoService.insert(tbGroupOrderInfo);
}
/**
* 编辑数据

View File

@ -1,5 +1,6 @@
package com.chaozhanggui.system.cashierservice.controller;
import com.chaozhanggui.system.cashierservice.entity.dto.ComShopDto;
import com.chaozhanggui.system.cashierservice.entity.dto.HomeBaseDto;
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
import com.chaozhanggui.system.cashierservice.service.HomeDistrictService;
@ -22,6 +23,9 @@ public class HomeDistrictController {
@Resource
private HomeDistrictService districtService;
/**
* 顶部图/菜单
*/
@RequestMapping("/topCommon")
public Result topCommon(HomeDto param,@RequestHeader("environment") String environment){
return districtService.topCommon(param,environment);
@ -44,7 +48,15 @@ public class HomeDistrictController {
* 咖啡饮品
*/
@RequestMapping("/productCate")
public Result productCate(HomeDto param) throws ExecutionException, InterruptedException {
public Result productCate(HomeDto param){
return districtService.proList(param);
}
/**
* 通用门店
*/
@RequestMapping("/comShopList")
public Result comShopList(ComShopDto param){
return districtService.queryComShopList(param);
}
}

View File

@ -1,37 +0,0 @@
package com.chaozhanggui.system.cashierservice.controller;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.LocationUtils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
@CrossOrigin(origins = "*")
@RestController
@Slf4j
@RequestMapping("/location")
public class LocationController {
/**
* 行政区域查询
*
* @param keywords citycode市adcode区
* @return
*/
@GetMapping("/district")
public Result createOrder(String keywords) throws JsonProcessingException {
String district = LocationUtils.district(keywords);
ObjectMapper mapper = new ObjectMapper();
// JSON 字符串解析为 JsonNode 对象
JsonNode jsonNode = mapper.readTree(district);
JsonNode districts = jsonNode.get("districts");
return Result.success(CodeEnum.SUCCESS, districts);
}
}

View File

@ -9,7 +9,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbMerchantAccount;
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
import com.chaozhanggui.system.cashierservice.entity.dto.AuthUserDto;
import com.chaozhanggui.system.cashierservice.entity.dto.OnlineUserDto;
import com.chaozhanggui.system.cashierservice.entity.vo.UserPassVo;
import com.chaozhanggui.system.cashierservice.entity.dto.UserPassDto;
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
import com.chaozhanggui.system.cashierservice.service.LoginService;
@ -252,7 +252,7 @@ public class LoginContoller {
}
@PostMapping(value = "/upPass")
public Result upPass(@RequestHeader String token,@RequestBody UserPassVo passVo){
public Result upPass(@RequestHeader String token,@RequestBody UserPassDto passVo){
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
String newPass = MD5Utils.MD5Encode(passVo.getNewPass(), "utf-8");
if (ObjectUtil.isNull(passVo.getCode())) {

View File

@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import java.util.Random;
@CrossOrigin(origins = "*")
@RestController
@ -61,6 +62,21 @@ public class NotifyController {
return null;
}
@RequestMapping("notifyCallBackGroup")
public String notifyCallBackGroup(HttpServletRequest request){
Map<String, Object> map= getParameterMap(request);
log.info("团购卷回调返回信息:{}",JSONUtil.toJsonStr(map));
if(ObjectUtil.isNotEmpty(map)&&map.containsKey("code")&&"200".equals(map.get("code")+"")){
JSONObject object=JSONUtil.parseObj(map.get("data"));
if(ObjectUtil.isNotEmpty(object)&&object.containsKey("status")&&"1".equals(object.getStr("status"))){
String orderNo=object.getStr("orderNumber");
return payService.callBackGroupPay(orderNo);
}
}
return null;
}
private Map<String, Object> getParameterMap(HttpServletRequest request) {

View File

@ -1,16 +1,20 @@
package com.chaozhanggui.system.cashierservice.controller;
import cn.hutool.core.util.ObjectUtil;
import com.chaozhanggui.system.cashierservice.entity.TbOrderDetail;
import com.chaozhanggui.system.cashierservice.entity.dto.ReturnGroupOrderDto;
import com.chaozhanggui.system.cashierservice.service.PayService;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.IpUtil;
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@CrossOrigin(origins = "*")
@ -26,25 +30,36 @@ public class PayController {
/**
* 支付
*
* @param request
* @param openId
* payType wechatPay:微信支付aliPay:支付宝支付
* @param map
* @return
*/
@RequestMapping("orderPay")
public Result pay(HttpServletRequest request, @RequestHeader("openId") String openId, @RequestBody Map<String,String> map) {
if(ObjectUtil.isEmpty(map)||map.size()<=0||!map.containsKey("orderId")||ObjectUtil.isEmpty(map.get("orderId"))){
public Result pay(HttpServletRequest request, @RequestHeader String token, @RequestBody Map<String, String> map) {
if (ObjectUtil.isEmpty(map) || map.size() <= 0 || !map.containsKey("orderId") || ObjectUtil.isEmpty(map.get("orderId"))) {
return Result.fail("订单号不允许为空");
}
String orderId = map.get("orderId").toString();
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
try {
return payService.payOrder(openId,map.get("orderId").toString(), IpUtil.getIpAddr(request));
if(orderId.startsWith("GP")){
return payService.groupOrderPay(orderId, map.get("payType"), userId, IpUtil.getIpAddr(request));
}else {
return payService.payOrder(userId, orderId, map.get("payType"), IpUtil.getIpAddr(request));
}
} catch (Exception e) {
e.printStackTrace();
}
return Result.fail("支付失败");
}
@RequestMapping("returnGpOrder")
public Result returnOrder(@RequestBody ReturnGroupOrderDto param){
return payService.returnOrder(param);
}
//
// public Result memberAccountPay(@RequestHeader("openId") String openId,
@ -59,12 +74,13 @@ public class PayController {
/**
* 修改订单状态
*
* @param map
* @return
*/
@RequestMapping("modfiyOrderInfo")
public Result modfiyOrderInfo( @RequestBody Map<String,String> map){
if(ObjectUtil.isEmpty(map)||map.size()<=0||!map.containsKey("orderId")||ObjectUtil.isEmpty(map.get("orderId"))){
public Result modfiyOrderInfo(@RequestBody Map<String, String> map) {
if (ObjectUtil.isEmpty(map) || map.size() <= 0 || !map.containsKey("orderId") || ObjectUtil.isEmpty(map.get("orderId"))) {
return Result.fail("订单号不允许为空");
}
@ -79,23 +95,18 @@ public class PayController {
/**
* 充值
*
* @param request
* @param openId
* @param map
* @return
*/
@RequestMapping("memeberIn")
public Result memeberIn(HttpServletRequest request,@RequestHeader("openId") String openId,@RequestHeader("id") String id,
@RequestBody Map<String,Object> map
){
return payService.memberIn(openId,id,map.get("amount").toString(),map.get("shopId").toString(),IpUtil.getIpAddr(request));
public Result memeberIn(HttpServletRequest request, @RequestHeader("openId") String openId, @RequestHeader("id") String id,
@RequestBody Map<String, Object> map
) {
return payService.memberIn(openId, id, map.get("amount").toString(), map.get("shopId").toString(), IpUtil.getIpAddr(request));
}
}

View File

@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.chaozhanggui.system.cashierservice.service.ProductService;
import com.chaozhanggui.system.cashierservice.sign.Result;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -20,6 +21,21 @@ public class ProductController {
@Autowired
private ProductService productService;
/**
* 通过桌码获取shopId
* @param code
* @return shopid
*/
@RequestMapping("queryShopIdByTableCode")
public Result queryShopIdByTableCode(@RequestParam("code") String code) {
return productService.queryShopIdByTableCode(code);
}
/**
* 通过code和分组Id
* @param map
* @return
*/
@RequestMapping("queryProduct")
public Result queryProduct(@RequestBody Map<String, String> map) {

View File

@ -1,21 +0,0 @@
package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.SysDict;
import com.chaozhanggui.system.cashierservice.entity.SysDictDetail;
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 SysDictDetailMapper {
List<SysDict> selectHot();
List<SysDict> selectByType(@Param("type") String type);
List<SysDictDetail> selectByDictId(@Param("dictId") Long dictId);
}

View File

@ -1,17 +1,14 @@
package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.SysDict;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SysDictMapper {
int deleteByPrimaryKey(Long dictId);
List<SysDict> selectHot();
int insert(SysDict record);
List<SysDict> selectByType(@Param("type") String type);
int insertSelective(SysDict record);
SysDict selectByPrimaryKey(Long dictId);
int updateByPrimaryKeySelective(SysDict record);
int updateByPrimaryKey(SysDict record);
List<SysDict> selectByDictId(@Param("dictId") Long dictId);
}

View File

@ -0,0 +1,72 @@
package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderCoupon;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* 团购卷 卷码表(TbGroupOrderCoupon)表数据库访问层
*
* @author ww
* @since 2024-05-06 14:39:59
*/
public interface TbGroupOrderCouponMapper {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
TbGroupOrderCoupon queryById(Integer id);
List<TbGroupOrderCoupon> queryByOrderId(Integer orderId);
List<TbGroupOrderCoupon> queryNoRefundByOrderId(Integer orderId);
/**
* 查询数据
*
* @param tbGroupOrderCoupon 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
List<TbGroupOrderCoupon> queryAll(TbGroupOrderCoupon tbGroupOrderCoupon, @Param("pageable") Pageable pageable);
/**
* 新增数据
*
* @param tbGroupOrderCoupon 实例对象
* @return 影响行数
*/
int insert(TbGroupOrderCoupon tbGroupOrderCoupon);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<TbGroupOrderCoupon> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<TbGroupOrderCoupon> entities);
/**
* 修改数据
*
* @param tbGroupOrderCoupon 实例对象
* @return 影响行数
*/
int update(TbGroupOrderCoupon tbGroupOrderCoupon);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Integer id);
}

View File

@ -3,6 +3,7 @@ package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderInfo;
import com.chaozhanggui.system.cashierservice.entity.dto.GroupOrderDto;
import com.chaozhanggui.system.cashierservice.entity.vo.GroupOrderListVo;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -23,6 +24,8 @@ public interface TbGroupOrderInfoMapper {
*/
TbGroupOrderInfo queryById(Integer id);
TbGroupOrderInfo selectByPayOrderNo(@Param("payOrderNO")String payOrderNO);
/**
* 查询数据
*
@ -56,13 +59,6 @@ public interface TbGroupOrderInfoMapper {
*/
int update(TbGroupOrderInfo tbGroupOrderInfo);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Integer id);
}

View File

@ -29,8 +29,7 @@ public interface TbOrderInfoMapper {
List<TbOrderInfo> selectAllByStatus(String status);
TbOrderInfo selectByPayOrderNo(String payOrderNo);
List<TbOrderInfo> selectByUserId(@Param("userId")Integer userId, @Param("page")Integer page,
@Param("size")Integer size, @Param("status") String status);
List<TbOrderInfo> selectByUserId(@Param("userId")Integer userId, @Param("status") String status);
List<TbOrderInfo> selectByTradeDay(@Param("day") String day,@Param("minPrice") BigDecimal minPrice,@Param("maxPrice") BigDecimal maxPrice);

View File

@ -3,7 +3,6 @@ package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
@ -25,6 +24,7 @@ public interface TbPlatformDictMapper {
List<TbPlatformDict> queryByIdList(@Param("idList")List<Integer> idList);
List<TbPlatformDict> queryAllByType(@Param("type") String type,@Param("environment") String environment);
List<TbPlatformDict> queryGroupByValue(@Param("value")String value,@Param("environment") String environment);
}

View File

@ -27,5 +27,6 @@ public interface TbProductGroupMapper {
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);
}

View File

@ -27,4 +27,11 @@ public interface TbProductMapper {
@Param("rightTopLng") Double rightTopLng, @Param("rightTopLat") Double rightTopLat,
@Param("leftBottomLng") Double leftBottomLng, @Param("leftBottomLat") Double leftBottomLat,
@Param("cities") String cities, @Param("orderBy") String orderBy, @Param("lng") String lng, @Param("lat") String lat);
List<ShopGroupInfoVo> selHotGroups(@Param("type") String type,
@Param("startTime") String startTime, @Param("endTime") String endTime,
@Param("cities") String cities, @Param("orderBy") String orderBy, @Param("lng") String lng, @Param("lat") String lat);
void upGroupRealSalesNumber(@Param("id") String id,@Param("number") Integer number);
}

View File

@ -21,10 +21,13 @@ public interface TbShopInfoMapper {
List<SubShopVo> selShopInfoByGps(@Param("rightTopLng") Double rightTopLng, @Param("rightTopLat") Double rightTopLat,
@Param("leftBottomLng") Double leftBottomLng, @Param("leftBottomLat") Double leftBottomLat,
@Param("cities") String cities, @Param("lng") String lng, @Param("lat") String lat);
@Param("cities") String cities, @Param("lng") String lng, @Param("lat") String lat,
@Param("shopName")String shopName);
TbShopInfo selectByPrimaryKey(Integer id);
Integer selNumByChain(@Param("chainName") String chainName);
List<TbShopInfo> selectByIds(@Param("list") List<String> ids);
int updateByPrimaryKeySelective(TbShopInfo record);

View File

@ -22,6 +22,8 @@ public interface TbShopTableMapper {
TbShopTable selectQRcode(String code);
String queryShopIdByTableCode(String code);
int updateByPrimaryKeySelective(TbShopTable record);
int updateByPrimaryKey(TbShopTable record);

View File

@ -3,17 +3,28 @@ package com.chaozhanggui.system.cashierservice.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Data
public class SysDict implements Serializable {
private Long dictId;
private String dictName;
private String name;
private String description;
/**
* 是否有子类0否1是
*/
private Integer isChild;
private Integer isChild;
/**
*
*/
private String value;
private List<SysDict> detail=new ArrayList<>();
}

View File

@ -0,0 +1,101 @@
package com.chaozhanggui.system.cashierservice.entity;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 团购卷 卷码表(TbGroupOrderCoupon)实体类
*
* @author ww
* @since 2024-05-06 14:39:59
*/
public class TbGroupOrderCoupon implements Serializable {
private static final long serialVersionUID = -35424376349743542L;
private Integer id;
/**
* 团购订单id
*/
private Integer orderId;
/**
* 团购卷码
*/
private String couponNo;
/**
* 是否已退款
* 0
* 1
*/
private Integer isRefund;
/**
* 退款金额
*/
private BigDecimal refundAmount;
/**
* 退款原因
*/
private String refundReason;
/**
* 退款说明
*/
private String refundDesc;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getOrderId() {
return orderId;
}
public void setOrderId(Integer orderId) {
this.orderId = orderId;
}
public String getCouponNo() {
return couponNo;
}
public void setCouponNo(String couponNo) {
this.couponNo = couponNo;
}
public Integer getIsRefund() {
return isRefund;
}
public void setIsRefund(Integer isRefund) {
this.isRefund = isRefund;
}
public BigDecimal getRefundAmount() {
return refundAmount;
}
public void setRefundAmount(BigDecimal refundAmount) {
this.refundAmount = refundAmount;
}
public String getRefundReason() {
return refundReason;
}
public void setRefundReason(String refundReason) {
this.refundReason = refundReason;
}
public String getRefundDesc() {
return refundDesc;
}
public void setRefundDesc(String refundDesc) {
this.refundDesc = refundDesc;
}
}

View File

@ -2,17 +2,13 @@ package com.chaozhanggui.system.cashierservice.entity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.io.Serializable;
/**
* 团购卷订单
*
* @author ww
* @since 2024-04-27 16:15:09
*/
@Data
public class TbGroupOrderInfo implements Serializable {
private static final long serialVersionUID = -27465362251022601L;
private static final long serialVersionUID = -11810357048433715L;
/**
* id
*/
@ -21,6 +17,7 @@ public class TbGroupOrderInfo implements Serializable {
* 订单编号
*/
private String orderNo;
private Integer merchantId;
/**
* 商户Id
*/
@ -33,48 +30,51 @@ public class TbGroupOrderInfo implements Serializable {
* 商品id
*/
private Integer proId;
/**
* 商品名称
*/
private String proName;
/**
* 商品图
*/
private String proImg;
/**
* 团购卷编号
* 商品名称
*/
private String couponNo;
/**
* 团购卷图片
*/
private String couponUrl;
private String proName;
/**
* 团购卷到期日期
*/
private Date expDate;
/**
* 支付方式
* 订单类型 预留字段
*/
private String orderType;
/**
* 支付方式 wechatPay微信支付aliPay支付宝支付
*/
private String payType;
/**
* 订单金额
*/
private Double orderAmount;
private BigDecimal orderAmount;
/**
* 优惠金额
*/
private Double saveAmount;
private BigDecimal saveAmount;
/**
* 实付金额
*/
private Double payAmount;
private BigDecimal payAmount;
/**
* 退单金额
*/
private BigDecimal refundAmount;
/**
* 数量
*/
private Integer number;
private Integer refundNumber;
/**
* 订单状态
* 状态: unpaid-待付款;unused-待使用;closed-已完成;refunding-退款中;refund-已退款;cancelled-已取消;
*/
private String status;
/**
@ -90,13 +90,17 @@ public class TbGroupOrderInfo implements Serializable {
*/
private Date payTime;
/**
* 是否支持退款 0不支持
* 是否支持退款 0不支持 1支持
*/
private Integer refundAble;
/**
* 创建时间
*/
private Date createTime;
/**
* 卷码核销员
*/
private String verifier;
/**
* 更新时间
*/
@ -114,5 +118,6 @@ public class TbGroupOrderInfo implements Serializable {
*/
private Integer source;
}

View File

@ -20,6 +20,7 @@ public class TbPlatformDict implements Serializable {
* 描述 同类型下 name唯一
*/
private String name;
private String value;
private String fontColor;
private String backColor;
/**
@ -102,6 +103,14 @@ public class TbPlatformDict implements Serializable {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getType() {
return type;
}

View File

@ -62,6 +62,8 @@ public class TbShopInfo implements Serializable {
private String industryName;
private String businessStartDay;
private String businessEndDay;
private String businessTime;
private String postTime;

View File

@ -2,6 +2,9 @@ package com.chaozhanggui.system.cashierservice.entity.dto;
import lombok.Data;
/**
* 分页数据
*/
@Data
public class BasePageDto {
private Integer page = 1;

View File

@ -0,0 +1,15 @@
package com.chaozhanggui.system.cashierservice.entity.dto;
import lombok.Data;
/**
* 通用门店查询类
*/
@Data
public class ComShopDto extends HomeBaseDto{
/**
* 连锁店名
*/
private String shopName;
}

View File

@ -0,0 +1,18 @@
package com.chaozhanggui.system.cashierservice.entity.dto;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class CreateGroupOrderDto {
private Integer proId;
private Integer shopId;
private Integer num;
private Integer userId;
private String phone;
private BigDecimal orderAmount;
private BigDecimal payAmount;
private String remark;
}

View File

@ -2,11 +2,12 @@ package com.chaozhanggui.system.cashierservice.entity.dto;
import lombok.Data;
/**
* 查询通用核心类
* 经纬度
* 城市信息
* 分页数据
*/
@Data
public class HomeBaseDto extends BasePageDto{
@ -23,8 +24,7 @@ public class HomeBaseDto extends BasePageDto{
*/
private String address;
private double distanceInKm = 10;
private String distanceInKm;
//是否分页 1分页
private Integer isPage = 1;
}

View File

@ -15,9 +15,17 @@ public class HomeDto extends HomeBaseDto {
/**
* 0.今日上新
* 1.离我最近
* 2.销量优先/热榜推荐
* 2.销量优先
* 3.价格优先
* 4.热榜推荐
* 5.精选推荐
*/
private Integer orderBy = 0;
/**
* 0:今天
* 1:两小时内
*/
private Integer dateType = 1;
}

View File

@ -0,0 +1,29 @@
package com.chaozhanggui.system.cashierservice.entity.dto;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class ReturnGroupOrderDto {
/**
* 退单数
*/
private Integer num;
/**
* 团购订单id
*/
private Integer orderId;
/**
* 退款金额
*/
private BigDecimal refundAmount;
/**
* 退款原因
*/
private String refundReason;
/**
* 退款说明
*/
private String refundDesc;
}

View File

@ -1,4 +1,4 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
package com.chaozhanggui.system.cashierservice.entity.dto;
import lombok.Data;
@ -6,7 +6,7 @@ import lombok.Data;
* 修改密码的 Vo
*/
@Data
public class UserPassVo {
public class UserPassDto {
private String phone;
private String code;

View File

@ -1,5 +1,6 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import com.chaozhanggui.system.cashierservice.entity.SysDict;
import lombok.Data;
import java.util.List;
@ -20,5 +21,5 @@ public class CommonVo {
/**
* 菜单列表 不一定有
*/
private List<DicDetailVO> menu;
private List<SysDict> menu;
}

View File

@ -1,12 +1,19 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderCoupon;
import com.chaozhanggui.system.cashierservice.entity.TbPurchaseNotice;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
public class GroupOrderDetailsVo {
private Integer id;
/**
* 商品id
*/
private Integer proId;
/**
* 商品名称
*/
@ -19,7 +26,7 @@ public class GroupOrderDetailsVo {
* 可用时间说明
* 周一至周日
*/
private String avaTime;
private String avaTime="";
/**
* 商品描述
* 随时退·过期自动退·到店
@ -28,7 +35,7 @@ public class GroupOrderDetailsVo {
/**
* 订单金额
*/
private Double orderAmount;
private BigDecimal orderAmount;
/**
* number 张可用 | 2024-04-11 23:59:59 到期
*/
@ -41,14 +48,9 @@ public class GroupOrderDetailsVo {
* 是否支持退款
*/
private Integer refundAble;
/**
* 卷码
*/
private List<String> couponNo;
/**
* 卷码图
*/
private List<String> couponUrl;
List<TbGroupOrderCoupon> coupons;
/**
* 商家名称
*/
@ -72,7 +74,7 @@ public class GroupOrderDetailsVo {
/**
* 购买须知
*/
private TbPurchaseNotice notice;
private TbPurchaseNotice notice=new TbPurchaseNotice();
/**
* 订单编号
*/
@ -92,30 +94,6 @@ public class GroupOrderDetailsVo {
/**
* 实付金额
*/
private Double payAmount;
public void setStatus(String status) {
switch (status) {
case "unpaid":
this.status = "待付款";
break;
case "unused":
this.status = "待使用";
break;
case "closed":
this.status = "已完成";
break;
case "refunding":
this.status = "退款中";
break;
case "refund":
this.status = "已退款";
break;
case "cancelled":
this.status = "已取消";
break;
default:
this.status = status;
}
}
private BigDecimal payAmount;
private BigDecimal saveAmount;
}

View File

@ -20,10 +20,6 @@ public class GroupOrderListVo {
* 商品图
*/
private String proImg;
/**
* 团购卷图片
*/
private String couponUrl;
/**
* 订单金额
*/

View File

@ -17,6 +17,8 @@ public class HomeDistrictVo{
* 描述 同类型下 name唯一
*/
private String name;
private String value;
/**
* 字体颜色
*/
@ -29,5 +31,7 @@ public class HomeDistrictVo{
* 绝对跳转地址
*/
private String absUrl;
}

View File

@ -1,5 +1,6 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import com.chaozhanggui.system.cashierservice.entity.SysDict;
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
import java.util.List;
@ -20,7 +21,7 @@ public class HomeUpVO {
/**
* 条件查询
*/
List<DicDetailVO> menu;
List<SysDict> menu;
/**
* 今日上新
*/
@ -74,11 +75,11 @@ public class HomeUpVO {
this.district = district;
}
public List<DicDetailVO> getMenu() {
public List<SysDict> getMenu() {
return menu;
}
public void setMenu(List<DicDetailVO> menu) {
public void setMenu(List<SysDict> menu) {
this.menu = menu;
}
}

View File

@ -5,6 +5,8 @@ import java.math.BigDecimal;
@Data
public class OrderConfirmVo {
private String proId;
private String shopId;
/**
* 商品图片
*/

View File

@ -50,6 +50,14 @@ public class ProductInfoVo {
* 店铺名称
*/
private String shopName;
/**
* 多少家店可用
*/
private Integer shopNum;
/**
* 连锁店扩展店名
*/
private String chainName;
/**
* 联系方式
*/
@ -75,5 +83,5 @@ public class ProductInfoVo {
/**
* 购买须知/价格说明
*/
private TbPurchaseNotice purchaseNotice;
private TbPurchaseNotice purchaseNotice=new TbPurchaseNotice();
}

View File

@ -22,6 +22,7 @@ public class ProductVo {
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public static class Food {
private Integer id;
private String name; // 商品名称
private BigDecimal lowPrice; // 售价
private String unitName; // 单位

View File

@ -28,4 +28,7 @@ public class ShopGroupInfoVo {
//销量
private Integer number;
private String address;
}

View File

@ -20,6 +20,12 @@ public class SubShopVo{
* 手机号
*/
private String phone;
/**
* 营业时间
*/
private String businessStartDay;
private String businessEndDay;
private String businessTime;
/**
* Logo图
*/

View File

@ -0,0 +1,17 @@
package com.chaozhanggui.system.cashierservice.model;
import lombok.Data;
@Data
public class ReturnOrderReq extends BaseRequest {
private String orderNumber;
private String amount;
private String mercRefundNo;
private String refundReason;
private String payPassword;
}

View File

@ -0,0 +1,48 @@
package com.chaozhanggui.system.cashierservice.service;
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderCoupon;
import com.chaozhanggui.system.cashierservice.dao.TbGroupOrderCouponMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 团购卷 卷码表(TbGroupOrderCoupon)表服务实现类
*
* @author ww
* @since 2024-05-06 14:39:59
*/
@Service
public class GroupOrderCouponService {
@Resource
private TbGroupOrderCouponMapper tbGroupOrderCouponMapper;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
public TbGroupOrderCoupon queryById(Integer id) {
return this.tbGroupOrderCouponMapper.queryById(id);
}
public List<TbGroupOrderCoupon> queryByOrderId(Integer orderId) {
return tbGroupOrderCouponMapper.queryByOrderId(orderId);
}
public List<TbGroupOrderCoupon> queryNoRefundByOrderId(Integer orderId) {
return tbGroupOrderCouponMapper.queryNoRefundByOrderId(orderId);
}
public TbGroupOrderCoupon insert(TbGroupOrderCoupon tbGroupOrderCoupon) {
this.tbGroupOrderCouponMapper.insert(tbGroupOrderCoupon);
return tbGroupOrderCoupon;
}
public TbGroupOrderCoupon update(TbGroupOrderCoupon tbGroupOrderCoupon) {
this.tbGroupOrderCouponMapper.update(tbGroupOrderCoupon);
return this.queryById(tbGroupOrderCoupon.getId());
}
}

View File

@ -1,19 +1,19 @@
package com.chaozhanggui.system.cashierservice.service;
import com.chaozhanggui.system.cashierservice.dao.TbProductMapper;
import com.chaozhanggui.system.cashierservice.dao.TbPurchaseNoticeMapper;
import com.chaozhanggui.system.cashierservice.dao.TbShopInfoMapper;
import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.dao.TbGroupOrderInfoMapper;
import com.chaozhanggui.system.cashierservice.entity.dto.CreateGroupOrderDto;
import com.chaozhanggui.system.cashierservice.entity.dto.GroupOrderDto;
import com.chaozhanggui.system.cashierservice.entity.vo.GroupOrderDetailsVo;
import com.chaozhanggui.system.cashierservice.entity.vo.GroupOrderListVo;
import com.chaozhanggui.system.cashierservice.entity.vo.ProductVo;
import com.chaozhanggui.system.cashierservice.exception.MsgException;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.DateUtils;
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
import com.chaozhanggui.system.cashierservice.util.LocationUtils;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
@ -22,18 +22,23 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Random;
@Service
@Slf4j
public class GroupOrderInfoService{
public class GroupOrderInfoService {
@Autowired
private TbShopInfoMapper shopInfoMapper;
@Autowired
private TbProductMapper tbProductMapper;
@Resource
private TbGroupOrderInfoMapper tbGroupOrderInfoMapper;
@Autowired
private GroupOrderCouponService groupOrderCouponService;
@Autowired
private TbMerchantAccountMapper merchantAccountMapper;
@Resource
private TbPurchaseNoticeMapper noticeMapper;
@ -43,23 +48,33 @@ public class GroupOrderInfoService{
* @param id 主键
* @return 实例对象
*/
public Result queryById(Integer id,String lng,String lat) {
public Result queryById(Integer id, String lng, String lat) {
TbGroupOrderInfo groupOrder = tbGroupOrderInfoMapper.queryById(id);
GroupOrderDetailsVo result=new GroupOrderDetailsVo();
GroupOrderDetailsVo result = new GroupOrderDetailsVo();
result.setId(id);
result.setProId(groupOrder.getProId());
result.setProName(groupOrder.getProName());
result.setProImg(groupOrder.getProImg());
TbPurchaseNotice tbPurchaseNotice = noticeMapper.queryByCouponId(groupOrder.getProId());
result.setAvaTime(tbPurchaseNotice.getAvailableTime()+" | 到店吃");
// result.setProDetail();
if(tbPurchaseNotice!=null){
result.setAvaTime(tbPurchaseNotice.getAvailableTime()+" | 到店吃");
result.setNotice(tbPurchaseNotice);
}
// result.setProDetail(); //随时退·过期自动退·到店
result.setOrderAmount(groupOrder.getOrderAmount());
result.setExpDate(groupOrder.getNumber()+"张可用 | "+ DateUtils.getTimeM(groupOrder.getExpDate()));
if(!groupOrder.getStatus().equals("unpaid")){
if(!groupOrder.getStatus().equals("closed")){
result.setExpDate(groupOrder.getNumber()-
groupOrder.getRefundNumber() + "张可用 | " +
DateUtils.getTimeM(
groupOrder.getExpDate())+" 到期");
}
}
result.setRefundAble(groupOrder.getRefundAble());
List<String> coupons = Arrays.asList(groupOrder.getCouponNo().split(","));
List<String> couponUrls = Arrays.asList(groupOrder.getCouponUrl().split(","));
result.setCouponNo(coupons);
result.setCouponUrl(couponUrls);
List<TbGroupOrderCoupon> tbGroupOrderCoupons = groupOrderCouponService.queryByOrderId(id);
result.setCoupons(tbGroupOrderCoupons);
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(groupOrder.getShopId());
result.setShopName(shopInfo.getShopName());
@ -73,67 +88,90 @@ public class GroupOrderInfoService{
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(groupOrder.getProId());
result.setTagVos(JSONUtil.parseListTNewList(product.getGroupSnap(), ProductVo.class));
result.setNotice(tbPurchaseNotice);
result.setOrderNo(groupOrder.getOrderNo());
result.setPhone(groupOrder.getPhone());
result.setPayTime(DateUtils.getTime(groupOrder.getPayTime()));
if (groupOrder.getPayTime() != null) {
result.setPayTime(DateUtils.getTime(groupOrder.getPayTime()));
}
result.setNumber(groupOrder.getNumber());
result.setPayAmount(groupOrder.getPayAmount());
return Result.success(CodeEnum.SUCCESS,result);
result.setSaveAmount(groupOrder.getSaveAmount());
result.setStatus(groupOrder.getStatus());
return Result.success(CodeEnum.SUCCESS, result);
}
/**
* 分页查询
*
* @return 查询结果
*/
public Result queryByPage(GroupOrderDto param) {
PageHelper.startPage(param.getPage(), param.getSize());
List<GroupOrderListVo> tbGroupOrderInfos = tbGroupOrderInfoMapper.queryAll(param);
return Result.success(CodeEnum.SUCCESS,new PageInfo(tbGroupOrderInfos));
return new Result(CodeEnum.SUCCESS,new PageInfo<>(tbGroupOrderInfoMapper.queryAll(param)));
}
/**
* 新增数据
*
* @param tbGroupOrderInfo 实例对象
* @return 实例对象
*/
public Result insert(TbGroupOrderInfo tbGroupOrderInfo) {
public Result insert(CreateGroupOrderDto param) {
TbMerchantAccount tbMerchantAccount = merchantAccountMapper.selectByShopId(param.getShopId().toString());
if (tbMerchantAccount == null) {
throw new MsgException("生成订单错误");
}
TbGroupOrderInfo tbGroupOrderInfo = new TbGroupOrderInfo();
tbGroupOrderInfo.setOrderNo(generateOrderNumber());
tbGroupOrderInfo.setMerchantId(tbMerchantAccount.getId());
tbGroupOrderInfo.setShopId(param.getShopId());
tbGroupOrderInfo.setProId(param.getProId());
tbGroupOrderInfo.setUserId(param.getUserId());
tbGroupOrderInfo.setPhone(param.getPhone());
TbProduct tbProduct = tbProductMapper.selectById(param.getProId());
tbGroupOrderInfo.setProImg(tbProduct.getCoverImg());
tbGroupOrderInfo.setProName(tbProduct.getName());
tbGroupOrderInfo.setNumber(param.getNum());
tbGroupOrderInfo.setRefundNumber(0);
tbGroupOrderInfo.setOrderAmount(param.getOrderAmount());
tbGroupOrderInfo.setRefundAmount(BigDecimal.ZERO);
tbGroupOrderInfo.setSaveAmount(param.getOrderAmount().subtract(param.getPayAmount()));
tbGroupOrderInfo.setPayAmount(param.getPayAmount());
tbGroupOrderInfo.setStatus("unpaid");
tbGroupOrderInfo.setRemark(param.getRemark());
tbGroupOrderInfo.setCreateTime(new Date());
tbGroupOrderInfo.setTradeDay(new Date());
tbGroupOrderInfo.setRefundAble(1);
int insert = tbGroupOrderInfoMapper.insert(tbGroupOrderInfo);
if(insert>0){
return new Result(CodeEnum.SUCCESS);
}else {
if (insert > 0) {
return new Result(CodeEnum.SUCCESS,tbGroupOrderInfo);
} else {
return new Result(CodeEnum.FAIL);
}
}
public String generateOrderNumber() {
String date = DateUtils.getSdfTimes();
Random random = new Random();
int randomNum = random.nextInt(900) + 100;
return "GP" + date + randomNum;
}
/**
* 修改数据
*
* @param tbGroupOrderInfo 实例对象
* @return 实例对象
*/
public Result update(TbGroupOrderInfo tbGroupOrderInfo) {
int update = tbGroupOrderInfoMapper.update(tbGroupOrderInfo);
if(update>0){
if (update > 0) {
return new Result(CodeEnum.SUCCESS);
}else {
} else {
return new Result(CodeEnum.FAIL);
}
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
public boolean deleteById(Integer id) {
return this.tbGroupOrderInfoMapper.deleteById(id) > 0;
}
}

View File

@ -1,12 +1,13 @@
package com.chaozhanggui.system.cashierservice.service;
import com.chaozhanggui.system.cashierservice.dao.SysDictDetailMapper;
import com.chaozhanggui.system.cashierservice.dao.SysDictMapper;
import com.chaozhanggui.system.cashierservice.dao.TbCouponCategoryMapper;
import com.chaozhanggui.system.cashierservice.dao.TbPlatformDictMapper;
import com.chaozhanggui.system.cashierservice.dao.TbShopInfoMapper;
import com.chaozhanggui.system.cashierservice.entity.SysDict;
import com.chaozhanggui.system.cashierservice.entity.TbCouponCategory;
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
import com.chaozhanggui.system.cashierservice.entity.dto.ComShopDto;
import com.chaozhanggui.system.cashierservice.entity.dto.HomeBaseDto;
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
import com.chaozhanggui.system.cashierservice.entity.vo.*;
@ -26,7 +27,6 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
@Service
@Slf4j
@ -41,7 +41,8 @@ public class HomeDistrictService {
@Resource
private TbCouponCategoryMapper couponCategoryMapper;
@Resource
private SysDictDetailMapper sysDictDetailMapper;
// private SysDictDetailMapper sysDictDetailMapper;
private SysDictMapper sysDictMapper;
public Result topCommon(HomeDto param, String environment){
CommonVo result = new CommonVo();
@ -55,22 +56,17 @@ public class HomeDistrictService {
}else {//商品分类页
TbCouponCategory tbCouponCategory = couponCategoryMapper.queryById(Integer.valueOf(param.getType()));
result.setTitle(tbCouponCategory.getName());
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType(param.getType(), environment);
List<TbPlatformDict> carouselList = platformDictMapper.queryGroupByValue(param.getType(), environment);
if (!CollectionUtils.isEmpty(carouselList)) {
result.setCarousel(JSONUtil.parseListTNewList(carouselList, HomeCarouselVo.class));
}
List<SysDict> sysDicts = sysDictDetailMapper.selectByType(null);
List<DicDetailVO> dicDetailVO = new ArrayList<>();
for (SysDict sysDictsList : sysDicts) {
DicDetailVO dicDetailVOList = new DicDetailVO();
dicDetailVOList.setDictName(sysDictsList.getDictName());
dicDetailVOList.setName(sysDictsList.getName());
dicDetailVOList.setDescription(sysDictsList.getDescription());
dicDetailVOList.setDetail(sysDictDetailMapper.selectByDictId(sysDictsList.getDictId()));
dicDetailVOList.setIsChild((sysDictsList.getIsChild() == null || sysDictsList.getIsChild() == 0) ? false : true);
dicDetailVO.add(dicDetailVOList);
List<SysDict> sysDicts = sysDictMapper.selectByType(null);
for (SysDict sysDict : sysDicts) {
if (sysDict.getIsChild()==1) {
sysDict.setDetail(sysDictMapper.selectByDictId(sysDict.getDictId()));
}
}
result.setMenu(dicDetailVO);
result.setMenu(sysDicts);
}
} else {
if (param.getOrderBy() != null) {
@ -80,23 +76,19 @@ public class HomeDistrictService {
result.setCarousel(JSONUtil.parseListTNewList(carouselList, HomeCarouselVo.class));
}
result.setTitle("今日上新");
} else if (param.getOrderBy() == 2) {
} else if (param.getOrderBy() == 4) {
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType("hotCoupon", environment);
if (!CollectionUtils.isEmpty(carouselList)) {
result.setCarousel(JSONUtil.parseListTNewList(carouselList, HomeCarouselVo.class));
}
result.setTitle("热榜推荐");
List<SysDict> sysDicts = sysDictDetailMapper.selectHot();
List<DicDetailVO> dicDetailVO = new ArrayList<>();
for (SysDict sysDictsList : sysDicts) {
DicDetailVO dicDetailVOList = new DicDetailVO();
dicDetailVOList.setDictName(sysDictsList.getDictName());
dicDetailVOList.setName(sysDictsList.getName());
dicDetailVOList.setDescription(sysDictsList.getDescription());
dicDetailVOList.setIsChild((sysDictsList.getIsChild() == null || sysDictsList.getIsChild() == 0) ? false : true);
dicDetailVO.add(dicDetailVOList);
List<SysDict> sysDicts = sysDictMapper.selectHot();
for (SysDict sysDict : sysDicts) {
if (sysDict.getIsChild()==1) {
sysDict.setDetail(sysDictMapper.selectByDictId(sysDict.getDictId()));
}
}
result.setMenu(dicDetailVO);
result.setMenu(sysDicts);
}
}
}
@ -114,7 +106,7 @@ public class HomeDistrictService {
topAndBottomMap.get("rightTopPoint")[0],//34.39724773780949
topAndBottomMap.get("leftBottomPoint")[1],
topAndBottomMap.get("leftBottomPoint")[0],
param.getAddress(), param.getLng(), param.getLat());//西安市
param.getAddress(), param.getLng(), param.getLat(),null);//西安市
for (SubShopVo subShopVo : subShopVos) {//距离计算
if (StringUtils.isNotBlank(subShopVo.getLat()) && StringUtils.isNotBlank(subShopVo.getLng())) {
BigDecimal distance = LocationUtils.getDistanceFrom2LngLat(
@ -123,17 +115,38 @@ public class HomeDistrictService {
subShopVo.setDistances(distance.toString());
}
}
PageInfo pageInfo = new PageInfo();
pageInfo.setList(subShopVos);
return Result.success(CodeEnum.SUCCESS, pageInfo);
return Result.success(CodeEnum.SUCCESS, new PageInfo(subShopVos));
}
public Result queryComShopList(ComShopDto param) {
Map<String, double[]> topAndBottomMap = LocationUtils.returnLLSquarePoint(
Double.parseDouble(param.getLng()),
Double.parseDouble(param.getLat()),
param.getDistanceInKm());
List<SubShopVo> subShopVos = shopInfoMapper.selShopInfoByGps(
topAndBottomMap.get("rightTopPoint")[1],//109.06198684730003
topAndBottomMap.get("rightTopPoint")[0],//34.39724773780949
topAndBottomMap.get("leftBottomPoint")[1],
topAndBottomMap.get("leftBottomPoint")[0],
param.getAddress(), param.getLng(), param.getLat(),param.getShopName());//西安市
for (SubShopVo subShopVo : subShopVos) {//距离计算
subShopVo.setBusinessTime(subShopVo.getBusinessStartDay()+""+subShopVo.getBusinessEndDay()+" "+subShopVo.getBusinessTime());
if (StringUtils.isNotBlank(subShopVo.getLat()) && StringUtils.isNotBlank(subShopVo.getLng())) {
BigDecimal distance = LocationUtils.getDistanceFrom2LngLat(
Double.parseDouble(param.getLng()), Double.parseDouble(param.getLat()),
Double.parseDouble(subShopVo.getLng()), Double.parseDouble(subShopVo.getLat()));
subShopVo.setDistances(distance.toString());
}
}
return Result.success(CodeEnum.SUCCESS, subShopVos);
}
/**
* 通用商品页
*/
public Result proList(HomeDto param) throws ExecutionException, InterruptedException {
PageInfo products = productService.products(param);
return Result.success(CodeEnum.SUCCESS, products);
public Result proList(HomeDto param) {
return Result.success(CodeEnum.SUCCESS, productService.products(param));
}
}

View File

@ -1,6 +1,6 @@
package com.chaozhanggui.system.cashierservice.service;
import com.chaozhanggui.system.cashierservice.dao.SysDictDetailMapper;
import com.chaozhanggui.system.cashierservice.dao.SysDictMapper;
import com.chaozhanggui.system.cashierservice.dao.TbPlatformDictMapper;
import com.chaozhanggui.system.cashierservice.dao.TbProductSkuMapper;
import com.chaozhanggui.system.cashierservice.entity.Enum.LogoEnum;
@ -11,6 +11,7 @@ import com.chaozhanggui.system.cashierservice.entity.vo.*;
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.BigDecimalUtils;
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
import com.chaozhanggui.system.cashierservice.util.RandomUtil;
import com.chaozhanggui.system.cashierservice.util.StringUtil;
@ -37,7 +38,7 @@ public class HomePageService {
@Resource
private TbPlatformDictMapper platformDictMapper;
@Resource
private SysDictDetailMapper sysDictDetailMapper;
private SysDictMapper sysDictMapper;
@Resource
private ProductService productService;
@Autowired
@ -53,18 +54,13 @@ public class HomePageService {
homeUpVO.setDistrict(JSONUtil.parseListTNewList(districtList, HomeDistrictVo.class));
//菜单
List<SysDict> sysDicts = sysDictDetailMapper.selectByType("home");
List<DicDetailVO> dicDetailVO = new ArrayList<>();
for (SysDict sysDictsList : sysDicts) {
DicDetailVO dicDetailVOList = new DicDetailVO();
dicDetailVOList.setDictName(sysDictsList.getDictName());
dicDetailVOList.setName(sysDictsList.getName());
dicDetailVOList.setDescription(sysDictsList.getDescription());
dicDetailVOList.setDetail(sysDictDetailMapper.selectByDictId(sysDictsList.getDictId()));
dicDetailVOList.setIsChild((sysDictsList.getIsChild() == null || sysDictsList.getIsChild() == 0) ? false : true);
dicDetailVO.add(dicDetailVOList);
List<SysDict> sysDicts = sysDictMapper.selectByType("home");
for (SysDict sysDict : sysDicts) {
if (sysDict.getIsChild()==1) {
sysDict.setDetail(sysDictMapper.selectByDictId(sysDict.getDictId()));
}
}
homeUpVO.setMenu(dicDetailVO);
homeUpVO.setMenu(sysDicts);
/**
* 销量榜
*/
@ -72,8 +68,7 @@ public class HomePageService {
for (HomeVO o : homeVOs) {
BigDecimal originPrice = o.getOriginPrice();
if (originPrice.compareTo(BigDecimal.ZERO) != 0) {
BigDecimal multiply = o.getSalePrice().divide(o.getOriginPrice(), 2, RoundingMode.DOWN).multiply(BigDecimal.TEN);
o.setDiscount(multiply);
o.setDiscount(BigDecimalUtils.getDiscount(o.getOriginPrice(),o.getSalePrice()));
} else {
o.setDiscount(null);
}

View File

@ -1,12 +1,9 @@
package com.chaozhanggui.system.cashierservice.service;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.entity.vo.CashierCarVo;
import com.chaozhanggui.system.cashierservice.entity.vo.OrderVo;
import com.chaozhanggui.system.cashierservice.exception.MsgException;
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
@ -14,25 +11,19 @@ import com.chaozhanggui.system.cashierservice.redis.RedisCst;
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.socket.AppWebSocketServer;
import com.chaozhanggui.system.cashierservice.util.DateUtils;
import com.chaozhanggui.system.cashierservice.util.N;
import com.chaozhanggui.system.cashierservice.util.RedisUtils;
import com.chaozhanggui.system.cashierservice.util.SnowFlakeUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.awt.print.Pageable;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.ParseException;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@ -209,18 +200,12 @@ public class OrderService {
public Result orderList(Integer userId, Integer page, Integer size, String status) {
TbUserInfo tbUserInfo = userInfoMapper.selectByPrimaryKey(userId);
if (tbUserInfo == null) {
return Result.fail("生成订单失败");
}
//获取页码号
int beginNo;
if (page <= 0) {
beginNo = 0;
} else {
beginNo = (page - 1) * size;
}
List<TbOrderInfo> tbOrderInfos = orderInfoMapper.selectByUserId(userId, beginNo, size, status);
// TbUserInfo tbUserInfo = userInfoMapper.selectByPrimaryKey(userId);
// if (tbUserInfo == null) {
// return Result.fail("获取订单失败");
// }
PageHelper.startPage(page, size);
List<TbOrderInfo> tbOrderInfos = orderInfoMapper.selectByUserId(userId, status);
for (TbOrderInfo orderInfo : tbOrderInfos) {
List<TbOrderDetail> list = tbOrderDetailMapper.selectAllByOrderId(orderInfo.getId());

View File

@ -1,11 +1,15 @@
package com.chaozhanggui.system.cashierservice.service;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.entity.dto.ReturnGroupOrderDto;
import com.chaozhanggui.system.cashierservice.exception.MsgException;
import com.chaozhanggui.system.cashierservice.model.PayReq;
import com.chaozhanggui.system.cashierservice.model.ReturnOrderReq;
import com.chaozhanggui.system.cashierservice.model.TradeQueryReq;
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
@ -28,16 +32,14 @@ import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
import java.time.LocalDateTime;
import java.util.*;
@Service
@Slf4j
public class PayService {
@Autowired
TbOrderInfoMapper tbOrderInfoMapper;
@ -53,7 +55,11 @@ public class PayService {
@Autowired
TbOrderDetailMapper tbOrderDetailMapper;
@Autowired
private TbMerchantAccountMapper merchantAccountMapper;
@Autowired
private GroupOrderCouponService groupOrderCouponService;
@Autowired
@ -66,12 +72,13 @@ public class PayService {
@Value("${ysk.callBackurl}")
private String callBackurl;
@Value("${ysk.callBackGroupurl}")
private String callBackGroupurl;
@Value("${ysk.callBackIn}")
private String callBackIn;
@Autowired
private TbCashierCartMapper tbCashierCartMapper;
@ -94,37 +101,47 @@ public class PayService {
@Autowired
TbShopUserFlowMapper tbShopUserFlowMapper;
@Resource
private TbGroupOrderInfoMapper tbGroupOrderInfoMapper;
@Autowired
private TbProductMapper tbProductMapper;
@Resource
private GroupOrderCouponService orderCouponService;
@Transactional(rollbackFor = Exception.class)
public Result payOrder(String openId,String orderId,String ip) throws Exception {
TbOrderInfo orderInfo= tbOrderInfoMapper.selectByPrimaryKey(Integer.valueOf(orderId));
public Result payOrder(String openId, String orderId,String payType, String ip) throws Exception {
TbOrderInfo orderInfo = tbOrderInfoMapper.selectByPrimaryKey(Integer.valueOf(orderId));
if(!"unpaid".equals(orderInfo.getStatus())&&!"paying".equals(orderInfo.getStatus())){
if (!"unpaid".equals(orderInfo.getStatus()) && !"paying".equals(orderInfo.getStatus())) {
return Result.fail("订单状态异常,不允许支付");
}
if(ObjectUtil.isNull(orderInfo.getMerchantId())||ObjectUtil.isEmpty(orderInfo.getMerchantId())){
if (ObjectUtil.isNull(orderInfo.getMerchantId()) || ObjectUtil.isEmpty(orderInfo.getMerchantId())) {
return Result.fail("没有对应的商户");
}
TbMerchantThirdApply thirdApply= tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getMerchantId()));
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getMerchantId()));
if(ObjectUtil.isEmpty(thirdApply)||ObjectUtil.isNull(thirdApply)){
if (ObjectUtil.isEmpty(thirdApply) || ObjectUtil.isNull(thirdApply)) {
return Result.fail("支付通道不存在");
}
TbOrderPayment payment=tbOrderPaymentMapper.selectByOrderId(orderId);
if(ObjectUtil.isEmpty(payment)||payment==null){
payment=new TbOrderPayment();
TbOrderPayment payment = tbOrderPaymentMapper.selectByOrderId(orderId);
if (ObjectUtil.isEmpty(payment) || payment == null) {
payment = new TbOrderPayment();
payment.setPayTypeId("ysk");
payment.setAmount(orderInfo.getOrderAmount());
payment.setPaidAmount(orderInfo.getPayAmount());
payment.setHasRefundAmount(BigDecimal.ZERO);
payment.setPayName("微信支付");
payment.setPayType("wechatPay");
if (payType.equals("wechatPay")) {
payment.setPayName("微信支付");
payment.setPayType("wechatPay");
} else if (payType.equals("aliPay")) {
payment.setPayName("支付宝支付");
payment.setPayType("aliPay");
}
payment.setReceived(payment.getAmount());
payment.setChangeFee(BigDecimal.ZERO);
payment.setMemberId(orderInfo.getMemberId());
@ -132,32 +149,41 @@ public class PayService {
payment.setOrderId(orderInfo.getId().toString());
payment.setCreatedAt(System.currentTimeMillis());
tbOrderPaymentMapper.insert(payment);
}else {
} else {
if (payType.equals("wechatPay")) {
payment.setPayName("微信支付");
payment.setPayType("wechatPay");
} else if (payType.equals("aliPay")) {
payment.setPayName("支付宝支付");
payment.setPayType("aliPay");
}
payment.setUpdatedAt(System.currentTimeMillis());
tbOrderPaymentMapper.updateByPrimaryKey(payment);
}
PayReq req=new PayReq();
PayReq req = new PayReq();
req.setAppId(thirdApply.getAppId());
req.setTimestamp(System.currentTimeMillis());
req.setIp(ip);
req.setMercOrderNo(orderInfo.getOrderNo());
req.setNotifyUrl(callBackurl);
req.setPayAmt(payment.getAmount().setScale(2,BigDecimal.ROUND_DOWN).toPlainString());
req.setPayType("03");
req.setPayWay("WXZF");
req.setPayAmt(payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
if (payType.equals("wechatPay")) {
req.setPayType("03");
req.setPayWay("WXZF");//WXZF ZFBZF UNIONPAY
} else if (payType.equals("aliPay")) {
req.setPayWay("ZFBZF");
}
req.setSubject("扫码点餐");
req.setUserId(openId);
Map<String, Object> map = BeanUtil.transBeanMap(req);
req.setSign(MD5Util.encrypt(map, thirdApply.getAppToken(), true));
Map<String,Object> map= BeanUtil.transBeanMap(req);
req.setSign(MD5Util.encrypt(map,thirdApply.getAppToken(),true));
ResponseEntity<String> response= restTemplate.postForEntity(url.concat("trans/pay"),req,String.class);
if(response.getStatusCodeValue()==200&&ObjectUtil.isNotEmpty(response.getBody())){
JSONObject object=JSONObject.parseObject(response.getBody());
if(object.get("code").equals("0")){
ResponseEntity<String> response = restTemplate.postForEntity(url.concat("trans/pay"), req, String.class);
if (response.getStatusCodeValue() == 200 && ObjectUtil.isNotEmpty(response.getBody())) {
JSONObject object = JSONObject.parseObject(response.getBody());
if (object.get("code").equals("0")) {
payment.setTradeNumber(object.getJSONObject("data").get("orderNumber").toString());
payment.setUpdatedAt(System.currentTimeMillis());
tbOrderPaymentMapper.updateByPrimaryKeySelective(payment);
@ -166,7 +192,7 @@ public class PayService {
tbOrderInfoMapper.updateByPrimaryKey(orderInfo);
String key= RedisCst.TABLE_CART.concat(orderInfo.getTableId()).concat("-").concat(orderInfo.getShopId());
String key = RedisCst.TABLE_CART.concat(orderInfo.getTableId()).concat("-").concat(orderInfo.getShopId());
//清除缓存购物车数据
redisUtil.deleteByKey(key);
JSONObject jsonObject1 = new JSONObject();
@ -175,10 +201,10 @@ public class PayService {
jsonObject1.put("type", "");
jsonObject1.put("data", new JSONArray());
jsonObject1.put("amount", 0);
AppWebSocketServer.AppSendInfo(jsonObject1,key, false);
tbCashierCartMapper.updateStatusByOrderId(orderId.toString(),"final");
return Result.success(CodeEnum.SUCCESS,object.getJSONObject("data"));
}else {
AppWebSocketServer.AppSendInfo(jsonObject1, key, false);
tbCashierCartMapper.updateStatusByOrderId(orderId.toString(), "final");
return Result.success(CodeEnum.SUCCESS, object.getJSONObject("data"));
} else {
return Result.fail(object.getString("msg"));
}
}
@ -186,11 +212,159 @@ public class PayService {
return Result.fail("失败");
}
@Transactional(rollbackFor = Exception.class)
public Result groupOrderPay(String orderId, String payType, String userId, String ip) {
TbGroupOrderInfo orderInfo = tbGroupOrderInfoMapper.queryById(Integer.valueOf(orderId));
if (!"unpaid".equals(orderInfo.getStatus()) && !"paying".equals(orderInfo.getStatus())) {
return Result.fail("订单状态异常,不允许支付");
}
TbMerchantAccount tbMerchantAccount = merchantAccountMapper.selectByShopId(orderInfo.getShopId().toString());
if (tbMerchantAccount == null) {
throw new MsgException("生成订单错误");
}
if (ObjectUtil.isNull(tbMerchantAccount.getMerchantId()) || ObjectUtil.isEmpty(tbMerchantAccount.getMerchantId())) {
return Result.fail("没有对应的商户");
}
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(tbMerchantAccount.getMerchantId()));
if (ObjectUtil.isEmpty(thirdApply) || ObjectUtil.isNull(thirdApply)) {
return Result.fail("支付通道不存在");
}
TbOrderPayment payment = tbOrderPaymentMapper.selectByOrderId(orderId);
if (ObjectUtil.isEmpty(payment) || payment == null) {
payment = new TbOrderPayment();
payment.setPayTypeId("ysk");
payment.setAmount(orderInfo.getOrderAmount());
payment.setPaidAmount(orderInfo.getPayAmount());
payment.setHasRefundAmount(BigDecimal.ZERO);
if (payType.equals("wechatPay")) {
payment.setPayName("微信支付");
payment.setPayType("wechatPay");
} else if (payType.equals("aliPay")) {
payment.setPayName("支付宝支付");
payment.setPayType("aliPay");
}
payment.setReceived(payment.getAmount());
payment.setChangeFee(BigDecimal.ZERO);
// payment.setMemberId(orderInfo.getMemberId());//会员Id
payment.setShopId(orderInfo.getShopId().toString());
payment.setOrderId(orderInfo.getId().toString());
payment.setCreatedAt(System.currentTimeMillis());
tbOrderPaymentMapper.insert(payment);
} else {
if (payType.equals("wechatPay")) {
payment.setPayName("微信支付");
payment.setPayType("wechatPay");
} else if (payType.equals("aliPay")) {
payment.setPayName("支付宝支付");
payment.setPayType("aliPay");
}
payment.setUpdatedAt(System.currentTimeMillis());
tbOrderPaymentMapper.updateByPrimaryKey(payment);
}
PayReq req = new PayReq();
req.setAppId(thirdApply.getAppId());
req.setTimestamp(System.currentTimeMillis());
req.setIp(ip);
req.setMercOrderNo(orderInfo.getOrderNo());
req.setNotifyUrl(callBackGroupurl);
req.setPayAmt(payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
if (payType.equals("wechatPay")) {
req.setPayType("03");
req.setPayWay("WXZF");//WXZF ZFBZF UNIONPAY
} else if (payType.equals("aliPay")) {
req.setPayWay("ZFBZF");
}
req.setSubject("零点八零:团购卷");
req.setUserId(userId);
Map<String, Object> map = BeanUtil.transBeanMap(req);
req.setSign(MD5Util.encrypt(map, thirdApply.getAppToken(), true));
ResponseEntity<String> response = restTemplate.postForEntity(url.concat("trans/pay"), req, String.class);
if (response.getStatusCodeValue() == 200 && ObjectUtil.isNotEmpty(response.getBody())) {
JSONObject object = JSONObject.parseObject(response.getBody());
if (object.get("code").equals("0")) {
payment.setTradeNumber(object.getJSONObject("data").get("orderNumber").toString());
payment.setUpdatedAt(System.currentTimeMillis());
tbOrderPaymentMapper.updateByPrimaryKeySelective(payment);
orderInfo.setPayType(payType);
orderInfo.setStatus("paying");
orderInfo.setPayOrderNo(payment.getTradeNumber());
tbGroupOrderInfoMapper.update(orderInfo);
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("status", "success");
jsonObject1.put("msg", "成功");
jsonObject1.put("type", "");
jsonObject1.put("data", new JSONArray());
jsonObject1.put("amount", 0);
tbProductMapper.upGroupRealSalesNumber(orderInfo.getProId().toString(), orderInfo.getNumber());
return Result.success(CodeEnum.SUCCESS, object.getJSONObject("data"));
} else {
return Result.fail(object.getString("msg"));
}
}
return Result.fail("失败");
}
@Transactional(rollbackFor = Exception.class)
public Result accountPay(String orderId, String userId, String shopId,String pwd) {
if (ObjectUtil.isEmpty(orderId) || ObjectUtil.isEmpty(userId)||ObjectUtil.isEmpty(shopId)||ObjectUtil.isEmpty(pwd)) {
public Result returnOrder(ReturnGroupOrderDto param) {
TbGroupOrderInfo groupOrderInfo = tbGroupOrderInfoMapper.queryById(param.getOrderId());
List<TbGroupOrderCoupon> tbGroupOrderCoupons = orderCouponService.queryNoRefundByOrderId(param.getOrderId());
if (param.getNum() > tbGroupOrderCoupons.size()) {
return Result.fail("可退数量不足");
}
for (int i = 0; i < param.getNum(); i++) {
TbGroupOrderCoupon coupon = tbGroupOrderCoupons.get(i);
coupon.setIsRefund(1);
coupon.setRefundAmount(param.getRefundAmount());
coupon.setRefundDesc(param.getRefundDesc());
coupon.setRefundReason(param.getRefundReason());
orderCouponService.update(coupon);
}
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(groupOrderInfo.getMerchantId());
MsgException.checkNull(thirdApply, "支付参数配置错误");
ReturnOrderReq req = new ReturnOrderReq();
req.setAppId(thirdApply.getAppId());
req.setTimestamp(System.currentTimeMillis());
req.setOrderNumber(groupOrderInfo.getPayOrderNo());
req.setAmount(param.getRefundAmount().toString());
req.setMercRefundNo(groupOrderInfo.getOrderNo());
req.setRefundReason("团购卷:退货");
req.setPayPassword(thirdApply.getPayPassword());
Map<String, Object> map = BeanUtil.transBean2Map(req);
req.setSign(MD5Util.encrypt(map, thirdApply.getAppToken(), true));
log.info("groupOrderReturn req:{}", JSONUtil.toJsonStr(req));
ResponseEntity<String> response = restTemplate.postForEntity(url.concat("merchantOrder/returnOrder"), req, String.class);
log.info("groupOrderReturn:{}", response.getBody());
if (response.getStatusCodeValue() == 200 && ObjectUtil.isNotEmpty(response.getBody())) {
JSONObject object = JSONObject.parseObject(response.getBody());
if (!object.get("code").equals("0")) {
MsgException.check(true, "退款渠道调用失败");
}
}
groupOrderInfo.setRefundNumber(groupOrderInfo.getRefundNumber() + param.getNum());
groupOrderInfo.setRefundAmount(groupOrderInfo.getRefundAmount().add(param.getRefundAmount()));
if (groupOrderInfo.getNumber() == groupOrderInfo.getRefundNumber()) {
groupOrderInfo.setRefundAble(0);
groupOrderInfo.setStatus("refund");
}
tbGroupOrderInfoMapper.update(groupOrderInfo);
return Result.success(CodeEnum.SUCCESS);
}
@Transactional(rollbackFor = Exception.class)
public Result accountPay(String orderId, String userId, String shopId, String pwd) {
if (ObjectUtil.isEmpty(orderId) || ObjectUtil.isEmpty(userId) || ObjectUtil.isEmpty(shopId) || ObjectUtil.isEmpty(pwd)) {
return Result.fail("参数错误");
}
@ -210,18 +384,18 @@ public class PayService {
return Result.fail("当前店铺未开通储值卡支付");
}
TbShopUser user = tbShopUserMapper.selectByUserIdAndShopId(userId,shopId);
TbShopUser user = tbShopUserMapper.selectByUserIdAndShopId(userId, shopId);
if (ObjectUtil.isEmpty(user) || !"1".equals(user.getIsVip().toString())) {
return Result.fail("此用户非会员用户");
}
if("1".equals(user.getIsPwd())){
if ("1".equals(user.getIsPwd())) {
return Result.fail("会员支付密码为初始化密码");
}
if(!MD5Util.encrypt(pwd).equals(user.getPwd())){
if (!MD5Util.encrypt(pwd).equals(user.getPwd())) {
return Result.fail("会员支付密码错误");
}
@ -254,12 +428,12 @@ public class PayService {
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
int cartCount= tbCashierCartMapper.updateStatusByOrderId(orderId.toString(),"final");
int cartCount = tbCashierCartMapper.updateStatusByOrderId(orderId.toString(), "final");
log.info("更新购物车:{}",cartCount);
log.info("更新购物车:{}", cartCount);
//更新子单状态
tbOrderDetailMapper.updateStatusByOrderIdAndStatus(Integer.valueOf(orderId),"closed");
tbOrderDetailMapper.updateStatusByOrderIdAndStatus(Integer.valueOf(orderId), "closed");
//修改主单状态
orderInfo.setStatus("closed");
@ -269,10 +443,10 @@ public class PayService {
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
JSONObject jsonObject=new JSONObject();
jsonObject.put("token",0);
jsonObject.put("type","wxcreate");
jsonObject.put("orderId",orderInfo.getId().toString());
JSONObject jsonObject = new JSONObject();
jsonObject.put("token", 0);
jsonObject.put("type", "wxcreate");
jsonObject.put("orderId", orderInfo.getId().toString());
producer.putOrderCollect(jsonObject.toJSONString());
@ -284,48 +458,48 @@ public class PayService {
@Transactional(rollbackFor = Exception.class)
public Result modifyOrderStatus(Integer orderId) throws IOException {
TbOrderInfo orderInfo= tbOrderInfoMapper.selectByPrimaryKey(Integer.valueOf(orderId));
if(ObjectUtil.isEmpty(orderInfo)){
TbOrderInfo orderInfo = tbOrderInfoMapper.selectByPrimaryKey(Integer.valueOf(orderId));
if (ObjectUtil.isEmpty(orderInfo)) {
return Result.fail("订单信息不存在");
}
if("paying".equals(orderInfo.getStatus())){
TbOrderPayment payment= tbOrderPaymentMapper.selectByOrderId(orderInfo.getId().toString());
if(ObjectUtil.isNotEmpty(payment)&&ObjectUtil.isNotEmpty(payment.getTradeNumber())){
if ("paying".equals(orderInfo.getStatus())) {
TbOrderPayment payment = tbOrderPaymentMapper.selectByOrderId(orderInfo.getId().toString());
if (ObjectUtil.isNotEmpty(payment) && ObjectUtil.isNotEmpty(payment.getTradeNumber())) {
TbMerchantThirdApply thirdApply= tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getMerchantId()));
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getMerchantId()));
if(ObjectUtil.isEmpty(thirdApply)||ObjectUtil.isNull(thirdApply)){
if (ObjectUtil.isEmpty(thirdApply) || ObjectUtil.isNull(thirdApply)) {
return Result.fail("支付通道不存在");
}
TradeQueryReq req=new TradeQueryReq();
TradeQueryReq req = new TradeQueryReq();
req.setAppId(thirdApply.getAppId());
req.setTimestamp(System.currentTimeMillis());
req.setOrderNumber(payment.getTradeNumber());
Map<String,Object> map= BeanUtil.transBeanMap(req);
Map<String, Object> map = BeanUtil.transBeanMap(req);
req.setSign(MD5Util.encrypt(map,thirdApply.getAppToken(),true));
req.setSign(MD5Util.encrypt(map, thirdApply.getAppToken(), true));
ResponseEntity<String> response= restTemplate.postForEntity(url.concat("merchantOrder/tradeQuery"),req,String.class);
if(response.getStatusCodeValue()==200&&ObjectUtil.isNotEmpty(response.getBody())){
JSONObject object=JSONObject.parseObject(response.getBody());
ResponseEntity<String> response = restTemplate.postForEntity(url.concat("merchantOrder/tradeQuery"), req, String.class);
if (response.getStatusCodeValue() == 200 && ObjectUtil.isNotEmpty(response.getBody())) {
JSONObject object = JSONObject.parseObject(response.getBody());
if(object.get("code").equals("0")){
JSONObject data=object.getJSONObject("data");
String status=data.getString("status");
String cartStatus="";
switch (status){
if (object.get("code").equals("0")) {
JSONObject data = object.getJSONObject("data");
String status = data.getString("status");
String cartStatus = "";
switch (status) {
case "0": //交易失败
break;
case "1": //交易成功
//修改数据库中购物车数据
int cartCount= tbCashierCartMapper.updateStatusByOrderId(orderId.toString(),"final");
int cartCount = tbCashierCartMapper.updateStatusByOrderId(orderId.toString(), "final");
log.info("更新购物车:{}",cartCount);
log.info("更新购物车:{}", cartCount);
//更新子单状态
tbOrderDetailMapper.updateStatusByOrderIdAndStatus(Integer.valueOf(orderId),"closed");
tbOrderDetailMapper.updateStatusByOrderIdAndStatus(Integer.valueOf(orderId), "closed");
//修改主单状态
orderInfo.setStatus("closed");
@ -335,76 +509,72 @@ public class PayService {
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
JSONObject jsonObject=new JSONObject();
jsonObject.put("token",0);
jsonObject.put("type","wxcreate");
jsonObject.put("orderId",orderInfo.getId().toString());
JSONObject jsonObject = new JSONObject();
jsonObject.put("token", 0);
jsonObject.put("type", "wxcreate");
jsonObject.put("orderId", orderInfo.getId().toString());
producer.putOrderCollect(jsonObject.toJSONString());
log.info("发送打印数据");
producer.printMechine(orderInfo.getId() + "");
log.info("发送赠送购物券");
JSONObject coupons = new JSONObject();
coupons.put("type","buy");
coupons.put("orderId",orderId);
coupons.put("type", "buy");
coupons.put("orderId", orderId);
producer.printCoupons(coupons.toJSONString());
return Result.success(CodeEnum.SUCCESS,orderId);
return Result.success(CodeEnum.SUCCESS, orderId);
case "2": //退款成功
cartStatus="refund";
cartStatus = "refund";
orderInfo.setStatus("refund");
break;
case "3": //退款失败
break;
case "4": //退款中
cartStatus="refunding";
cartStatus = "refunding";
orderInfo.setStatus("refunding");
break;
}
tbCashierCartMapper.updateStatusByOrderId(orderId.toString(),cartStatus);
tbCashierCartMapper.updateStatusByOrderId(orderId.toString(), cartStatus);
orderInfo.setUpdatedAt(System.currentTimeMillis());
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
}
}
}
}
return Result.success(CodeEnum.SUCCESS,orderId);
return Result.success(CodeEnum.SUCCESS, orderId);
}
@Transactional(rollbackFor = Exception.class)
public Result memberIn(String openId,String userId,String amount,String shopId,String ip){
if(ObjectUtil.isEmpty(openId)||ObjectUtil.isEmpty(userId)){
public Result memberIn(String openId, String userId, String amount, String shopId, String ip) {
if (ObjectUtil.isEmpty(openId) || ObjectUtil.isEmpty(userId)) {
return Result.fail("用户信息允许为空");
}
TbShopUser tbShopUser= tbShopUserMapper.selectByUserIdAndShopId(userId,shopId);
if(ObjectUtil.isEmpty(tbShopUser)){
TbShopUser tbShopUser = tbShopUserMapper.selectByUserIdAndShopId(userId, shopId);
if (ObjectUtil.isEmpty(tbShopUser)) {
return Result.fail("对应的用户信息不存在");
}
TbShopInfo shopInfo= tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(shopId));
if(ObjectUtil.isEmpty(shopInfo)){
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(shopId));
if (ObjectUtil.isEmpty(shopInfo)) {
return Result.fail("对应的店铺信息不存在");
}
TbMerchantThirdApply thirdApply= tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(shopInfo.getMerchantId()));
if(ObjectUtil.isEmpty(thirdApply)||ObjectUtil.isNull(thirdApply)){
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(shopInfo.getMerchantId()));
if (ObjectUtil.isEmpty(thirdApply) || ObjectUtil.isNull(thirdApply)) {
return Result.fail("支付通道不存在");
}
BigDecimal payAmount= new BigDecimal(amount).setScale(2,BigDecimal.ROUND_DOWN);
BigDecimal payAmount = new BigDecimal(amount).setScale(2, BigDecimal.ROUND_DOWN);
TbMemberIn memberIn=new TbMemberIn();
TbMemberIn memberIn = new TbMemberIn();
memberIn.setAmount(payAmount);
memberIn.setUserId(Integer.valueOf(tbShopUser.getUserId()));
memberIn.setCode(tbShopUser.getDynamicCode());
@ -415,8 +585,7 @@ public class PayService {
tbMemberInMapper.insert(memberIn);
PayReq req=new PayReq();
PayReq req = new PayReq();
req.setAppId(thirdApply.getAppId());
req.setTimestamp(System.currentTimeMillis());
@ -430,26 +599,49 @@ public class PayService {
req.setUserId(openId);
Map<String,Object> map= BeanUtil.transBeanMap(req);
req.setSign(MD5Util.encrypt(map,thirdApply.getAppToken(),true));
Map<String, Object> map = BeanUtil.transBeanMap(req);
req.setSign(MD5Util.encrypt(map, thirdApply.getAppToken(), true));
ResponseEntity<String> response= restTemplate.postForEntity(url.concat("trans/pay"),req,String.class);
if(response.getStatusCodeValue()==200&&ObjectUtil.isNotEmpty(response.getBody())){
JSONObject object=JSONObject.parseObject(response.getBody());
if(object.get("code").equals("0")){
ResponseEntity<String> response = restTemplate.postForEntity(url.concat("trans/pay"), req, String.class);
if (response.getStatusCodeValue() == 200 && ObjectUtil.isNotEmpty(response.getBody())) {
JSONObject object = JSONObject.parseObject(response.getBody());
if (object.get("code").equals("0")) {
memberIn.setOrderNo(object.getJSONObject("data").get("orderNumber").toString());
memberIn.setUpdateTime(new Date());
tbMemberInMapper.updateByPrimaryKeySelective(memberIn);
return Result.success(CodeEnum.SUCCESS,object.getJSONObject("data"));
}else {
return Result.success(CodeEnum.SUCCESS, object.getJSONObject("data"));
} else {
return Result.fail(object.getString("msg"));
}
}
return Result.fail("失败");
}
@Transactional(rollbackFor = Exception.class)
public String callBackGroupPay(String payOrderNO) {
TbGroupOrderInfo orderInfo = tbGroupOrderInfoMapper.selectByPayOrderNo(payOrderNO);
if (ObjectUtil.isEmpty(orderInfo)) {
return "订单信息不存在";
}
if ("paying".equals(orderInfo.getStatus())) {
for (int i = 0; i < orderInfo.getNumber(); i++) {
TbGroupOrderCoupon groupOrderCoupon = new TbGroupOrderCoupon();
groupOrderCoupon.setOrderId(orderInfo.getId());
groupOrderCoupon.setCouponNo(genCouponNumber());
groupOrderCoupon.setIsRefund(0);
groupOrderCouponService.insert(groupOrderCoupon);
}
orderInfo.setExpDate(getNextMonDate());
//修改主单状态
orderInfo.setStatus("unused");
orderInfo.setPayAmount(orderInfo.getOrderAmount());
tbGroupOrderInfoMapper.update(orderInfo);
return "SUCCESS";
}
return null;
}
@Transactional(rollbackFor = Exception.class)
public String callBackPay(String payOrderNO) {
@ -474,10 +666,10 @@ public class PayService {
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
JSONObject jsonObject=new JSONObject();
jsonObject.put("token",0);
jsonObject.put("type","wxcreate");
jsonObject.put("orderId",orderInfo.getId().toString());
JSONObject jsonObject = new JSONObject();
jsonObject.put("token", 0);
jsonObject.put("type", "wxcreate");
jsonObject.put("orderId", orderInfo.getId().toString());
producer.putOrderCollect(jsonObject.toJSONString());
@ -492,10 +684,10 @@ public class PayService {
@Transactional(rollbackFor = Exception.class)
public String minsuccess(String payOrderNO,String tradeNo){
public String minsuccess(String payOrderNO, String tradeNo) {
TbMemberIn memberIn= tbMemberInMapper.selectByOrderNo(payOrderNO);
if(ObjectUtil.isEmpty(memberIn)){
TbMemberIn memberIn = tbMemberInMapper.selectByOrderNo(payOrderNO);
if (ObjectUtil.isEmpty(memberIn)) {
return "充值记录不存在";
}
@ -504,8 +696,8 @@ public class PayService {
memberIn.setUpdateTime(new Date());
tbMemberInMapper.updateByPrimaryKeySelective(memberIn);
TbShopUser tbShopUser= tbShopUserMapper.selectByUserIdAndShopId(memberIn.getUserId().toString(),memberIn.getShopId().toString());
if(ObjectUtil.isEmpty(tbShopUser)){
TbShopUser tbShopUser = tbShopUserMapper.selectByUserIdAndShopId(memberIn.getUserId().toString(), memberIn.getShopId().toString());
if (ObjectUtil.isEmpty(tbShopUser)) {
return "用户信息不存在";
}
@ -515,7 +707,7 @@ public class PayService {
tbShopUser.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser);
TbShopUserFlow flow=new TbShopUserFlow();
TbShopUserFlow flow = new TbShopUserFlow();
flow.setShopUserId(Integer.valueOf(tbShopUser.getId()));
flow.setBizCode("scanMemberIn");
flow.setBizName("会员扫码充值");
@ -531,20 +723,48 @@ public class PayService {
//
// }
/**
* 生成长度为12的随机串
*
* @return
*/
public static String genCouponNumber() {
Random random = new Random();
long min = 10000000000L;
long max = 19999999999L;
// 生成介于min和max之间的随机整数
long randomNumber = min + ((long) (random.nextDouble() * (max - min)));
// 将随机整数转换为字符串并在前面补0直到长度为12位
return String.format("%012d", randomNumber);
}
public static void main(String[] args){
/**
* 获取一个月后的时间
*
* @return
*/
public Date getNextMonDate() {
// 获取当前日期和时间
LocalDateTime currentDateTime = LocalDateTime.now();
// 计算一个月后的日期和时间
LocalDateTime nextMonthDateTime = currentDateTime.plusMonths(1);
return java.sql.Timestamp.valueOf(nextMonthDateTime);
}
RestTemplate restTemplate1= new RestTemplate();
JSONObject param=new JSONObject();
String priv="MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAIqNqTqhN8zE7eFZnwKcyBTENce2wdAtl/gaDHNuNVgg33dS27Jx0fKl9QSHXyzyxbAdG8F94niYbRBstrMymFRjuO72jH+rIH62Ym1k7l8JSLVK2dKHXt8lHDaQGUP10q0EEocnDQ9cL93oBNG1ttsV6vOAu1TPvRK9TGihRAe1AgMBAAECgYBmI8KCl0DkcrSOsRvYuC2DqZWf8el1B3eFjeZp3e/zVOCIPYv6Q5ArWg6DVSxjnWEA0KSagqvGjU+xkQMqnXzPcPMhsIS+1wyR/pP+pwiatO2ioHaQpEqHg9eXhxrgA477/xuKVw9zl5GNqaIgd++2NDXnqLh0Y6OR73f0OB5eDQJBAPihEm+UWLOam/Q/k2+k4Lm2dvxJTBur1fslBiJpgMhgcz/PlwRwpL7aPD0AuPv0NqLouuoTiKpq9icnUv12tgsCQQCOqTANw0IErCHUNdinjXewmG3ui1j9XgM41rSn5ZeTrPL4GhZc2zbS/pZT4PBKUL6NLGkfPHmw4rOmNL/Xc5E/AkBqAwQBX5eSvVHSC2mqKPtJNGv3lqlFAzfyJg8/jQzEY5vAkZsq4Xzdg+A7gptdkvvY6rMIK9wSDhl3CGVyfbORAkA1N+g1OiHmnFACWhP4bU25EyPvWQxZeDi7e1zpRTzGWj5JT3IIMb7B9zcdE0yQbI6pG2gbvvOmiOt7lTH7raEBAkBas2gugvR3f0aGqQcqMpyM627pyRppQ2h58/7KBylP3oR2BReqMUcXeiJ8TuBXzbRXpeVQ0DWOva5CWZJmBMdz";
public static void main(String[] args) {
PayReq req=new PayReq();
RestTemplate restTemplate1 = new RestTemplate();
JSONObject param = new JSONObject();
String priv = "MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAIqNqTqhN8zE7eFZnwKcyBTENce2wdAtl/gaDHNuNVgg33dS27Jx0fKl9QSHXyzyxbAdG8F94niYbRBstrMymFRjuO72jH+rIH62Ym1k7l8JSLVK2dKHXt8lHDaQGUP10q0EEocnDQ9cL93oBNG1ttsV6vOAu1TPvRK9TGihRAe1AgMBAAECgYBmI8KCl0DkcrSOsRvYuC2DqZWf8el1B3eFjeZp3e/zVOCIPYv6Q5ArWg6DVSxjnWEA0KSagqvGjU+xkQMqnXzPcPMhsIS+1wyR/pP+pwiatO2ioHaQpEqHg9eXhxrgA477/xuKVw9zl5GNqaIgd++2NDXnqLh0Y6OR73f0OB5eDQJBAPihEm+UWLOam/Q/k2+k4Lm2dvxJTBur1fslBiJpgMhgcz/PlwRwpL7aPD0AuPv0NqLouuoTiKpq9icnUv12tgsCQQCOqTANw0IErCHUNdinjXewmG3ui1j9XgM41rSn5ZeTrPL4GhZc2zbS/pZT4PBKUL6NLGkfPHmw4rOmNL/Xc5E/AkBqAwQBX5eSvVHSC2mqKPtJNGv3lqlFAzfyJg8/jQzEY5vAkZsq4Xzdg+A7gptdkvvY6rMIK9wSDhl3CGVyfbORAkA1N+g1OiHmnFACWhP4bU25EyPvWQxZeDi7e1zpRTzGWj5JT3IIMb7B9zcdE0yQbI6pG2gbvvOmiOt7lTH7raEBAkBas2gugvR3f0aGqQcqMpyM627pyRppQ2h58/7KBylP3oR2BReqMUcXeiJ8TuBXzbRXpeVQ0DWOva5CWZJmBMdz";
PayReq req = new PayReq();
req.setAppId("M8002023120892f1e4");
req.setTimestamp(System.currentTimeMillis());
req.setIp("127.0.0.1");
req.setMercOrderNo(System.currentTimeMillis()+"");
req.setMercOrderNo(System.currentTimeMillis() + "");
req.setNotifyUrl("https");
req.setPayAmt("0.01");
req.setPayType("03");
@ -552,13 +772,12 @@ public class PayService {
req.setSubject("ddd");
req.setUserId("or1l864NBOoJZhC5x_yeziZ26j6c");
Map<String,Object> map= BeanUtil.transBeanMap(req);
Map<String, Object> map = BeanUtil.transBeanMap(req);
req.setSign(MD5Util.encrypt(map,priv,true));
req.setSign(MD5Util.encrypt(map, priv, true));
ResponseEntity<String> response= restTemplate1.postForEntity("https://gatewaytestapi.sxczgkj.cn/gate-service/trans/pay",req,String.class);
ResponseEntity<String> response = restTemplate1.postForEntity("https://gatewaytestapi.sxczgkj.cn/gate-service/trans/pay", req, String.class);
// TradeQueryReq req=new TradeQueryReq();
@ -572,11 +791,8 @@ public class PayService {
// ResponseEntity<String> response= restTemplate1.postForEntity("https://gateway.api.sxczgkj.cn/gate-service/merchantOrder/tradeQuery",req,String.class);
//
//
System.out.println(">>>>>>>>>>>>>>>"+response.getBody());
System.out.println(">>>>>>>>>>>>>>>" + response.getBody());
}
}

View File

@ -10,16 +10,14 @@ import com.chaozhanggui.system.cashierservice.entity.vo.*;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.socket.AppWebSocketServer;
import com.chaozhanggui.system.cashierservice.util.DateUtils;
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
import com.chaozhanggui.system.cashierservice.util.LocationUtils;
import com.chaozhanggui.system.cashierservice.util.Threads;
import com.chaozhanggui.system.cashierservice.util.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
@ -64,6 +62,13 @@ public class ProductService {
@Autowired
TbProductSkuMapper tbProductSkuMapper;
public Result queryShopIdByTableCode(String code) {
String shopId = tbShopTableMapper.queryShopIdByTableCode(code);
if (StringUtils.isBlank(shopId)) {
return Result.fail("台桌信息不存在");
}
return Result.success(CodeEnum.SUCCESS, shopId);
}
public Result queryProduct(String code, String productGroupId) {
@ -142,17 +147,40 @@ public class ProductService {
* 销量榜
* 咖啡饮品
*/
public PageInfo products(HomeDto homeDto) throws ExecutionException, InterruptedException {
public PageInfo products(HomeDto homeDto) {
if (homeDto.getOrderBy() == 5) {
homeDto.setPage(1);
homeDto.setSize(4);
}
PageHelper.startPage(homeDto.getPage(), homeDto.getSize());
//经纬度(附近一km)
Map<String, double[]> topAndBottomMap = LocationUtils.returnLLSquarePoint(
Double.parseDouble(homeDto.getLng()), Double.parseDouble(homeDto.getLat()), homeDto.getDistanceInKm());
List<ShopGroupInfoVo> shopGroupInfoVos = tbProductMapper.selGroups(
homeDto.getType(),
topAndBottomMap.get("rightTopPoint")[1], topAndBottomMap.get("rightTopPoint")[0],
topAndBottomMap.get("leftBottomPoint")[1], topAndBottomMap.get("leftBottomPoint")[0],
homeDto.getAddress(), homeDto.getOrderBy().toString(), homeDto.getLng(), homeDto.getLat());
Long stTime = null;
Long enTime = null;
List<ShopGroupInfoVo> shopGroupInfoVos = new ArrayList<>();
if (homeDto.getOrderBy() == 4) {
if (homeDto.getDateType() == 0) {
stTime = DateUtils.getDayStartLong();
enTime = DateUtils.getDayEndLong();
} else if (homeDto.getDateType() == 1) {
enTime = System.currentTimeMillis();
stTime = enTime - 3600000L * 2;
}
shopGroupInfoVos = tbProductMapper.selHotGroups(
homeDto.getType(),
DateUtils.getStrTime(new Date(stTime)), DateUtils.getStrTime(new Date(enTime)),
homeDto.getAddress(), homeDto.getOrderBy().toString(), homeDto.getLng(), homeDto.getLat());
} else {
shopGroupInfoVos = tbProductMapper.selGroups(
homeDto.getType(),
topAndBottomMap.get("rightTopPoint")[1], topAndBottomMap.get("rightTopPoint")[0],
topAndBottomMap.get("leftBottomPoint")[1], topAndBottomMap.get("leftBottomPoint")[0],
homeDto.getAddress(), homeDto.getOrderBy().toString(), homeDto.getLng(), homeDto.getLat());
}
if (CollectionUtils.isEmpty(shopGroupInfoVos)) {
return new PageInfo();
}
List<Integer> productIds = shopGroupInfoVos.stream().map(ShopGroupInfoVo::getProId).collect(Collectors.toList());
List<String> stringList = productIds.stream()
.map(Object::toString) // Integer 对象映射为 String 对象
@ -196,7 +224,7 @@ public class ProductService {
homeVO.setDiscount(BigDecimal.ZERO);
} else {
homeVO.setOriginPrice(tbProductSku.getOriginPrice());
homeVO.setDiscount(tbProductSku.getOriginPrice().divide(tbProductSku.getSalePrice(), 2, RoundingMode.DOWN).multiply(BigDecimal.TEN));
homeVO.setDiscount(BigDecimalUtils.getDiscount(tbProductSku.getOriginPrice(), tbProductSku.getSalePrice()));
}
//销量
homeVO.setRealSalesNumber(new BigDecimal(o.getNumber()));
@ -225,15 +253,13 @@ public class ProductService {
* @throws Exception
*/
public Result productInfo(Integer productId, String lat, String lng, String environment) throws Exception {
CompletableFuture<TbProduct> product = CompletableFuture.supplyAsync(() ->
tbProductMapper.selectById(productId));
CompletableFuture<TbProductWithBLOBs> product = CompletableFuture.supplyAsync(() ->
tbProductMapper.selectByPrimaryKey(productId));
CompletableFuture<List<TbProductSku>> productSku = CompletableFuture.supplyAsync(() ->
tbProductSkuMapper.selectSku(productId.toString()));
CompletableFuture<List<TagProductVO>> dictPro = CompletableFuture.supplyAsync(() ->
tagProductDeptsMapper.queryTagByProductId(productId.toString()));
Threads.call(product, productSku, dictPro);
Threads.call(product, productSku);
TbProduct tbProduct = product.get();
TbProductWithBLOBs tbProduct = product.get();
TbShopInfo tbShopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(tbProduct.getShopId()));
TbPurchaseNotice tbPurchaseNotice = purchaseNoticeMapper.queryByCouponId(tbProduct.getId());
@ -254,7 +280,7 @@ public class ProductService {
productInfo.setDiscount(BigDecimal.ZERO);
} else {
productInfo.setOriginPrice(tbProductSku.getSalePrice());
productInfo.setDiscount(tbProductSku.getOriginPrice().divide(tbProductSku.getSalePrice(), 2, RoundingMode.DOWN).multiply(BigDecimal.TEN));
productInfo.setDiscount(BigDecimalUtils.getDiscount(tbProductSku.getOriginPrice(), tbProductSku.getSalePrice()));
}
//现价
productInfo.setSalePrice(new BigDecimal(tbProductSku.getSalePrice().toString()));
@ -264,34 +290,33 @@ public class ProductService {
//名称
productInfo.setProductName(tbProduct.getName());
//店铺
productInfo.setShopName(tbShopInfo.getShopName() + (StringUtils.isNotBlank(tbShopInfo.getChainName()) ? "(" + tbShopInfo.getChainName() + ")" : ""));
productInfo.setShopName(tbShopInfo.getShopName());
if (StringUtils.isNotBlank(tbShopInfo.getChainName())) {
productInfo.setChainName(tbShopInfo.getChainName());
Integer i = tbShopInfoMapper.selNumByChain(tbShopInfo.getChainName());
productInfo.setShopNum(i);
}
productInfo.setPhone(tbShopInfo.getPhone());
productInfo.setBusinessTime(tbShopInfo.getBusinessTime());
productInfo.setBusinessTime(tbShopInfo.getBusinessStartDay() + "" + tbShopInfo.getBusinessEndDay() + " " + tbShopInfo.getBusinessTime());
BigDecimal distance = LocationUtils.getDistanceFrom2LngLat(
Double.parseDouble(lng), Double.parseDouble(lat),
Double.parseDouble(tbShopInfo.getLng()), Double.parseDouble(tbShopInfo.getLat()));
productInfo.setDistances(distance.toString());//距离
productInfo.setAddress(tbShopInfo.getAddress());
//商品 暂时只做单商品
ProductVo productVo = new ProductVo();
TbShopUnit tbShopUnit = unitMapper.selectByPrimaryKey(Integer.valueOf(tbProduct.getUnitId()));
TbShopCategory tbShopCategory = categoryMapper.selectByPrimaryKey(Integer.valueOf(tbProduct.getCategoryId()));
productVo.setTitle(tbShopCategory.getName());
productVo.setNumber(1);
ProductVo.Food food = new ProductVo.Food();
food.setName(tbProduct.getName());
food.setUnitName(tbShopUnit.getName());
food.setLowPrice(tbProduct.getLowPrice());
for (TagProductVO tagProductVO : dictPro.get()) {
food.getProTag().add(tagProductVO);
List<ProductVo> productVos = JSONUtil.parseListTNewList(tbProduct.getGroupSnap(), ProductVo.class);
for (ProductVo productVo : productVos) {
for (ProductVo.Food good : productVo.getGoods()) {
List<TagProductVO> dictPro = tagProductDeptsMapper.queryTagByProductId(good.getId().toString());
good.setProTag(dictPro);
}
}
productVo.getGoods().add(food);
productInfo.getProductList().add(productVo);
productInfo.setPurchaseNotice(tbPurchaseNotice);
productInfo.setProductList(productVos);
List<TbPlatformDict> tbPlatformDicts = platformDictMapper.queryAllByType("prodetail", environment);
if (tbPurchaseNotice != null) {
productInfo.setPurchaseNotice(tbPurchaseNotice);
if (tbPurchaseNotice.getBookingType().startsWith("无需预约")) {
List<TbPlatformDict> book = platformDictMapper.queryAllByType("prodetail-book", environment);
tbPlatformDicts.addAll(book);
@ -311,15 +336,19 @@ public class ProductService {
tbProductSkuMapper.selectSku(productId.toString()));
CompletableFuture<TbPurchaseNotice> notice = CompletableFuture.supplyAsync(() ->
purchaseNoticeMapper.queryByCouponId(productId));
Threads.call(product, productSku,notice);
Threads.call(product, productSku, notice);
TbProduct tbProduct = product.get();
OrderConfirmVo confirmVo=new OrderConfirmVo();
OrderConfirmVo confirmVo = new OrderConfirmVo();
confirmVo.setProId(tbProduct.getId().toString());
confirmVo.setShopId(tbProduct.getShopId());
confirmVo.setProImg(tbProduct.getCoverImg());
confirmVo.setProName(tbProduct.getName());
TbPurchaseNotice tbPurchaseNotice = notice.get();
confirmVo.setAvaTime(tbPurchaseNotice.getAvailableTime());
if (tbPurchaseNotice != null) {
confirmVo.setAvaTime(tbPurchaseNotice.getAvailableTime());
}
//价格组装
for (TbProductSku tbProductSku : productSku.get()) {
@ -329,13 +358,15 @@ public class ProductService {
confirmVo.setSave(tbProductSku.getSalePrice());
} else {
confirmVo.setOriginPrice(tbProductSku.getOriginPrice());
confirmVo.setSave(tbProductSku.getSalePrice());
confirmVo.setSave(tbProductSku.getOriginPrice().subtract(tbProductSku.getSalePrice()));
}
//现价=售价
confirmVo.setSalePrice(tbProductSku.getSalePrice().subtract(tbProductSku.getOriginPrice()));
confirmVo.setSalePrice(tbProductSku.getSalePrice());
}
List<TbPlatformDict> tbPlatformDicts = platformDictMapper.queryAllByType("order_confirm_no_counpon", environment);
if (!CollectionUtils.isEmpty(tbPlatformDicts)) {
confirmVo.setCouponDetail(JSONUtil.parseListTNewList(tbPlatformDicts, TagVo.class).get(0));
}
List<TbPlatformDict> tbPlatformDicts = platformDictMapper.queryAllByType("order_confirm_no_counpon",environment);
confirmVo.setCouponDetail(JSONUtil.parseListTNewList(tbPlatformDicts, TagVo.class).get(0));
return Result.success(CodeEnum.SUCCESS, confirmVo);
}
}

View File

@ -0,0 +1,20 @@
package com.chaozhanggui.system.cashierservice.util;
import java.math.BigDecimal;
public class BigDecimalUtils {
/**
* 折扣计算
* @param orPrice 原价
* @param saPrice 现价
* @return
*/
public static BigDecimal getDiscount(BigDecimal orPrice,BigDecimal saPrice){
BigDecimal discountRate = saPrice.divide(orPrice, 2, BigDecimal.ROUND_HALF_UP);
// 将折扣率转换为百分比形式
BigDecimal discountPercentage = discountRate.multiply(BigDecimal.TEN);
return discountPercentage;
}
}

View File

@ -269,6 +269,16 @@ public class DateUtils {
cal.set(Calendar.MILLISECOND, 999);
return cal.getTime();
}
public static Long getDayStartLong() {
// 获取今天的日期和时间00:00:00
LocalDateTime todayStart = LocalDateTime.now().toLocalDate().atStartOfDay();
// 转换为UTC时间戳毫秒
long timestampInMillis = todayStart.toInstant(ZoneOffset.UTC).toEpochMilli();
return timestampInMillis;
}
public static Long getDayEndLong() {
// 获取今天的日期和时间00:00:00
LocalDateTime todayStart = LocalDateTime.now().toLocalDate().atStartOfDay();

View File

@ -1,5 +1,7 @@
package com.chaozhanggui.system.cashierservice.util;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.HashMap;
@ -9,7 +11,27 @@ import static java.lang.Math.*;
import static java.lang.Math.sin;
public class LocationUtils {
/**
* 通过Ip获取定位信息
* @param ip
* @return
*/
public static String getGPSByIp(String ip) {
Map<String, String> param = new HashMap<>();
//超掌柜生活-用户端
param.put("key", "7a7f2e4790ea222660a027352ee3af39");
if(StringUtils.isNotBlank(ip)){
param.put("ip", ip);
}
String s = HttpClientUtil.doGet("https://restapi.amap.com/v3/ip", param);
return s;
}
/**
* 行政区域查询
* @param keywords
* @return
*/
public static String district(String keywords) {
Map<String, String> param = new HashMap<>();
//超掌柜生活-用户端
@ -57,20 +79,23 @@ public class LocationUtils {
* 右上顶点 double[] leftTopPoints = stringMap.get("rightTopPoint");
* 左下点 double[] leftBottomPoints = stringMap.get("leftBottomPoint");
*/
public static Map<String, double[]> returnLLSquarePoint(double longitude, double latitude, double distanceInKm) {
public static Map<String, double[]> returnLLSquarePoint(double longitude, double latitude, String distanceInKm) {
BigDecimal distanceKm = new BigDecimal(10);
if (StringUtils.isNotBlank(distanceInKm)) {
distanceKm = new BigDecimal(distanceInKm);
}
Map<String, double[]> squareMap = new HashMap<>();
BigDecimal bdlongitude = new BigDecimal(longitude);
// 地球平均半径单位千米
BigDecimal earthRadius = new BigDecimal("6378.137");
// 将距离转换为弧度
BigDecimal radialDistance = BigDecimal.valueOf(distanceInKm).divide(earthRadius, 10, RoundingMode.HALF_UP);
BigDecimal radialDistance = distanceKm.divide(earthRadius, 10, RoundingMode.HALF_UP);
// 计算纬度上变化对应的角度
BigDecimal dLatitude = BigDecimal.valueOf(Math.toDegrees(2 * Math.asin(Math.sin(radialDistance.divide(BigDecimal.valueOf(2)).doubleValue()) / Math.cos(Math.toRadians(latitude)))));
// 计算经度上变化对应的角度这里需要考虑纬度对距离的影响
// 使用Haversine公式来估算在给定纬度上距离对应的经度变化
BigDecimal estimatedLongitudeDistance = getDistanceFrom2LngLat(latitude, longitude, latitude, bdlongitude.add(BigDecimal.valueOf(0.01)).doubleValue()); // 假设0.01度经度变化对应的距离
BigDecimal dLongitude = BigDecimal.valueOf(distanceInKm).divide(estimatedLongitudeDistance, 10, RoundingMode.HALF_UP).multiply(new BigDecimal("0.0192736")); // 根据比例计算经度变化
BigDecimal dLongitude = distanceKm.divide(estimatedLongitudeDistance, 10, RoundingMode.HALF_UP).multiply(new BigDecimal("0.0192736")); // 根据比例计算经度变化
// 正方形四个顶点的坐标
double[] rightTopPoint = {BigDecimal.valueOf(latitude).add(dLatitude.divide(BigDecimal.valueOf(2))).doubleValue(), BigDecimal.valueOf(longitude).add(dLongitude.divide(BigDecimal.valueOf(2))).doubleValue()};
double[] leftBottomPoint = {BigDecimal.valueOf(latitude).subtract(dLatitude.divide(BigDecimal.valueOf(2))).doubleValue(), BigDecimal.valueOf(longitude).subtract(dLongitude.divide(BigDecimal.valueOf(2))).doubleValue()};
@ -93,7 +118,7 @@ public class LocationUtils {
}
//1KM
public static void main(String[] args) {
Map<String, double[]> stringMap = returnLLSquarePoint(108.975418, 34.280890, 5);
Map<String, double[]> stringMap = returnLLSquarePoint(108.975418, 34.280890, "5");
double[] leftTopPoints = stringMap.get("rightTopPoint");
double[] leftBottomPoints = stringMap.get("leftBottomPoint");

View File

@ -55,6 +55,7 @@ mybatis:
ysk:
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
callBackurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBack
callBackGroupurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBackGroup
callBackIn: https://p40312246f.goho.co/cashierService/notify/memberInCallBack
default: 18710449883
server:

View File

@ -52,6 +52,7 @@ mybatis:
ysk:
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
callBackurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBack
callBackGroupurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBackGroup
callBackIn: https://p40312246f.goho.co/cashierService/notify/memberInCallBack
default: 18710449883
server:

View File

@ -52,6 +52,7 @@ mybatis:
ysk:
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
callBackurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBack
callBackGroupurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBackGroup
callBackIn: https://p40312246f.goho.co/cashierService/notify/memberInCallBack
default: 18710449883

View File

@ -54,6 +54,7 @@ mybatis:
ysk:
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
callBackurl: https://cashier.sxczgkj.cn/cashierService/notify/notifyCallBack
callBackGroupurl: https://cashier.sxczgkj.cn/cashierService/notify/notifyCallBackGroup
callBackIn: https://cashier.sxczgkj.cn/cashierService/notify/memberInCallBack
default: 19191703856
prod: prod1

View File

@ -54,6 +54,7 @@ mybatis:
ysk:
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
callBackurl: https://cashier.sxczgkj.cn/cashierService/notify/notifyCallBack
callBackGroupurl: https://cashier.sxczgkj.cn/cashierService/notify/notifyCallBackGroup
callBackIn: https://cashier.sxczgkj.cn/cashierService/notify/memberInCallBack
default: 19191703856
prod: prod2

View File

@ -52,6 +52,7 @@ mybatis:
ysk:
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
callBackurl: https://cashierapplet.sxczgkj.cn/cashierService/notify/notifyCallBack
callBackGroupurl: https://cashierapplet.sxczgkj.cn/cashierService/notify/notifyCallBackGroup
callBackIn: https://cashierapplet.sxczgkj.cn/cashierService/notify/memberInCallBack
default: 18710449883

View File

@ -1,24 +0,0 @@
<?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.SysDictDetailMapper">
<select id="selectHot" resultType="com.chaozhanggui.system.cashierservice.entity.SysDict">
select *
from sys_dict
where type = 'hot'
</select>
<select id="selectByType" resultType="com.chaozhanggui.system.cashierservice.entity.SysDict">
select *
from sys_dict
where type = 'common'
<if test="type != null and type !=''">
or type = #{type}
</if>
</select>
<select id="selectByDictId" resultType="com.chaozhanggui.system.cashierservice.entity.SysDictDetail">
select * from sys_dict_detail
where dict_id = #{dictId}
</select>
</mapper>

View File

@ -1,117 +1,48 @@
<?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.SysDictMapper">
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.SysDict">
<id column="dict_id" jdbcType="BIGINT" property="dictId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
dict_id, name, description, create_by, update_by, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys_dict
where dict_id = #{dictId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from sys_dict
where dict_id = #{dictId,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.SysDict">
insert into sys_dict (dict_id, name, description,
create_by, update_by, create_time,
update_time)
values (#{dictId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{createBy,jdbcType=VARCHAR}, #{updateBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.SysDict">
insert into sys_dict
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dictId != null">
dict_id,
</if>
<if test="name != null">
name,
</if>
<if test="description != null">
description,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dictId != null">
#{dictId,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="updateBy != null">
#{updateBy,jdbcType=VARCHAR},
</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.SysDict">
update sys_dict
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where dict_id = #{dictId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.SysDict">
update sys_dict
set name = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
update_by = #{updateBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where dict_id = #{dictId,jdbcType=BIGINT}
</update>
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.SysDict">
<id column="dict_id" jdbcType="BIGINT" property="dictId"/>
<result column="dict_name" jdbcType="VARCHAR" property="dictName"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="value" jdbcType="VARCHAR" property="value"/>
<result column="is_child" jdbcType="INTEGER" property="isChild"/>
</resultMap>
<sql id="Base_Column_List">
dict_id
, dict_name , name, value, is_child
</sql>
<sql id="Child_Column_List">
dict_id
, dict_name , name, value
</sql>
<select id="selectHot" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from sys_dict
where type = 'hot'
and status =1
order by sort
</select>
<select id="selectByType" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from sys_dict
where type = 'common'
<if test="type != null and type !=''">
or type = #{type}
</if>
and status =1
order by sort
</select>
<select id="selectByDictId" resultMap="BaseResultMap">
select
<include refid="Child_Column_List"/>
from sys_dict
where dict_id = #{dictId} and status =1
order by sort
</select>
</mapper>

View File

@ -0,0 +1,127 @@
<?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.TbGroupOrderCouponMapper">
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbGroupOrderCoupon" id="TbGroupOrderCouponMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="orderId" column="order_id" jdbcType="INTEGER"/>
<result property="couponNo" column="coupon_no" jdbcType="VARCHAR"/>
<result property="isRefund" column="is_refund" jdbcType="INTEGER"/>
<result property="refundAmount" column="refund_amount" jdbcType="NUMERIC"/>
<result property="refundReason" column="refund_reason" jdbcType="VARCHAR"/>
<result property="refundDesc" column="refund_desc" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id
, order_id, coupon_no, is_refund, refund_amount, refund_reason, refund_desc </sql>
<!--查询单个-->
<select id="queryById" resultMap="TbGroupOrderCouponMap">
select
<include refid="Base_Column_List"/>
from tb_group_order_coupon
where id = #{id}
</select>
<!--查询单个-->
<select id="queryByOrderId" resultMap="TbGroupOrderCouponMap">
select
<include refid="Base_Column_List"/>
from tb_group_order_coupon
where order_id = #{orderId}
</select>
<select id="queryNoRefundByOrderId" resultMap="TbGroupOrderCouponMap">
select
<include refid="Base_Column_List"/>
from tb_group_order_coupon
where order_id = #{orderId}
AND isRefund = 0
</select>
<!--查询指定行数据-->
<select id="queryAll" resultMap="TbGroupOrderCouponMap">
select
<include refid="Base_Column_List"/>
from tb_group_order_coupon
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="orderId != null">
and order_id = #{orderId}
</if>
<if test="couponNo != null and couponNo != ''">
and coupon_no = #{couponNo}
</if>
<if test="isRefund != null">
and is_refund = #{isRefund}
</if>
<if test="refundAmount != null">
and refund_amount = #{refundAmount}
</if>
<if test="refundReason != null and refundReason != ''">
and refund_reason = #{refundReason}
</if>
<if test="refundDesc != null and refundDesc != ''">
and refund_desc = #{refundDesc}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into tb_group_order_coupon(order_id, coupon_no, is_refund, refund_amount, refund_reason, refund_desc)
values (#{orderId}, #{couponNo}, #{isRefund}, #{refundAmount}, #{refundReason}, #{refundDesc})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into tb_group_order_coupon(order_id, coupon_no, is_refund, refund_amount, refund_reason, refund_desc)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.orderId}, #{entity.couponNo}, #{entity.isRefund}, #{entity.refundAmount}, #{entity.refundReason},
#{entity.refundDesc})
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update tb_group_order_coupon
<set>
<if test="orderId != null">
order_id = #{orderId},
</if>
<if test="couponNo != null and couponNo != ''">
coupon_no = #{couponNo},
</if>
<if test="isRefund != null">
is_refund = #{isRefund},
</if>
<if test="refundAmount != null">
refund_amount = #{refundAmount},
</if>
<if test="refundReason != null and refundReason != ''">
refund_reason = #{refundReason},
</if>
<if test="refundDesc != null and refundDesc != ''">
refund_desc = #{refundDesc},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from tb_group_order_coupon
where id = #{id}
</delete>
</mapper>

View File

@ -5,18 +5,20 @@
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbGroupOrderInfo" id="TbGroupOrderInfoMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
<result property="merchantId" column="merchant_id" jdbcType="INTEGER"/>
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="proId" column="pro_id" jdbcType="INTEGER"/>
<result property="proName" column="pro_name" jdbcType="VARCHAR"/>
<result property="proImg" column="pro_img" jdbcType="VARCHAR"/>
<result property="couponNo" column="coupon_no" jdbcType="VARCHAR"/>
<result property="couponUrl" column="coupon_url" jdbcType="VARCHAR"/>
<result property="proName" column="pro_name" jdbcType="VARCHAR"/>
<result property="expDate" column="exp_date" jdbcType="TIMESTAMP"/>
<result property="orderType" column="order_type" jdbcType="VARCHAR"/>
<result property="payType" column="pay_type" jdbcType="VARCHAR"/>
<result property="orderAmount" column="order_amount" jdbcType="NUMERIC"/>
<result property="saveAmount" column="save_amount" jdbcType="NUMERIC"/>
<result property="payAmount" column="pay_amount" jdbcType="NUMERIC"/>
<result property="refundAmount" column="refund_amount" jdbcType="NUMERIC"/>
<result property="refundNumber" column="refund_number" jdbcType="INTEGER"/>
<result property="number" column="number" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
@ -24,18 +26,20 @@
<result property="payTime" column="pay_time" jdbcType="TIMESTAMP"/>
<result property="refundAble" column="refund_able" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="verifier" column="verifier" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="payOrderNo" column="pay_order_no" jdbcType="VARCHAR"/>
<result property="tradeDay" column="trade_day" jdbcType="TIMESTAMP"/>
<result property="source" column="source" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id
, order_no, shop_id, user_id, pro_id, pro_name,pro_img, coupon_no, coupon_url, exp_date, order_type, order_amount, save_amount, pay_amount, number, status, remark, phone, pay_time, refund_able, create_time, update_time, pay_order_no, trade_day, source </sql>
, order_no, merchant_id, shop_id, user_id, pro_id, pro_img, pro_name, exp_date, order_type, pay_type, order_amount, save_amount, pay_amount, refund_amount, refund_number, number, status, remark, phone, pay_time, refund_able, create_time, verifier, update_time, pay_order_no, trade_day, source </sql>
<sql id="List_Column">
id
, order_no, pro_name,pro_img,coupon_url,order_amount, pay_amount, number, status </sql>
, order_no, pro_name,pro_img,order_amount, pay_amount, number, status </sql>
<!--查询单个-->
<select id="queryById" resultMap="TbGroupOrderInfoMap">
@ -46,6 +50,14 @@
where id = #{id}
</select>
<select id="selectByPayOrderNo" resultMap="TbGroupOrderInfoMap">
select
<include refid="Base_Column_List"/>
from tb_group_order_info
where pay_order_no = #{payOrderNO}
</select>
<!--查询指定行数据-->
<select id="queryAll" resultType="com.chaozhanggui.system.cashierservice.entity.vo.GroupOrderListVo">
select
@ -66,28 +78,31 @@
order by create_time desc
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into tb_group_order_info(order_no, shop_id, user_id, pro_id, pro_name, pro_img, coupon_no, coupon_url,
exp_date, order_type, order_amount, save_amount, pay_amount, number, status,
insert into tb_group_order_info(order_no, merchant_id, shop_id, user_id, pro_id, pro_name, pro_img,
exp_date, order_type, pay_type, order_amount, save_amount, pay_amount, number,
refund_number, status,
remark, phone, pay_time, refund_able, create_time, update_time, pay_order_no,
trade_day, source)
values (#{orderNo}, #{shopId}, #{userId}, #{proId}, #{proName}, #{proImg}, #{couponNo}, #{couponUrl},
#{expDate}, #{orderType}, #{orderAmount}, #{saveAmount}, #{payAmount}, #{number}, #{status}, #{remark},
values (#{orderNo}, #{merchantId}, #{shopId}, #{userId}, #{proId}, #{proName}, #{proImg},
#{expDate}, #{orderType}, #{payType}, #{orderAmount}, #{saveAmount}, #{payAmount}, #{number},
#{refundNumber}, #{status}, #{remark},
#{phone}, #{payTime}, #{refundAble}, #{createTime}, #{updateTime}, #{payOrderNo}, #{tradeDay},
#{source})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into tb_group_order_info(order_no, shop_id, user_id, pro_id, pro_name, pro_img, coupon_no, coupon_url,
exp_date, order_type, order_amount, save_amount, pay_amount, number, status, remark, phone, pay_time,
insert into tb_group_order_info(order_no,merchant_id, shop_id, user_id, pro_id, pro_name, pro_img,
exp_date, order_type, pay_type, order_amount, save_amount, pay_amount, number, status, remark, phone, pay_time,
refund_able, create_time, update_time, pay_order_no, trade_day, source)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.orderNo}, #{entity.shopId}, #{entity.userId}, #{entity.proId}, #{entity.proName},#{entity.proImg}
#{entity.couponNo}, #{entity.couponUrl}, #{entity.expDate}, #{entity.orderType},
#{entity.orderAmount}, #{entity.saveAmount}, #{entity.payAmount}, #{entity.number}, #{entity.status},
(#{entity.orderNo},#{entity.merchantId} #{entity.shopId}, #{entity.userId}, #{entity.proId},
#{entity.proName},#{entity.proImg},
#{entity.expDate}, #{entity.orderType},
#{entity.payType}, #{entity.orderAmount}, #{entity.saveAmount}, #{entity.payAmount}, #{entity.number},
#{entity.status},
#{entity.remark}, #{entity.phone}, #{entity.payTime}, #{entity.refundAble}, #{entity.createTime},
#{entity.updateTime}, #{entity.payOrderNo}, #{entity.tradeDay}, #{entity.source})
</foreach>
@ -100,6 +115,9 @@
<if test="orderNo != null and orderNo != ''">
order_no = #{orderNo},
</if>
<if test="merchantId != null">
merchant_id = #{merchantId},
</if>
<if test="shopId != null">
shop_id = #{shopId},
</if>
@ -115,18 +133,15 @@
<if test="proImg != null and proImg != ''">
pro_img = #{proImg},
</if>
<if test="couponNo != null and couponNo != ''">
coupon_no = #{couponNo},
</if>
<if test="couponUrl != null and couponUrl != ''">
coupon_url = #{couponUrl},
</if>
<if test="expDate != null">
exp_date = #{expDate},
</if>
<if test="orderType != null and orderType != ''">
order_type = #{orderType},
</if>
<if test="payType != null and payType != ''">
pay_type = #{payType},
</if>
<if test="orderAmount != null">
order_amount = #{orderAmount},
</if>
@ -172,13 +187,5 @@
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from tb_group_order_info
where id = #{id}
</delete>
</mapper>

View File

@ -551,7 +551,6 @@
order by a.id desc
Limit #{page}, #{size}
</select>
<select id="selectByPayOrderNo" resultMap="BaseResultMap">

View File

@ -6,6 +6,7 @@
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="shareImg" column="share_img" jdbcType="VARCHAR"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="value" column="value" jdbcType="VARCHAR"/>
<result property="fontColor" column="font_color" jdbcType="VARCHAR"/>
<result property="backColor" column="back_color" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="VARCHAR"/>
@ -25,7 +26,7 @@
<!--查询单个-->
<select id="queryById" resultMap="TbPlatformDictMap">
select
id, name, type,font_color,back_color, cover_img, share_img, video, video_cover_img, jump_type, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
id, name,value, type,font_color,back_color, cover_img, share_img, video, video_cover_img, jump_type, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
from tb_platform_dict
where id = #{id}
</select>
@ -33,17 +34,18 @@
<select id="queryByIdList" resultMap="TbPlatformDictMap">
select
id, name, type, font_color, back_color, cover_img, share_img, video, video_cover_img, jump_type, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
id, name,value, type, font_color, back_color, cover_img, share_img, video, video_cover_img, jump_type, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
from tb_platform_dict
where id IN
<foreach collection="idList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
order by sort
</select>
<select id="queryAllByType" resultType="com.chaozhanggui.system.cashierservice.entity.TbPlatformDict">
select
id, name, type,font_color,back_color, cover_img, share_img, video, video_cover_img, jump_type, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
id, name,value, type,font_color,back_color, cover_img, share_img, video, video_cover_img, jump_type, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
from tb_platform_dict
<where>
<if test="type != null and type != ''">
@ -56,6 +58,25 @@
and is_show_mall = 1
</if>
</where>
order by sort
</select>
<select id="queryGroupByValue" resultType="com.chaozhanggui.system.cashierservice.entity.TbPlatformDict">
select
id, name,value, type,font_color,back_color, cover_img, share_img, video, video_cover_img, jump_type, abs_url,
created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
from tb_platform_dict
<where>
value = #{value}
and type = 'group'
<if test="environment == 'app'">
and is_show_app = 1
</if>
<if test="environment == 'wx'">
and is_show_mall = 1
</if>
</where>
order by sort
</select>
</mapper>

View File

@ -222,4 +222,16 @@
</if>
order by g.sort asc
</select>
<select id="selectByShopId" resultMap="BaseResultMap">
SELECT
*
FROM
tb_product_group
where shop_id=#{shopId} and is_show=1
<if test="groupId != null">
and id = #{groupId}
</if>
order by g.sort asc
</select>
</mapper>

View File

@ -74,7 +74,7 @@
</resultMap>
<sql id="Base_Column_List">
id, category_id, spec_id, source_path, brand_id, merchant_id, shop_id, name, short_title,
type, pack_fee, low_price, low_member_price, unit_id, unit_snap, cover_img, share_img,
type, pack_fee, low_price, low_member_price, unit_id, unit_snap, cover_img, share_img, images,
video_cover_img, sort, limit_number, product_score, status, fail_msg, is_recommend,
is_hot, is_new, is_on_sale, is_show, type_enum, is_distribute, is_del, is_stock,
is_pause_sale, is_free_freight, freight_id, strategy_type, strategy_id, is_vip, is_delete,
@ -882,6 +882,11 @@
spec_table_headers = #{specTableHeaders,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="upGroupRealSalesNumber">
update tb_product
set real_sales_number = real_sales_number + #{number,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectByIdIn" resultMap="BaseResultMap">
select *
@ -949,8 +954,8 @@
pro.cover_img AS proImg,
pro.real_sales_number AS number
FROM
tb_product pro
LEFT JOIN tb_shop_info AS info ON info.id = pro.shop_id
tb_product pro
LEFT JOIN tb_shop_info AS info ON info.id = pro.shop_id
<where>
info.`status`='1'
AND pro.is_combo = '1'
@ -968,14 +973,44 @@
ORDER BY (ABS(info.lat - #{lat}) + ABS(info.lng - #{lng})) ASC
</when>
<when test="orderBy == '2'">
ORDER BYpro.real_sales_number desc
ORDER BY pro.real_sales_number desc
</when>
<when test="orderBy == '3'">
ORDER BY pro.low_price ASC
</when>
<otherwise>
ORDER BY pro.id DESC
ORDER BY pro.real_sales_number DESC
</otherwise>
</choose>
</select>
<select id="selHotGroups" resultType="com.chaozhanggui.system.cashierservice.entity.vo.ShopGroupInfoVo">
SELECT
info.id AS shopId,
info.shop_name AS shopName,
info.logo AS shopImg,
info.tag AS shopTag,
info.lat AS lat,
info.lng AS lng,
pro.id AS proId,
pro.`name` AS proName,
pro.cover_img AS proImg,
sum(`order`.number) AS number
FROM
tb_group_order_info AS `order`
LEFT JOIN tb_product AS pro ON `order`.pro_id = pro.id
LEFT JOIN tb_shop_info AS info ON info.id = `order`.shop_id
<where>
info.`status`='1'
AND info.cities = #{cities}
<if test="type != null and type != ''">
AND pro.group_category_id LIKE concat('%',#{type,jdbcType=VARCHAR},'%')
</if>
<if test="startTime != null and startTime != ''">
AND `order`.create_time BETWEEN #{startTime} AND #{endTime}
</if>
</where>
group by `order`.pro_id
ORDER BY number desc
</select>
</mapper>

View File

@ -396,7 +396,7 @@
pro.cover_img AS image,
sku.origin_price AS originPrice,
sku.sale_price AS salePrice,
MAX( sku.real_sales_number ) AS realSalesNumber
pro.real_sales_number AS realSalesNumber
FROM
tb_product pro
LEFT JOIN tb_product_sku sku ON pro.id = sku.product_id
@ -415,7 +415,7 @@
pro.cover_img AS image,
sku.origin_price AS originPrice,
sku.sale_price AS salePrice,
MAX( sku.real_sales_number ) AS realSalesNumber
pro.real_sales_number AS realSalesNumber
FROM
tb_product pro
LEFT JOIN tb_product_sku sku ON pro.id = sku.product_id

View File

@ -29,6 +29,8 @@
<result column="type" jdbcType="VARCHAR" property="type"/>
<result column="industry" jdbcType="VARCHAR" property="industry"/>
<result column="industry_name" jdbcType="VARCHAR" property="industryName"/>
<result column="business_start_day" jdbcType="VARCHAR" property="businessStartDay"/>
<result column="business_end_day" jdbcType="VARCHAR" property="businessEndDay"/>
<result column="business_time" jdbcType="VARCHAR" property="businessTime"/>
<result column="post_time" jdbcType="VARCHAR" property="postTime"/>
<result column="post_amount_line" jdbcType="DECIMAL" property="postAmountLine"/>
@ -56,7 +58,7 @@
, account, shop_code, sub_title, merchant_id, shop_name, chain_name, back_img,
front_img, contact_name, phone, logo, is_deposit, is_supply, cover_img, share_img,
detail, lat, lng, mch_id, register_type, is_wx_ma_independent, address, city, type,
industry, industry_name, business_time, post_time, post_amount_line, on_sale, settle_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
</sql>
@ -72,6 +74,13 @@
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selNumByChain" resultType="java.lang.Integer">
select
count(1)
from tb_shop_info
where chain_name = #{chainName}
</select>
<select id="selShopInfoByGps" resultType="com.chaozhanggui.system.cashierservice.entity.vo.SubShopVo">
SELECT
@ -80,11 +89,14 @@
tb_shop_info as info
<where>
info.status=1
AND info.cities =#{cities}
AND (info.cities =#{cities} or info.districts =#{cities})
<if test="rightTopLng != null and rightTopLng != '' and leftBottomLng != null and leftBottomLng != ''">
AND info.lng BETWEEN #{leftBottomLng} AND #{rightTopLng}
AND info.lat BETWEEN #{leftBottomLat} AND #{rightTopLat}
</if>
<if test="shopName != null and shopName != ''">
AND shop_name = #{shopName}
</if>
</where>
ORDER BY (ABS(info.lat - #{lat}) + ABS(info.lng - #{lng})) ASC
</select>

View File

@ -35,6 +35,15 @@
from tb_shop_table
where qrcode = #{qrcode}
</select>
<select id="queryShopIdByTableCode" resultType="string">
select
shop_id
from tb_shop_table
where qrcode = #{qrcode}
limit 1
</select>
<select id="selectShopTableById" resultType="com.chaozhanggui.system.cashierservice.entity.TbShopTable">
select
a.id, a.name, a.shop_id, a.max_capacity, a.sort, a.area_id, a.is_predate, a.predate_amount, a.status,