parent
ff26b0d4ba
commit
d86506da76
|
|
@ -34,13 +34,16 @@ public class LoginFilter implements Filter {
|
|||
*/
|
||||
private static final List<String> NOT_LOGIN_URL = Arrays.asList(
|
||||
// 忽略静态资源
|
||||
"css/**",
|
||||
"js/**",
|
||||
"cashierService/phoneValidateCode",//验证码
|
||||
"cashierService/location/**",//高德 获取行政区域
|
||||
"cashierService/home/homePageUp",//首页上半
|
||||
"cashierService/home",//首页
|
||||
"cashierService/login/**"//登录部分接口不校验
|
||||
// "css/**",
|
||||
// "js/**",
|
||||
// "cashierService/phoneValidateCode",//验证码
|
||||
// "cashierService/tbPlatformDict",//获取菜单
|
||||
// "cashierService/location/**",//高德 获取行政区域
|
||||
// "cashierService/home/homePageUp",//首页上半
|
||||
// "cashierService/home",//首页
|
||||
// "cashierService/distirict/subShopList",//首页
|
||||
// "cashierService/product/productInfo",//商品详情
|
||||
// "cashierService/login/**"//登录部分接口不校验
|
||||
);
|
||||
|
||||
@Autowired
|
||||
|
|
@ -62,8 +65,9 @@ public class LoginFilter implements Filter {
|
|||
}
|
||||
// 获取请求地址
|
||||
String url = request.getRequestURI();
|
||||
|
||||
// 不需要授权的接口直接访问的地址
|
||||
if (containsUrl(NOT_LOGIN_URL, url)) {
|
||||
if (!containsUrl(NOT_LOGIN_URL, url)) {
|
||||
chain.doFilter(req, resp);
|
||||
return;
|
||||
}
|
||||
|
|
@ -130,6 +134,9 @@ public class LoginFilter implements Filter {
|
|||
return true;
|
||||
}
|
||||
} else {
|
||||
if (url.equals(s)) {
|
||||
return true;
|
||||
}
|
||||
if (url.equals("/" + s)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbPlatformDictMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
|
|
@ -8,25 +10,26 @@ import com.chaozhanggui.system.cashierservice.util.StringUtil;
|
|||
import com.chaozhanggui.system.cashierservice.util.ValidateCodeUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 通用接口
|
||||
* @author lyf
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/phoneValidateCode")
|
||||
@RequestMapping
|
||||
@RequiredArgsConstructor
|
||||
public class PhoneValidateCodeController {
|
||||
public class CommonController {
|
||||
|
||||
private final ValidateCodeUtil validateCodeUtil;
|
||||
@Resource
|
||||
private RedisUtils redisUtils;
|
||||
@Resource
|
||||
private TbPlatformDictMapper platformDictMapper;
|
||||
/**
|
||||
* 一分钟
|
||||
*/
|
||||
|
|
@ -37,7 +40,7 @@ public class PhoneValidateCodeController {
|
|||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
@GetMapping
|
||||
@GetMapping("/phoneValidateCode")
|
||||
public Result verifyPhoneIsExist(@RequestParam String phone) {
|
||||
if (StringUtils.isBlank(phone)) {
|
||||
return Result.fail("手机号不可为空!");
|
||||
|
|
@ -52,4 +55,13 @@ public class PhoneValidateCodeController {
|
|||
}
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单
|
||||
*/
|
||||
@GetMapping("/tbPlatformDict")
|
||||
public Result getPlatformDict(@RequestParam String type, @RequestHeader String environment) {
|
||||
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType(type, environment);
|
||||
return Result.success(CodeEnum.SUCCESS,carouselList);
|
||||
}
|
||||
}
|
||||
|
|
@ -20,12 +20,13 @@ public class HomeController {
|
|||
@Resource
|
||||
private HomePageService homePageService;
|
||||
|
||||
@PostMapping
|
||||
public Result homePage(@RequestBody HomeDto homeDto,@RequestHeader("environment") String environmen)throws Exception{
|
||||
return homePageService.homePage(homeDto, environmen);
|
||||
}
|
||||
@PostMapping("/homePageUp")
|
||||
public Result homePageUp(@RequestHeader("environment") String environment){
|
||||
return homePageService.homePageUp(environment);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public Result homePage(@RequestBody HomeDto homeDto,@RequestHeader("environment") String environmen)throws Exception{
|
||||
return homePageService.proList(homeDto, environmen);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.HomeBaseDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
|
||||
import com.chaozhanggui.system.cashierservice.service.HomeDistrictService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
/**
|
||||
* 首页其它接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/distirict")
|
||||
@RequiredArgsConstructor
|
||||
public class HomeDistrictController {
|
||||
|
||||
@Resource
|
||||
private HomeDistrictService districtService;
|
||||
|
||||
/**
|
||||
* 预约到店(店铺列表)
|
||||
*/
|
||||
@RequestMapping("/subShopList")
|
||||
public Result subShopList(HomeBaseDto param,@RequestHeader("environment") String environment){
|
||||
return districtService.queryShopListByPage(param,environment);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 品类
|
||||
*
|
||||
* 今日上新
|
||||
* 热榜推荐
|
||||
* 咖啡饮品
|
||||
*/
|
||||
@RequestMapping("/productCate")
|
||||
public Result productCate(HomeDto param, @RequestHeader("environment") String environment) throws ExecutionException, InterruptedException {
|
||||
return districtService.proList(param,environment);
|
||||
}
|
||||
}
|
||||
|
|
@ -87,7 +87,12 @@ public class LoginContoller {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序登录
|
||||
* @param request
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/wx/custom/login")
|
||||
public Result wxCustomLogin(HttpServletRequest request, @RequestBody Map<String, String> map
|
||||
// ,
|
||||
|
|
@ -102,15 +107,15 @@ public class LoginContoller {
|
|||
|
||||
String code = map.get("code").toString();
|
||||
|
||||
String qrCode = map.get("qrCode");
|
||||
// String qrCode = map.get("qrCode");
|
||||
|
||||
String rawData = map.get("rawData");
|
||||
|
||||
String signature = map.get("signature");
|
||||
|
||||
String encryptedData = map.get("encryptedData");
|
||||
|
||||
String ivStr = map.get("iv");
|
||||
// String encryptedData = map.get("encryptedData");
|
||||
//
|
||||
// String ivStr = map.get("iv");
|
||||
|
||||
String phone = map.get("phone");
|
||||
|
||||
|
|
@ -134,7 +139,8 @@ public class LoginContoller {
|
|||
String avatarUrl = rawDataJson.getString("avatarUrl");
|
||||
|
||||
try {
|
||||
return loginService.wxCustomLogin(openid, avatarUrl, nickName, phone, qrCode, IpUtil.getIpAddr(request));
|
||||
// return loginService.wxCustomLogin(openid, avatarUrl, nickName, phone, qrCode, IpUtil.getIpAddr(request));
|
||||
return loginService.wxCustomLogin(openid, avatarUrl, nickName, phone, IpUtil.getIpAddr(request));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
@ -144,6 +150,11 @@ public class LoginContoller {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序获取手机号
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("getPhoneNumber")
|
||||
public Result getPhoneNumber(@RequestBody Map<String, String> map) {
|
||||
|
||||
|
|
@ -202,27 +213,33 @@ public class LoginContoller {
|
|||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * 获取会员码
|
||||
// *
|
||||
// * @param openId
|
||||
// * @param token
|
||||
// * @param id
|
||||
// * @return
|
||||
// */
|
||||
// @GetMapping("createCardNo")
|
||||
// public Result createCardNo(@RequestHeader("openId") String openId, @RequestHeader("token") String token, @RequestHeader("id") String id,
|
||||
//
|
||||
// @RequestParam("shopId") String shopId
|
||||
// ) {
|
||||
// return loginService.createCardNo(id, openId,shopId);
|
||||
// }
|
||||
|
||||
@GetMapping("/userInfo")
|
||||
public Result userInfo(@RequestParam("userId") Integer userId) {
|
||||
return loginService.userInfo(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取会员码
|
||||
*
|
||||
* @param openId
|
||||
* 更新用户信息
|
||||
* @param token
|
||||
* @param id
|
||||
* @param userInfo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("createCardNo")
|
||||
public Result createCardNo(@RequestHeader("openId") String openId, @RequestHeader("token") String token, @RequestHeader("id") String id,
|
||||
|
||||
@RequestParam("shopId") String shopId
|
||||
) {
|
||||
return loginService.createCardNo(id, openId,shopId);
|
||||
}
|
||||
|
||||
@GetMapping("/wx/userInfo")
|
||||
public Result userInfo(@RequestParam("userId") Integer userId, @RequestParam("shopId") String shopId) {
|
||||
return loginService.userInfo(userId, shopId);
|
||||
}
|
||||
|
||||
@PostMapping("/upUserInfo")
|
||||
public Result userInfo(@RequestHeader String token, @RequestBody TbUserInfo userInfo) {
|
||||
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||
|
|
@ -262,6 +279,7 @@ public class LoginContoller {
|
|||
*/
|
||||
@PostMapping("/app/login")
|
||||
public Result applogin(@RequestBody AuthUserDto authUserDto) {
|
||||
boolean tf = false;
|
||||
if (ObjectUtil.isNull(authUserDto.getCode())) {
|
||||
if (StringUtils.isBlank(authUserDto.getPassword())) {
|
||||
return Result.fail("请输入密码,或使用验证码登录");
|
||||
|
|
@ -270,7 +288,7 @@ public class LoginContoller {
|
|||
String mdPasswordString = MD5Utils.MD5Encode(authUserDto.getPassword(), "utf-8");
|
||||
return loginService.appLogin(authUserDto.getUsername(), mdPasswordString);
|
||||
} else {
|
||||
boolean tf = loginService.validate(authUserDto.getCode(), authUserDto.getUsername());
|
||||
tf = loginService.validate(authUserDto.getCode(), authUserDto.getUsername());
|
||||
if (tf) {
|
||||
return loginService.appLogin(authUserDto.getUsername(), null);
|
||||
} else {
|
||||
|
|
@ -279,14 +297,21 @@ public class LoginContoller {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//退出登录的接口
|
||||
/**
|
||||
* APP退出登录
|
||||
* @header token
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/loginOut")
|
||||
public Result loginOut(HttpServletRequest request) {
|
||||
String token = request.getHeader("token");
|
||||
public Result loginOut(@RequestHeader String token,@RequestHeader String environment,HttpServletRequest request) {
|
||||
//获取当前登录人的账号
|
||||
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||
redisUtil.deleteByKey(RedisCst.ONLINE_APP_USER.concat(userId));
|
||||
if(environment.equals("wx")){
|
||||
String openId = request.getHeader("openId");
|
||||
redisUtil.deleteByKey(RedisCst.ONLINE_USER.concat(openId));
|
||||
}else if(environment.equals("app")){
|
||||
redisUtil.deleteByKey(RedisCst.ONLINE_APP_USER.concat(userId));
|
||||
}
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ public class ProductController {
|
|||
}
|
||||
|
||||
@GetMapping("/productInfo")
|
||||
public Result productInfo(@RequestParam Integer productId) throws Exception {
|
||||
return productService.productInfo(productId);
|
||||
public Result productInfo(@RequestParam Integer productId,@RequestHeader String environment) throws Exception {
|
||||
return productService.productInfo(productId,environment);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,10 @@ import java.util.List;
|
|||
@Component
|
||||
@Mapper
|
||||
public interface SysDictDetailMapper {
|
||||
List<SysDict> selectByAll();
|
||||
|
||||
List<SysDict> selectHot();
|
||||
|
||||
List<SysDict> selectByType(@Param("type") String type);
|
||||
|
||||
List<SysDictDetail> selectByDictId(@Param("dictId") Long dictId);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbCouponCategory;
|
||||
/**
|
||||
* 团购卷分类(TbCouponCategory)表数据库访问层
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-04-24 14:09:16
|
||||
*/
|
||||
public interface TbCouponCategoryMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbCouponCategory queryById(Integer id);
|
||||
}
|
||||
|
||||
|
|
@ -28,67 +28,11 @@ public interface TbMerchantCouponMapper {
|
|||
*/
|
||||
TbMerchantCoupon queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param tbMerchantCoupon 查询条件
|
||||
* @param pageable 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<TbMerchantCoupon> queryAllByLimit(TbMerchantCoupon tbMerchantCoupon, @Param("pageable") Pageable pageable);
|
||||
|
||||
|
||||
List<CouAndShopVo> queryAllByPage(@Param("pageable")Integer page, @Param("sizeable")Integer size, @Param("rightTopLng") Double rightTopLng,
|
||||
@Param("rightTopLat")Double rightTopLat, @Param("leftBottomLng")Double leftBottomLng, @Param("leftBottomLat")Double leftBottomLat,
|
||||
@Param("cities")String cities, @Param("order")String order,@Param("lng")String lng,@Param("lat")String lat);
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
* @param tbMerchantCoupon 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
long count(TbMerchantCoupon tbMerchantCoupon);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbMerchantCoupon 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(TbMerchantCoupon tbMerchantCoupon);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<TbMerchantCoupon> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<TbMerchantCoupon> entities);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<TbMerchantCoupon> 实例对象列表
|
||||
* @return 影响行数
|
||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||
*/
|
||||
int insertOrUpdateBatch(@Param("entities") List<TbMerchantCoupon> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbMerchantCoupon 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(TbMerchantCoupon tbMerchantCoupon);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public interface TbPurchaseNoticeMapper {
|
|||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbPurchaseNotice queryById(Integer id);
|
||||
TbPurchaseNotice queryByCouponId(Integer id);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.dao;
|
|||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.HomeVO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.SubShopVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.UserDutyVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -18,7 +19,12 @@ public interface TbShopInfoMapper {
|
|||
|
||||
int insertSelective(TbShopInfo record);
|
||||
|
||||
List<SubShopVo> selShopInfoByGps(@Param("rightTopLng") Double rightTopLng, @Param("rightTopLat") Double rightTopLat,
|
||||
@Param("leftBottomLng") Double leftBottomLng, @Param("leftBottomLat") Double leftBottomLat,
|
||||
@Param("cities") String cities, @Param("lng") String lng, @Param("lat") String lat);
|
||||
|
||||
TbShopInfo selectByPrimaryKey(Integer id);
|
||||
|
||||
List<TbShopInfo> selectByIds(@Param("list") List<String> ids);
|
||||
|
||||
int updateByPrimaryKeySelective(TbShopInfo record);
|
||||
|
|
@ -31,7 +37,7 @@ public interface TbShopInfoMapper {
|
|||
|
||||
TbShopInfo selectByPhone(String phone);
|
||||
|
||||
List<HomeVO> selectShopInfo(@Param("page")Integer page, @Param("size")Integer size);
|
||||
List<HomeVO> selectShopInfo(@Param("page") Integer page, @Param("size") Integer size);
|
||||
|
||||
List<UserDutyVo> searchUserDutyDetail(@Param("list") List<Integer> productId);
|
||||
}
|
||||
|
|
@ -24,14 +24,6 @@ public interface TbUserInfoMapper {
|
|||
|
||||
TbUserInfo selectByOpenId(String openId);
|
||||
|
||||
/**
|
||||
* 通过手机号查询
|
||||
* @param phone
|
||||
* @param source 公众号 WECHAT 小程序 WECHAT-APP 手机注册 TELEPHONE 移动端 APP
|
||||
* @return
|
||||
*/
|
||||
TbUserInfo selectUserByPhone(String phone,String source);
|
||||
|
||||
/**
|
||||
* 查询来源为APP 未绑定微信用户的 用户数据
|
||||
* @param phone
|
||||
|
|
|
|||
|
|
@ -0,0 +1,71 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 团购卷分类(TbCouponCategory)实体类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-04-24 14:09:16
|
||||
*/
|
||||
public class TbCouponCategory implements Serializable {
|
||||
private static final long serialVersionUID = -45350278241700844L;
|
||||
|
||||
private Integer id;
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 0:不展示;1:展示;
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -41,6 +41,7 @@ public class TbMerchantCoupon implements Serializable {
|
|||
* 限领数量
|
||||
*/
|
||||
private String limitNumber;
|
||||
private String useNumber;
|
||||
/**
|
||||
* 发放数量
|
||||
*/
|
||||
|
|
@ -135,6 +136,13 @@ public class TbMerchantCoupon implements Serializable {
|
|||
private String merchantId;
|
||||
|
||||
|
||||
public String getUseNumber() {
|
||||
return useNumber;
|
||||
}
|
||||
|
||||
public void setUseNumber(String useNumber) {
|
||||
this.useNumber = useNumber;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 查询通用核心类
|
||||
* 经纬度
|
||||
* 城市信息
|
||||
* 分页数据
|
||||
*/
|
||||
@Data
|
||||
public class HomeBaseDto {
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private String lat;
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private String lng;
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
private double distanceInKm = 10;
|
||||
|
||||
//是否分页 1分页
|
||||
private Integer isPage = 1;
|
||||
|
||||
private Integer page = 1;
|
||||
|
||||
private Integer size = 10;
|
||||
}
|
||||
|
|
@ -6,32 +6,18 @@ import lombok.Data;
|
|||
* @author 12847
|
||||
*/
|
||||
@Data
|
||||
public class HomeDto {
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private String lat;
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private String lng;
|
||||
public class HomeDto extends HomeBaseDto {
|
||||
/**
|
||||
* 品类
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 1.离我最近 2.销量优先 3.价格优先
|
||||
* 0.今日上新
|
||||
* 1.离我最近
|
||||
* 2.销量优先/热榜推荐
|
||||
* 3.价格优先
|
||||
*/
|
||||
private Integer orderBy;
|
||||
private Integer orderBy = 0;
|
||||
|
||||
private Integer other;
|
||||
|
||||
private Integer page;
|
||||
|
||||
private Integer size;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class CommonPageVo extends CommonVo{
|
||||
private PageInfo result;
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 顶部图
|
||||
* 预约到店
|
||||
* 每日上新
|
||||
* 热榜推荐
|
||||
* 咖啡饮品
|
||||
*/
|
||||
@Data
|
||||
public class CommonVo {
|
||||
|
||||
private String title;
|
||||
|
||||
private List<HomeCarouselVo> carousel;
|
||||
/**
|
||||
* 菜单列表 不一定有
|
||||
*/
|
||||
private List<DicDetailVO> menu;
|
||||
}
|
||||
|
|
@ -40,6 +40,12 @@ public class ProductInfoVo {
|
|||
* 商品名称
|
||||
*/
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 购买须知标签
|
||||
*/
|
||||
private List<TagVo> noticeTag;
|
||||
|
||||
/**
|
||||
* 店铺名称
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 预约到店列表页Vo
|
||||
*/
|
||||
@Data
|
||||
public class SubShopVo{
|
||||
private Integer id;
|
||||
/**
|
||||
* 店铺名称
|
||||
*/
|
||||
private String shopName;
|
||||
/**
|
||||
* 连锁店扩展名
|
||||
*/
|
||||
private String chainName;
|
||||
/**
|
||||
* Logo图
|
||||
*/
|
||||
private String logo;
|
||||
/**
|
||||
* 封面图
|
||||
*/
|
||||
private String coverImg;
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 距离
|
||||
*/
|
||||
private String distances ="100";
|
||||
|
||||
private String lat;
|
||||
|
||||
private String lng;
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.dao.SysDictDetailMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbCouponCategoryMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbPlatformDictMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbShopInfoMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.SysDict;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbCouponCategory;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.HomeBaseDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.*;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.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.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.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class HomeDistrictService {
|
||||
@Resource
|
||||
private ProductService productService;
|
||||
|
||||
@Resource
|
||||
private TbShopInfoMapper shopInfoMapper;
|
||||
@Resource
|
||||
private TbPlatformDictMapper platformDictMapper;
|
||||
@Resource
|
||||
private TbCouponCategoryMapper couponCategoryMapper;
|
||||
@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 + 顶部图
|
||||
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)) {
|
||||
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);
|
||||
} else {
|
||||
if (param.getOrderBy() != null) {
|
||||
if (param.getOrderBy() == 0) {
|
||||
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType("newCoupon", environment);
|
||||
if (!CollectionUtils.isEmpty(carouselList)) {
|
||||
result.setCarousel(JSONUtil.parseListTNewList(carouselList, HomeCarouselVo.class));
|
||||
}
|
||||
result.setTitle("今日上新");
|
||||
} else if (param.getOrderBy() == 2) {
|
||||
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType("hotCoupon", environment);
|
||||
if (!CollectionUtils.isEmpty(carouselList)) {
|
||||
result.setCarousel(JSONUtil.parseListTNewList(carouselList, HomeCarouselVo.class));
|
||||
}
|
||||
result.setTitle("热榜推荐");
|
||||
List<SysDict> sysDicts = sysDictDetailMapper.selectHot();
|
||||
List<DicDetailVO> dicDetailVO = new ArrayList<>();
|
||||
for (SysDict sysDictsList : sysDicts) {
|
||||
DicDetailVO dicDetailVOList = new DicDetailVO();
|
||||
dicDetailVOList.setDictName(sysDictsList.getDictName());
|
||||
dicDetailVOList.setName(sysDictsList.getName());
|
||||
dicDetailVOList.setDescription(sysDictsList.getDescription());
|
||||
dicDetailVOList.setIsChild((sysDictsList.getIsChild() == null || sysDictsList.getIsChild() == 0) ? false : true);
|
||||
dicDetailVO.add(dicDetailVOList);
|
||||
}
|
||||
result.setMenu(dicDetailVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<HomeVO> products = productService.products(param);
|
||||
|
||||
PageInfo pageInfo = new PageInfo();
|
||||
pageInfo.setList(products);
|
||||
result.setResult(pageInfo);
|
||||
return Result.success(CodeEnum.SUCCESS, result);
|
||||
}
|
||||
}
|
||||
|
|
@ -32,120 +32,17 @@ import java.util.stream.Collectors;
|
|||
@Service
|
||||
@Slf4j
|
||||
public class HomePageService {
|
||||
@Resource
|
||||
private TbShopInfoMapper shopInfoMapper;
|
||||
@Resource
|
||||
private TbProductSkuMapper productSkuMapper;
|
||||
@Resource
|
||||
private TbPlatformDictMapper platformDictMapper;
|
||||
@Resource
|
||||
private TbMerchantCouponMapper merchantCouponMapper;
|
||||
@Resource
|
||||
private TbProductMapper productMapper;
|
||||
@Resource
|
||||
private SysDictDetailMapper sysDictDetailMapper;
|
||||
@Resource
|
||||
private TagProductDeptsMapper tagProductDeptsMapper;
|
||||
private ProductService productService;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
|
||||
public Result homePage(HomeDto homeDto, String environmen) throws ExecutionException, InterruptedException {
|
||||
int beginNo;
|
||||
if (homeDto.getPage() <= 0) {
|
||||
beginNo = 0;
|
||||
} else {
|
||||
beginNo = (homeDto.getPage() - 1) * homeDto.getSize();
|
||||
}
|
||||
//经纬度(附近一km)
|
||||
Map<String, double[]> topAndBottomMap = new HashMap<>();
|
||||
List<CouAndShopVo> tbMerchantCoupons = new ArrayList<>();
|
||||
if (homeDto.getOther() != null && homeDto.getOther() == 1){
|
||||
topAndBottomMap = LocationUtils.returnLLSquarePoint(Double.parseDouble(homeDto.getLng()), Double.parseDouble(homeDto.getLat()), 1);
|
||||
tbMerchantCoupons = merchantCouponMapper.queryAllByPage(beginNo, homeDto.getSize(), topAndBottomMap.get("rightTopPoint")[0],topAndBottomMap.get("rightTopPoint")[1],
|
||||
topAndBottomMap.get("leftBottomPoint")[0],topAndBottomMap.get("leftBottomPoint")[1],homeDto.getAddress(),homeDto.getOrderBy().toString(),homeDto.getLng(),homeDto.getLat());
|
||||
}else {
|
||||
tbMerchantCoupons = merchantCouponMapper.queryAllByPage(beginNo, homeDto.getSize(), null,null,null,null,
|
||||
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(() ->
|
||||
shopInfoMapper.selectByIds(shopIds));
|
||||
CompletableFuture<List<TbProduct>> product = CompletableFuture.supplyAsync(() ->
|
||||
productMapper.selectByIds((productIds)));
|
||||
CompletableFuture<List<TbProductSku>> productSku = CompletableFuture.supplyAsync(() ->
|
||||
productSkuMapper.selectSkus((productIds)));
|
||||
CompletableFuture<List<TagProductVO>> dictPro = CompletableFuture.supplyAsync(() ->
|
||||
tagProductDeptsMapper.queryTagAndProduct(productIdsInt));
|
||||
Threads.call(shopInfo,product,productSku,dictPro);
|
||||
|
||||
//组装
|
||||
List<HomeVO> homeVOList = new ArrayList<>();
|
||||
for (CouAndShopVo o : tbMerchantCoupons) {
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
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())) {
|
||||
//原价
|
||||
if (tbProductSku.getSalePrice().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.setRealSalesNumber(new BigDecimal(o.getNumber()));
|
||||
//现价
|
||||
homeVO.setSalePrice(new BigDecimal(o.getAmount().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 Result.success(CodeEnum.SUCCESS, homeVOList);
|
||||
}
|
||||
|
||||
public Result homePageUp(String environment) {
|
||||
HomeUpVO homeUpVO = new HomeUpVO();
|
||||
//轮播图
|
||||
|
|
@ -156,7 +53,7 @@ public class HomePageService {
|
|||
homeUpVO.setDistrict(JSONUtil.parseListTNewList(districtList, HomeDistrictVo.class));
|
||||
|
||||
//菜单
|
||||
List<SysDict> sysDicts = sysDictDetailMapper.selectByAll();
|
||||
List<SysDict> sysDicts = sysDictDetailMapper.selectByType("home");
|
||||
List<DicDetailVO> dicDetailVO = new ArrayList<>();
|
||||
for (SysDict sysDictsList : sysDicts) {
|
||||
DicDetailVO dicDetailVOList = new DicDetailVO();
|
||||
|
|
@ -200,11 +97,18 @@ public class HomePageService {
|
|||
return Result.success(CodeEnum.SUCCESS, homeUpVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
public Result proList(HomeDto homeDto, String environmen) throws ExecutionException, InterruptedException {
|
||||
List<HomeVO> products = productService.products(homeDto);
|
||||
return Result.success(CodeEnum.SUCCESS, products);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小条幅随机数据
|
||||
* @return
|
||||
*/
|
||||
|
||||
private BannerVO bannerVoRandom(){
|
||||
BannerVO bannerVO = new BannerVO();
|
||||
List<BannerInfoVo> bannerInfoList = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
|||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.MD5Utils;
|
||||
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
|
@ -21,6 +22,7 @@ import java.math.BigDecimal;
|
|||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class LoginService {
|
||||
|
||||
|
||||
|
|
@ -50,110 +52,58 @@ public class LoginService {
|
|||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result wxCustomLogin(String openId, String headImage, String nickName, String telephone, String qrCode, String ip) throws Exception {
|
||||
|
||||
public Result wxCustomLogin(String openId, String headImage, String nickName, String telephone, String ip) throws Exception {
|
||||
TbUserInfo userInfo = tbUserInfoMapper.selectByOpenId(openId);
|
||||
if (ObjectUtil.isNull(userInfo)) {
|
||||
userInfo = new TbUserInfo();
|
||||
|
||||
userInfo.setAmount(BigDecimal.ZERO);
|
||||
userInfo.setChargeAmount(BigDecimal.ZERO);
|
||||
userInfo.setLineOfCredit(BigDecimal.ZERO);
|
||||
userInfo.setConsumeNumber(0);
|
||||
userInfo.setConsumeAmount(BigDecimal.ZERO);
|
||||
userInfo.setTotalScore(0);
|
||||
userInfo.setLockScore(0);
|
||||
userInfo.setHeadImg(ObjectUtil.isNotNull(headImage) ? headImage : "");
|
||||
userInfo.setNickName(ObjectUtil.isNotNull(nickName) ? nickName : "微信用户");
|
||||
userInfo.setTelephone(ObjectUtil.isNotNull(telephone) ? telephone : "");
|
||||
userInfo.setMiniAppOpenId(openId);
|
||||
userInfo.setStatus(Byte.parseByte("1"));
|
||||
userInfo.setParentType("PERSON");
|
||||
userInfo.setIsResource(Byte.parseByte("0"));
|
||||
userInfo.setIsOnline(Byte.parseByte("0"));
|
||||
userInfo.setIsVip(Byte.parseByte("0"));
|
||||
userInfo.setSourcePath("WECHAT-APP");
|
||||
userInfo.setIsAttentionMp(Byte.parseByte("0"));
|
||||
userInfo.setSearchWord("||微信用户");
|
||||
userInfo.setLastLogInAt(System.currentTimeMillis());
|
||||
userInfo.setCreatedAt(System.currentTimeMillis());
|
||||
userInfo.setUpdatedAt(System.currentTimeMillis());
|
||||
tbUserInfoMapper.insert(userInfo);
|
||||
|
||||
} else {
|
||||
userInfo.setHeadImg(ObjectUtil.isNotNull(headImage) ? headImage : "");
|
||||
userInfo.setNickName(ObjectUtil.isNotNull(nickName) ? nickName : "微信用户");
|
||||
userInfo.setTelephone(ObjectUtil.isNotNull(telephone) ? telephone : "");
|
||||
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
|
||||
}
|
||||
//app与微信用户 互相关联
|
||||
if (ObjectUtil.isNotNull(telephone)) {
|
||||
TbUserInfo appUser = tbUserInfoMapper.selectByPhone(telephone);
|
||||
if (appUser != null) {
|
||||
TbUserInfo wechatUser = tbUserInfoMapper.selectByOpenId(openId);
|
||||
appUser.setUserId(wechatUser.getId());
|
||||
tbUserInfoMapper.updateByPrimaryKey(appUser);
|
||||
wechatUser.setUserId(appUser.getId());
|
||||
tbUserInfoMapper.updateByPrimaryKey(wechatUser);
|
||||
userInfo = tbUserInfoMapper.selectByPhone(telephone);
|
||||
if (ObjectUtil.isNull(userInfo)) {
|
||||
userInfo = new TbUserInfo();
|
||||
userInfo.setAmount(BigDecimal.ZERO);
|
||||
userInfo.setChargeAmount(BigDecimal.ZERO);
|
||||
userInfo.setLineOfCredit(BigDecimal.ZERO);
|
||||
userInfo.setConsumeNumber(0);
|
||||
userInfo.setConsumeAmount(BigDecimal.ZERO);
|
||||
userInfo.setTotalScore(0);
|
||||
userInfo.setLockScore(0);
|
||||
userInfo.setHeadImg(ObjectUtil.isNotNull(headImage) ? headImage : "");
|
||||
userInfo.setNickName(ObjectUtil.isNotNull(nickName) ? nickName : "微信用户");
|
||||
userInfo.setTelephone(ObjectUtil.isNotNull(telephone) ? telephone : "");
|
||||
userInfo.setMiniAppOpenId(openId);
|
||||
userInfo.setStatus(Byte.parseByte("1"));
|
||||
userInfo.setParentType("PERSON");
|
||||
userInfo.setIsResource(Byte.parseByte("0"));
|
||||
userInfo.setIsOnline(Byte.parseByte("0"));
|
||||
userInfo.setIsVip(Byte.parseByte("0"));
|
||||
userInfo.setSourcePath("WECHAT-APP");
|
||||
userInfo.setIsAttentionMp(Byte.parseByte("0"));
|
||||
userInfo.setSearchWord("||微信用户");
|
||||
userInfo.setLastLogInAt(System.currentTimeMillis());
|
||||
userInfo.setCreatedAt(System.currentTimeMillis());
|
||||
userInfo.setUpdatedAt(System.currentTimeMillis());
|
||||
tbUserInfoMapper.insert(userInfo);
|
||||
} else {
|
||||
userInfo.setSearchWord(userInfo.getSearchWord() + "||微信用户");
|
||||
userInfo.setMiniAppOpenId(openId);
|
||||
userInfo.setUpdatedAt(System.currentTimeMillis());
|
||||
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
|
||||
}
|
||||
}
|
||||
TbShopInfo tbShopInfo = null;
|
||||
if (ObjectUtil.isEmpty(qrCode)) {
|
||||
tbShopInfo = tbShopInfoMapper.selectByPhone(defaultPhone);
|
||||
|
||||
|
||||
} else {
|
||||
tbShopInfo = tbShopInfoMapper.selectByQrCode(qrCode);
|
||||
}
|
||||
|
||||
|
||||
TbShopUser tbShopUser = null;
|
||||
Map<String, String> shopMap = new HashMap<>();
|
||||
if (ObjectUtil.isNotEmpty(tbShopInfo)) {
|
||||
tbShopUser = tbShopUserMapper.selectByUserIdAndShopId(userInfo.getId().toString(), tbShopInfo.getId().toString());
|
||||
if (ObjectUtil.isEmpty(tbShopUser)) {
|
||||
tbShopUser = new TbShopUser();
|
||||
tbShopUser.setAmount(BigDecimal.ZERO);
|
||||
tbShopUser.setCreditAmount(BigDecimal.ZERO);
|
||||
tbShopUser.setConsumeAmount(BigDecimal.ZERO);
|
||||
tbShopUser.setConsumeNumber(0);
|
||||
tbShopUser.setLevelConsume(BigDecimal.ZERO);
|
||||
tbShopUser.setStatus(Byte.parseByte("1"));
|
||||
tbShopUser.setShopId(tbShopInfo.getId().toString());
|
||||
tbShopUser.setUserId(userInfo.getId().toString());
|
||||
tbShopUser.setMiniOpenId(openId);
|
||||
tbShopUser.setIsPwd("1");
|
||||
tbShopUser.setCreatedAt(System.currentTimeMillis());
|
||||
tbShopUser.setUpdatedAt(System.currentTimeMillis());
|
||||
tbShopUserMapper.insert(tbShopUser);
|
||||
}else {
|
||||
tbShopUser.setUpdatedAt(System.currentTimeMillis());
|
||||
tbShopUserMapper.updateByPrimaryKey(tbShopUser);
|
||||
}
|
||||
shopMap.put("shopId", tbShopUser.getShopId());
|
||||
shopMap.put("name", tbShopInfo.getShopName());
|
||||
shopMap.put("amount", BigDecimal.ZERO.toPlainString());
|
||||
shopMap.put("levelConsume", BigDecimal.ZERO.toPlainString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
//生成token 信息
|
||||
String token = TokenUtil.generateToken(userInfo.getId(), userInfo.getMiniAppOpenId(), userInfo.getTelephone(), userInfo.getNickName());
|
||||
|
||||
|
||||
//存储登录记录
|
||||
TbToken tbToken = new TbToken(tbShopInfo.getId(), userInfo.getId(), "wx_lite", token, ip, "1", new Date());
|
||||
tbTokenMapper.insert(tbToken);
|
||||
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
try {
|
||||
map.put("token", token);
|
||||
map.put("userInfo", userInfo);
|
||||
map.put("shopUser", shopMap);
|
||||
map.put("shopInfo", tbShopInfo);
|
||||
redisUtil.saveMessage(RedisCst.ONLINE_USER.concat(openId), JSON.toJSONString(map));
|
||||
//redis里 获取要关注的公众号信息
|
||||
//userInfo 某字段存储关注公众号的标识
|
||||
// userInfo.get
|
||||
//公众号 appid
|
||||
//展示描述
|
||||
//图标
|
||||
// map.put("", );
|
||||
// log.info("登录结果:"+ JSONUtil.toJSONString(map));
|
||||
return Result.success(CodeEnum.SUCCESS, map);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
@ -162,6 +112,14 @@ public class LoginService {
|
|||
return Result.fail("登录失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* APP注册
|
||||
*
|
||||
* @param phone
|
||||
* @param password
|
||||
* @param nickName
|
||||
* @return
|
||||
*/
|
||||
public TbUserInfo register(String phone, String password, String nickName) {
|
||||
|
||||
TbUserInfo userInfo = new TbUserInfo();
|
||||
|
|
@ -186,19 +144,11 @@ public class LoginService {
|
|||
userInfo.setLastLogInAt(System.currentTimeMillis());
|
||||
userInfo.setCreatedAt(System.currentTimeMillis());
|
||||
userInfo.setUpdatedAt(System.currentTimeMillis());
|
||||
if(StringUtils.isNotBlank(password)){
|
||||
if (StringUtils.isNotBlank(password)) {
|
||||
userInfo.setPassword(MD5Utils.MD5Encode(password, "UTF-8"));
|
||||
}
|
||||
tbUserInfoMapper.insert(userInfo);
|
||||
//注册时 app与微信小程序用户关联
|
||||
TbUserInfo wechatUser = tbUserInfoMapper.selectUserByPhone(phone, "WECHAT-APP");
|
||||
TbUserInfo appUser = tbUserInfoMapper.selectByPhone(phone);
|
||||
if (wechatUser != null) {
|
||||
appUser.setUserId(wechatUser.getId());
|
||||
tbUserInfoMapper.updateByPrimaryKey(appUser);
|
||||
wechatUser.setUserId(appUser.getId());
|
||||
tbUserInfoMapper.updateByPrimaryKey(wechatUser);
|
||||
}
|
||||
return appUser;
|
||||
}
|
||||
|
||||
|
|
@ -223,14 +173,28 @@ public class LoginService {
|
|||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result appLogin(String username, String password) {
|
||||
TbUserInfo userInfo = tbUserInfoMapper.selectUserByPhone(username, "APP");
|
||||
TbUserInfo userInfo = tbUserInfoMapper.selectByPhone(username);
|
||||
if (ObjectUtil.isNull(userInfo)) {
|
||||
//注册
|
||||
userInfo=register(username, password, username);
|
||||
if (StringUtils.isNotBlank(password)) {
|
||||
return Result.fail("暂未设置密码,请使用验证码登录");
|
||||
}
|
||||
userInfo = register(username, password, username);
|
||||
}else {
|
||||
String searchWord = userInfo.getSearchWord();
|
||||
if(!searchWord.contains("移动端用户")){
|
||||
userInfo.setSearchWord(userInfo.getSearchWord() + "||移动端用户");
|
||||
userInfo.setUpdatedAt(System.currentTimeMillis());
|
||||
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(password) && !password.equalsIgnoreCase(userInfo.getPassword())) {
|
||||
return Result.fail("密码错误");
|
||||
if (StringUtils.isNotBlank(password)) {//未使用验证码
|
||||
if (StringUtils.isBlank(userInfo.getPassword())) {
|
||||
return Result.fail("暂未设置密码,请使用验证码登录");
|
||||
} else if (!password.equalsIgnoreCase(userInfo.getPassword())) {
|
||||
return Result.fail("用户名或密码错误");
|
||||
}
|
||||
}
|
||||
|
||||
//生成token 信息
|
||||
String token = null;
|
||||
try {
|
||||
|
|
@ -251,7 +215,7 @@ public class LoginService {
|
|||
return Result.fail("登录失败");
|
||||
}
|
||||
|
||||
public Result createCardNo(String id, String openId,String shopId) {
|
||||
public Result createCardNo(String id, String openId, String shopId) {
|
||||
if (ObjectUtil.isEmpty(id) || ObjectUtil.isEmpty(openId)) {
|
||||
return Result.fail("head 信息不允许为空");
|
||||
}
|
||||
|
|
@ -266,59 +230,32 @@ public class LoginService {
|
|||
}
|
||||
|
||||
|
||||
TbShopUser tbShopUser= tbShopUserMapper.selectByUserIdAndShopId(userInfo.getId().toString(),shopId);
|
||||
if(ObjectUtil.isEmpty(tbShopUser)||tbShopUser==null){
|
||||
TbShopUser tbShopUser = tbShopUserMapper.selectByUserIdAndShopId(userInfo.getId().toString(), shopId);
|
||||
if (ObjectUtil.isEmpty(tbShopUser) || tbShopUser == null) {
|
||||
return Result.fail("用户信息错误");
|
||||
}
|
||||
|
||||
String dynamicCode = RandomUtil.randomNumbers(8);
|
||||
dynamicCode= StringUtils.rightPad(tbShopUser.getId(),6,"0").concat(dynamicCode);
|
||||
dynamicCode = StringUtils.rightPad(tbShopUser.getId(), 6, "0").concat(dynamicCode);
|
||||
|
||||
tbShopUser.setDynamicCode(dynamicCode);
|
||||
tbShopUser.setUpdatedAt(System.currentTimeMillis());
|
||||
tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser);
|
||||
|
||||
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, dynamicCode);
|
||||
}
|
||||
|
||||
|
||||
public Result userInfo(Integer userId, String shopId) {
|
||||
public Result userInfo(Integer userId) {
|
||||
TbUserInfo tbUserInfo = tbUserInfoMapper.selectByPrimaryKey(userId);
|
||||
|
||||
if (tbUserInfo == null) {
|
||||
return Result.success(CodeEnum.ENCRYPT, new ArrayList());
|
||||
}
|
||||
|
||||
|
||||
TbShopInfo tbShopInfo = null;
|
||||
if (ObjectUtil.isEmpty(shopId)) {
|
||||
tbShopInfo = tbShopInfoMapper.selectByPhone(defaultPhone);
|
||||
} else {
|
||||
tbShopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(shopId));
|
||||
}
|
||||
|
||||
TbShopUser tbShopUser = null;
|
||||
Map<String, String> shopMap = new HashMap<>();
|
||||
if (ObjectUtil.isNotEmpty(tbShopInfo)) {
|
||||
tbShopUser = tbShopUserMapper.selectByUserIdAndShopId(tbUserInfo.getId().toString(), tbShopInfo.getId().toString());
|
||||
shopMap.put("shopId", tbShopUser.getShopId());
|
||||
shopMap.put("name", tbShopInfo.getShopName());
|
||||
shopMap.put("amount", BigDecimal.ZERO.toPlainString());
|
||||
shopMap.put("levelConsume", BigDecimal.ZERO.toPlainString());
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("userInfo", tbUserInfo);
|
||||
map.put("shopUser", shopMap);
|
||||
map.put("shopInfo", tbShopInfo);
|
||||
|
||||
|
||||
return Result.success(CodeEnum.ENCRYPT, map);
|
||||
return Result.success(CodeEnum.ENCRYPT, tbUserInfo);
|
||||
}
|
||||
|
||||
public Result upUserInfo(TbUserInfo userInfo){
|
||||
public Result upUserInfo(TbUserInfo userInfo) {
|
||||
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,13 +6,16 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ProductInfoVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ProductVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.TagProductVO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.*;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.socket.AppWebSocketServer;
|
||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
||||
import com.chaozhanggui.system.cashierservice.util.LocationUtils;
|
||||
import com.chaozhanggui.system.cashierservice.util.Threads;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -20,14 +23,13 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
|
|
@ -135,8 +137,116 @@ public class ProductService {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
* 首页底部列表
|
||||
* 爆品上新
|
||||
* 销量榜
|
||||
* 咖啡饮品
|
||||
*/
|
||||
public List<HomeVO> products(HomeDto homeDto) throws ExecutionException, InterruptedException {
|
||||
PageHelper.startPage(homeDto.getPage(), homeDto.getSize());
|
||||
|
||||
public Result productInfo(Integer productId) throws Exception {
|
||||
//经纬度(附近一km)
|
||||
Map<String, double[]> topAndBottomMap = LocationUtils.returnLLSquarePoint(
|
||||
Double.parseDouble(homeDto.getLng()), Double.parseDouble(homeDto.getLat()), homeDto.getDistanceInKm());
|
||||
List<CouAndShopVo> tbMerchantCoupons = merchantCouponMapper.queryAllByPage(
|
||||
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<HomeVO> homeVOList = new ArrayList<>();
|
||||
for (CouAndShopVo o : tbMerchantCoupons) {
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
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())) {
|
||||
//原价
|
||||
if (tbProductSku.getSalePrice().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.setRealSalesNumber(new BigDecimal(o.getNumber()));
|
||||
//现价
|
||||
homeVO.setSalePrice(new BigDecimal(o.getAmount().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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 团购卷详情
|
||||
*
|
||||
* @param productId 团购卷Id
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Result productInfo(Integer productId,String environment) throws Exception {
|
||||
TbMerchantCoupon tbMerchantCoupon = merchantCouponMapper.queryById(productId);
|
||||
|
||||
CompletableFuture<TbShopInfo> shopInfo = CompletableFuture.supplyAsync(() ->
|
||||
|
|
@ -148,7 +258,7 @@ public class ProductService {
|
|||
CompletableFuture<List<TagProductVO>> dictPro = CompletableFuture.supplyAsync(() ->
|
||||
tagProductDeptsMapper.queryTagByProductId(tbMerchantCoupon.getRelationIds()));
|
||||
CompletableFuture<TbPurchaseNotice> purchaseNotice = CompletableFuture.supplyAsync(() ->
|
||||
purchaseNoticeMapper.queryById(tbMerchantCoupon.getId()));
|
||||
purchaseNoticeMapper.queryByCouponId(tbMerchantCoupon.getId()));
|
||||
Threads.call(shopInfo, product, productSku, dictPro);
|
||||
|
||||
ProductInfoVo productInfo = new ProductInfoVo();
|
||||
|
|
@ -195,18 +305,15 @@ public class ProductService {
|
|||
}
|
||||
productVo.getFoods().add(food);
|
||||
productInfo.getProductList().add(productVo);
|
||||
|
||||
productInfo.setPurchaseNotice(purchaseNotice.get());
|
||||
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);
|
||||
}
|
||||
productInfo.setNoticeTag(JSONUtil.parseListTNewList(tbPlatformDicts, TagVo.class));
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, productInfo);
|
||||
}
|
||||
|
||||
private List<String> tagList(String tag) {
|
||||
if (tag == null) {
|
||||
return new ArrayList<>();
|
||||
} else {
|
||||
String[] arr = tag.split(",");
|
||||
return new ArrayList<>(Arrays.asList(arr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,19 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.SysDictDetailMapper">
|
||||
|
||||
<select id="selectByAll" resultType="com.chaozhanggui.system.cashierservice.entity.SysDict">
|
||||
select * from sys_dict
|
||||
<select id="selectHot" resultType="com.chaozhanggui.system.cashierservice.entity.SysDict">
|
||||
select *
|
||||
from sys_dict
|
||||
where type = 'hot'
|
||||
</select>
|
||||
|
||||
<select id="selectByType" resultType="com.chaozhanggui.system.cashierservice.entity.SysDict">
|
||||
select *
|
||||
from sys_dict
|
||||
where type = 'common'
|
||||
<if test="type != null and type !=''">
|
||||
or type = #{type}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectByDictId" resultType="com.chaozhanggui.system.cashierservice.entity.SysDictDetail">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
<?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.TbCouponCategoryMapper">
|
||||
|
||||
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbCouponCategory" id="TbCouponCategoryMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="status" column="status" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
, name, create_time, update_time, status </sql>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="TbCouponCategoryMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_coupon_category
|
||||
where id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
@ -12,6 +12,7 @@
|
|||
<result property="fromTime" column="from_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="toTime" column="to_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="limitNumber" column="limit_number" jdbcType="VARCHAR"/>
|
||||
<result property="useNumber" column="use_number" jdbcType="VARCHAR"/>
|
||||
<result property="number" column="number" jdbcType="INTEGER"/>
|
||||
<result property="leftNumber" column="left_number" jdbcType="VARCHAR"/>
|
||||
<result property="amount" column="amount" jdbcType="NUMERIC"/>
|
||||
|
|
@ -42,232 +43,11 @@
|
|||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="TbMerchantCouponMap">
|
||||
select
|
||||
id, status, title, template_id, shop_id, shop_snap, from_time, to_time, limit_number, number, left_number, amount, limit_amount, is_show, pic, type, ratio, max_ratio_amount, track, class_type, effect_type, effect_days, relation_ids, relation_list, editor, note, created_at, updated_at, furnish_meal, furnish_express, furnish_draw, furnish_vir, disable_distribute, merchant_id
|
||||
id, status, title, template_id, shop_id, shop_snap, from_time, to_time, limit_number,use_number, number, left_number, amount, limit_amount, is_show, pic, type, ratio, max_ratio_amount, track, class_type, effect_type, effect_days, relation_ids, relation_list, editor, note, created_at, updated_at, furnish_meal, furnish_express, furnish_draw, furnish_vir, disable_distribute, merchant_id
|
||||
from tb_merchant_coupon
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="TbMerchantCouponMap">
|
||||
select
|
||||
id, status, title, template_id, shop_id, shop_snap, from_time, to_time, limit_number, number, left_number, amount, limit_amount, is_show, pic, type, ratio, max_ratio_amount, track, class_type, effect_type, effect_days, relation_ids, relation_list, editor, note, created_at, updated_at, furnish_meal, furnish_express, furnish_draw, furnish_vir, disable_distribute, merchant_id
|
||||
from tb_merchant_coupon
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
and status = #{status}
|
||||
</if>
|
||||
<if test="title != null and title != ''">
|
||||
and title = #{title}
|
||||
</if>
|
||||
<if test="templateId != null and templateId != ''">
|
||||
and template_id = #{templateId}
|
||||
</if>
|
||||
<if test="shopId != null and shopId != ''">
|
||||
and shop_id = #{shopId}
|
||||
</if>
|
||||
<if test="shopSnap != null and shopSnap != ''">
|
||||
and shop_snap = #{shopSnap}
|
||||
</if>
|
||||
<if test="fromTime != null">
|
||||
and from_time = #{fromTime}
|
||||
</if>
|
||||
<if test="toTime != null">
|
||||
and to_time = #{toTime}
|
||||
</if>
|
||||
<if test="limitNumber != null and limitNumber != ''">
|
||||
and limit_number = #{limitNumber}
|
||||
</if>
|
||||
<if test="number != null">
|
||||
and number = #{number}
|
||||
</if>
|
||||
<if test="leftNumber != null and leftNumber != ''">
|
||||
and left_number = #{leftNumber}
|
||||
</if>
|
||||
<if test="amount != null">
|
||||
and amount = #{amount}
|
||||
</if>
|
||||
<if test="limitAmount != null">
|
||||
and limit_amount = #{limitAmount}
|
||||
</if>
|
||||
<if test="isShow != null">
|
||||
and is_show = #{isShow}
|
||||
</if>
|
||||
<if test="pic != null and pic != ''">
|
||||
and pic = #{pic}
|
||||
</if>
|
||||
<if test="type != null">
|
||||
and type = #{type}
|
||||
</if>
|
||||
<if test="ratio != null">
|
||||
and ratio = #{ratio}
|
||||
</if>
|
||||
<if test="maxRatioAmount != null">
|
||||
and max_ratio_amount = #{maxRatioAmount}
|
||||
</if>
|
||||
<if test="track != null and track != ''">
|
||||
and track = #{track}
|
||||
</if>
|
||||
<if test="classType != null and classType != ''">
|
||||
and class_type = #{classType}
|
||||
</if>
|
||||
<if test="effectType != null">
|
||||
and effect_type = #{effectType}
|
||||
</if>
|
||||
<if test="effectDays != null">
|
||||
and effect_days = #{effectDays}
|
||||
</if>
|
||||
<if test="relationIds != null and relationIds != ''">
|
||||
and relation_ids = #{relationIds}
|
||||
</if>
|
||||
<if test="relationList != null and relationList != ''">
|
||||
and relation_list = #{relationList}
|
||||
</if>
|
||||
<if test="editor != null and editor != ''">
|
||||
and editor = #{editor}
|
||||
</if>
|
||||
<if test="note != null and note != ''">
|
||||
and note = #{note}
|
||||
</if>
|
||||
<if test="createdAt != null">
|
||||
and created_at = #{createdAt}
|
||||
</if>
|
||||
<if test="updatedAt != null">
|
||||
and updated_at = #{updatedAt}
|
||||
</if>
|
||||
<if test="furnishMeal != null">
|
||||
and furnish_meal = #{furnishMeal}
|
||||
</if>
|
||||
<if test="furnishExpress != null">
|
||||
and furnish_express = #{furnishExpress}
|
||||
</if>
|
||||
<if test="furnishDraw != null">
|
||||
and furnish_draw = #{furnishDraw}
|
||||
</if>
|
||||
<if test="furnishVir != null">
|
||||
and furnish_vir = #{furnishVir}
|
||||
</if>
|
||||
<if test="disableDistribute != null">
|
||||
and disable_distribute = #{disableDistribute}
|
||||
</if>
|
||||
<if test="merchantId != null and merchantId != ''">
|
||||
and merchant_id = #{merchantId}
|
||||
</if>
|
||||
</where>
|
||||
limit #{pageable.offset}, #{pageable.pageSize}
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from tb_merchant_coupon
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
and status = #{status}
|
||||
</if>
|
||||
<if test="title != null and title != ''">
|
||||
and title = #{title}
|
||||
</if>
|
||||
<if test="templateId != null and templateId != ''">
|
||||
and template_id = #{templateId}
|
||||
</if>
|
||||
<if test="shopId != null and shopId != ''">
|
||||
and shop_id = #{shopId}
|
||||
</if>
|
||||
<if test="shopSnap != null and shopSnap != ''">
|
||||
and shop_snap = #{shopSnap}
|
||||
</if>
|
||||
<if test="fromTime != null">
|
||||
and from_time = #{fromTime}
|
||||
</if>
|
||||
<if test="toTime != null">
|
||||
and to_time = #{toTime}
|
||||
</if>
|
||||
<if test="limitNumber != null and limitNumber != ''">
|
||||
and limit_number = #{limitNumber}
|
||||
</if>
|
||||
<if test="number != null">
|
||||
and number = #{number}
|
||||
</if>
|
||||
<if test="leftNumber != null and leftNumber != ''">
|
||||
and left_number = #{leftNumber}
|
||||
</if>
|
||||
<if test="amount != null">
|
||||
and amount = #{amount}
|
||||
</if>
|
||||
<if test="limitAmount != null">
|
||||
and limit_amount = #{limitAmount}
|
||||
</if>
|
||||
<if test="isShow != null">
|
||||
and is_show = #{isShow}
|
||||
</if>
|
||||
<if test="pic != null and pic != ''">
|
||||
and pic = #{pic}
|
||||
</if>
|
||||
<if test="type != null">
|
||||
and type = #{type}
|
||||
</if>
|
||||
<if test="ratio != null">
|
||||
and ratio = #{ratio}
|
||||
</if>
|
||||
<if test="maxRatioAmount != null">
|
||||
and max_ratio_amount = #{maxRatioAmount}
|
||||
</if>
|
||||
<if test="track != null and track != ''">
|
||||
and track = #{track}
|
||||
</if>
|
||||
<if test="classType != null and classType != ''">
|
||||
and class_type = #{classType}
|
||||
</if>
|
||||
<if test="effectType != null">
|
||||
and effect_type = #{effectType}
|
||||
</if>
|
||||
<if test="effectDays != null">
|
||||
and effect_days = #{effectDays}
|
||||
</if>
|
||||
<if test="relationIds != null and relationIds != ''">
|
||||
and relation_ids = #{relationIds}
|
||||
</if>
|
||||
<if test="relationList != null and relationList != ''">
|
||||
and relation_list = #{relationList}
|
||||
</if>
|
||||
<if test="editor != null and editor != ''">
|
||||
and editor = #{editor}
|
||||
</if>
|
||||
<if test="note != null and note != ''">
|
||||
and note = #{note}
|
||||
</if>
|
||||
<if test="createdAt != null">
|
||||
and created_at = #{createdAt}
|
||||
</if>
|
||||
<if test="updatedAt != null">
|
||||
and updated_at = #{updatedAt}
|
||||
</if>
|
||||
<if test="furnishMeal != null">
|
||||
and furnish_meal = #{furnishMeal}
|
||||
</if>
|
||||
<if test="furnishExpress != null">
|
||||
and furnish_express = #{furnishExpress}
|
||||
</if>
|
||||
<if test="furnishDraw != null">
|
||||
and furnish_draw = #{furnishDraw}
|
||||
</if>
|
||||
<if test="furnishVir != null">
|
||||
and furnish_vir = #{furnishVir}
|
||||
</if>
|
||||
<if test="disableDistribute != null">
|
||||
and disable_distribute = #{disableDistribute}
|
||||
</if>
|
||||
<if test="merchantId != null and merchantId != ''">
|
||||
and merchant_id = #{merchantId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="queryAllByPage" resultType="com.chaozhanggui.system.cashierservice.entity.vo.CouAndShopVo">
|
||||
SELECT
|
||||
cou.id as id,
|
||||
|
|
@ -285,7 +65,11 @@
|
|||
<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}
|
||||
|
|
@ -293,189 +77,21 @@
|
|||
</where>
|
||||
|
||||
<choose>
|
||||
<when test="order == '1'">
|
||||
<when test="orderBy == '1'">
|
||||
ORDER BY (ABS(info.lat - #{lat}) + ABS(info.lng - #{lng})) ASC
|
||||
</when>
|
||||
<when test="order == '2'">
|
||||
<when test="orderBy == '2'">
|
||||
ORDER BY cou.number ASC
|
||||
</when>
|
||||
<when test="order == '3'">
|
||||
<when test="orderBy == '3'">
|
||||
ORDER BY cou.amount ASC
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY cou.id ASC
|
||||
ORDER BY cou.id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
limit #{pageable}, #{sizeable}
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_merchant_coupon(status, title, template_id, shop_id, shop_snap, from_time, to_time, limit_number, number, left_number, amount, limit_amount, is_show, pic, type, ratio, max_ratio_amount, track, class_type, effect_type, effect_days, relation_ids, relation_list, editor, note, created_at, updated_at, furnish_meal, furnish_express, furnish_draw, furnish_vir, disable_distribute, merchant_id)
|
||||
values (#{status}, #{title}, #{templateId}, #{shopId}, #{shopSnap}, #{fromTime}, #{toTime}, #{limitNumber}, #{number}, #{leftNumber}, #{amount}, #{limitAmount}, #{isShow}, #{pic}, #{type}, #{ratio}, #{maxRatioAmount}, #{track}, #{classType}, #{effectType}, #{effectDays}, #{relationIds}, #{relationList}, #{editor}, #{note}, #{createdAt}, #{updatedAt}, #{furnishMeal}, #{furnishExpress}, #{furnishDraw}, #{furnishVir}, #{disableDistribute}, #{merchantId})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_merchant_coupon(status, title, template_id, shop_id, shop_snap, from_time, to_time, limit_number, number, left_number, amount, limit_amount, is_show, pic, type, ratio, max_ratio_amount, track, class_type, effect_type, effect_days, relation_ids, relation_list, editor, note, created_at, updated_at, furnish_meal, furnish_express, furnish_draw, furnish_vir, disable_distribute, merchant_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.status}, #{entity.title}, #{entity.templateId}, #{entity.shopId}, #{entity.shopSnap}, #{entity.fromTime}, #{entity.toTime}, #{entity.limitNumber}, #{entity.number}, #{entity.leftNumber}, #{entity.amount}, #{entity.limitAmount}, #{entity.isShow}, #{entity.pic}, #{entity.type}, #{entity.ratio}, #{entity.maxRatioAmount}, #{entity.track}, #{entity.classType}, #{entity.effectType}, #{entity.effectDays}, #{entity.relationIds}, #{entity.relationList}, #{entity.editor}, #{entity.note}, #{entity.createdAt}, #{entity.updatedAt}, #{entity.furnishMeal}, #{entity.furnishExpress}, #{entity.furnishDraw}, #{entity.furnishVir}, #{entity.disableDistribute}, #{entity.merchantId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_merchant_coupon(status, title, template_id, shop_id, shop_snap, from_time, to_time, limit_number, number, left_number, amount, limit_amount, is_show, pic, type, ratio, max_ratio_amount, track, class_type, effect_type, effect_days, relation_ids, relation_list, editor, note, created_at, updated_at, furnish_meal, furnish_express, furnish_draw, furnish_vir, disable_distribute, merchant_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.status}, #{entity.title}, #{entity.templateId}, #{entity.shopId}, #{entity.shopSnap}, #{entity.fromTime}, #{entity.toTime}, #{entity.limitNumber}, #{entity.number}, #{entity.leftNumber}, #{entity.amount}, #{entity.limitAmount}, #{entity.isShow}, #{entity.pic}, #{entity.type}, #{entity.ratio}, #{entity.maxRatioAmount}, #{entity.track}, #{entity.classType}, #{entity.effectType}, #{entity.effectDays}, #{entity.relationIds}, #{entity.relationList}, #{entity.editor}, #{entity.note}, #{entity.createdAt}, #{entity.updatedAt}, #{entity.furnishMeal}, #{entity.furnishExpress}, #{entity.furnishDraw}, #{entity.furnishVir}, #{entity.disableDistribute}, #{entity.merchantId})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
status = values(status),
|
||||
title = values(title),
|
||||
template_id = values(template_id),
|
||||
shop_id = values(shop_id),
|
||||
shop_snap = values(shop_snap),
|
||||
from_time = values(from_time),
|
||||
to_time = values(to_time),
|
||||
limit_number = values(limit_number),
|
||||
number = values(number),
|
||||
left_number = values(left_number),
|
||||
amount = values(amount),
|
||||
limit_amount = values(limit_amount),
|
||||
is_show = values(is_show),
|
||||
pic = values(pic),
|
||||
type = values(type),
|
||||
ratio = values(ratio),
|
||||
max_ratio_amount = values(max_ratio_amount),
|
||||
track = values(track),
|
||||
class_type = values(class_type),
|
||||
effect_type = values(effect_type),
|
||||
effect_days = values(effect_days),
|
||||
relation_ids = values(relation_ids),
|
||||
relation_list = values(relation_list),
|
||||
editor = values(editor),
|
||||
note = values(note),
|
||||
created_at = values(created_at),
|
||||
updated_at = values(updated_at),
|
||||
furnish_meal = values(furnish_meal),
|
||||
furnish_express = values(furnish_express),
|
||||
furnish_draw = values(furnish_draw),
|
||||
furnish_vir = values(furnish_vir),
|
||||
disable_distribute = values(disable_distribute),
|
||||
merchant_id = values(merchant_id)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update tb_merchant_coupon
|
||||
<set>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="title != null and title != ''">
|
||||
title = #{title},
|
||||
</if>
|
||||
<if test="templateId != null and templateId != ''">
|
||||
template_id = #{templateId},
|
||||
</if>
|
||||
<if test="shopId != null and shopId != ''">
|
||||
shop_id = #{shopId},
|
||||
</if>
|
||||
<if test="shopSnap != null and shopSnap != ''">
|
||||
shop_snap = #{shopSnap},
|
||||
</if>
|
||||
<if test="fromTime != null">
|
||||
from_time = #{fromTime},
|
||||
</if>
|
||||
<if test="toTime != null">
|
||||
to_time = #{toTime},
|
||||
</if>
|
||||
<if test="limitNumber != null and limitNumber != ''">
|
||||
limit_number = #{limitNumber},
|
||||
</if>
|
||||
<if test="number != null">
|
||||
number = #{number},
|
||||
</if>
|
||||
<if test="leftNumber != null and leftNumber != ''">
|
||||
left_number = #{leftNumber},
|
||||
</if>
|
||||
<if test="amount != null">
|
||||
amount = #{amount},
|
||||
</if>
|
||||
<if test="limitAmount != null">
|
||||
limit_amount = #{limitAmount},
|
||||
</if>
|
||||
<if test="isShow != null">
|
||||
is_show = #{isShow},
|
||||
</if>
|
||||
<if test="pic != null and pic != ''">
|
||||
pic = #{pic},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
type = #{type},
|
||||
</if>
|
||||
<if test="ratio != null">
|
||||
ratio = #{ratio},
|
||||
</if>
|
||||
<if test="maxRatioAmount != null">
|
||||
max_ratio_amount = #{maxRatioAmount},
|
||||
</if>
|
||||
<if test="track != null and track != ''">
|
||||
track = #{track},
|
||||
</if>
|
||||
<if test="classType != null and classType != ''">
|
||||
class_type = #{classType},
|
||||
</if>
|
||||
<if test="effectType != null">
|
||||
effect_type = #{effectType},
|
||||
</if>
|
||||
<if test="effectDays != null">
|
||||
effect_days = #{effectDays},
|
||||
</if>
|
||||
<if test="relationIds != null and relationIds != ''">
|
||||
relation_ids = #{relationIds},
|
||||
</if>
|
||||
<if test="relationList != null and relationList != ''">
|
||||
relation_list = #{relationList},
|
||||
</if>
|
||||
<if test="editor != null and editor != ''">
|
||||
editor = #{editor},
|
||||
</if>
|
||||
<if test="note != null and note != ''">
|
||||
note = #{note},
|
||||
</if>
|
||||
<if test="createdAt != null">
|
||||
created_at = #{createdAt},
|
||||
</if>
|
||||
<if test="updatedAt != null">
|
||||
updated_at = #{updatedAt},
|
||||
</if>
|
||||
<if test="furnishMeal != null">
|
||||
furnish_meal = #{furnishMeal},
|
||||
</if>
|
||||
<if test="furnishExpress != null">
|
||||
furnish_express = #{furnishExpress},
|
||||
</if>
|
||||
<if test="furnishDraw != null">
|
||||
furnish_draw = #{furnishDraw},
|
||||
</if>
|
||||
<if test="furnishVir != null">
|
||||
furnish_vir = #{furnishVir},
|
||||
</if>
|
||||
<if test="disableDistribute != null">
|
||||
disable_distribute = #{disableDistribute},
|
||||
</if>
|
||||
<if test="merchantId != null and merchantId != ''">
|
||||
merchant_id = #{merchantId},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete from tb_merchant_coupon where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@
|
|||
, 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 id="queryByCouponId" resultMap="TbPurchaseNoticeMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
from tb_purchase_notice
|
||||
where id = #{id}
|
||||
where coupon_id = #{couponId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -598,7 +598,7 @@
|
|||
</select>
|
||||
|
||||
<select id="selectByPhone" resultMap="BaseResultMap">
|
||||
select * from tb_user_info where telephone=#{phone} AND source_path='APP' AND user_id is null
|
||||
select * from tb_user_info where telephone=#{phone}
|
||||
</select>
|
||||
<select id="selectAll" resultType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo">
|
||||
select * from tb_user_info
|
||||
|
|
|
|||
Loading…
Reference in New Issue