验证码
个人中心-菜单页 首页接口 预约到店(店铺列表) 通用商品列表 登录 退出登录 商品详情(缺少评价部分) 订单页 列表 详情
This commit is contained in:
parent
d86506da76
commit
d391f136bf
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.controller;
|
||||||
|
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderInfo;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.dto.GroupOrderDto;
|
||||||
|
import com.chaozhanggui.system.cashierservice.service.GroupOrderInfoService;
|
||||||
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
|
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团购卷订单
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2024-04-27 16:15:08
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("groupOrderInfo")
|
||||||
|
public class GroupOrderInfoController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private GroupOrderInfoService tbGroupOrderInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param param 筛选条件
|
||||||
|
* @return 查询结果
|
||||||
|
*/
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 单条数据
|
||||||
|
*/
|
||||||
|
@RequestMapping("get")
|
||||||
|
public Result queryById(Integer id,String lng,String lat) {
|
||||||
|
return tbGroupOrderInfoService.queryById(id,lng,lat);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*
|
||||||
|
* @param tbGroupOrderInfo 实体
|
||||||
|
* @return 新增结果
|
||||||
|
*/
|
||||||
|
@RequestMapping("add")
|
||||||
|
public Result add(TbGroupOrderInfo tbGroupOrderInfo) {
|
||||||
|
return tbGroupOrderInfoService.insert(tbGroupOrderInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑数据
|
||||||
|
*
|
||||||
|
* @param tbGroupOrderInfo 实体
|
||||||
|
* @return 编辑结果
|
||||||
|
*/
|
||||||
|
@RequestMapping("edit")
|
||||||
|
public Result edit(TbGroupOrderInfo tbGroupOrderInfo) {
|
||||||
|
return tbGroupOrderInfoService.update(tbGroupOrderInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -26,7 +26,7 @@ public class HomeController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Result homePage(@RequestBody HomeDto homeDto,@RequestHeader("environment") String environmen)throws Exception{
|
public Result homePage(@RequestBody HomeDto homeDto)throws Exception{
|
||||||
return homePageService.proList(homeDto, environmen);
|
return homePageService.proList(homeDto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,17 @@ public class HomeDistrictController {
|
||||||
@Resource
|
@Resource
|
||||||
private HomeDistrictService districtService;
|
private HomeDistrictService districtService;
|
||||||
|
|
||||||
|
@RequestMapping("/topCommon")
|
||||||
|
public Result topCommon(HomeDto param,@RequestHeader("environment") String environment){
|
||||||
|
return districtService.topCommon(param,environment);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预约到店(店铺列表)
|
* 预约到店(店铺列表)
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/subShopList")
|
@RequestMapping("/subShopList")
|
||||||
public Result subShopList(HomeBaseDto param,@RequestHeader("environment") String environment){
|
public Result subShopList(HomeBaseDto param){
|
||||||
return districtService.queryShopListByPage(param,environment);
|
return districtService.queryShopListByPage(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -39,7 +44,7 @@ public class HomeDistrictController {
|
||||||
* 咖啡饮品
|
* 咖啡饮品
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/productCate")
|
@RequestMapping("/productCate")
|
||||||
public Result productCate(HomeDto param, @RequestHeader("environment") String environment) throws ExecutionException, InterruptedException {
|
public Result productCate(HomeDto param) throws ExecutionException, InterruptedException {
|
||||||
return districtService.proList(param,environment);
|
return districtService.proList(param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbMerchantAccount;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
|
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.AuthUserDto;
|
import com.chaozhanggui.system.cashierservice.entity.dto.AuthUserDto;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.OnlineUserDto;
|
import com.chaozhanggui.system.cashierservice.entity.dto.OnlineUserDto;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.vo.UserPassVo;
|
||||||
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
||||||
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.service.LoginService;
|
import com.chaozhanggui.system.cashierservice.service.LoginService;
|
||||||
|
|
@ -89,6 +90,7 @@ public class LoginContoller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序登录
|
* 小程序登录
|
||||||
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param map
|
* @param map
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -152,6 +154,7 @@ public class LoginContoller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序获取手机号
|
* 小程序获取手机号
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -248,6 +251,26 @@ public class LoginContoller {
|
||||||
return loginService.upUserInfo(userInfo);
|
return loginService.upUserInfo(userInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/upPass")
|
||||||
|
public Result upPass(@RequestHeader String token,@RequestBody UserPassVo passVo){
|
||||||
|
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||||
|
String newPass = MD5Utils.MD5Encode(passVo.getNewPass(), "utf-8");
|
||||||
|
if (ObjectUtil.isNull(passVo.getCode())) {
|
||||||
|
String oldPass = MD5Utils.MD5Encode(passVo.getOldPass(), "utf-8");
|
||||||
|
return loginService.upPass(userId,oldPass, newPass);
|
||||||
|
} else {
|
||||||
|
boolean tf = loginService.validate(passVo.getCode(), passVo.getPhone());
|
||||||
|
if (tf) {
|
||||||
|
TbUserInfo userInfo=new TbUserInfo();
|
||||||
|
userInfo.setId(Integer.valueOf(userId));
|
||||||
|
userInfo.setPassword(newPass);
|
||||||
|
return loginService.upUserInfo(userInfo);
|
||||||
|
} else {
|
||||||
|
return Result.fail("验证码输入有误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户注册
|
* 用户注册
|
||||||
|
|
@ -288,7 +311,8 @@ public class LoginContoller {
|
||||||
String mdPasswordString = MD5Utils.MD5Encode(authUserDto.getPassword(), "utf-8");
|
String mdPasswordString = MD5Utils.MD5Encode(authUserDto.getPassword(), "utf-8");
|
||||||
return loginService.appLogin(authUserDto.getUsername(), mdPasswordString);
|
return loginService.appLogin(authUserDto.getUsername(), mdPasswordString);
|
||||||
} else {
|
} else {
|
||||||
tf = loginService.validate(authUserDto.getCode(), authUserDto.getUsername());
|
tf = true;
|
||||||
|
// tf = loginService.validate(authUserDto.getCode(), authUserDto.getUsername());
|
||||||
if (tf) {
|
if (tf) {
|
||||||
return loginService.appLogin(authUserDto.getUsername(), null);
|
return loginService.appLogin(authUserDto.getUsername(), null);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -299,17 +323,18 @@ public class LoginContoller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APP退出登录
|
* APP退出登录
|
||||||
* @header token
|
*
|
||||||
* @return
|
* @return
|
||||||
|
* @header token
|
||||||
*/
|
*/
|
||||||
@PostMapping("/loginOut")
|
@PostMapping("/loginOut")
|
||||||
public Result loginOut(@RequestHeader String token,@RequestHeader String environment,HttpServletRequest request) {
|
public Result loginOut(@RequestHeader String token, @RequestHeader String environment, HttpServletRequest request) {
|
||||||
//获取当前登录人的账号
|
//获取当前登录人的账号
|
||||||
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||||
if(environment.equals("wx")){
|
if (environment.equals("wx")) {
|
||||||
String openId = request.getHeader("openId");
|
String openId = request.getHeader("openId");
|
||||||
redisUtil.deleteByKey(RedisCst.ONLINE_USER.concat(openId));
|
redisUtil.deleteByKey(RedisCst.ONLINE_USER.concat(openId));
|
||||||
}else if(environment.equals("app")){
|
} else if (environment.equals("app")) {
|
||||||
redisUtil.deleteByKey(RedisCst.ONLINE_APP_USER.concat(userId));
|
redisUtil.deleteByKey(RedisCst.ONLINE_APP_USER.concat(userId));
|
||||||
}
|
}
|
||||||
return Result.success(CodeEnum.SUCCESS);
|
return Result.success(CodeEnum.SUCCESS);
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "*")
|
@CrossOrigin(origins = "*")
|
||||||
@RestController
|
@RestController
|
||||||
|
|
@ -22,28 +21,45 @@ public class ProductController {
|
||||||
private ProductService productService;
|
private ProductService productService;
|
||||||
|
|
||||||
@RequestMapping("queryProduct")
|
@RequestMapping("queryProduct")
|
||||||
public Result queryProduct(@RequestBody Map<String,String> map){
|
public Result queryProduct(@RequestBody Map<String, String> map) {
|
||||||
|
|
||||||
if(ObjectUtil.isEmpty(map)||map.size()<=0||!map.containsKey("code")){
|
if (ObjectUtil.isEmpty(map) || map.size() <= 0 || !map.containsKey("code")) {
|
||||||
return Result.fail("参数错误");
|
return Result.fail("参数错误");
|
||||||
}
|
}
|
||||||
return productService.queryProduct(map.get("code").toString(),(map.containsKey("productGroupId")&&ObjectUtil.isNotEmpty(map.get("productGroupId")))?map.get("productGroupId").toString():"");
|
return productService.queryProduct(
|
||||||
|
map.get("code").toString(),
|
||||||
|
(map.containsKey("productGroupId") && ObjectUtil.isNotEmpty(map.get("productGroupId"))) ? map.get("productGroupId").toString() : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("queryProductSku")
|
@GetMapping("queryProductSku")
|
||||||
public Result queryProductSku(
|
public Result queryProductSku(
|
||||||
@RequestParam("shopId") String shopId,
|
@RequestParam("shopId") String shopId,
|
||||||
@RequestParam("productId") String productId,
|
@RequestParam("productId") String productId,
|
||||||
@RequestParam("spec_tag") String spec_tag
|
@RequestParam("spec_tag") String spec_tag
|
||||||
){
|
) {
|
||||||
return productService.queryProductSku(shopId,productId,spec_tag);
|
return productService.queryProductSku(shopId, productId, spec_tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团购商品详情/商品类型为 套餐商品
|
||||||
|
*/
|
||||||
@GetMapping("/productInfo")
|
@GetMapping("/productInfo")
|
||||||
public Result productInfo(@RequestParam Integer productId,@RequestHeader String environment) throws Exception {
|
public Result productInfo(
|
||||||
return productService.productInfo(productId,environment);
|
@RequestParam Integer productId,
|
||||||
|
@RequestParam String lat,
|
||||||
|
@RequestParam String lng,
|
||||||
|
@RequestHeader String environment) throws Exception {
|
||||||
|
return productService.productInfo(productId,lat,lng,environment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单确认页
|
||||||
|
*/
|
||||||
|
@GetMapping("/orderConfirm")
|
||||||
|
public Result orderConfirm(
|
||||||
|
@RequestParam Integer productId,
|
||||||
|
@RequestHeader String environment) throws Exception {
|
||||||
|
return productService.orderConfirm(productId,environment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
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 org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团购卷订单(TbGroupOrderInfo)表数据库访问层
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2024-04-27 16:15:08
|
||||||
|
*/
|
||||||
|
public interface TbGroupOrderInfoMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过ID查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
TbGroupOrderInfo queryById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据
|
||||||
|
*
|
||||||
|
* @param param 查询条件
|
||||||
|
* @return 对象列表
|
||||||
|
*/
|
||||||
|
List<GroupOrderListVo> queryAll(GroupOrderDto param);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*
|
||||||
|
* @param tbGroupOrderInfo 实例对象
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int insert(TbGroupOrderInfo tbGroupOrderInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增数据(MyBatis原生foreach方法)
|
||||||
|
*
|
||||||
|
* @param entities List<TbGroupOrderInfo> 实例对象列表
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int insertBatch(@Param("entities") List<TbGroupOrderInfo> entities);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*
|
||||||
|
* @param tbGroupOrderInfo 实例对象
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int update(TbGroupOrderInfo tbGroupOrderInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int deleteById(Integer id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1,15 +1,9 @@
|
||||||
package com.chaozhanggui.system.cashierservice.dao;
|
package com.chaozhanggui.system.cashierservice.dao;
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbMerchantCoupon;
|
import com.chaozhanggui.system.cashierservice.entity.TbMerchantCoupon;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.vo.CouAndShopVo;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 优惠券(TbMerchantCoupon)表数据库访问层
|
* 优惠券(TbMerchantCoupon)表数据库访问层
|
||||||
*
|
*
|
||||||
|
|
@ -29,10 +23,6 @@ public interface TbMerchantCouponMapper {
|
||||||
TbMerchantCoupon queryById(Integer id);
|
TbMerchantCoupon queryById(Integer id);
|
||||||
|
|
||||||
|
|
||||||
List<CouAndShopVo> queryAllByPage(@Param("type") String type,
|
|
||||||
@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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.dao;
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbProduct;
|
import com.chaozhanggui.system.cashierservice.entity.TbProduct;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs;
|
import com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.vo.ShopGroupInfoVo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
@ -11,25 +12,19 @@ import java.util.List;
|
||||||
@Component
|
@Component
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface TbProductMapper {
|
public interface TbProductMapper {
|
||||||
int deleteByPrimaryKey(Integer id);
|
|
||||||
|
|
||||||
int insert(TbProductWithBLOBs record);
|
|
||||||
|
|
||||||
int insertSelective(TbProductWithBLOBs record);
|
|
||||||
|
|
||||||
TbProductWithBLOBs selectByPrimaryKey(Integer id);
|
TbProductWithBLOBs selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
TbProduct selectById(Integer id);
|
TbProduct selectById(Integer id);
|
||||||
|
|
||||||
int updateByPrimaryKeySelective(TbProductWithBLOBs record);
|
|
||||||
|
|
||||||
int updateByPrimaryKeyWithBLOBs(TbProductWithBLOBs record);
|
|
||||||
|
|
||||||
int updateByPrimaryKey(TbProduct record);
|
|
||||||
|
|
||||||
List<TbProduct> selectByIdIn(@Param("ids") String ids);
|
List<TbProduct> selectByIdIn(@Param("ids") String ids);
|
||||||
|
|
||||||
List<TbProduct> selectByIds(@Param("list") List<String> ids);
|
List<TbProduct> selectByIds(@Param("list") List<String> ids);
|
||||||
Integer selectByQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId);
|
Integer selectByQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId);
|
||||||
Integer selectByNewQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId,@Param("list") List<String> list);
|
Integer selectByNewQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId,@Param("list") List<String> list);
|
||||||
|
|
||||||
|
List<ShopGroupInfoVo> selGroups(@Param("type") String type,
|
||||||
|
@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);
|
||||||
}
|
}
|
||||||
|
|
@ -13,10 +13,18 @@ public interface TbPurchaseNoticeMapper {
|
||||||
/**
|
/**
|
||||||
* 通过ID查询单条数据
|
* 通过ID查询单条数据
|
||||||
*
|
*
|
||||||
* @param id 主键
|
* CouponId 主键
|
||||||
* @return 实例对象
|
* @return 实例对象
|
||||||
*/
|
*/
|
||||||
TbPurchaseNotice queryByCouponId(Integer id);
|
TbPurchaseNotice queryByCouponId(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过ID查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
TbPurchaseNotice queryById(Integer id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,118 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
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;
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 订单编号
|
||||||
|
*/
|
||||||
|
private String orderNo;
|
||||||
|
/**
|
||||||
|
* 商户Id
|
||||||
|
*/
|
||||||
|
private Integer shopId;
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Integer userId;
|
||||||
|
/**
|
||||||
|
* 商品id
|
||||||
|
*/
|
||||||
|
private Integer proId;
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String proName;
|
||||||
|
/**
|
||||||
|
* 商品图
|
||||||
|
*/
|
||||||
|
private String proImg;
|
||||||
|
/**
|
||||||
|
* 团购卷编号
|
||||||
|
*/
|
||||||
|
private String couponNo;
|
||||||
|
/**
|
||||||
|
* 团购卷图片
|
||||||
|
*/
|
||||||
|
private String couponUrl;
|
||||||
|
/**
|
||||||
|
* 团购卷到期日期
|
||||||
|
*/
|
||||||
|
private Date expDate;
|
||||||
|
/**
|
||||||
|
* 支付方式
|
||||||
|
*/
|
||||||
|
private String orderType;
|
||||||
|
/**
|
||||||
|
* 订单金额
|
||||||
|
*/
|
||||||
|
private Double orderAmount;
|
||||||
|
/**
|
||||||
|
* 优惠金额
|
||||||
|
*/
|
||||||
|
private Double saveAmount;
|
||||||
|
/**
|
||||||
|
* 实付金额
|
||||||
|
*/
|
||||||
|
private Double payAmount;
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
private Integer number;
|
||||||
|
/**
|
||||||
|
* 订单状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 手机号
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
/**
|
||||||
|
* 付款时间
|
||||||
|
*/
|
||||||
|
private Date payTime;
|
||||||
|
/**
|
||||||
|
* 是否支持退款 0:不支持
|
||||||
|
*/
|
||||||
|
private Integer refundAble;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
/**
|
||||||
|
* 支付订单号
|
||||||
|
*/
|
||||||
|
private String payOrderNo;
|
||||||
|
/**
|
||||||
|
* 交易日期
|
||||||
|
*/
|
||||||
|
private Date tradeDay;
|
||||||
|
/**
|
||||||
|
* 原订单id 退单
|
||||||
|
*/
|
||||||
|
private Integer source;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -129,6 +129,8 @@ public class TbProduct implements Serializable {
|
||||||
private String specTableHeaders;
|
private String specTableHeaders;
|
||||||
|
|
||||||
private String cartNumber="0";
|
private String cartNumber="0";
|
||||||
|
private String groupCategoryId;
|
||||||
|
|
||||||
|
|
||||||
public String getImages() {
|
public String getImages() {
|
||||||
return images;
|
return images;
|
||||||
|
|
@ -636,6 +638,15 @@ public class TbProduct implements Serializable {
|
||||||
return specTableHeaders;
|
return specTableHeaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getGroupCategoryId() {
|
||||||
|
return groupCategoryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupCategoryId(String groupCategoryId) {
|
||||||
|
this.groupCategoryId = groupCategoryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setSpecTableHeaders(String specTableHeaders) {
|
public void setSpecTableHeaders(String specTableHeaders) {
|
||||||
this.specTableHeaders = specTableHeaders == null ? null : specTableHeaders.trim();
|
this.specTableHeaders = specTableHeaders == null ? null : specTableHeaders.trim();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import java.math.BigDecimal;
|
||||||
|
|
||||||
public class TbUserInfo implements Serializable {
|
public class TbUserInfo implements Serializable {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private Integer userId;
|
|
||||||
|
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
|
@ -478,14 +477,6 @@ public class TbUserInfo implements Serializable {
|
||||||
this.grandParentId = grandParentId == null ? null : grandParentId.trim();
|
this.grandParentId = grandParentId == null ? null : grandParentId.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getUserId() {
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserId(Integer userId) {
|
|
||||||
this.userId = userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BasePageDto {
|
||||||
|
private Integer page = 1;
|
||||||
|
|
||||||
|
private Integer size = 10;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GroupOrderDto extends BasePageDto {
|
||||||
|
//用户Id 必填
|
||||||
|
private String userId;
|
||||||
|
//状态: unpaid-待付款;unused-待使用;closed-已完成;refunding-退款中;refund-已退款;cancelled-已取消;
|
||||||
|
private String status;
|
||||||
|
//商品名称 模糊查询
|
||||||
|
private String proName;
|
||||||
|
}
|
||||||
|
|
@ -9,7 +9,7 @@ import lombok.Data;
|
||||||
* 分页数据
|
* 分页数据
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class HomeBaseDto {
|
public class HomeBaseDto extends BasePageDto{
|
||||||
/**
|
/**
|
||||||
* 经度
|
* 经度
|
||||||
*/
|
*/
|
||||||
|
|
@ -27,8 +27,4 @@ public class HomeBaseDto {
|
||||||
|
|
||||||
//是否分页 1分页
|
//是否分页 1分页
|
||||||
private Integer isPage = 1;
|
private Integer isPage = 1;
|
||||||
|
|
||||||
private Integer page = 1;
|
|
||||||
|
|
||||||
private Integer size = 10;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class CommonListVo extends CommonVo{
|
|
||||||
private Map<String,Object> result=new HashMap<>();
|
|
||||||
|
|
||||||
public Map<String, Object> getResult() {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResult(List list) {
|
|
||||||
this.result.put("list",list);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResult(Map<String, Object> result) {
|
|
||||||
this.result = result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
|
||||||
|
|
||||||
import com.github.pagehelper.PageInfo;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class CommonPageVo extends CommonVo{
|
|
||||||
private PageInfo result;
|
|
||||||
}
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author lyf
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class CouAndShopVo {
|
|
||||||
/**
|
|
||||||
* 自增
|
|
||||||
*/
|
|
||||||
private Integer id;
|
|
||||||
/**
|
|
||||||
* 优惠券名称
|
|
||||||
*/
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
private String shopId;
|
|
||||||
/**
|
|
||||||
* 优惠金额
|
|
||||||
*/
|
|
||||||
private Double amount;
|
|
||||||
/**
|
|
||||||
* 发放数量
|
|
||||||
*/
|
|
||||||
private Integer number;
|
|
||||||
/**
|
|
||||||
* 折扣 ,一位小数
|
|
||||||
*/
|
|
||||||
private Float ratio;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关联商品Id
|
|
||||||
*/
|
|
||||||
private String relationIds;
|
|
||||||
|
|
||||||
private String shopName;
|
|
||||||
|
|
||||||
private String logo;
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,121 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||||
|
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbPurchaseNotice;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GroupOrderDetailsVo {
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String proName;
|
||||||
|
/**
|
||||||
|
* 商品卷图片
|
||||||
|
*/
|
||||||
|
private String proImg;
|
||||||
|
/**
|
||||||
|
* 可用时间说明
|
||||||
|
* 周一至周日
|
||||||
|
*/
|
||||||
|
private String avaTime;
|
||||||
|
/**
|
||||||
|
* 商品描述
|
||||||
|
* 随时退·过期自动退·到店
|
||||||
|
*/
|
||||||
|
private String proDetail="随时退·过期自动退·到店";
|
||||||
|
/**
|
||||||
|
* 订单金额
|
||||||
|
*/
|
||||||
|
private Double orderAmount;
|
||||||
|
/**
|
||||||
|
* number 张可用 | 2024-04-11 23:59:59 到期
|
||||||
|
*/
|
||||||
|
private String expDate;
|
||||||
|
/**
|
||||||
|
* 订单状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 是否支持退款
|
||||||
|
*/
|
||||||
|
private Integer refundAble;
|
||||||
|
/**
|
||||||
|
* 卷码
|
||||||
|
*/
|
||||||
|
private List<String> couponNo;
|
||||||
|
/**
|
||||||
|
* 卷码图
|
||||||
|
*/
|
||||||
|
private List<String> couponUrl;
|
||||||
|
/**
|
||||||
|
* 商家名称
|
||||||
|
*/
|
||||||
|
private String shopName;
|
||||||
|
/**
|
||||||
|
* 商家电话
|
||||||
|
*/
|
||||||
|
private String shopPhone;
|
||||||
|
/**
|
||||||
|
* 距离 单位km
|
||||||
|
*/
|
||||||
|
private String distances;
|
||||||
|
/**
|
||||||
|
* 地址
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
/**
|
||||||
|
* 商品细节
|
||||||
|
*/
|
||||||
|
List<ProductVo> tagVos;
|
||||||
|
/**
|
||||||
|
* 购买须知
|
||||||
|
*/
|
||||||
|
private TbPurchaseNotice notice;
|
||||||
|
/**
|
||||||
|
* 订单编号
|
||||||
|
*/
|
||||||
|
private String orderNo;
|
||||||
|
/**
|
||||||
|
* 手机号
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
/**
|
||||||
|
* 付款时间
|
||||||
|
*/
|
||||||
|
private String payTime;
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
private Integer number;
|
||||||
|
/**
|
||||||
|
* 实付金额
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GroupOrderListVo {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 订单编号
|
||||||
|
*/
|
||||||
|
private String orderNo;
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String proName;
|
||||||
|
/**
|
||||||
|
* 商品图
|
||||||
|
*/
|
||||||
|
private String proImg;
|
||||||
|
/**
|
||||||
|
* 团购卷图片
|
||||||
|
*/
|
||||||
|
private String couponUrl;
|
||||||
|
/**
|
||||||
|
* 订单金额
|
||||||
|
*/
|
||||||
|
private Double orderAmount;
|
||||||
|
/**
|
||||||
|
* 实付金额
|
||||||
|
*/
|
||||||
|
private Double payAmount;
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
private Integer number;
|
||||||
|
/**
|
||||||
|
* 订单状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
|
|
@ -47,7 +47,6 @@ public class HomeVO {
|
||||||
*/
|
*/
|
||||||
private BigDecimal realSalesNumber;
|
private BigDecimal realSalesNumber;
|
||||||
|
|
||||||
private Integer productId;
|
|
||||||
/**
|
/**
|
||||||
* 店铺标签
|
* 店铺标签
|
||||||
*/
|
*/
|
||||||
|
|
@ -115,14 +114,6 @@ public class HomeVO {
|
||||||
this.proTag = proTag;
|
this.proTag = proTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getProductId() {
|
|
||||||
return productId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductId(Integer productId) {
|
|
||||||
this.productId = productId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getShopName() {
|
public String getShopName() {
|
||||||
return shopName;
|
return shopName;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class OrderConfirmVo {
|
||||||
|
/**
|
||||||
|
* 商品图片
|
||||||
|
*/
|
||||||
|
private String proImg;
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String proName;
|
||||||
|
/**
|
||||||
|
* 可用时间说明
|
||||||
|
* 周一至周日
|
||||||
|
*/
|
||||||
|
private String avaTime;
|
||||||
|
/**
|
||||||
|
* 商品描述
|
||||||
|
* 随时退·过期自动退·到店
|
||||||
|
*/
|
||||||
|
private String proDetail="随时退·过期自动退·到店";
|
||||||
|
/**
|
||||||
|
* 商品原价/划线价
|
||||||
|
*/
|
||||||
|
private BigDecimal originPrice;
|
||||||
|
/**
|
||||||
|
* 商品现价
|
||||||
|
*/
|
||||||
|
private BigDecimal salePrice;
|
||||||
|
/**
|
||||||
|
* 优惠金额
|
||||||
|
*/
|
||||||
|
private BigDecimal save;
|
||||||
|
/**
|
||||||
|
* 优惠劵
|
||||||
|
* 暂无可用/有多少张可选择
|
||||||
|
* 字体颜色
|
||||||
|
* 背景色
|
||||||
|
*/
|
||||||
|
private TagVo couponDetail;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -25,7 +25,7 @@ public class ProductInfoVo {
|
||||||
/**
|
/**
|
||||||
* 折扣
|
* 折扣
|
||||||
*/
|
*/
|
||||||
private Float discount;
|
private BigDecimal discount;
|
||||||
/**
|
/**
|
||||||
* 原价
|
* 原价
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
@ -7,6 +8,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class ProductVo {
|
public class ProductVo {
|
||||||
//选几个
|
//选几个
|
||||||
private Integer number;
|
private Integer number;
|
||||||
|
|
@ -15,13 +17,14 @@ public class ProductVo {
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
//食物
|
//食物
|
||||||
private List<Food> foods=new ArrayList<>(); // 食品列表
|
private List<Food> goods=new ArrayList<>(); // 食品列表
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public static class Food {
|
public static class Food {
|
||||||
private String name; // 商品名称
|
private String name; // 商品名称
|
||||||
private BigDecimal price; // 售价
|
private BigDecimal lowPrice; // 售价
|
||||||
private String unit; // 单位
|
private String unitName; // 单位
|
||||||
/**
|
/**
|
||||||
* 商品标签
|
* 商品标签
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ww
|
||||||
|
* 店铺团购卷vo
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ShopGroupInfoVo {
|
||||||
|
private Integer shopId;
|
||||||
|
|
||||||
|
private String shopName;
|
||||||
|
|
||||||
|
private String shopImg;
|
||||||
|
|
||||||
|
private String shopTag;
|
||||||
|
private String lat;
|
||||||
|
private String lng;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private Integer proId;
|
||||||
|
|
||||||
|
private String proName;
|
||||||
|
|
||||||
|
private String proImg;
|
||||||
|
//销量
|
||||||
|
private Integer number;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -16,6 +16,10 @@ public class SubShopVo{
|
||||||
* 连锁店扩展名
|
* 连锁店扩展名
|
||||||
*/
|
*/
|
||||||
private String chainName;
|
private String chainName;
|
||||||
|
/**
|
||||||
|
* 手机号
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
/**
|
/**
|
||||||
* Logo图
|
* Logo图
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改密码的 Vo 类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UserPassVo {
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
private String oldPass;
|
||||||
|
|
||||||
|
private String newPass;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,139 @@
|
||||||
|
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.entity.*;
|
||||||
|
import com.chaozhanggui.system.cashierservice.dao.TbGroupOrderInfoMapper;
|
||||||
|
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.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.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class GroupOrderInfoService{
|
||||||
|
@Autowired
|
||||||
|
private TbShopInfoMapper shopInfoMapper;
|
||||||
|
@Autowired
|
||||||
|
private TbProductMapper tbProductMapper;
|
||||||
|
@Resource
|
||||||
|
private TbGroupOrderInfoMapper tbGroupOrderInfoMapper;
|
||||||
|
@Resource
|
||||||
|
private TbPurchaseNoticeMapper noticeMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过ID查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Result queryById(Integer id,String lng,String lat) {
|
||||||
|
TbGroupOrderInfo groupOrder = tbGroupOrderInfoMapper.queryById(id);
|
||||||
|
GroupOrderDetailsVo result=new GroupOrderDetailsVo();
|
||||||
|
result.setProName(groupOrder.getProName());
|
||||||
|
result.setProImg(groupOrder.getProImg());
|
||||||
|
TbPurchaseNotice tbPurchaseNotice = noticeMapper.queryByCouponId(groupOrder.getProId());
|
||||||
|
result.setAvaTime(tbPurchaseNotice.getAvailableTime()+" | 到店吃");
|
||||||
|
// result.setProDetail();
|
||||||
|
result.setOrderAmount(groupOrder.getOrderAmount());
|
||||||
|
|
||||||
|
result.setExpDate(groupOrder.getNumber()+"张可用 | "+ 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);
|
||||||
|
|
||||||
|
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(groupOrder.getShopId());
|
||||||
|
result.setShopName(shopInfo.getShopName());
|
||||||
|
BigDecimal distance = LocationUtils.getDistanceFrom2LngLat(
|
||||||
|
Double.parseDouble(lng), Double.parseDouble(lat),
|
||||||
|
Double.parseDouble(shopInfo.getLng()), Double.parseDouble(shopInfo.getLat()));
|
||||||
|
result.setDistances(distance.toString());
|
||||||
|
result.setAddress(shopInfo.getAddress());
|
||||||
|
result.setShopPhone(shopInfo.getPhone());
|
||||||
|
|
||||||
|
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()));
|
||||||
|
result.setNumber(groupOrder.getNumber());
|
||||||
|
result.setPayAmount(groupOrder.getPayAmount());
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*
|
||||||
|
* @param tbGroupOrderInfo 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Result insert(TbGroupOrderInfo tbGroupOrderInfo) {
|
||||||
|
int insert = tbGroupOrderInfoMapper.insert(tbGroupOrderInfo);
|
||||||
|
if(insert>0){
|
||||||
|
return new Result(CodeEnum.SUCCESS);
|
||||||
|
}else {
|
||||||
|
return new Result(CodeEnum.FAIL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*
|
||||||
|
* @param tbGroupOrderInfo 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Result update(TbGroupOrderInfo tbGroupOrderInfo) {
|
||||||
|
int update = tbGroupOrderInfoMapper.update(tbGroupOrderInfo);
|
||||||
|
if(update>0){
|
||||||
|
return new Result(CodeEnum.SUCCESS);
|
||||||
|
}else {
|
||||||
|
return new Result(CodeEnum.FAIL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
|
||||||
|
public boolean deleteById(Integer id) {
|
||||||
|
return this.tbGroupOrderInfoMapper.deleteById(id) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -20,9 +20,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.bind.annotation.RequestHeader;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -43,47 +43,16 @@ public class HomeDistrictService {
|
||||||
@Resource
|
@Resource
|
||||||
private SysDictDetailMapper sysDictDetailMapper;
|
private SysDictDetailMapper sysDictDetailMapper;
|
||||||
|
|
||||||
public Result queryShopListByPage(HomeBaseDto param, String environment) {
|
public Result topCommon(HomeDto param, String environment){
|
||||||
PageHelper.startPage(param.getPage(), param.getSize());
|
CommonVo result = new CommonVo();
|
||||||
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType("subShop", environment);
|
String type = param.getType();
|
||||||
|
//预约到店
|
||||||
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],//108.88884915269998
|
|
||||||
topAndBottomMap.get("leftBottomPoint")[0],//34.288450262190516
|
|
||||||
param.getAddress(), param.getLng(), param.getLat());//西安市
|
|
||||||
for (SubShopVo subShopVo : subShopVos) {//距离计算
|
|
||||||
if (StringUtils.isNotBlank(subShopVo.getLat()) && StringUtils.isNotBlank(subShopVo.getLng())) {
|
|
||||||
double distance = LocationUtils.getDistanceFrom2LngLat(
|
|
||||||
Double.parseDouble(param.getLng()), Double.parseDouble(param.getLat()),
|
|
||||||
Double.parseDouble(subShopVo.getLng()), Double.parseDouble(subShopVo.getLat()));
|
|
||||||
subShopVo.setDistances(Double.toString(distance));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CommonPageVo result = new CommonPageVo();
|
|
||||||
PageInfo pageInfo = new PageInfo();
|
|
||||||
pageInfo.setList(subShopVos);
|
|
||||||
result.setResult(pageInfo);
|
|
||||||
|
|
||||||
result.setCarousel(JSONUtil.parseListTNewList(carouselList, HomeCarouselVo.class));
|
|
||||||
result.setTitle("预约到店");
|
|
||||||
return Result.success(CodeEnum.SUCCESS, result);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通用商品页
|
|
||||||
*/
|
|
||||||
public Result proList(HomeDto param, String environment) throws ExecutionException, InterruptedException {
|
|
||||||
CommonPageVo result = new CommonPageVo();
|
|
||||||
// title + 顶部图
|
|
||||||
if (StringUtils.isNotBlank(param.getType())) {
|
if (StringUtils.isNotBlank(param.getType())) {
|
||||||
|
if(type.equals("subShop")){
|
||||||
|
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType(type,environment);
|
||||||
|
result.setCarousel(JSONUtil.parseListTNewList(carouselList, HomeCarouselVo.class));
|
||||||
|
result.setTitle(carouselList.get(0).getName());
|
||||||
|
}else {//商品分类页
|
||||||
TbCouponCategory tbCouponCategory = couponCategoryMapper.queryById(Integer.valueOf(param.getType()));
|
TbCouponCategory tbCouponCategory = couponCategoryMapper.queryById(Integer.valueOf(param.getType()));
|
||||||
result.setTitle(tbCouponCategory.getName());
|
result.setTitle(tbCouponCategory.getName());
|
||||||
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType(param.getType(), environment);
|
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType(param.getType(), environment);
|
||||||
|
|
@ -102,6 +71,7 @@ public class HomeDistrictService {
|
||||||
dicDetailVO.add(dicDetailVOList);
|
dicDetailVO.add(dicDetailVOList);
|
||||||
}
|
}
|
||||||
result.setMenu(dicDetailVO);
|
result.setMenu(dicDetailVO);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (param.getOrderBy() != null) {
|
if (param.getOrderBy() != null) {
|
||||||
if (param.getOrderBy() == 0) {
|
if (param.getOrderBy() == 0) {
|
||||||
|
|
@ -130,12 +100,40 @@ public class HomeDistrictService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<HomeVO> products = productService.products(param);
|
|
||||||
|
|
||||||
PageInfo pageInfo = new PageInfo();
|
|
||||||
pageInfo.setList(products);
|
|
||||||
result.setResult(pageInfo);
|
|
||||||
return Result.success(CodeEnum.SUCCESS, result);
|
return Result.success(CodeEnum.SUCCESS, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Result queryShopListByPage(HomeBaseDto param) {
|
||||||
|
PageHelper.startPage(param.getPage(), param.getSize());
|
||||||
|
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());//西安市
|
||||||
|
for (SubShopVo subShopVo : subShopVos) {//距离计算
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PageInfo pageInfo = new PageInfo();
|
||||||
|
pageInfo.setList(subShopVos);
|
||||||
|
return Result.success(CodeEnum.SUCCESS, pageInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用商品页
|
||||||
|
*/
|
||||||
|
public Result proList(HomeDto param) throws ExecutionException, InterruptedException {
|
||||||
|
PageInfo products = productService.products(param);
|
||||||
|
return Result.success(CodeEnum.SUCCESS, products);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,30 @@
|
||||||
package com.chaozhanggui.system.cashierservice.service;
|
package com.chaozhanggui.system.cashierservice.service;
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
import com.chaozhanggui.system.cashierservice.dao.SysDictDetailMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
import com.chaozhanggui.system.cashierservice.dao.TbPlatformDictMapper;
|
||||||
|
import com.chaozhanggui.system.cashierservice.dao.TbProductSkuMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.Enum.LogoEnum;
|
import com.chaozhanggui.system.cashierservice.entity.Enum.LogoEnum;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.SysDict;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
|
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.vo.*;
|
import com.chaozhanggui.system.cashierservice.entity.vo.*;
|
||||||
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import com.chaozhanggui.system.cashierservice.util.*;
|
|
||||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
|
||||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.util.Threads;
|
import com.chaozhanggui.system.cashierservice.util.RandomUtil;
|
||||||
|
import com.chaozhanggui.system.cashierservice.util.StringUtil;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lyf
|
* @author lyf
|
||||||
|
|
@ -100,8 +100,8 @@ public class HomePageService {
|
||||||
/**
|
/**
|
||||||
* 商品列表
|
* 商品列表
|
||||||
*/
|
*/
|
||||||
public Result proList(HomeDto homeDto, String environmen) throws ExecutionException, InterruptedException {
|
public Result proList(HomeDto homeDto) throws ExecutionException, InterruptedException {
|
||||||
List<HomeVO> products = productService.products(homeDto);
|
PageInfo products = productService.products(homeDto);
|
||||||
return Result.success(CodeEnum.SUCCESS, products);
|
return Result.success(CodeEnum.SUCCESS, products);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -255,6 +255,18 @@ public class LoginService {
|
||||||
return Result.success(CodeEnum.ENCRYPT, tbUserInfo);
|
return Result.success(CodeEnum.ENCRYPT, tbUserInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Result upPass(String userId,String oldPass,String newPass) {
|
||||||
|
TbUserInfo tbUserInfo = tbUserInfoMapper.selectByPrimaryKey(Integer.valueOf(userId));
|
||||||
|
if(!tbUserInfo.getPassword().equals(oldPass)){
|
||||||
|
return Result.success(CodeEnum.FAIL_OLDPASS);
|
||||||
|
}
|
||||||
|
if(tbUserInfo.getPassword().equals(newPass)){
|
||||||
|
return Result.success(CodeEnum.FAIL_NEWPASS);
|
||||||
|
}
|
||||||
|
tbUserInfo.setPassword(newPass);
|
||||||
|
return upUserInfo(tbUserInfo);
|
||||||
|
}
|
||||||
|
|
||||||
public Result upUserInfo(TbUserInfo userInfo) {
|
public Result upUserInfo(TbUserInfo userInfo) {
|
||||||
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
|
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
|
||||||
return Result.success(CodeEnum.SUCCESS);
|
return Result.success(CodeEnum.SUCCESS);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.chaozhanggui.system.cashierservice.service;
|
package com.chaozhanggui.system.cashierservice.service;
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
|
@ -16,6 +15,7 @@ import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.util.LocationUtils;
|
import com.chaozhanggui.system.cashierservice.util.LocationUtils;
|
||||||
import com.chaozhanggui.system.cashierservice.util.Threads;
|
import com.chaozhanggui.system.cashierservice.util.Threads;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -53,8 +53,6 @@ public class ProductService {
|
||||||
@Resource
|
@Resource
|
||||||
private TagProductDeptsMapper tagProductDeptsMapper;
|
private TagProductDeptsMapper tagProductDeptsMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private TbMerchantCouponMapper merchantCouponMapper;
|
|
||||||
@Resource
|
|
||||||
private TbPlatformDictMapper platformDictMapper;
|
private TbPlatformDictMapper platformDictMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private TbShopUnitMapper unitMapper;
|
private TbShopUnitMapper unitMapper;
|
||||||
|
|
@ -144,101 +142,81 @@ public class ProductService {
|
||||||
* 销量榜
|
* 销量榜
|
||||||
* 咖啡饮品
|
* 咖啡饮品
|
||||||
*/
|
*/
|
||||||
public List<HomeVO> products(HomeDto homeDto) throws ExecutionException, InterruptedException {
|
public PageInfo products(HomeDto homeDto) throws ExecutionException, InterruptedException {
|
||||||
PageHelper.startPage(homeDto.getPage(), homeDto.getSize());
|
PageHelper.startPage(homeDto.getPage(), homeDto.getSize());
|
||||||
|
|
||||||
//经纬度(附近一km)
|
//经纬度(附近一km)
|
||||||
Map<String, double[]> topAndBottomMap = LocationUtils.returnLLSquarePoint(
|
Map<String, double[]> topAndBottomMap = LocationUtils.returnLLSquarePoint(
|
||||||
Double.parseDouble(homeDto.getLng()), Double.parseDouble(homeDto.getLat()), homeDto.getDistanceInKm());
|
Double.parseDouble(homeDto.getLng()), Double.parseDouble(homeDto.getLat()), homeDto.getDistanceInKm());
|
||||||
List<CouAndShopVo> tbMerchantCoupons = merchantCouponMapper.queryAllByPage(
|
|
||||||
|
List<ShopGroupInfoVo> shopGroupInfoVos = tbProductMapper.selGroups(
|
||||||
homeDto.getType(),
|
homeDto.getType(),
|
||||||
topAndBottomMap.get("rightTopPoint")[1], topAndBottomMap.get("rightTopPoint")[0],
|
topAndBottomMap.get("rightTopPoint")[1], topAndBottomMap.get("rightTopPoint")[0],
|
||||||
topAndBottomMap.get("leftBottomPoint")[1], topAndBottomMap.get("leftBottomPoint")[0],
|
topAndBottomMap.get("leftBottomPoint")[1], topAndBottomMap.get("leftBottomPoint")[0],
|
||||||
homeDto.getAddress(), homeDto.getOrderBy().toString(), homeDto.getLng(), homeDto.getLat());
|
homeDto.getAddress(), homeDto.getOrderBy().toString(), homeDto.getLng(), homeDto.getLat());
|
||||||
|
List<Integer> productIds = shopGroupInfoVos.stream().map(ShopGroupInfoVo::getProId).collect(Collectors.toList());
|
||||||
|
List<String> stringList = productIds.stream()
|
||||||
//统计shopId,以及productId
|
.map(Object::toString) // 将 Integer 对象映射为 String 对象
|
||||||
List<String> shopIds = new ArrayList<>();
|
.collect(Collectors.toList());
|
||||||
List<String> productIds = new ArrayList<>();
|
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectSkus(stringList);
|
||||||
List<Integer> productIdsInt = new ArrayList<>();
|
List<TagProductVO> dictPro = tagProductDeptsMapper.queryTagAndProduct(productIds);
|
||||||
for (CouAndShopVo coupon : tbMerchantCoupons) {
|
|
||||||
shopIds.add(coupon.getShopId());
|
|
||||||
productIds.add(coupon.getRelationIds());
|
|
||||||
productIdsInt.add(Integer.valueOf(coupon.getRelationIds()));
|
|
||||||
}
|
|
||||||
CompletableFuture<List<TbShopInfo>> shopInfo = CompletableFuture.supplyAsync(() ->
|
|
||||||
tbShopInfoMapper.selectByIds(shopIds));
|
|
||||||
CompletableFuture<List<TbProduct>> product = CompletableFuture.supplyAsync(() ->
|
|
||||||
tbProductMapper.selectByIds((productIds)));
|
|
||||||
CompletableFuture<List<TbProductSku>> productSku = CompletableFuture.supplyAsync(() ->
|
|
||||||
tbProductSkuMapper.selectSkus((productIds)));
|
|
||||||
CompletableFuture<List<TagProductVO>> dictPro = CompletableFuture.supplyAsync(() ->
|
|
||||||
tagProductDeptsMapper.queryTagAndProduct(productIdsInt));
|
|
||||||
Threads.call(shopInfo, product, productSku, dictPro);
|
|
||||||
|
|
||||||
//组装
|
//组装
|
||||||
List<HomeVO> homeVOList = new ArrayList<>();
|
List<HomeVO> homeVOList = new ArrayList<>();
|
||||||
for (CouAndShopVo o : tbMerchantCoupons) {
|
for (ShopGroupInfoVo o : shopGroupInfoVos) {
|
||||||
HomeVO homeVO = new HomeVO();
|
HomeVO homeVO = new HomeVO();
|
||||||
homeVO.setId(o.getId());
|
homeVO.setId(o.getProId());
|
||||||
for (TbShopInfo tbShopInfo : shopInfo.get()) {
|
homeVO.setShopName(o.getShopName());
|
||||||
if (o.getShopId().equals(tbShopInfo.getId().toString())) {
|
homeVO.setShopImage(o.getShopImg());
|
||||||
homeVO.setShopName(tbShopInfo.getShopName());
|
if (StringUtils.isBlank(o.getShopTag())) {
|
||||||
homeVO.setImage(tbShopInfo.getLogo());
|
|
||||||
if (StringUtils.isBlank(tbShopInfo.getTag())) {
|
|
||||||
homeVO.setShopTag(new ArrayList<>());
|
homeVO.setShopTag(new ArrayList<>());
|
||||||
} else {
|
} else {
|
||||||
List<Integer> shopTagIds = Arrays.stream(tbShopInfo.getTag().split(","))
|
List<Integer> shopTagIds = Arrays.stream(o.getShopTag().split(","))
|
||||||
.map(Integer::parseInt)
|
.map(Integer::parseInt)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
List<TbPlatformDict> tbPlatformDicts = platformDictMapper.queryByIdList(shopTagIds);
|
List<TbPlatformDict> tbPlatformDicts = platformDictMapper.queryByIdList(shopTagIds);
|
||||||
homeVO.setShopTag(JSONUtil.parseListTNewList(tbPlatformDicts, TagVo.class));
|
homeVO.setShopTag(JSONUtil.parseListTNewList(tbPlatformDicts, TagVo.class));
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(tbShopInfo.getLat()) && StringUtils.isNotBlank(tbShopInfo.getLng())) {
|
if (StringUtils.isNotBlank(o.getLat()) && StringUtils.isNotBlank(o.getLng())) {
|
||||||
double distance = LocationUtils.getDistanceFrom2LngLat(
|
BigDecimal distance = LocationUtils.getDistanceFrom2LngLat(
|
||||||
Double.parseDouble(homeDto.getLng()), Double.parseDouble(homeDto.getLat()),
|
Double.parseDouble(homeDto.getLng()), Double.parseDouble(homeDto.getLat()),
|
||||||
Double.parseDouble(tbShopInfo.getLng()), Double.parseDouble(tbShopInfo.getLat()));
|
Double.parseDouble(o.getLng()), Double.parseDouble(o.getLat()));
|
||||||
homeVO.setDistances(Double.toString(distance));
|
homeVO.setDistances(distance.toString());
|
||||||
}
|
}
|
||||||
|
homeVO.setProductName(o.getProName());
|
||||||
|
homeVO.setImage(o.getProImg());
|
||||||
|
for (TagProductVO tagProductVO : dictPro) {
|
||||||
|
if (o.getProId().toString().equals(tagProductVO.getProductId().toString())) {
|
||||||
|
homeVO.getProTag().add(tagProductVO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (TbProduct tbProduct : product.get()) {
|
for (TbProductSku tbProductSku : tbProductSkus) {
|
||||||
if (o.getRelationIds().equals(tbProduct.getId().toString())) {
|
if (o.getProId().toString().equals(tbProductSku.getProductId())) {
|
||||||
homeVO.setProductName(o.getTitle());
|
|
||||||
homeVO.setImage(tbProduct.getCoverImg());
|
|
||||||
homeVO.setProductId(tbProduct.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (TbProductSku tbProductSku : productSku.get()) {
|
|
||||||
if (o.getRelationIds().equals(tbProductSku.getProductId())) {
|
|
||||||
//原价
|
//原价
|
||||||
if (tbProductSku.getSalePrice().compareTo(BigDecimal.ZERO) == 0) {
|
if (tbProductSku.getOriginPrice().compareTo(BigDecimal.ZERO) == 0) {
|
||||||
homeVO.setOriginPrice(BigDecimal.ZERO);
|
homeVO.setOriginPrice(BigDecimal.ZERO);
|
||||||
homeVO.setDiscount(BigDecimal.ZERO);
|
homeVO.setDiscount(BigDecimal.ZERO);
|
||||||
} else {
|
} else {
|
||||||
homeVO.setOriginPrice(tbProductSku.getSalePrice());
|
homeVO.setOriginPrice(tbProductSku.getOriginPrice());
|
||||||
homeVO.setDiscount(new BigDecimal(o.getAmount()).divide(tbProductSku.getSalePrice(), 2, RoundingMode.DOWN).multiply(BigDecimal.TEN));
|
homeVO.setDiscount(tbProductSku.getOriginPrice().divide(tbProductSku.getSalePrice(), 2, RoundingMode.DOWN).multiply(BigDecimal.TEN));
|
||||||
}
|
}
|
||||||
//销量
|
//销量
|
||||||
homeVO.setRealSalesNumber(new BigDecimal(o.getNumber()));
|
homeVO.setRealSalesNumber(new BigDecimal(o.getNumber()));
|
||||||
//现价
|
//现价
|
||||||
homeVO.setSalePrice(new BigDecimal(o.getAmount().toString()));
|
homeVO.setSalePrice(new BigDecimal(tbProductSku.getSalePrice().toString()));
|
||||||
// 共省金额
|
// 共省金额
|
||||||
homeVO.setSave(homeVO.getOriginPrice().subtract(homeVO.getSalePrice()));
|
homeVO.setSave(homeVO.getOriginPrice().subtract(homeVO.getSalePrice()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (TagProductVO tagProductVO : dictPro.get()) {
|
|
||||||
if (o.getRelationIds().equals(tagProductVO.getProductId().toString())) {
|
|
||||||
homeVO.getProTag().add(tagProductVO);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
homeVO.setEndTime(DateUtils.getDayEndLong());
|
homeVO.setEndTime(DateUtils.getDayEndLong());
|
||||||
homeVOList.add(homeVO);
|
homeVOList.add(homeVO);
|
||||||
}
|
}
|
||||||
return homeVOList;
|
PageInfo pageInfo = new PageInfo<>(shopGroupInfoVos);
|
||||||
|
pageInfo.setList(homeVOList);
|
||||||
|
|
||||||
|
return pageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 团购卷详情
|
* 团购卷详情
|
||||||
*
|
*
|
||||||
|
|
@ -246,47 +224,53 @@ public class ProductService {
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public Result productInfo(Integer productId,String environment) throws Exception {
|
public Result productInfo(Integer productId, String lat, String lng, String environment) throws Exception {
|
||||||
TbMerchantCoupon tbMerchantCoupon = merchantCouponMapper.queryById(productId);
|
|
||||||
|
|
||||||
CompletableFuture<TbShopInfo> shopInfo = CompletableFuture.supplyAsync(() ->
|
|
||||||
tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(tbMerchantCoupon.getShopId())));
|
|
||||||
CompletableFuture<TbProduct> product = CompletableFuture.supplyAsync(() ->
|
CompletableFuture<TbProduct> product = CompletableFuture.supplyAsync(() ->
|
||||||
tbProductMapper.selectById(Integer.valueOf(tbMerchantCoupon.getRelationIds())));
|
tbProductMapper.selectById(productId));
|
||||||
CompletableFuture<List<TbProductSku>> productSku = CompletableFuture.supplyAsync(() ->
|
CompletableFuture<List<TbProductSku>> productSku = CompletableFuture.supplyAsync(() ->
|
||||||
tbProductSkuMapper.selectSku(tbMerchantCoupon.getRelationIds()));
|
tbProductSkuMapper.selectSku(productId.toString()));
|
||||||
CompletableFuture<List<TagProductVO>> dictPro = CompletableFuture.supplyAsync(() ->
|
CompletableFuture<List<TagProductVO>> dictPro = CompletableFuture.supplyAsync(() ->
|
||||||
tagProductDeptsMapper.queryTagByProductId(tbMerchantCoupon.getRelationIds()));
|
tagProductDeptsMapper.queryTagByProductId(productId.toString()));
|
||||||
CompletableFuture<TbPurchaseNotice> purchaseNotice = CompletableFuture.supplyAsync(() ->
|
Threads.call(product, productSku, dictPro);
|
||||||
purchaseNoticeMapper.queryByCouponId(tbMerchantCoupon.getId()));
|
|
||||||
Threads.call(shopInfo, product, productSku, dictPro);
|
TbProduct tbProduct = product.get();
|
||||||
|
TbShopInfo tbShopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(tbProduct.getShopId()));
|
||||||
|
TbPurchaseNotice tbPurchaseNotice = purchaseNoticeMapper.queryByCouponId(tbProduct.getId());
|
||||||
|
|
||||||
|
|
||||||
ProductInfoVo productInfo = new ProductInfoVo();
|
ProductInfoVo productInfo = new ProductInfoVo();
|
||||||
// 图片组装
|
// 图片组装
|
||||||
TbProduct tbProduct = product.get();
|
|
||||||
TbShopInfo tbShopInfo = shopInfo.get();
|
|
||||||
if (StringUtils.isNotBlank(tbProduct.getImages())) {
|
if (StringUtils.isNotBlank(tbProduct.getImages())) {
|
||||||
productInfo.setImages(JSON.parseArray(tbProduct.getImages()));
|
productInfo.setImages(JSON.parseArray(tbProduct.getImages()));
|
||||||
} else {
|
} else {
|
||||||
productInfo.setImages(new JSONArray());
|
productInfo.setImages(new JSONArray());
|
||||||
}
|
}
|
||||||
//折扣
|
|
||||||
productInfo.setDiscount(tbMerchantCoupon.getRatio());
|
|
||||||
//价格组装
|
//价格组装
|
||||||
for (TbProductSku tbProductSku : productSku.get()) {
|
for (TbProductSku tbProductSku : productSku.get()) {
|
||||||
|
//原价
|
||||||
|
if (tbProductSku.getSalePrice().compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
productInfo.setOriginPrice(BigDecimal.ZERO);
|
||||||
|
productInfo.setDiscount(BigDecimal.ZERO);
|
||||||
|
} else {
|
||||||
productInfo.setOriginPrice(tbProductSku.getSalePrice());
|
productInfo.setOriginPrice(tbProductSku.getSalePrice());
|
||||||
productInfo.setRealSalesNumber(tbProductSku.getRealSalesNumber() == null ? BigDecimal.ZERO : new BigDecimal(tbProductSku.getRealSalesNumber()));
|
productInfo.setDiscount(tbProductSku.getOriginPrice().divide(tbProductSku.getSalePrice(), 2, RoundingMode.DOWN).multiply(BigDecimal.TEN));
|
||||||
Float discount = productInfo.getDiscount();
|
|
||||||
BigDecimal discountDecimal = new BigDecimal(discount);
|
|
||||||
productInfo.setSalePrice(tbProductSku.getSalePrice().multiply((discountDecimal.multiply(new BigDecimal("0.1")))));
|
|
||||||
}
|
}
|
||||||
|
//现价
|
||||||
|
productInfo.setSalePrice(new BigDecimal(tbProductSku.getSalePrice().toString()));
|
||||||
|
}
|
||||||
|
//销量
|
||||||
|
productInfo.setRealSalesNumber(new BigDecimal(tbProduct.getRealSalesNumber()));
|
||||||
//名称
|
//名称
|
||||||
productInfo.setProductName(tbProduct.getName());
|
productInfo.setProductName(tbProduct.getName());
|
||||||
//店铺
|
//店铺
|
||||||
productInfo.setShopName(tbShopInfo.getShopName() + (StringUtils.isNotBlank(tbShopInfo.getChainName()) ? "(" + tbShopInfo.getChainName() + ")" : ""));
|
productInfo.setShopName(tbShopInfo.getShopName() + (StringUtils.isNotBlank(tbShopInfo.getChainName()) ? "(" + tbShopInfo.getChainName() + ")" : ""));
|
||||||
productInfo.setPhone(tbShopInfo.getPhone());
|
productInfo.setPhone(tbShopInfo.getPhone());
|
||||||
productInfo.setBusinessTime(tbShopInfo.getBusinessTime());
|
productInfo.setBusinessTime(tbShopInfo.getBusinessTime());
|
||||||
// productInfo.setDistances();//距离
|
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());
|
productInfo.setAddress(tbShopInfo.getAddress());
|
||||||
|
|
||||||
//商品 暂时只做单商品
|
//商品 暂时只做单商品
|
||||||
|
|
@ -297,23 +281,61 @@ public class ProductService {
|
||||||
productVo.setNumber(1);
|
productVo.setNumber(1);
|
||||||
ProductVo.Food food = new ProductVo.Food();
|
ProductVo.Food food = new ProductVo.Food();
|
||||||
food.setName(tbProduct.getName());
|
food.setName(tbProduct.getName());
|
||||||
food.setUnit(tbShopUnit.getName());
|
food.setUnitName(tbShopUnit.getName());
|
||||||
food.setPrice(tbProduct.getLowPrice());
|
food.setLowPrice(tbProduct.getLowPrice());
|
||||||
|
|
||||||
for (TagProductVO tagProductVO : dictPro.get()) {
|
for (TagProductVO tagProductVO : dictPro.get()) {
|
||||||
food.getProTag().add(tagProductVO);
|
food.getProTag().add(tagProductVO);
|
||||||
}
|
}
|
||||||
productVo.getFoods().add(food);
|
productVo.getGoods().add(food);
|
||||||
productInfo.getProductList().add(productVo);
|
productInfo.getProductList().add(productVo);
|
||||||
TbPurchaseNotice tbPurchaseNotice = purchaseNotice.get();
|
|
||||||
productInfo.setPurchaseNotice(tbPurchaseNotice);
|
productInfo.setPurchaseNotice(tbPurchaseNotice);
|
||||||
List<TbPlatformDict> tbPlatformDicts = platformDictMapper.queryAllByType("prodetail", environment);
|
List<TbPlatformDict> tbPlatformDicts = platformDictMapper.queryAllByType("prodetail", environment);
|
||||||
if(tbPurchaseNotice.getBookingType().startsWith("无需预约")){
|
if (tbPurchaseNotice != null) {
|
||||||
|
if (tbPurchaseNotice.getBookingType().startsWith("无需预约")) {
|
||||||
List<TbPlatformDict> book = platformDictMapper.queryAllByType("prodetail-book", environment);
|
List<TbPlatformDict> book = platformDictMapper.queryAllByType("prodetail-book", environment);
|
||||||
tbPlatformDicts.addAll(book);
|
tbPlatformDicts.addAll(book);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
productInfo.setNoticeTag(JSONUtil.parseListTNewList(tbPlatformDicts, TagVo.class));
|
productInfo.setNoticeTag(JSONUtil.parseListTNewList(tbPlatformDicts, TagVo.class));
|
||||||
|
|
||||||
return Result.success(CodeEnum.SUCCESS, productInfo);
|
return Result.success(CodeEnum.SUCCESS, productInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单确认页
|
||||||
|
*/
|
||||||
|
public Result orderConfirm(Integer productId, String environment) throws Exception {
|
||||||
|
CompletableFuture<TbProduct> product = CompletableFuture.supplyAsync(() ->
|
||||||
|
tbProductMapper.selectById(productId));
|
||||||
|
CompletableFuture<List<TbProductSku>> productSku = CompletableFuture.supplyAsync(() ->
|
||||||
|
tbProductSkuMapper.selectSku(productId.toString()));
|
||||||
|
CompletableFuture<TbPurchaseNotice> notice = CompletableFuture.supplyAsync(() ->
|
||||||
|
purchaseNoticeMapper.queryByCouponId(productId));
|
||||||
|
Threads.call(product, productSku,notice);
|
||||||
|
|
||||||
|
TbProduct tbProduct = product.get();
|
||||||
|
OrderConfirmVo confirmVo=new OrderConfirmVo();
|
||||||
|
confirmVo.setProImg(tbProduct.getCoverImg());
|
||||||
|
confirmVo.setProName(tbProduct.getName());
|
||||||
|
|
||||||
|
TbPurchaseNotice tbPurchaseNotice = notice.get();
|
||||||
|
confirmVo.setAvaTime(tbPurchaseNotice.getAvailableTime());
|
||||||
|
|
||||||
|
//价格组装
|
||||||
|
for (TbProductSku tbProductSku : productSku.get()) {
|
||||||
|
//原价
|
||||||
|
if (tbProductSku.getOriginPrice().compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
confirmVo.setOriginPrice(BigDecimal.ZERO);
|
||||||
|
confirmVo.setSave(tbProductSku.getSalePrice());
|
||||||
|
} else {
|
||||||
|
confirmVo.setOriginPrice(tbProductSku.getOriginPrice());
|
||||||
|
confirmVo.setSave(tbProductSku.getSalePrice());
|
||||||
|
}
|
||||||
|
//现价=售价
|
||||||
|
confirmVo.setSalePrice(tbProductSku.getSalePrice().subtract(tbProductSku.getOriginPrice()));
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import javax.annotation.Resource;
|
||||||
* @author ww
|
* @author ww
|
||||||
* @since 2024-04-12 14:50:10
|
* @since 2024-04-12 14:50:10
|
||||||
*/
|
*/
|
||||||
public class TbShopVideoService {
|
public class ShopVideoService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private TbShopVideoMapper tbShopVideoMapper;
|
private TbShopVideoMapper tbShopVideoMapper;
|
||||||
|
|
@ -8,7 +8,9 @@ public enum CodeEnum {
|
||||||
UPGRADE_REQUIRED("426",false,"成功","success"),
|
UPGRADE_REQUIRED("426",false,"成功","success"),
|
||||||
ENCRYPT("0",true,"成功","success"),
|
ENCRYPT("0",true,"成功","success"),
|
||||||
FAIL("1",false,"失败","fail"),
|
FAIL("1",false,"失败","fail"),
|
||||||
TOKEN_EXEIST("-2",false,"token不能为空","fail"),
|
FAIL_OLDPASS("1",false,"修改失败,旧密码错误","fail"),
|
||||||
|
FAIL_NEWPASS("1",false,"新密码不能与旧密码相同","fail"),
|
||||||
|
TOKEN_EXEIST("-4",false,"token不能为空","fail"),
|
||||||
TOKEN_EXPIRED("-4",false,"账号已过期,请重新登陆","fail"),
|
TOKEN_EXPIRED("-4",false,"账号已过期,请重新登陆","fail"),
|
||||||
SIGN_FAIL("100013",false,"签名不正确","fail"),
|
SIGN_FAIL("100013",false,"签名不正确","fail"),
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ public class DateUtils {
|
||||||
private final static SimpleDateFormat sdfDay = new SimpleDateFormat("yyyy-MM-dd");
|
private final static SimpleDateFormat sdfDay = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
private final static SimpleDateFormat sdfDays = new SimpleDateFormat("yyyyMMdd");
|
private final static SimpleDateFormat sdfDays = new SimpleDateFormat("yyyyMMdd");
|
||||||
private final static SimpleDateFormat sdfTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
private final static SimpleDateFormat sdfTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
private final static SimpleDateFormat sdfTimeM = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||||
private final static SimpleDateFormat sdfTimeSS = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
private final static SimpleDateFormat sdfTimeSS = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
private final static SimpleDateFormat sdfTimes = new SimpleDateFormat("yyyyMMddHHmmss");
|
private final static SimpleDateFormat sdfTimes = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||||
|
|
||||||
|
|
@ -59,6 +60,9 @@ public class DateUtils {
|
||||||
public static String getTimes(Date date){
|
public static String getTimes(Date date){
|
||||||
return sdfday.format(date);
|
return sdfday.format(date);
|
||||||
}
|
}
|
||||||
|
public static String getTimeM(Date date){
|
||||||
|
return sdfTimeM.format(date);
|
||||||
|
}
|
||||||
public static String getSdfDayTimes(Date date){
|
public static String getSdfDayTimes(Date date){
|
||||||
return sdfDay.format(date);
|
return sdfDay.format(date);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -193,6 +193,17 @@ public class JSONUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> List<T> parseListTNewList(String json, Class<T> clazz) {
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper(); // 创建JSON转换器
|
||||||
|
try {
|
||||||
|
// 将JSON字符串转换为List<T>
|
||||||
|
return objectMapper.readValue(json, objectMapper.getTypeFactory().constructCollectionType(List.class, clazz));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class JSONEntity {
|
public static class JSONEntity {
|
||||||
public JSONEntity() {
|
public JSONEntity() {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.chaozhanggui.system.cashierservice.util;
|
package com.chaozhanggui.system.cashierservice.util;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -29,7 +31,7 @@ public class LocationUtils {
|
||||||
* @return 距离,单位千米(KM)
|
* @return 距离,单位千米(KM)
|
||||||
* @see <a href="https://zh.wikipedia.org/wiki/%E5%8D%8A%E6%AD%A3%E7%9F%A2%E5%85%AC%E5%BC%8F">半正矢(Haversine)公式</a>
|
* @see <a href="https://zh.wikipedia.org/wiki/%E5%8D%8A%E6%AD%A3%E7%9F%A2%E5%85%AC%E5%BC%8F">半正矢(Haversine)公式</a>
|
||||||
*/
|
*/
|
||||||
public static double getDistanceFrom2LngLat(double lng1, double lat1, double lng2, double lat2) {
|
public static BigDecimal getDistanceFrom2LngLat(double lng1, double lat1, double lng2, double lat2) {
|
||||||
//将角度转化为弧度
|
//将角度转化为弧度
|
||||||
double radLng1 = radians(lng1);//d * Math.PI / 180.0;
|
double radLng1 = radians(lng1);//d * Math.PI / 180.0;
|
||||||
double radLat1 = radians(lat1);
|
double radLat1 = radians(lat1);
|
||||||
|
|
@ -39,7 +41,10 @@ public class LocationUtils {
|
||||||
double a = radLat1 - radLat2;
|
double a = radLat1 - radLat2;
|
||||||
double b = radLng1 - radLng2;
|
double b = radLng1 - radLng2;
|
||||||
|
|
||||||
return 2 * asin(sqrt(sin(a / 2) * sin(a / 2) + cos(radLat1) * cos(radLat2) * sin(b / 2) * sin(b / 2))) * 6378.137;
|
double dis= 2 * asin(sqrt(sin(a / 2) * sin(a / 2) + cos(radLat1) * cos(radLat2) * sin(b / 2) * sin(b / 2))) * 6378.137;
|
||||||
|
BigDecimal bigDecimalValue = new BigDecimal(dis);
|
||||||
|
bigDecimalValue = bigDecimalValue.setScale(3, RoundingMode.DOWN);
|
||||||
|
return bigDecimalValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -54,28 +59,32 @@ public class LocationUtils {
|
||||||
*/
|
*/
|
||||||
public static Map<String, double[]> returnLLSquarePoint(double longitude, double latitude, double distanceInKm) {
|
public static Map<String, double[]> returnLLSquarePoint(double longitude, double latitude, double distanceInKm) {
|
||||||
Map<String, double[]> squareMap = new HashMap<>();
|
Map<String, double[]> squareMap = new HashMap<>();
|
||||||
|
BigDecimal bdlongitude = new BigDecimal(longitude);
|
||||||
// 地球平均半径,单位:千米
|
// 地球平均半径,单位:千米
|
||||||
double earthRadius = 6378.137;
|
BigDecimal earthRadius = new BigDecimal("6378.137");
|
||||||
// 将距离转换为弧度
|
// 将距离转换为弧度
|
||||||
double radialDistance = distanceInKm / earthRadius;
|
|
||||||
|
BigDecimal radialDistance = BigDecimal.valueOf(distanceInKm).divide(earthRadius, 10, RoundingMode.HALF_UP);
|
||||||
// 计算纬度上变化对应的角度
|
// 计算纬度上变化对应的角度
|
||||||
double dLatitude = Math.toDegrees(2 * Math.asin(Math.sin(radialDistance / 2) / Math.cos(Math.toRadians(latitude))));
|
BigDecimal dLatitude = BigDecimal.valueOf(Math.toDegrees(2 * Math.asin(Math.sin(radialDistance.divide(BigDecimal.valueOf(2)).doubleValue()) / Math.cos(Math.toRadians(latitude)))));
|
||||||
// 计算经度上变化对应的角度,这里需要考虑纬度对距离的影响
|
// 计算经度上变化对应的角度,这里需要考虑纬度对距离的影响
|
||||||
// 使用Haversine公式来估算在给定纬度上,距离对应的经度变化
|
// 使用Haversine公式来估算在给定纬度上,距离对应的经度变化
|
||||||
double estimatedLongitudeDistance = getDistanceFrom2LngLat(latitude, longitude, latitude, longitude + 0.01); // 假设0.01度经度变化对应的距离
|
BigDecimal estimatedLongitudeDistance = getDistanceFrom2LngLat(latitude, longitude, latitude, bdlongitude.add(BigDecimal.valueOf(0.01)).doubleValue()); // 假设0.01度经度变化对应的距离
|
||||||
double dLongitude = distanceInKm / estimatedLongitudeDistance * 0.0192736; // 根据比例计算经度变化
|
BigDecimal dLongitude = BigDecimal.valueOf(distanceInKm).divide(estimatedLongitudeDistance, 10, RoundingMode.HALF_UP).multiply(new BigDecimal("0.0192736")); // 根据比例计算经度变化
|
||||||
// 正方形四个顶点的坐标
|
// 正方形四个顶点的坐标
|
||||||
double[] rightTopPoint = {latitude + dLatitude / 2, longitude + dLongitude / 2};
|
double[] rightTopPoint = {BigDecimal.valueOf(latitude).add(dLatitude.divide(BigDecimal.valueOf(2))).doubleValue(), BigDecimal.valueOf(longitude).add(dLongitude.divide(BigDecimal.valueOf(2))).doubleValue()};
|
||||||
double[] leftBottomPoint = {latitude - dLatitude / 2, longitude - dLongitude / 2};
|
double[] leftBottomPoint = {BigDecimal.valueOf(latitude).subtract(dLatitude.divide(BigDecimal.valueOf(2))).doubleValue(), BigDecimal.valueOf(longitude).subtract(dLongitude.divide(BigDecimal.valueOf(2))).doubleValue()};
|
||||||
|
|
||||||
squareMap.put("rightTopPoint", rightTopPoint);
|
squareMap.put("rightTopPoint", rightTopPoint);
|
||||||
squareMap.put("leftBottomPoint", leftBottomPoint);
|
squareMap.put("leftBottomPoint", leftBottomPoint);
|
||||||
// 打印结果rightTopPoint[0]纬度lng,rightTopPoint[1]经度lat
|
// System.out.println("rightTop:" + rightTopPoint[0] + "======" + rightTopPoint[1]);
|
||||||
System.out.println("rightTop:" + rightTopPoint[0] + "======" + rightTopPoint[1]);
|
// System.out.println("leftBottom:" + leftBottomPoint[0] + "======" + leftBottomPoint[1]);
|
||||||
System.out.println("leftBottom:" + leftBottomPoint[0] + "======" + leftBottomPoint[1]);
|
|
||||||
return squareMap;
|
return squareMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将角度转化为弧度
|
* 将角度转化为弧度
|
||||||
*/
|
*/
|
||||||
|
|
@ -84,23 +93,20 @@ public class LocationUtils {
|
||||||
}
|
}
|
||||||
//1KM
|
//1KM
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Map<String, double[]> stringMap = returnLLSquarePoint(108.954398, 34.308687, 1);
|
Map<String, double[]> stringMap = returnLLSquarePoint(108.975418, 34.280890, 5);
|
||||||
double[] leftTopPoints = stringMap.get("rightTopPoint");
|
double[] leftTopPoints = stringMap.get("rightTopPoint");
|
||||||
double[] leftBottomPoints = stringMap.get("leftBottomPoint");
|
double[] leftBottomPoints = stringMap.get("leftBottomPoint");
|
||||||
|
|
||||||
double lat2 = 108.975418;
|
double lat2 = 108.975418;
|
||||||
double lon2 = 34.280890;
|
double lon2 = 34.280890;
|
||||||
double distance3 = getDistanceFrom2LngLat(109.019993, 34.342849, lat2, lon2);
|
BigDecimal distance3 = getDistanceFrom2LngLat(108.975418, 34.280890, 109.019993, 34.342849);
|
||||||
System.out.println(distance3);
|
System.out.println(distance3);
|
||||||
|
|
||||||
// 计算距离
|
// 计算距离
|
||||||
double distance1 = getDistanceFrom2LngLat(leftTopPoints[1], leftTopPoints[0], lat2, lon2);
|
BigDecimal distance1 = getDistanceFrom2LngLat(leftTopPoints[1], leftTopPoints[0], lat2, lon2);
|
||||||
double distance2 = getDistanceFrom2LngLat(leftBottomPoints[1], leftBottomPoints[0], lat2, lon2);
|
BigDecimal distance2 = getDistanceFrom2LngLat(leftBottomPoints[1], leftBottomPoints[0], lat2, lon2);
|
||||||
System.out.println("Distance between the two points is: " + distance1 + " km");
|
System.out.println("Distance between the two points is: " + distance1 + " km");
|
||||||
System.out.println("Distance between the two points is: " + distance2 + " km");
|
System.out.println("Distance between the two points is: " + distance2 + " km");
|
||||||
}
|
}
|
||||||
// public static void main(String[] args) {
|
//108.88883399281181(Double), 109.06200200718818(Double), 34.22653139523867(Double), 34.335248604761325(Double)
|
||||||
// Map<String, double[]> stringMap = returnLLSquarePoint(34.342849, 109.019993, 1);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package me.zhengjie.utils;
|
package com.chaozhanggui.system.cashierservice.util;
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,184 @@
|
||||||
|
<?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.TbGroupOrderInfoMapper">
|
||||||
|
|
||||||
|
<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="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="expDate" column="exp_date" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="orderType" column="order_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="number" column="number" jdbcType="INTEGER"/>
|
||||||
|
<result property="status" column="status" jdbcType="VARCHAR"/>
|
||||||
|
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||||
|
<result property="phone" column="phone" jdbcType="VARCHAR"/>
|
||||||
|
<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="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>
|
||||||
|
<sql id="List_Column">
|
||||||
|
id
|
||||||
|
, order_no, pro_name,pro_img,coupon_url,order_amount, pay_amount, number, status </sql>
|
||||||
|
|
||||||
|
<!--查询单个-->
|
||||||
|
<select id="queryById" resultMap="TbGroupOrderInfoMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
|
||||||
|
from tb_group_order_info
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--查询指定行数据-->
|
||||||
|
<select id="queryAll" resultType="com.chaozhanggui.system.cashierservice.entity.vo.GroupOrderListVo">
|
||||||
|
select
|
||||||
|
<include refid="List_Column"/>
|
||||||
|
|
||||||
|
from tb_group_order_info
|
||||||
|
<where>
|
||||||
|
<if test="userId != null">
|
||||||
|
and user_id = #{userId}
|
||||||
|
</if>
|
||||||
|
<if test="proName != null and proName != ''">
|
||||||
|
and pro_name = #{proName}
|
||||||
|
</if>
|
||||||
|
<if test="status != null and status != ''">
|
||||||
|
and status = #{status}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
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,
|
||||||
|
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},
|
||||||
|
#{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,
|
||||||
|
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.remark}, #{entity.phone}, #{entity.payTime}, #{entity.refundAble}, #{entity.createTime},
|
||||||
|
#{entity.updateTime}, #{entity.payOrderNo}, #{entity.tradeDay}, #{entity.source})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!--通过主键修改数据-->
|
||||||
|
<update id="update">
|
||||||
|
update tb_group_order_info
|
||||||
|
<set>
|
||||||
|
<if test="orderNo != null and orderNo != ''">
|
||||||
|
order_no = #{orderNo},
|
||||||
|
</if>
|
||||||
|
<if test="shopId != null">
|
||||||
|
shop_id = #{shopId},
|
||||||
|
</if>
|
||||||
|
<if test="userId != null">
|
||||||
|
user_id = #{userId},
|
||||||
|
</if>
|
||||||
|
<if test="proId != null">
|
||||||
|
pro_id = #{proId},
|
||||||
|
</if>
|
||||||
|
<if test="proName != null and proName != ''">
|
||||||
|
pro_name = #{proName},
|
||||||
|
</if>
|
||||||
|
<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="orderAmount != null">
|
||||||
|
order_amount = #{orderAmount},
|
||||||
|
</if>
|
||||||
|
<if test="saveAmount != null">
|
||||||
|
save_amount = #{saveAmount},
|
||||||
|
</if>
|
||||||
|
<if test="payAmount != null">
|
||||||
|
pay_amount = #{payAmount},
|
||||||
|
</if>
|
||||||
|
<if test="number != null">
|
||||||
|
number = #{number},
|
||||||
|
</if>
|
||||||
|
<if test="status != null and status != ''">
|
||||||
|
status = #{status},
|
||||||
|
</if>
|
||||||
|
<if test="remark != null and remark != ''">
|
||||||
|
remark = #{remark},
|
||||||
|
</if>
|
||||||
|
<if test="phone != null and phone != ''">
|
||||||
|
phone = #{phone},
|
||||||
|
</if>
|
||||||
|
<if test="payTime != null">
|
||||||
|
pay_time = #{payTime},
|
||||||
|
</if>
|
||||||
|
<if test="refundAble != null">
|
||||||
|
refund_able = #{refundAble},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time = #{createTime},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
update_time = #{updateTime},
|
||||||
|
</if>
|
||||||
|
<if test="payOrderNo != null and payOrderNo != ''">
|
||||||
|
pay_order_no = #{payOrderNo},
|
||||||
|
</if>
|
||||||
|
<if test="tradeDay != null">
|
||||||
|
trade_day = #{tradeDay},
|
||||||
|
</if>
|
||||||
|
<if test="source != null">
|
||||||
|
source = #{source},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!--通过主键删除-->
|
||||||
|
<delete id="deleteById">
|
||||||
|
delete
|
||||||
|
from tb_group_order_info
|
||||||
|
where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
||||||
|
|
@ -48,49 +48,6 @@
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryAllByPage" resultType="com.chaozhanggui.system.cashierservice.entity.vo.CouAndShopVo">
|
|
||||||
SELECT
|
|
||||||
cou.id as id,
|
|
||||||
cou.title as title,
|
|
||||||
cou.shop_id as shopId,
|
|
||||||
cou.amount as amount,
|
|
||||||
cou.number as number,
|
|
||||||
cou.ratio as ratio,
|
|
||||||
cou.relation_ids as relationIds,
|
|
||||||
info.shop_name as shopName,
|
|
||||||
info.logo
|
|
||||||
FROM
|
|
||||||
tb_merchant_coupon as cou
|
|
||||||
LEFT JOIN tb_shop_info as info ON cou.shop_id = info.id
|
|
||||||
<where>
|
|
||||||
cou.class_type = 'product'
|
|
||||||
AND cou.`status` = 1
|
|
||||||
AND cou.type = 2
|
|
||||||
AND info.cities =#{cities}
|
|
||||||
<if test="type != null and type != ''">
|
|
||||||
AND category_id like concat('%',#{type,jdbcType=VARCHAR},'%')
|
|
||||||
</if>
|
|
||||||
<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>
|
|
||||||
</where>
|
|
||||||
|
|
||||||
<choose>
|
|
||||||
<when test="orderBy == '1'">
|
|
||||||
ORDER BY (ABS(info.lat - #{lat}) + ABS(info.lng - #{lng})) ASC
|
|
||||||
</when>
|
|
||||||
<when test="orderBy == '2'">
|
|
||||||
ORDER BY cou.number ASC
|
|
||||||
</when>
|
|
||||||
<when test="orderBy == '3'">
|
|
||||||
ORDER BY cou.amount ASC
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
ORDER BY cou.id desc
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@
|
||||||
<result column="enable_label" jdbcType="TINYINT" property="enableLabel" />
|
<result column="enable_label" jdbcType="TINYINT" property="enableLabel" />
|
||||||
<result column="tax_config_id" jdbcType="VARCHAR" property="taxConfigId" />
|
<result column="tax_config_id" jdbcType="VARCHAR" property="taxConfigId" />
|
||||||
<result column="spec_table_headers" jdbcType="VARCHAR" property="specTableHeaders" />
|
<result column="spec_table_headers" jdbcType="VARCHAR" property="specTableHeaders" />
|
||||||
|
<result column="group_category_id" jdbcType="VARCHAR" property="groupCategoryId" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
|
||||||
<result column="images" jdbcType="LONGVARCHAR" property="images" />
|
<result column="images" jdbcType="LONGVARCHAR" property="images" />
|
||||||
|
|
@ -80,7 +81,7 @@
|
||||||
created_at, updated_at, base_sales_number, real_sales_number, sales_number, thumb_count,
|
created_at, updated_at, base_sales_number, real_sales_number, sales_number, thumb_count,
|
||||||
store_count, furnish_meal, furnish_express, furnish_draw, furnish_vir, is_combo,
|
store_count, furnish_meal, furnish_express, furnish_draw, furnish_vir, is_combo,
|
||||||
is_show_cash, is_show_mall, is_need_examine, show_on_mall_status, show_on_mall_time,
|
is_show_cash, is_show_mall, is_need_examine, show_on_mall_status, show_on_mall_time,
|
||||||
show_on_mall_error_msg, enable_label, tax_config_id, spec_table_headers
|
show_on_mall_error_msg, enable_label, tax_config_id, spec_table_headers,group_category_id
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
images, video, notice, group_snap, spec_info, select_spec
|
images, video, notice, group_snap, spec_info, select_spec
|
||||||
|
|
@ -933,4 +934,48 @@
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selGroups" 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,
|
||||||
|
pro.real_sales_number AS number
|
||||||
|
FROM
|
||||||
|
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'
|
||||||
|
AND info.cities = #{cities}
|
||||||
|
<if test="type != null and type != ''">
|
||||||
|
AND group_category_id LIKE concat('%',#{type,jdbcType=VARCHAR},'%')
|
||||||
|
</if>
|
||||||
|
<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>
|
||||||
|
</where>
|
||||||
|
<choose>
|
||||||
|
<when test="orderBy == '1'">
|
||||||
|
ORDER BY (ABS(info.lat - #{lat}) + ABS(info.lng - #{lng})) ASC
|
||||||
|
</when>
|
||||||
|
<when test="orderBy == '2'">
|
||||||
|
ORDER BYpro.real_sales_number desc
|
||||||
|
</when>
|
||||||
|
<when test="orderBy == '3'">
|
||||||
|
ORDER BY pro.low_price ASC
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
ORDER BY pro.id DESC
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -391,15 +391,17 @@
|
||||||
</select>
|
</select>
|
||||||
<select id="selectSale" resultType="com.chaozhanggui.system.cashierservice.entity.vo.HomeVO">
|
<select id="selectSale" resultType="com.chaozhanggui.system.cashierservice.entity.vo.HomeVO">
|
||||||
SELECT
|
SELECT
|
||||||
pro.id as id,
|
pro.id AS id,
|
||||||
pro.`name` as productName,
|
pro.`name` AS productName,
|
||||||
pro.cover_img as image,
|
pro.cover_img AS image,
|
||||||
sku.origin_price as originPrice,
|
sku.origin_price AS originPrice,
|
||||||
sku.sale_price as salePrice,
|
sku.sale_price AS salePrice,
|
||||||
MAX(sku.real_sales_number) AS realSalesNumber
|
MAX( sku.real_sales_number ) AS realSalesNumber
|
||||||
FROM
|
FROM
|
||||||
tb_product_sku sku
|
tb_product pro
|
||||||
LEFT JOIN tb_product pro ON sku.product_id = pro.id
|
LEFT JOIN tb_product_sku sku ON pro.id = sku.product_id
|
||||||
|
WHERE
|
||||||
|
pro.type_enum = 'group'
|
||||||
GROUP BY
|
GROUP BY
|
||||||
sku.product_id
|
sku.product_id
|
||||||
ORDER BY
|
ORDER BY
|
||||||
|
|
@ -408,15 +410,17 @@
|
||||||
</select>
|
</select>
|
||||||
<select id="selectDay" resultType="com.chaozhanggui.system.cashierservice.entity.vo.HomeVO">
|
<select id="selectDay" resultType="com.chaozhanggui.system.cashierservice.entity.vo.HomeVO">
|
||||||
SELECT
|
SELECT
|
||||||
pro.id as id,
|
pro.id AS id,
|
||||||
pro.`name` as productName,
|
pro.`name` AS productName,
|
||||||
pro.cover_img as image,
|
pro.cover_img AS image,
|
||||||
sku.origin_price as originPrice,
|
sku.origin_price AS originPrice,
|
||||||
sku.sale_price as salePrice,
|
sku.sale_price AS salePrice,
|
||||||
MAX(sku.real_sales_number) AS realSalesNumber
|
MAX( sku.real_sales_number ) AS realSalesNumber
|
||||||
FROM
|
FROM
|
||||||
tb_product_sku sku
|
tb_product pro
|
||||||
LEFT JOIN tb_product pro ON sku.product_id = pro.id
|
LEFT JOIN tb_product_sku sku ON pro.id = sku.product_id
|
||||||
|
WHERE
|
||||||
|
pro.type_enum = 'group'
|
||||||
GROUP BY
|
GROUP BY
|
||||||
sku.product_id
|
sku.product_id
|
||||||
ORDER BY
|
ORDER BY
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,14 @@
|
||||||
id
|
id
|
||||||
, coupon_id, date_used, available_time, booking_type, refund_policy, usage_rules, invoice_info, group_pur_info, market_price_Info, discount_Info, platform_tips </sql>
|
, coupon_id, date_used, available_time, booking_type, refund_policy, usage_rules, invoice_info, group_pur_info, market_price_Info, discount_Info, platform_tips </sql>
|
||||||
|
|
||||||
|
<select id="queryById" resultMap="TbPurchaseNoticeMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
|
||||||
|
from tb_purchase_notice
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
<!--查询单个-->
|
<!--查询单个-->
|
||||||
<select id="queryByCouponId" resultMap="TbPurchaseNoticeMap">
|
<select id="queryByCouponId" resultMap="TbPurchaseNoticeMap">
|
||||||
select
|
select
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbUserInfoMapper">
|
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbUserInfoMapper">
|
||||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbUserInfo">
|
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbUserInfo">
|
||||||
<id column="id" jdbcType="INTEGER" property="id" />
|
<id column="id" jdbcType="INTEGER" property="id" />
|
||||||
<id column="user_id" jdbcType="INTEGER" property="userId" />
|
|
||||||
<result column="amount" jdbcType="DECIMAL" property="amount" />
|
<result column="amount" jdbcType="DECIMAL" property="amount" />
|
||||||
<result column="charge_amount" jdbcType="DECIMAL" property="chargeAmount" />
|
<result column="charge_amount" jdbcType="DECIMAL" property="chargeAmount" />
|
||||||
<result column="line_of_credit" jdbcType="DECIMAL" property="lineOfCredit" />
|
<result column="line_of_credit" jdbcType="DECIMAL" property="lineOfCredit" />
|
||||||
|
|
@ -51,7 +50,7 @@
|
||||||
<result column="password" jdbcType="VARCHAR" property="password" />
|
<result column="password" jdbcType="VARCHAR" property="password" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id,user_id, amount, charge_amount, line_of_credit, consume_amount, consume_number, total_score,
|
id, amount, charge_amount, line_of_credit, consume_amount, consume_number, total_score,
|
||||||
lock_score, card_no, card_password, level_id, head_img, nick_name, telephone, wx_ma_app_id,
|
lock_score, card_no, card_password, level_id, head_img, nick_name, telephone, wx_ma_app_id,
|
||||||
birth_day, sex, mini_app_open_id, open_id, union_id, code, type, identify, status,
|
birth_day, sex, mini_app_open_id, open_id, union_id, code, type, identify, status,
|
||||||
parent_id, parent_level, parent_type, project_id, merchant_id, is_resource, is_online,
|
parent_id, parent_level, parent_type, project_id, merchant_id, is_resource, is_online,
|
||||||
|
|
@ -71,7 +70,7 @@
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into tb_user_info (id,user_id, amount, charge_amount,
|
insert into tb_user_info (id, amount, charge_amount,
|
||||||
line_of_credit, consume_amount, consume_number,
|
line_of_credit, consume_amount, consume_number,
|
||||||
total_score, lock_score, card_no,
|
total_score, lock_score, card_no,
|
||||||
card_password, level_id, head_img,
|
card_password, level_id, head_img,
|
||||||
|
|
@ -87,7 +86,7 @@
|
||||||
last_log_in_at, last_leave_at, created_at,
|
last_log_in_at, last_leave_at, created_at,
|
||||||
updated_at, bind_parent_at, grand_parent_id,password
|
updated_at, bind_parent_at, grand_parent_id,password
|
||||||
)
|
)
|
||||||
values (#{id,jdbcType=INTEGER},#{userId,jdbcType=INTEGER}, #{amount,jdbcType=DECIMAL}, #{chargeAmount,jdbcType=DECIMAL},
|
values (#{id,jdbcType=INTEGER}, #{amount,jdbcType=DECIMAL}, #{chargeAmount,jdbcType=DECIMAL},
|
||||||
#{lineOfCredit,jdbcType=DECIMAL}, #{consumeAmount,jdbcType=DECIMAL}, #{consumeNumber,jdbcType=INTEGER},
|
#{lineOfCredit,jdbcType=DECIMAL}, #{consumeAmount,jdbcType=DECIMAL}, #{consumeNumber,jdbcType=INTEGER},
|
||||||
#{totalScore,jdbcType=INTEGER}, #{lockScore,jdbcType=INTEGER}, #{cardNo,jdbcType=VARCHAR},
|
#{totalScore,jdbcType=INTEGER}, #{lockScore,jdbcType=INTEGER}, #{cardNo,jdbcType=VARCHAR},
|
||||||
#{cardPassword,jdbcType=VARCHAR}, #{levelId,jdbcType=VARCHAR}, #{headImg,jdbcType=VARCHAR},
|
#{cardPassword,jdbcType=VARCHAR}, #{levelId,jdbcType=VARCHAR}, #{headImg,jdbcType=VARCHAR},
|
||||||
|
|
@ -110,9 +109,6 @@
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
id,
|
id,
|
||||||
</if>
|
</if>
|
||||||
<if test="userId != null and userId != ''">
|
|
||||||
user_id,
|
|
||||||
</if>
|
|
||||||
<if test="amount != null">
|
<if test="amount != null">
|
||||||
amount,
|
amount,
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -253,9 +249,6 @@
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
#{id,jdbcType=INTEGER},
|
#{id,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
<if test="userId != null and userId != ''">
|
|
||||||
#{userId,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="amount != null">
|
<if test="amount != null">
|
||||||
#{amount,jdbcType=DECIMAL},
|
#{amount,jdbcType=DECIMAL},
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -396,9 +389,6 @@
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo">
|
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo">
|
||||||
update tb_user_info
|
update tb_user_info
|
||||||
<set>
|
<set>
|
||||||
<if test="userId != null and userId != ''">
|
|
||||||
user_id = #{userId,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="amount != null">
|
<if test="amount != null">
|
||||||
amount = #{amount,jdbcType=DECIMAL},
|
amount = #{amount,jdbcType=DECIMAL},
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -539,7 +529,7 @@
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo">
|
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo">
|
||||||
update tb_user_info
|
update tb_user_info
|
||||||
set user_id = #{userId,jdbcType=INTEGER},
|
set
|
||||||
amount = #{amount,jdbcType=DECIMAL},
|
amount = #{amount,jdbcType=DECIMAL},
|
||||||
charge_amount = #{chargeAmount,jdbcType=DECIMAL},
|
charge_amount = #{chargeAmount,jdbcType=DECIMAL},
|
||||||
line_of_credit = #{lineOfCredit,jdbcType=DECIMAL},
|
line_of_credit = #{lineOfCredit,jdbcType=DECIMAL},
|
||||||
|
|
@ -593,9 +583,6 @@
|
||||||
select * from tb_user_info where mini_app_open_id=#{openId}
|
select * from tb_user_info where mini_app_open_id=#{openId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserByPhone" resultMap="BaseResultMap">
|
|
||||||
select * from tb_user_info where telephone=#{phone} AND source_path=#{source}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectByPhone" resultMap="BaseResultMap">
|
<select id="selectByPhone" resultMap="BaseResultMap">
|
||||||
select * from tb_user_info where telephone=#{phone}
|
select * from tb_user_info where telephone=#{phone}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue