验证码
个人中心-菜单页 首页接口 预约到店(店铺列表) 通用商品列表 登录 退出登录 商品详情(缺少评价部分) 订单页 列表 详情
This commit is contained in:
@@ -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
|
||||
public Result homePage(@RequestBody HomeDto homeDto,@RequestHeader("environment") String environmen)throws Exception{
|
||||
return homePageService.proList(homeDto, environmen);
|
||||
public Result homePage(@RequestBody HomeDto homeDto)throws Exception{
|
||||
return homePageService.proList(homeDto);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,17 @@ public class HomeDistrictController {
|
||||
@Resource
|
||||
private HomeDistrictService districtService;
|
||||
|
||||
@RequestMapping("/topCommon")
|
||||
public Result topCommon(HomeDto param,@RequestHeader("environment") String environment){
|
||||
return districtService.topCommon(param,environment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约到店(店铺列表)
|
||||
*/
|
||||
@RequestMapping("/subShopList")
|
||||
public Result subShopList(HomeBaseDto param,@RequestHeader("environment") String environment){
|
||||
return districtService.queryShopListByPage(param,environment);
|
||||
public Result subShopList(HomeBaseDto param){
|
||||
return districtService.queryShopListByPage(param);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +44,7 @@ public class HomeDistrictController {
|
||||
* 咖啡饮品
|
||||
*/
|
||||
@RequestMapping("/productCate")
|
||||
public Result productCate(HomeDto param, @RequestHeader("environment") String environment) throws ExecutionException, InterruptedException {
|
||||
return districtService.proList(param,environment);
|
||||
public Result productCate(HomeDto param) throws ExecutionException, InterruptedException {
|
||||
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.dto.AuthUserDto;
|
||||
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.RedisUtil;
|
||||
import com.chaozhanggui.system.cashierservice.service.LoginService;
|
||||
@@ -89,6 +90,7 @@ public class LoginContoller {
|
||||
|
||||
/**
|
||||
* 小程序登录
|
||||
*
|
||||
* @param request
|
||||
* @param map
|
||||
* @return
|
||||
@@ -152,6 +154,7 @@ public class LoginContoller {
|
||||
|
||||
/**
|
||||
* 小程序获取手机号
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@@ -248,6 +251,26 @@ public class LoginContoller {
|
||||
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");
|
||||
return loginService.appLogin(authUserDto.getUsername(), mdPasswordString);
|
||||
} else {
|
||||
tf = loginService.validate(authUserDto.getCode(), authUserDto.getUsername());
|
||||
tf = true;
|
||||
// tf = loginService.validate(authUserDto.getCode(), authUserDto.getUsername());
|
||||
if (tf) {
|
||||
return loginService.appLogin(authUserDto.getUsername(), null);
|
||||
} else {
|
||||
@@ -299,17 +323,18 @@ public class LoginContoller {
|
||||
|
||||
/**
|
||||
* APP退出登录
|
||||
* @header token
|
||||
*
|
||||
* @return
|
||||
* @header token
|
||||
*/
|
||||
@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");
|
||||
if(environment.equals("wx")){
|
||||
if (environment.equals("wx")) {
|
||||
String openId = request.getHeader("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));
|
||||
}
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@@ -22,28 +21,45 @@ public class ProductController {
|
||||
private ProductService productService;
|
||||
|
||||
@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 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")
|
||||
public Result queryProductSku(
|
||||
@RequestParam("shopId") String shopId,
|
||||
@RequestParam("productId") String productId,
|
||||
@RequestParam("spec_tag") String spec_tag
|
||||
){
|
||||
return productService.queryProductSku(shopId,productId,spec_tag);
|
||||
@RequestParam("shopId") String shopId,
|
||||
@RequestParam("productId") String productId,
|
||||
@RequestParam("spec_tag") String spec_tag
|
||||
) {
|
||||
return productService.queryProductSku(shopId, productId, spec_tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 团购商品详情/商品类型为 套餐商品
|
||||
*/
|
||||
@GetMapping("/productInfo")
|
||||
public Result productInfo(@RequestParam Integer productId,@RequestHeader String environment) throws Exception {
|
||||
return productService.productInfo(productId,environment);
|
||||
public Result productInfo(
|
||||
@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;
|
||||
|
||||
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.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 优惠券(TbMerchantCoupon)表数据库访问层
|
||||
*
|
||||
@@ -29,10 +23,6 @@ public interface TbMerchantCouponMapper {
|
||||
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.TbProductWithBLOBs;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ShopGroupInfoVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -11,25 +12,19 @@ import java.util.List;
|
||||
@Component
|
||||
@Mapper
|
||||
public interface TbProductMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(TbProductWithBLOBs record);
|
||||
|
||||
int insertSelective(TbProductWithBLOBs record);
|
||||
|
||||
TbProductWithBLOBs selectByPrimaryKey(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> selectByIds(@Param("list") List<String> ids);
|
||||
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);
|
||||
|
||||
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查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* CouponId 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
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 cartNumber="0";
|
||||
private String groupCategoryId;
|
||||
|
||||
|
||||
public String getImages() {
|
||||
return images;
|
||||
@@ -636,6 +638,15 @@ public class TbProduct implements Serializable {
|
||||
return specTableHeaders;
|
||||
}
|
||||
|
||||
public String getGroupCategoryId() {
|
||||
return groupCategoryId;
|
||||
}
|
||||
|
||||
public void setGroupCategoryId(String groupCategoryId) {
|
||||
this.groupCategoryId = groupCategoryId;
|
||||
}
|
||||
|
||||
|
||||
public void setSpecTableHeaders(String specTableHeaders) {
|
||||
this.specTableHeaders = specTableHeaders == null ? null : specTableHeaders.trim();
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.math.BigDecimal;
|
||||
|
||||
public class TbUserInfo implements Serializable {
|
||||
private Integer id;
|
||||
private Integer userId;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
@@ -478,14 +477,6 @@ public class TbUserInfo implements Serializable {
|
||||
this.grandParentId = grandParentId == null ? null : grandParentId.trim();
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
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
|
||||
public class HomeBaseDto {
|
||||
public class HomeBaseDto extends BasePageDto{
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@@ -27,8 +27,4 @@ public class HomeBaseDto {
|
||||
|
||||
//是否分页 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 Integer productId;
|
||||
/**
|
||||
* 店铺标签
|
||||
*/
|
||||
@@ -115,14 +114,6 @@ public class HomeVO {
|
||||
this.proTag = proTag;
|
||||
}
|
||||
|
||||
public Integer getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Integer productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getShopName() {
|
||||
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;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -7,6 +8,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class ProductVo {
|
||||
//选几个
|
||||
private Integer number;
|
||||
@@ -15,13 +17,14 @@ public class ProductVo {
|
||||
private String title;
|
||||
|
||||
//食物
|
||||
private List<Food> foods=new ArrayList<>(); // 食品列表
|
||||
private List<Food> goods=new ArrayList<>(); // 食品列表
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class Food {
|
||||
private String name; // 商品名称
|
||||
private BigDecimal price; // 售价
|
||||
private String unit; // 单位
|
||||
private BigDecimal lowPrice; // 售价
|
||||
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 phone;
|
||||
/**
|
||||
* 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.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -43,65 +43,35 @@ public class HomeDistrictService {
|
||||
@Resource
|
||||
private SysDictDetailMapper sysDictDetailMapper;
|
||||
|
||||
public Result queryShopListByPage(HomeBaseDto param, String environment) {
|
||||
PageHelper.startPage(param.getPage(), param.getSize());
|
||||
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType("subShop", environment);
|
||||
|
||||
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 + 顶部图
|
||||
public Result topCommon(HomeDto param, String environment){
|
||||
CommonVo result = new CommonVo();
|
||||
String type = param.getType();
|
||||
//预约到店
|
||||
if (StringUtils.isNotBlank(param.getType())) {
|
||||
TbCouponCategory tbCouponCategory = couponCategoryMapper.queryById(Integer.valueOf(param.getType()));
|
||||
result.setTitle(tbCouponCategory.getName());
|
||||
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType(param.getType(), environment);
|
||||
if (!CollectionUtils.isEmpty(carouselList)) {
|
||||
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()));
|
||||
result.setTitle(tbCouponCategory.getName());
|
||||
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType(param.getType(), environment);
|
||||
if (!CollectionUtils.isEmpty(carouselList)) {
|
||||
result.setCarousel(JSONUtil.parseListTNewList(carouselList, HomeCarouselVo.class));
|
||||
}
|
||||
List<SysDict> sysDicts = sysDictDetailMapper.selectByType(null);
|
||||
List<DicDetailVO> dicDetailVO = new ArrayList<>();
|
||||
for (SysDict sysDictsList : sysDicts) {
|
||||
DicDetailVO dicDetailVOList = new DicDetailVO();
|
||||
dicDetailVOList.setDictName(sysDictsList.getDictName());
|
||||
dicDetailVOList.setName(sysDictsList.getName());
|
||||
dicDetailVOList.setDescription(sysDictsList.getDescription());
|
||||
dicDetailVOList.setDetail(sysDictDetailMapper.selectByDictId(sysDictsList.getDictId()));
|
||||
dicDetailVOList.setIsChild((sysDictsList.getIsChild() == null || sysDictsList.getIsChild() == 0) ? false : true);
|
||||
dicDetailVO.add(dicDetailVOList);
|
||||
}
|
||||
result.setMenu(dicDetailVO);
|
||||
}
|
||||
List<SysDict> sysDicts = sysDictDetailMapper.selectByType(null);
|
||||
List<DicDetailVO> dicDetailVO = new ArrayList<>();
|
||||
for (SysDict sysDictsList : sysDicts) {
|
||||
DicDetailVO dicDetailVOList = new DicDetailVO();
|
||||
dicDetailVOList.setDictName(sysDictsList.getDictName());
|
||||
dicDetailVOList.setName(sysDictsList.getName());
|
||||
dicDetailVOList.setDescription(sysDictsList.getDescription());
|
||||
dicDetailVOList.setDetail(sysDictDetailMapper.selectByDictId(sysDictsList.getDictId()));
|
||||
dicDetailVOList.setIsChild((sysDictsList.getIsChild() == null || sysDictsList.getIsChild() == 0) ? false : true);
|
||||
dicDetailVO.add(dicDetailVOList);
|
||||
}
|
||||
result.setMenu(dicDetailVO);
|
||||
} else {
|
||||
if (param.getOrderBy() != null) {
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.dao.SysDictDetailMapper;
|
||||
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.SysDict;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.*;
|
||||
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.*;
|
||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
@@ -100,8 +100,8 @@ public class HomePageService {
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
public Result proList(HomeDto homeDto, String environmen) throws ExecutionException, InterruptedException {
|
||||
List<HomeVO> products = productService.products(homeDto);
|
||||
public Result proList(HomeDto homeDto) throws ExecutionException, InterruptedException {
|
||||
PageInfo products = productService.products(homeDto);
|
||||
return Result.success(CodeEnum.SUCCESS, products);
|
||||
}
|
||||
|
||||
|
||||
@@ -255,6 +255,18 @@ public class LoginService {
|
||||
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) {
|
||||
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
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.Threads;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -53,8 +53,6 @@ public class ProductService {
|
||||
@Resource
|
||||
private TagProductDeptsMapper tagProductDeptsMapper;
|
||||
@Resource
|
||||
private TbMerchantCouponMapper merchantCouponMapper;
|
||||
@Resource
|
||||
private TbPlatformDictMapper platformDictMapper;
|
||||
@Resource
|
||||
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());
|
||||
|
||||
//经纬度(附近一km)
|
||||
Map<String, double[]> topAndBottomMap = LocationUtils.returnLLSquarePoint(
|
||||
Double.parseDouble(homeDto.getLng()), Double.parseDouble(homeDto.getLat()), homeDto.getDistanceInKm());
|
||||
List<CouAndShopVo> tbMerchantCoupons = merchantCouponMapper.queryAllByPage(
|
||||
|
||||
List<ShopGroupInfoVo> shopGroupInfoVos = tbProductMapper.selGroups(
|
||||
homeDto.getType(),
|
||||
topAndBottomMap.get("rightTopPoint")[1], topAndBottomMap.get("rightTopPoint")[0],
|
||||
topAndBottomMap.get("leftBottomPoint")[1], topAndBottomMap.get("leftBottomPoint")[0],
|
||||
homeDto.getAddress(), homeDto.getOrderBy().toString(), homeDto.getLng(), homeDto.getLat());
|
||||
|
||||
|
||||
//统计shopId,以及productId
|
||||
List<String> shopIds = new ArrayList<>();
|
||||
List<String> productIds = new ArrayList<>();
|
||||
List<Integer> productIdsInt = new ArrayList<>();
|
||||
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<Integer> productIds = shopGroupInfoVos.stream().map(ShopGroupInfoVo::getProId).collect(Collectors.toList());
|
||||
List<String> stringList = productIds.stream()
|
||||
.map(Object::toString) // 将 Integer 对象映射为 String 对象
|
||||
.collect(Collectors.toList());
|
||||
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectSkus(stringList);
|
||||
List<TagProductVO> dictPro = tagProductDeptsMapper.queryTagAndProduct(productIds);
|
||||
//组装
|
||||
List<HomeVO> homeVOList = new ArrayList<>();
|
||||
for (CouAndShopVo o : tbMerchantCoupons) {
|
||||
for (ShopGroupInfoVo o : shopGroupInfoVos) {
|
||||
HomeVO homeVO = new HomeVO();
|
||||
homeVO.setId(o.getId());
|
||||
for (TbShopInfo tbShopInfo : shopInfo.get()) {
|
||||
if (o.getShopId().equals(tbShopInfo.getId().toString())) {
|
||||
homeVO.setShopName(tbShopInfo.getShopName());
|
||||
homeVO.setImage(tbShopInfo.getLogo());
|
||||
if (StringUtils.isBlank(tbShopInfo.getTag())) {
|
||||
homeVO.setShopTag(new ArrayList<>());
|
||||
} else {
|
||||
List<Integer> shopTagIds = Arrays.stream(tbShopInfo.getTag().split(","))
|
||||
.map(Integer::parseInt)
|
||||
.collect(Collectors.toList());
|
||||
List<TbPlatformDict> tbPlatformDicts = platformDictMapper.queryByIdList(shopTagIds);
|
||||
homeVO.setShopTag(JSONUtil.parseListTNewList(tbPlatformDicts, TagVo.class));
|
||||
}
|
||||
if (StringUtils.isNotBlank(tbShopInfo.getLat()) && StringUtils.isNotBlank(tbShopInfo.getLng())) {
|
||||
double distance = LocationUtils.getDistanceFrom2LngLat(
|
||||
Double.parseDouble(homeDto.getLng()), Double.parseDouble(homeDto.getLat()),
|
||||
Double.parseDouble(tbShopInfo.getLng()), Double.parseDouble(tbShopInfo.getLat()));
|
||||
homeVO.setDistances(Double.toString(distance));
|
||||
}
|
||||
|
||||
homeVO.setId(o.getProId());
|
||||
homeVO.setShopName(o.getShopName());
|
||||
homeVO.setShopImage(o.getShopImg());
|
||||
if (StringUtils.isBlank(o.getShopTag())) {
|
||||
homeVO.setShopTag(new ArrayList<>());
|
||||
} else {
|
||||
List<Integer> shopTagIds = Arrays.stream(o.getShopTag().split(","))
|
||||
.map(Integer::parseInt)
|
||||
.collect(Collectors.toList());
|
||||
List<TbPlatformDict> tbPlatformDicts = platformDictMapper.queryByIdList(shopTagIds);
|
||||
homeVO.setShopTag(JSONUtil.parseListTNewList(tbPlatformDicts, TagVo.class));
|
||||
}
|
||||
if (StringUtils.isNotBlank(o.getLat()) && StringUtils.isNotBlank(o.getLng())) {
|
||||
BigDecimal distance = LocationUtils.getDistanceFrom2LngLat(
|
||||
Double.parseDouble(homeDto.getLng()), Double.parseDouble(homeDto.getLat()),
|
||||
Double.parseDouble(o.getLng()), Double.parseDouble(o.getLat()));
|
||||
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()) {
|
||||
if (o.getRelationIds().equals(tbProduct.getId().toString())) {
|
||||
homeVO.setProductName(o.getTitle());
|
||||
homeVO.setImage(tbProduct.getCoverImg());
|
||||
homeVO.setProductId(tbProduct.getId());
|
||||
}
|
||||
}
|
||||
for (TbProductSku tbProductSku : productSku.get()) {
|
||||
if (o.getRelationIds().equals(tbProductSku.getProductId())) {
|
||||
for (TbProductSku tbProductSku : tbProductSkus) {
|
||||
if (o.getProId().toString().equals(tbProductSku.getProductId())) {
|
||||
//原价
|
||||
if (tbProductSku.getSalePrice().compareTo(BigDecimal.ZERO) == 0) {
|
||||
if (tbProductSku.getOriginPrice().compareTo(BigDecimal.ZERO) == 0) {
|
||||
homeVO.setOriginPrice(BigDecimal.ZERO);
|
||||
homeVO.setDiscount(BigDecimal.ZERO);
|
||||
} else {
|
||||
homeVO.setOriginPrice(tbProductSku.getSalePrice());
|
||||
homeVO.setDiscount(new BigDecimal(o.getAmount()).divide(tbProductSku.getSalePrice(), 2, RoundingMode.DOWN).multiply(BigDecimal.TEN));
|
||||
homeVO.setOriginPrice(tbProductSku.getOriginPrice());
|
||||
homeVO.setDiscount(tbProductSku.getOriginPrice().divide(tbProductSku.getSalePrice(), 2, RoundingMode.DOWN).multiply(BigDecimal.TEN));
|
||||
}
|
||||
//销量
|
||||
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()));
|
||||
}
|
||||
}
|
||||
for (TagProductVO tagProductVO : dictPro.get()) {
|
||||
if (o.getRelationIds().equals(tagProductVO.getProductId().toString())) {
|
||||
homeVO.getProTag().add(tagProductVO);
|
||||
}
|
||||
}
|
||||
|
||||
homeVO.setEndTime(DateUtils.getDayEndLong());
|
||||
homeVOList.add(homeVO);
|
||||
}
|
||||
return homeVOList;
|
||||
PageInfo pageInfo = new PageInfo<>(shopGroupInfoVos);
|
||||
pageInfo.setList(homeVOList);
|
||||
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 团购卷详情
|
||||
*
|
||||
@@ -246,47 +224,53 @@ public class ProductService {
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Result productInfo(Integer productId,String environment) throws Exception {
|
||||
TbMerchantCoupon tbMerchantCoupon = merchantCouponMapper.queryById(productId);
|
||||
|
||||
CompletableFuture<TbShopInfo> shopInfo = CompletableFuture.supplyAsync(() ->
|
||||
tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(tbMerchantCoupon.getShopId())));
|
||||
public Result productInfo(Integer productId, String lat, String lng, String environment) throws Exception {
|
||||
CompletableFuture<TbProduct> product = CompletableFuture.supplyAsync(() ->
|
||||
tbProductMapper.selectById(Integer.valueOf(tbMerchantCoupon.getRelationIds())));
|
||||
tbProductMapper.selectById(productId));
|
||||
CompletableFuture<List<TbProductSku>> productSku = CompletableFuture.supplyAsync(() ->
|
||||
tbProductSkuMapper.selectSku(tbMerchantCoupon.getRelationIds()));
|
||||
tbProductSkuMapper.selectSku(productId.toString()));
|
||||
CompletableFuture<List<TagProductVO>> dictPro = CompletableFuture.supplyAsync(() ->
|
||||
tagProductDeptsMapper.queryTagByProductId(tbMerchantCoupon.getRelationIds()));
|
||||
CompletableFuture<TbPurchaseNotice> purchaseNotice = CompletableFuture.supplyAsync(() ->
|
||||
purchaseNoticeMapper.queryByCouponId(tbMerchantCoupon.getId()));
|
||||
Threads.call(shopInfo, product, productSku, dictPro);
|
||||
tagProductDeptsMapper.queryTagByProductId(productId.toString()));
|
||||
Threads.call(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();
|
||||
// 图片组装
|
||||
TbProduct tbProduct = product.get();
|
||||
TbShopInfo tbShopInfo = shopInfo.get();
|
||||
if (StringUtils.isNotBlank(tbProduct.getImages())) {
|
||||
productInfo.setImages(JSON.parseArray(tbProduct.getImages()));
|
||||
} else {
|
||||
productInfo.setImages(new JSONArray());
|
||||
}
|
||||
//折扣
|
||||
productInfo.setDiscount(tbMerchantCoupon.getRatio());
|
||||
|
||||
//价格组装
|
||||
for (TbProductSku tbProductSku : productSku.get()) {
|
||||
productInfo.setOriginPrice(tbProductSku.getSalePrice());
|
||||
productInfo.setRealSalesNumber(tbProductSku.getRealSalesNumber() == null ? BigDecimal.ZERO : new BigDecimal(tbProductSku.getRealSalesNumber()));
|
||||
Float discount = productInfo.getDiscount();
|
||||
BigDecimal discountDecimal = new BigDecimal(discount);
|
||||
productInfo.setSalePrice(tbProductSku.getSalePrice().multiply((discountDecimal.multiply(new BigDecimal("0.1")))));
|
||||
//原价
|
||||
if (tbProductSku.getSalePrice().compareTo(BigDecimal.ZERO) == 0) {
|
||||
productInfo.setOriginPrice(BigDecimal.ZERO);
|
||||
productInfo.setDiscount(BigDecimal.ZERO);
|
||||
} else {
|
||||
productInfo.setOriginPrice(tbProductSku.getSalePrice());
|
||||
productInfo.setDiscount(tbProductSku.getOriginPrice().divide(tbProductSku.getSalePrice(), 2, RoundingMode.DOWN).multiply(BigDecimal.TEN));
|
||||
}
|
||||
//现价
|
||||
productInfo.setSalePrice(new BigDecimal(tbProductSku.getSalePrice().toString()));
|
||||
}
|
||||
//销量
|
||||
productInfo.setRealSalesNumber(new BigDecimal(tbProduct.getRealSalesNumber()));
|
||||
//名称
|
||||
productInfo.setProductName(tbProduct.getName());
|
||||
//店铺
|
||||
productInfo.setShopName(tbShopInfo.getShopName() + (StringUtils.isNotBlank(tbShopInfo.getChainName()) ? "(" + tbShopInfo.getChainName() + ")" : ""));
|
||||
productInfo.setPhone(tbShopInfo.getPhone());
|
||||
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());
|
||||
|
||||
//商品 暂时只做单商品
|
||||
@@ -297,23 +281,61 @@ public class ProductService {
|
||||
productVo.setNumber(1);
|
||||
ProductVo.Food food = new ProductVo.Food();
|
||||
food.setName(tbProduct.getName());
|
||||
food.setUnit(tbShopUnit.getName());
|
||||
food.setPrice(tbProduct.getLowPrice());
|
||||
food.setUnitName(tbShopUnit.getName());
|
||||
food.setLowPrice(tbProduct.getLowPrice());
|
||||
|
||||
for (TagProductVO tagProductVO : dictPro.get()) {
|
||||
food.getProTag().add(tagProductVO);
|
||||
}
|
||||
productVo.getFoods().add(food);
|
||||
productVo.getGoods().add(food);
|
||||
productInfo.getProductList().add(productVo);
|
||||
TbPurchaseNotice tbPurchaseNotice = purchaseNotice.get();
|
||||
productInfo.setPurchaseNotice(tbPurchaseNotice);
|
||||
List<TbPlatformDict> tbPlatformDicts = platformDictMapper.queryAllByType("prodetail", environment);
|
||||
if(tbPurchaseNotice.getBookingType().startsWith("无需预约")){
|
||||
List<TbPlatformDict> book = platformDictMapper.queryAllByType("prodetail-book", environment);
|
||||
tbPlatformDicts.addAll(book);
|
||||
if (tbPurchaseNotice != null) {
|
||||
if (tbPurchaseNotice.getBookingType().startsWith("无需预约")) {
|
||||
List<TbPlatformDict> book = platformDictMapper.queryAllByType("prodetail-book", environment);
|
||||
tbPlatformDicts.addAll(book);
|
||||
}
|
||||
}
|
||||
productInfo.setNoticeTag(JSONUtil.parseListTNewList(tbPlatformDicts, TagVo.class));
|
||||
|
||||
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
|
||||
* @since 2024-04-12 14:50:10
|
||||
*/
|
||||
public class TbShopVideoService {
|
||||
public class ShopVideoService {
|
||||
|
||||
@Resource
|
||||
private TbShopVideoMapper tbShopVideoMapper;
|
||||
@@ -8,7 +8,9 @@ public enum CodeEnum {
|
||||
UPGRADE_REQUIRED("426",false,"成功","success"),
|
||||
ENCRYPT("0",true,"成功","success"),
|
||||
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"),
|
||||
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 sdfDays = new SimpleDateFormat("yyyyMMdd");
|
||||
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 sdfTimes = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
|
||||
@@ -59,6 +60,9 @@ public class DateUtils {
|
||||
public static String getTimes(Date date){
|
||||
return sdfday.format(date);
|
||||
}
|
||||
public static String getTimeM(Date date){
|
||||
return sdfTimeM.format(date);
|
||||
}
|
||||
public static String getSdfDayTimes(Date 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 JSONEntity() {
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.chaozhanggui.system.cashierservice.util;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -29,7 +31,7 @@ public class LocationUtils {
|
||||
* @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>
|
||||
*/
|
||||
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 radLat1 = radians(lat1);
|
||||
@@ -39,7 +41,10 @@ public class LocationUtils {
|
||||
double a = radLat1 - radLat2;
|
||||
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) {
|
||||
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公式来估算在给定纬度上,距离对应的经度变化
|
||||
double estimatedLongitudeDistance = getDistanceFrom2LngLat(latitude, longitude, latitude, longitude + 0.01); // 假设0.01度经度变化对应的距离
|
||||
double dLongitude = distanceInKm / estimatedLongitudeDistance * 0.0192736; // 根据比例计算经度变化
|
||||
BigDecimal estimatedLongitudeDistance = getDistanceFrom2LngLat(latitude, longitude, latitude, bdlongitude.add(BigDecimal.valueOf(0.01)).doubleValue()); // 假设0.01度经度变化对应的距离
|
||||
BigDecimal dLongitude = BigDecimal.valueOf(distanceInKm).divide(estimatedLongitudeDistance, 10, RoundingMode.HALF_UP).multiply(new BigDecimal("0.0192736")); // 根据比例计算经度变化
|
||||
// 正方形四个顶点的坐标
|
||||
double[] rightTopPoint = {latitude + dLatitude / 2, longitude + dLongitude / 2};
|
||||
double[] leftBottomPoint = {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 = {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("leftBottomPoint", leftBottomPoint);
|
||||
// 打印结果rightTopPoint[0]纬度lng,rightTopPoint[1]经度lat
|
||||
System.out.println("rightTop:" + rightTopPoint[0] + "======" + rightTopPoint[1]);
|
||||
System.out.println("leftBottom:" + leftBottomPoint[0] + "======" + leftBottomPoint[1]);
|
||||
// System.out.println("rightTop:" + rightTopPoint[0] + "======" + rightTopPoint[1]);
|
||||
// System.out.println("leftBottom:" + leftBottomPoint[0] + "======" + leftBottomPoint[1]);
|
||||
return squareMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 将角度转化为弧度
|
||||
*/
|
||||
@@ -84,23 +93,20 @@ public class LocationUtils {
|
||||
}
|
||||
//1KM
|
||||
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[] leftBottomPoints = stringMap.get("leftBottomPoint");
|
||||
|
||||
double lat2 = 108.975418;
|
||||
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);
|
||||
|
||||
// 计算距离
|
||||
double distance1 = getDistanceFrom2LngLat(leftTopPoints[1], leftTopPoints[0], lat2, lon2);
|
||||
double distance2 = getDistanceFrom2LngLat(leftBottomPoints[1], leftBottomPoints[0], lat2, lon2);
|
||||
BigDecimal distance1 = getDistanceFrom2LngLat(leftTopPoints[1], leftTopPoints[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: " + distance2 + " km");
|
||||
}
|
||||
// public static void main(String[] args) {
|
||||
// Map<String, double[]> stringMap = returnLLSquarePoint(34.342849, 109.019993, 1);
|
||||
//
|
||||
// }
|
||||
//108.88883399281181(Double), 109.06200200718818(Double), 34.22653139523867(Double), 34.335248604761325(Double)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package me.zhengjie.utils;
|
||||
package com.chaozhanggui.system.cashierservice.util;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import javax.crypto.Cipher;
|
||||
|
||||
Reference in New Issue
Block a user