Merge branch 'master' of https://e.coding.net/g-cphe0354/shouyinjixitong/wx-cashier-service
This commit is contained in:
commit
42c54ca731
5
pom.xml
5
pom.xml
|
|
@ -62,6 +62,11 @@
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>dysmsapi20170525</artifactId>
|
||||||
|
<version>2.0.21</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,132 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.auth;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
||||||
|
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||||
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
|
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.servlet.*;
|
||||||
|
import javax.servlet.annotation.WebFilter;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录的拦截器
|
||||||
|
* 目前仅限APP使用
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@WebFilter(filterName = "LoginFilter", urlPatterns = "/*")
|
||||||
|
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/**"//登录部分接口不校验
|
||||||
|
);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登陆过滤器具体实现
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
|
||||||
|
HttpServletRequest request = (HttpServletRequest) req;
|
||||||
|
HttpServletResponse response = (HttpServletResponse) resp;
|
||||||
|
response.setCharacterEncoding("UTF-8");
|
||||||
|
response.setContentType("application/json; charset=utf-8");
|
||||||
|
// OPTIONS请求类型不做校验
|
||||||
|
if (request.getMethod().equalsIgnoreCase("OPTIONS")) {
|
||||||
|
chain.doFilter(req, resp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 获取请求地址
|
||||||
|
String url = request.getRequestURI();
|
||||||
|
// 不需要授权的接口直接访问的地址
|
||||||
|
if (containsUrl(NOT_LOGIN_URL, url)) {
|
||||||
|
chain.doFilter(req, resp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//environment 环境标识 wx app 后续environment不可为空
|
||||||
|
String environment = request.getHeader("environment");
|
||||||
|
//token校验目前只对app生效
|
||||||
|
if (StringUtils.isBlank(environment) || !environment.equals("app")) {
|
||||||
|
chain.doFilter(req, resp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断用户TOKEN是否存在
|
||||||
|
String token = request.getHeader("token");
|
||||||
|
if (StringUtils.isBlank(token)) {
|
||||||
|
Result result = new Result(CodeEnum.TOKEN_EXEIST);
|
||||||
|
String jsonString = JSONObject.toJSONString(result);
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(jsonString, JSONObject.class);
|
||||||
|
response.getWriter().print(jsonObject);
|
||||||
|
response.getWriter().flush();//流里边的缓存刷出
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//获取当前登录人的用户id
|
||||||
|
String loginName = TokenUtil.parseParamFromToken(token, "userId").toString();
|
||||||
|
//获取redis中的token
|
||||||
|
String message = redisUtil.getMessage(RedisCst.ONLINE_APP_USER.concat(loginName));
|
||||||
|
if (StringUtils.isBlank(message)) {
|
||||||
|
Result result = new Result(CodeEnum.TOKEN_EXPIRED);
|
||||||
|
String jsonString = JSONObject.toJSONString(result);
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(jsonString, JSONObject.class);
|
||||||
|
response.getWriter().print(jsonObject);
|
||||||
|
response.getWriter().flush();//流里边的缓存刷出
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String redisToken = JSON.parseObject(message).getString("token");
|
||||||
|
if (!token.equals(redisToken)) {
|
||||||
|
Result result = new Result(CodeEnum.TOKEN_EXPIRED);
|
||||||
|
String jsonString = JSONObject.toJSONString(result);
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(jsonString, JSONObject.class);
|
||||||
|
response.getWriter().print(jsonObject);
|
||||||
|
response.getWriter().flush();//流里边的缓存刷出
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
chain.doFilter(req, resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断url请求是否配置在urls列表中
|
||||||
|
*/
|
||||||
|
private boolean containsUrl(List<String> urls, String url) {
|
||||||
|
if (urls == null || urls.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (String s : urls) {
|
||||||
|
if (s.endsWith("**")) {
|
||||||
|
if (url.startsWith("/" + s.substring(0, s.length() - 2))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (url.equals("/" + s)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.config;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.servlet.*;
|
||||||
|
import javax.servlet.annotation.WebFilter;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跨域过滤器
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@Order(1)
|
||||||
|
@WebFilter(filterName = "CorsFilter", urlPatterns = "/*")
|
||||||
|
public class CorsFilter implements Filter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain)
|
||||||
|
throws IOException, ServletException {
|
||||||
|
HttpServletResponse response = (HttpServletResponse) resp;
|
||||||
|
HttpServletRequest reqs = (HttpServletRequest) req;
|
||||||
|
String curOrigin = reqs.getHeader("Origin");
|
||||||
|
response.setHeader("Access-Control-Allow-Origin", curOrigin == null ? "true" : curOrigin);
|
||||||
|
response.setHeader("Access-Control-Allow-Methods", "*");
|
||||||
|
response.setHeader("Access-Control-Max-Age", "3600");
|
||||||
|
response.setHeader("Access-Control-Allow-Headers", "x-requested-with,signature");
|
||||||
|
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||||
|
chain.doFilter(req, resp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
|
||||||
|
import com.chaozhanggui.system.cashierservice.service.HomePageService;
|
||||||
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lyf
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/home")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class HomeController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private HomePageService homePageService;
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public Result homePage(@RequestBody HomeDto homeDto){
|
||||||
|
return homePageService.homePage(homeDto);
|
||||||
|
}
|
||||||
|
@PostMapping("/homePageUp")
|
||||||
|
public Result homePageUp(@RequestHeader("environment") String environment){
|
||||||
|
return homePageService.homePageUp(environment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.controller;
|
||||||
|
|
||||||
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
|
import com.chaozhanggui.system.cashierservice.util.LocationUtils;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "*")
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
@RequestMapping("/location")
|
||||||
|
public class LocationController {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行政区域查询
|
||||||
|
*
|
||||||
|
* @param keywords citycode市、adcode区
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/district")
|
||||||
|
public Result createOrder(String keywords) throws JsonProcessingException {
|
||||||
|
String district = LocationUtils.district(keywords);
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
// 将 JSON 字符串解析为 JsonNode 对象
|
||||||
|
JsonNode jsonNode = mapper.readTree(district);
|
||||||
|
JsonNode districts = jsonNode.get("districts");
|
||||||
|
|
||||||
|
|
||||||
|
return Result.success(CodeEnum.SUCCESS, districts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,5 @@
|
||||||
package com.chaozhanggui.system.cashierservice.controller;
|
package com.chaozhanggui.system.cashierservice.controller;
|
||||||
|
|
||||||
|
|
||||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
|
||||||
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
|
|
||||||
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
|
|
||||||
import cn.binarywang.wx.miniapp.util.crypt.WxMaCryptUtils;
|
import cn.binarywang.wx.miniapp.util.crypt.WxMaCryptUtils;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
|
@ -12,17 +8,20 @@ import com.chaozhanggui.system.cashierservice.dao.TbMerchantAccountMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbMerchantAccount;
|
import com.chaozhanggui.system.cashierservice.entity.TbMerchantAccount;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.AuthUserDto;
|
import com.chaozhanggui.system.cashierservice.entity.dto.AuthUserDto;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.OnlineUserDto;
|
import com.chaozhanggui.system.cashierservice.entity.dto.OnlineUserDto;
|
||||||
|
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
||||||
|
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.service.LoginService;
|
import com.chaozhanggui.system.cashierservice.service.LoginService;
|
||||||
import com.chaozhanggui.system.cashierservice.service.OnlineUserService;
|
import com.chaozhanggui.system.cashierservice.service.OnlineUserService;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import com.chaozhanggui.system.cashierservice.util.IpUtil;
|
import com.chaozhanggui.system.cashierservice.util.IpUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
|
||||||
import com.chaozhanggui.system.cashierservice.util.MD5Utils;
|
import com.chaozhanggui.system.cashierservice.util.MD5Utils;
|
||||||
import com.chaozhanggui.system.cashierservice.util.StringUtil;
|
import com.chaozhanggui.system.cashierservice.util.StringUtil;
|
||||||
|
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.wxUtil.WechatUtil;
|
import com.chaozhanggui.system.cashierservice.wxUtil.WechatUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
@ -58,6 +57,8 @@ public class LoginContoller {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
TbMerchantAccountMapper merchantAccountMapper;
|
TbMerchantAccountMapper merchantAccountMapper;
|
||||||
|
@Autowired
|
||||||
|
RedisUtil redisUtil;
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping("/wx/business/login")
|
@RequestMapping("/wx/business/login")
|
||||||
|
|
@ -89,11 +90,6 @@ public class LoginContoller {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping("/wx/custom/login")
|
@RequestMapping("/wx/custom/login")
|
||||||
public Result wxCustomLogin(HttpServletRequest request, @RequestBody Map<String, String> map
|
public Result wxCustomLogin(HttpServletRequest request, @RequestBody Map<String, String> map
|
||||||
// ,
|
// ,
|
||||||
|
|
@ -209,6 +205,7 @@ public class LoginContoller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取会员码
|
* 获取会员码
|
||||||
|
*
|
||||||
* @param openId
|
* @param openId
|
||||||
* @param token
|
* @param token
|
||||||
* @param id
|
* @param id
|
||||||
|
|
@ -225,5 +222,62 @@ public class LoginContoller {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户注册
|
||||||
|
* phone 手机号
|
||||||
|
* nickName 用户昵称
|
||||||
|
* password 密码
|
||||||
|
* code 验证码
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
// @PostMapping("register")
|
||||||
|
// public Result register(@RequestBody TbUserInfo userInfo) {
|
||||||
|
// boolean tf = loginService.validate(userInfo.getCode(), userInfo.getTelephone());
|
||||||
|
// if (tf) {
|
||||||
|
// return loginService.register(userInfo.getTelephone(), userInfo.getPassword(), userInfo.getNickName());
|
||||||
|
// } else {
|
||||||
|
// return Result.fail("验证码校验失败");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App登录用户端的请求接口 登录即注册
|
||||||
|
* 查看 {@link com.chaozhanggui.system.cashierservice.entity.dto.AuthUserDto}
|
||||||
|
* username 手机号
|
||||||
|
* password 密码登录时使用
|
||||||
|
* code 验证码登录时使用
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/app/login")
|
||||||
|
public Result applogin(@RequestBody AuthUserDto authUserDto) {
|
||||||
|
if (ObjectUtil.isNull(authUserDto.getCode())) {
|
||||||
|
if(StringUtils.isBlank(authUserDto.getPassword())){
|
||||||
|
return Result.fail("请输入密码,或使用验证码登录");
|
||||||
|
}
|
||||||
|
//验证密码
|
||||||
|
String mdPasswordString = MD5Utils.MD5Encode(authUserDto.getPassword(), "utf-8");
|
||||||
|
return loginService.appLogin(authUserDto.getUsername(), mdPasswordString);
|
||||||
|
} else {
|
||||||
|
boolean tf = loginService.validate(authUserDto.getCode(), authUserDto.getUsername());
|
||||||
|
if (tf) {
|
||||||
|
return loginService.appLogin(authUserDto.getUsername(), null);
|
||||||
|
} else {
|
||||||
|
return Result.fail("验证码输入有误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//退出登录的接口
|
||||||
|
@PostMapping("/loginOut")
|
||||||
|
public Result loginOut(HttpServletRequest request) {
|
||||||
|
String token = request.getHeader("token");
|
||||||
|
//获取当前登录人的账号
|
||||||
|
String userId = TokenUtil.parseParamFromToken(token, "userId").toString();
|
||||||
|
redisUtil.deleteByKey(RedisCst.ONLINE_APP_USER.concat(userId));
|
||||||
|
return Result.success(CodeEnum.SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.controller;
|
||||||
|
|
||||||
|
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||||
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
|
import com.chaozhanggui.system.cashierservice.util.RedisUtils;
|
||||||
|
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 javax.annotation.Resource;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lyf
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/phoneValidateCode")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class PhoneValidateCodeController {
|
||||||
|
|
||||||
|
private final ValidateCodeUtil validateCodeUtil;
|
||||||
|
@Resource
|
||||||
|
private RedisUtils redisUtils;
|
||||||
|
/**
|
||||||
|
* 一分钟
|
||||||
|
*/
|
||||||
|
protected static final long ONE_MINUTE = 60;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送短信验证码
|
||||||
|
* @param phone
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
public Result verifyPhoneIsExist(@RequestParam String phone) {
|
||||||
|
if (StringUtils.isBlank(phone)) {
|
||||||
|
return Result.fail("手机号不可为空!");
|
||||||
|
}
|
||||||
|
String random = StringUtil.random(6);
|
||||||
|
validateCodeUtil.requestValidateCodeAli(phone, random);
|
||||||
|
//存入缓存
|
||||||
|
try {
|
||||||
|
redisUtils.set(phone,random,ONE_MINUTE,TimeUnit.SECONDS);
|
||||||
|
}catch (Exception e){
|
||||||
|
throw new MsgException("验证码发送失败");
|
||||||
|
}
|
||||||
|
return Result.success(CodeEnum.SUCCESS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.dao;
|
||||||
|
|
||||||
|
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (TbPlatformDict)表数据库访问层
|
||||||
|
*
|
||||||
|
* @author lyf
|
||||||
|
* @since 2024-04-01 14:38:09
|
||||||
|
*/
|
||||||
|
public interface TbPlatformDictMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过ID查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
TbPlatformDict queryById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询指定行数据
|
||||||
|
*
|
||||||
|
* @param tbPlatformDict 查询条件
|
||||||
|
* @param pageable 分页对象
|
||||||
|
* @return 对象列表
|
||||||
|
*/
|
||||||
|
List<TbPlatformDict> queryAllByLimit(TbPlatformDict tbPlatformDict, @Param("pageable") Pageable pageable);
|
||||||
|
|
||||||
|
List<TbPlatformDict> queryAllByType(@Param("type") String type,@Param("environment") String environment);
|
||||||
|
/**
|
||||||
|
* 统计总行数
|
||||||
|
*
|
||||||
|
* @param tbPlatformDict 查询条件
|
||||||
|
* @return 总行数
|
||||||
|
*/
|
||||||
|
long count(TbPlatformDict tbPlatformDict);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*
|
||||||
|
* @param tbPlatformDict 实例对象
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int insert(TbPlatformDict tbPlatformDict);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增数据(MyBatis原生foreach方法)
|
||||||
|
*
|
||||||
|
* @param entities List<TbPlatformDict> 实例对象列表
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int insertBatch(@Param("entities") List<TbPlatformDict> entities);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||||
|
*
|
||||||
|
* @param entities List<TbPlatformDict> 实例对象列表
|
||||||
|
* @return 影响行数
|
||||||
|
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||||
|
*/
|
||||||
|
int insertOrUpdateBatch(@Param("entities") List<TbPlatformDict> entities);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*
|
||||||
|
* @param tbPlatformDict 实例对象
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int update(TbPlatformDict tbPlatformDict);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int deleteById(Integer id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -31,4 +31,6 @@ public interface TbProductSkuMapper {
|
||||||
void updateAddStockById(@Param("skuId") String skuId, @Param("num") Integer num);
|
void updateAddStockById(@Param("skuId") String skuId, @Param("num") Integer num);
|
||||||
|
|
||||||
List<TbProductSku> selectAll();
|
List<TbProductSku> selectAll();
|
||||||
|
|
||||||
|
List<TbProductSku> selectDownSku(@Param("list") List<Integer> productId);
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +1,14 @@
|
||||||
package com.chaozhanggui.system.cashierservice.dao;
|
package com.chaozhanggui.system.cashierservice.dao;
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
|
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.vo.HomeVO;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.vo.UserDutyVo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface TbShopInfoMapper {
|
public interface TbShopInfoMapper {
|
||||||
|
|
@ -24,4 +29,8 @@ public interface TbShopInfoMapper {
|
||||||
TbShopInfo selectByQrCode(String qrcode);
|
TbShopInfo selectByQrCode(String qrcode);
|
||||||
|
|
||||||
TbShopInfo selectByPhone(String phone);
|
TbShopInfo selectByPhone(String phone);
|
||||||
|
|
||||||
|
List<HomeVO> selectShopInfo(@Param("page")Integer page, @Param("size")Integer size);
|
||||||
|
|
||||||
|
List<UserDutyVo> searchUserDutyDetail(@Param("list") List<Integer> productId);
|
||||||
}
|
}
|
||||||
|
|
@ -22,5 +22,20 @@ public interface TbUserInfoMapper {
|
||||||
|
|
||||||
TbUserInfo selectByOpenId(String openId);
|
TbUserInfo selectByOpenId(String openId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过手机号查询
|
||||||
|
* @param phone
|
||||||
|
* @param source 公众号 WECHAT 小程序 WECHAT-APP 手机注册 TELEPHONE 移动端 APP
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
TbUserInfo selectUserByPhone(String phone,String source);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询来源为APP 未绑定微信用户的 用户数据
|
||||||
|
* @param phone
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
TbUserInfo selectByPhone(String phone);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,194 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (TbPlatformDict)实体类
|
||||||
|
*
|
||||||
|
* @author lyf
|
||||||
|
* @since 2024-04-01 14:42:50
|
||||||
|
*/
|
||||||
|
public class TbPlatformDict implements Serializable {
|
||||||
|
private static final long serialVersionUID = -34581903392247717L;
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 描述 同类型下 name唯一
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* homeDistrict--金刚区(首页) carousel--轮播图 tag--标签
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
/**
|
||||||
|
* 封面图
|
||||||
|
*/
|
||||||
|
private String coverImg;
|
||||||
|
/**
|
||||||
|
* 分享图
|
||||||
|
*/
|
||||||
|
private String shareImg;
|
||||||
|
/**
|
||||||
|
* 视频URL地址
|
||||||
|
*/
|
||||||
|
private String video;
|
||||||
|
/**
|
||||||
|
* 视频封面图
|
||||||
|
*/
|
||||||
|
private String videoCoverImg;
|
||||||
|
/**
|
||||||
|
* 相对跳转地址
|
||||||
|
*/
|
||||||
|
private String relUrl;
|
||||||
|
/**
|
||||||
|
* 绝对跳转地址
|
||||||
|
*/
|
||||||
|
private String absUrl;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Long createdAt;
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Long updatedAt;
|
||||||
|
/**
|
||||||
|
* 收银端展示 0:不展示 1:展示
|
||||||
|
*/
|
||||||
|
private Integer isShowCash;
|
||||||
|
/**
|
||||||
|
* 小程序端展示 0:不展示 1:展示
|
||||||
|
*/
|
||||||
|
private Integer isShowMall;
|
||||||
|
/**
|
||||||
|
* APP端展示 0:不展示 1:展示
|
||||||
|
*/
|
||||||
|
private Integer isShowApp;
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
|
||||||
|
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 String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCoverImg() {
|
||||||
|
return coverImg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCoverImg(String coverImg) {
|
||||||
|
this.coverImg = coverImg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShareImg() {
|
||||||
|
return shareImg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShareImg(String shareImg) {
|
||||||
|
this.shareImg = shareImg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVideo() {
|
||||||
|
return video;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVideo(String video) {
|
||||||
|
this.video = video;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVideoCoverImg() {
|
||||||
|
return videoCoverImg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVideoCoverImg(String videoCoverImg) {
|
||||||
|
this.videoCoverImg = videoCoverImg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRelUrl() {
|
||||||
|
return relUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRelUrl(String relUrl) {
|
||||||
|
this.relUrl = relUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAbsUrl() {
|
||||||
|
return absUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAbsUrl(String absUrl) {
|
||||||
|
this.absUrl = absUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedAt(Long createdAt) {
|
||||||
|
this.createdAt = createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUpdatedAt() {
|
||||||
|
return updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdatedAt(Long updatedAt) {
|
||||||
|
this.updatedAt = updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIsShowCash() {
|
||||||
|
return isShowCash;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsShowCash(Integer isShowCash) {
|
||||||
|
this.isShowCash = isShowCash;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIsShowMall() {
|
||||||
|
return isShowMall;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsShowMall(Integer isShowMall) {
|
||||||
|
this.isShowMall = isShowMall;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIsShowApp() {
|
||||||
|
return isShowApp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsShowApp(Integer isShowApp) {
|
||||||
|
this.isShowApp = isShowApp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSort() {
|
||||||
|
return sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSort(Integer sort) {
|
||||||
|
this.sort = sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -5,6 +5,7 @@ import java.math.BigDecimal;
|
||||||
|
|
||||||
public class TbUserInfo implements Serializable {
|
public class TbUserInfo implements Serializable {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
|
@ -93,6 +94,7 @@ public class TbUserInfo implements Serializable {
|
||||||
private Long bindParentAt;
|
private Long bindParentAt;
|
||||||
|
|
||||||
private String grandParentId;
|
private String grandParentId;
|
||||||
|
private String password;
|
||||||
|
|
||||||
private String avatar = "";
|
private String avatar = "";
|
||||||
|
|
||||||
|
|
@ -475,4 +477,20 @@ public class TbUserInfo implements Serializable {
|
||||||
public void setGrandParentId(String grandParentId) {
|
public void setGrandParentId(String grandParentId) {
|
||||||
this.grandParentId = grandParentId == null ? null : grandParentId.trim();
|
this.grandParentId = grandParentId == null ? null : grandParentId.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(Integer userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 12847
|
||||||
|
*/
|
||||||
|
public class HomeDto {
|
||||||
|
/**
|
||||||
|
* 地址
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
/**
|
||||||
|
* 品类
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1.理我最近 2.销量优先 3.价格优先
|
||||||
|
*/
|
||||||
|
private Integer orderBy;
|
||||||
|
/**
|
||||||
|
* 附近1KM 1 0
|
||||||
|
*/
|
||||||
|
private Integer distance;
|
||||||
|
|
||||||
|
private Integer page;
|
||||||
|
|
||||||
|
private Integer size;
|
||||||
|
|
||||||
|
public String getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddress(String address) {
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getOrderBy() {
|
||||||
|
return orderBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderBy(Integer orderBy) {
|
||||||
|
this.orderBy = orderBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getDistance() {
|
||||||
|
return distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDistance(Integer distance) {
|
||||||
|
this.distance = distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPage() {
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPage(Integer page) {
|
||||||
|
this.page = page;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSize() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSize(Integer size) {
|
||||||
|
this.size = size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lyf
|
||||||
|
*/
|
||||||
|
public class DistrictVO {
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
private String icon;
|
||||||
|
/**
|
||||||
|
* 菜单名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 跳转地址
|
||||||
|
*/
|
||||||
|
private String relUrl;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||||
|
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lyf
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class HomeUpVO {
|
||||||
|
/**
|
||||||
|
* 轮播图
|
||||||
|
*/
|
||||||
|
List<TbPlatformDict> carousel;
|
||||||
|
/**
|
||||||
|
* 金刚区
|
||||||
|
*/
|
||||||
|
List<TbPlatformDict> district;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,128 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lyf
|
||||||
|
*/
|
||||||
|
public class HomeVO {
|
||||||
|
/**
|
||||||
|
* 店铺名称
|
||||||
|
*/
|
||||||
|
private String shopName;
|
||||||
|
/**
|
||||||
|
* 距离
|
||||||
|
*/
|
||||||
|
private String distance;
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String productName;
|
||||||
|
/**
|
||||||
|
* 商品图片
|
||||||
|
*/
|
||||||
|
private String image;
|
||||||
|
/**
|
||||||
|
* 原价
|
||||||
|
*/
|
||||||
|
private BigDecimal originPrice;
|
||||||
|
/**
|
||||||
|
* 现价
|
||||||
|
*/
|
||||||
|
private BigDecimal salePrice;
|
||||||
|
/**
|
||||||
|
* 折扣
|
||||||
|
*/
|
||||||
|
private BigDecimal discount;
|
||||||
|
/**
|
||||||
|
* 共省金额
|
||||||
|
*/
|
||||||
|
private BigDecimal save;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销量
|
||||||
|
*/
|
||||||
|
private BigDecimal realSalesNumber;
|
||||||
|
|
||||||
|
private Integer productId;
|
||||||
|
|
||||||
|
public Integer getProductId() {
|
||||||
|
return productId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductId(Integer productId) {
|
||||||
|
this.productId = productId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShopName() {
|
||||||
|
return shopName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShopName(String shopName) {
|
||||||
|
this.shopName = shopName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDistance() {
|
||||||
|
return distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDistance(String distance) {
|
||||||
|
this.distance = distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProductName() {
|
||||||
|
return productName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductName(String productName) {
|
||||||
|
this.productName = productName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImage() {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImage(String image) {
|
||||||
|
this.image = image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getOriginPrice() {
|
||||||
|
return originPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOriginPrice(BigDecimal originPrice) {
|
||||||
|
this.originPrice = originPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getSalePrice() {
|
||||||
|
return salePrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSalePrice(BigDecimal salePrice) {
|
||||||
|
this.salePrice = salePrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getDiscount() {
|
||||||
|
return discount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDiscount(BigDecimal discount) {
|
||||||
|
this.discount = discount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getSave() {
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSave(BigDecimal save) {
|
||||||
|
this.save = save;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getRealSalesNumber() {
|
||||||
|
return realSalesNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRealSalesNumber(BigDecimal realSalesNumber) {
|
||||||
|
this.realSalesNumber = realSalesNumber;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lyf
|
||||||
|
*/
|
||||||
|
public class UserDutyVo {
|
||||||
|
|
||||||
|
private BigDecimal number;
|
||||||
|
|
||||||
|
private Integer productId;
|
||||||
|
|
||||||
|
public BigDecimal getNumber() {
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumber(BigDecimal number) {
|
||||||
|
this.number = number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getProductId() {
|
||||||
|
return productId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductId(Integer productId) {
|
||||||
|
this.productId = productId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图
|
||||||
|
* @author lyf
|
||||||
|
*/
|
||||||
|
public class carouselVO {
|
||||||
|
/**
|
||||||
|
* 封面图
|
||||||
|
*/
|
||||||
|
private String coverImg;
|
||||||
|
/**
|
||||||
|
* 跳转地址
|
||||||
|
*/
|
||||||
|
private String relUrl;
|
||||||
|
}
|
||||||
|
|
@ -2,10 +2,14 @@ package com.chaozhanggui.system.cashierservice.interceptor;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
||||||
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||||
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.SginAnot;
|
import com.chaozhanggui.system.cashierservice.sign.SginAnot;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.SignEnum;
|
import com.chaozhanggui.system.cashierservice.sign.SignEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.util.*;
|
import com.chaozhanggui.system.cashierservice.util.*;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -44,14 +48,29 @@ public class SignInterceptor implements HandlerInterceptor {
|
||||||
|
|
||||||
String token = request.getHeader("token");
|
String token = request.getHeader("token");
|
||||||
|
|
||||||
String type=request.getHeader("type");
|
// String type=request.getHeader("type");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (ignoreUrl.contains(requestURI)) {
|
if (ignoreUrl.contains(requestURI)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// version:版本号
|
||||||
|
// type: ios; android;
|
||||||
|
// environment:app;wx
|
||||||
|
String environment = request.getHeader("environment");
|
||||||
|
if (StringUtils.isNotBlank(environment) && environment.equals("app")) {
|
||||||
|
String type = request.getHeader("type");
|
||||||
|
String version = request.getHeader("version");
|
||||||
|
//LDBL_APP_VERSION:ios:version 存在即需要强制更新
|
||||||
|
String message = redisUtil.getMessage(RedisCst.LDBL_APP_VERSION + type + ":" + version);
|
||||||
|
// 返回false表示拦截器的处理已完成,请求不再继续向下执行
|
||||||
|
if (StringUtils.isNotBlank(message)) {
|
||||||
|
response.getWriter().write(JSONUtil.toJsonStr(Result.success(CodeEnum.UPGRADE_REQUIRED, message.replaceAll("\"", ""))));
|
||||||
|
response.getWriter().flush();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
String ip = IpUtil.getIpAddr(request);
|
String ip = IpUtil.getIpAddr(request);
|
||||||
|
|
@ -63,9 +82,9 @@ public class SignInterceptor implements HandlerInterceptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if("C".equals(type)){
|
// if("C".equals(type)){
|
||||||
String openId=request.getHeader("openId");
|
// String openId=request.getHeader("openId");
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -108,6 +127,7 @@ public class SignInterceptor implements HandlerInterceptor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 把request转为map
|
* 把request转为map
|
||||||
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ public class OrderDetailPO implements Serializable {
|
||||||
|
|
||||||
List<Detail> detailList;
|
List<Detail> detailList;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class Detail implements Serializable{
|
public static class Detail implements Serializable{
|
||||||
|
|
@ -41,6 +43,8 @@ public class OrderDetailPO implements Serializable {
|
||||||
|
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
private String spec;
|
||||||
|
|
||||||
public Detail(String productName, String number, String amount, String remark) {
|
public Detail(String productName, String number, String amount, String remark) {
|
||||||
this.productName = productName;
|
this.productName = productName;
|
||||||
this.number = number;
|
this.number = number;
|
||||||
|
|
@ -51,7 +55,7 @@ public class OrderDetailPO implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public OrderDetailPO(String merchantName, String printType, String masterId, String orderNo, String tradeDate, String operator, String receiptsAmount, String balance, String payType, String integral, List<Detail> detailList) {
|
public OrderDetailPO(String merchantName, String printType, String masterId, String orderNo, String tradeDate, String operator, String receiptsAmount, String balance, String payType, String integral, List<Detail> detailList,String remark) {
|
||||||
this.merchantName = merchantName;
|
this.merchantName = merchantName;
|
||||||
this.printType = printType;
|
this.printType = printType;
|
||||||
this.masterId = masterId;
|
this.masterId = masterId;
|
||||||
|
|
@ -63,5 +67,6 @@ public class OrderDetailPO implements Serializable {
|
||||||
this.payType = payType;
|
this.payType = payType;
|
||||||
this.integral = integral;
|
this.integral = integral;
|
||||||
this.detailList = detailList;
|
this.detailList = detailList;
|
||||||
|
this.remark=remark;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,10 @@ public class PrintMechineConsumer {
|
||||||
@Autowired
|
@Autowired
|
||||||
private TbProductMapper tbProductMapper;
|
private TbProductMapper tbProductMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TbOrderDetailMapper tbOrderDetailMapper;
|
||||||
|
|
||||||
@RabbitHandler
|
@RabbitHandler
|
||||||
public void listener(String message) {
|
public void listener(String message) {
|
||||||
String orderId = message;
|
String orderId = message;
|
||||||
|
|
@ -167,7 +171,7 @@ public class PrintMechineConsumer {
|
||||||
}
|
}
|
||||||
if(ObjectUtil.isNotEmpty(detailList)&&detailList.size()>0){
|
if(ObjectUtil.isNotEmpty(detailList)&&detailList.size()>0){
|
||||||
|
|
||||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getTableName(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList);
|
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getTableName(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList,orderInfo.getRemark());
|
||||||
String data= PrinterUtils.getCashPrintData(detailPO,"结算单");
|
String data= PrinterUtils.getCashPrintData(detailPO,"结算单");
|
||||||
PrinterUtils.printTickets(1, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
PrinterUtils.printTickets(1, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||||
}
|
}
|
||||||
|
|
@ -256,6 +260,137 @@ public class PrintMechineConsumer {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "cash": //小票打印机
|
case "cash": //小票打印机
|
||||||
|
switch (model) {
|
||||||
|
case "normal": //普通出单
|
||||||
|
|
||||||
|
if ("return".equals(orderInfo.getOrderType())) {
|
||||||
|
List<TbOrderDetail> tbOrderDetails = tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));
|
||||||
|
if (ObjectUtil.isNotEmpty(tbOrderDetails) && tbOrderDetails.size() > 0) {
|
||||||
|
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
||||||
|
tbOrderDetails.parallelStream().forEach(it -> {
|
||||||
|
String categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||||
|
|
||||||
|
Long count = categoryInfos.stream().filter(c ->
|
||||||
|
c.getId().toString().equals(categoryId)
|
||||||
|
).count();
|
||||||
|
log.info("获取当前类别是否未打印类别:{}", count);
|
||||||
|
|
||||||
|
|
||||||
|
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getProductSkuId()));
|
||||||
|
String remark = "";
|
||||||
|
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||||
|
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||||
|
}
|
||||||
|
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), it.getPriceAmount().toPlainString(), remark);
|
||||||
|
detailList.add(detail);
|
||||||
|
|
||||||
|
});
|
||||||
|
String balance = "0";
|
||||||
|
|
||||||
|
if ("deposit".equals(orderInfo.getPayType())) {
|
||||||
|
TbShopUser user = tbShopUserMapper.selectByPrimaryKey(orderInfo.getMemberId());
|
||||||
|
if (ObjectUtil.isNotEmpty(user) && ObjectUtil.isNotEmpty(user.getAmount())) {
|
||||||
|
balance = user.getAmount().toPlainString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
|
||||||
|
// OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList);
|
||||||
|
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", ObjectUtil.isEmpty(orderInfo.getMasterId()) || ObjectUtil.isNull(orderInfo.getMasterId()) ? orderInfo.getTableName() : orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList, orderInfo.getRemark());
|
||||||
|
|
||||||
|
String printType = "退款单";
|
||||||
|
|
||||||
|
String data = PrinterUtils.getCashPrintData(detailPO, printType);
|
||||||
|
PrinterUtils.printTickets(1, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
cashierCarts = cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(), "final");
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||||
|
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
||||||
|
cashierCarts.parallelStream().forEach(it -> {
|
||||||
|
String categoryId;
|
||||||
|
if (ObjectUtil.isEmpty(it.getCategoryId())) {
|
||||||
|
categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||||
|
} else {
|
||||||
|
categoryId = it.getCategoryId();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Long count = categoryInfos.stream().filter(c ->
|
||||||
|
c.getId().toString().equals(categoryId)
|
||||||
|
).count();
|
||||||
|
|
||||||
|
if (count > 0) {
|
||||||
|
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||||
|
String remark = "";
|
||||||
|
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||||
|
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||||
|
}
|
||||||
|
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getName(), it.getNumber().toString(), it.getTotalAmount().toPlainString(), remark);
|
||||||
|
detailList.add(detail);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
String balance = "0";
|
||||||
|
|
||||||
|
if ("deposit".equals(orderInfo.getPayType())) {
|
||||||
|
TbShopUser user = tbShopUserMapper.selectByPrimaryKey(orderInfo.getMemberId());
|
||||||
|
if (ObjectUtil.isNotEmpty(user) && ObjectUtil.isNotEmpty(user.getAmount())) {
|
||||||
|
balance = user.getAmount().toPlainString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
|
||||||
|
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, (ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()), "0", detailList, orderInfo.getRemark());
|
||||||
|
String printType = "结算单";
|
||||||
|
|
||||||
|
if ("return".equals(orderInfo.getOrderType())) {
|
||||||
|
printType = "退款单";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FeieyunPrintUtil.getCashPrintData(detailPO, tbPrintMachineWithBLOBs.getAddress(), printType, printType);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "one": //一菜一品
|
||||||
|
|
||||||
|
cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, "final");
|
||||||
|
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||||
|
|
||||||
|
cashierCarts.parallelStream().forEach(it -> {
|
||||||
|
|
||||||
|
String categoryId;
|
||||||
|
if (ObjectUtil.isEmpty(it.getCategoryId())) {
|
||||||
|
categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||||
|
} else {
|
||||||
|
categoryId = it.getCategoryId();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Long count = categoryInfos.stream().filter(c ->
|
||||||
|
c.getId().toString().equals(categoryId)
|
||||||
|
).count();
|
||||||
|
|
||||||
|
if (count > 0) {
|
||||||
|
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||||
|
String remark = "";
|
||||||
|
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||||
|
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||||
|
}
|
||||||
|
FeieyunPrintUtil.getPrintData(tbPrintMachineWithBLOBs.getAddress(), orderInfo.getTableName(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber(), remark);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "kitchen": //出品打印机
|
case "kitchen": //出品打印机
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ public class RedisCst {
|
||||||
|
|
||||||
//在线用户
|
//在线用户
|
||||||
public static final String ONLINE_USER = "ONLINE_USER:";
|
public static final String ONLINE_USER = "ONLINE_USER:";
|
||||||
|
public static final String ONLINE_APP_USER = "ONLINE_APP_USER:";
|
||||||
|
public static final String LDBL_APP_VERSION = "LDBL_APP_VERSION:";
|
||||||
public static final String TABLE_CART = "TABLE:CART:";
|
public static final String TABLE_CART = "TABLE:CART:";
|
||||||
public static final String PRODUCT = "PRODUCT:";
|
public static final String PRODUCT = "PRODUCT:";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,10 @@ public class CloudPrinterService {
|
||||||
private TbProductMapper tbProductMapper;
|
private TbProductMapper tbProductMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TbOrderDetailMapper tbOrderDetailMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Result printReceipt(String type,String orderId,Boolean ispre){
|
public Result printReceipt(String type,String orderId,Boolean ispre){
|
||||||
|
|
@ -167,7 +171,7 @@ public class CloudPrinterService {
|
||||||
}
|
}
|
||||||
if(ObjectUtil.isNotEmpty(detailList)&&detailList.size()>0){
|
if(ObjectUtil.isNotEmpty(detailList)&&detailList.size()>0){
|
||||||
|
|
||||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getTableName(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList);
|
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getTableName(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList,orderInfo.getRemark());
|
||||||
String data= PrinterUtils.getCashPrintData(detailPO,"结算单");
|
String data= PrinterUtils.getCashPrintData(detailPO,"结算单");
|
||||||
PrinterUtils.printTickets(1, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
PrinterUtils.printTickets(1, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||||
}
|
}
|
||||||
|
|
@ -256,6 +260,137 @@ public class CloudPrinterService {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "cash": //小票打印机
|
case "cash": //小票打印机
|
||||||
|
switch (model) {
|
||||||
|
case "normal": //普通出单
|
||||||
|
|
||||||
|
if ("return".equals(orderInfo.getOrderType())) {
|
||||||
|
List<TbOrderDetail> tbOrderDetails = tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));
|
||||||
|
if (ObjectUtil.isNotEmpty(tbOrderDetails) && tbOrderDetails.size() > 0) {
|
||||||
|
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
||||||
|
tbOrderDetails.parallelStream().forEach(it -> {
|
||||||
|
String categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||||
|
|
||||||
|
Long count = categoryInfos.stream().filter(c ->
|
||||||
|
c.getId().toString().equals(categoryId)
|
||||||
|
).count();
|
||||||
|
log.info("获取当前类别是否未打印类别:{}", count);
|
||||||
|
|
||||||
|
|
||||||
|
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getProductSkuId()));
|
||||||
|
String remark = "";
|
||||||
|
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||||
|
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||||
|
}
|
||||||
|
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), it.getPriceAmount().toPlainString(), remark);
|
||||||
|
detailList.add(detail);
|
||||||
|
|
||||||
|
});
|
||||||
|
String balance = "0";
|
||||||
|
|
||||||
|
if ("deposit".equals(orderInfo.getPayType())) {
|
||||||
|
TbShopUser user = tbShopUserMapper.selectByPrimaryKey(orderInfo.getMemberId());
|
||||||
|
if (ObjectUtil.isNotEmpty(user) && ObjectUtil.isNotEmpty(user.getAmount())) {
|
||||||
|
balance = user.getAmount().toPlainString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
|
||||||
|
// OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList);
|
||||||
|
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", ObjectUtil.isEmpty(orderInfo.getMasterId()) || ObjectUtil.isNull(orderInfo.getMasterId()) ? orderInfo.getTableName() : orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList, orderInfo.getRemark());
|
||||||
|
|
||||||
|
String printType = "退款单";
|
||||||
|
|
||||||
|
String data = PrinterUtils.getCashPrintData(detailPO, printType);
|
||||||
|
PrinterUtils.printTickets(1, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
cashierCarts = cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(), "final");
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||||
|
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
||||||
|
cashierCarts.parallelStream().forEach(it -> {
|
||||||
|
String categoryId;
|
||||||
|
if (ObjectUtil.isEmpty(it.getCategoryId())) {
|
||||||
|
categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||||
|
} else {
|
||||||
|
categoryId = it.getCategoryId();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Long count = categoryInfos.stream().filter(c ->
|
||||||
|
c.getId().toString().equals(categoryId)
|
||||||
|
).count();
|
||||||
|
|
||||||
|
if (count > 0) {
|
||||||
|
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||||
|
String remark = "";
|
||||||
|
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||||
|
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||||
|
}
|
||||||
|
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getName(), it.getNumber().toString(), it.getTotalAmount().toPlainString(), remark);
|
||||||
|
detailList.add(detail);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
String balance = "0";
|
||||||
|
|
||||||
|
if ("deposit".equals(orderInfo.getPayType())) {
|
||||||
|
TbShopUser user = tbShopUserMapper.selectByPrimaryKey(orderInfo.getMemberId());
|
||||||
|
if (ObjectUtil.isNotEmpty(user) && ObjectUtil.isNotEmpty(user.getAmount())) {
|
||||||
|
balance = user.getAmount().toPlainString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
|
||||||
|
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, (ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()), "0", detailList, orderInfo.getRemark());
|
||||||
|
String printType = "结算单";
|
||||||
|
|
||||||
|
if ("return".equals(orderInfo.getOrderType())) {
|
||||||
|
printType = "退款单";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FeieyunPrintUtil.getCashPrintData(detailPO, tbPrintMachineWithBLOBs.getAddress(), printType, printType);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "one": //一菜一品
|
||||||
|
|
||||||
|
cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, "final");
|
||||||
|
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||||
|
|
||||||
|
cashierCarts.parallelStream().forEach(it -> {
|
||||||
|
|
||||||
|
String categoryId;
|
||||||
|
if (ObjectUtil.isEmpty(it.getCategoryId())) {
|
||||||
|
categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||||
|
} else {
|
||||||
|
categoryId = it.getCategoryId();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Long count = categoryInfos.stream().filter(c ->
|
||||||
|
c.getId().toString().equals(categoryId)
|
||||||
|
).count();
|
||||||
|
|
||||||
|
if (count > 0) {
|
||||||
|
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||||
|
String remark = "";
|
||||||
|
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||||
|
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||||
|
}
|
||||||
|
FeieyunPrintUtil.getPrintData(tbPrintMachineWithBLOBs.getAddress(), orderInfo.getTableName(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber(), remark);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "kitchen": //出品打印机
|
case "kitchen": //出品打印机
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.service;
|
||||||
|
|
||||||
|
import com.chaozhanggui.system.cashierservice.dao.TbPlatformDictMapper;
|
||||||
|
import com.chaozhanggui.system.cashierservice.dao.TbProductSkuMapper;
|
||||||
|
import com.chaozhanggui.system.cashierservice.dao.TbShopInfoMapper;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbProductSku;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.vo.HomeUpVO;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.vo.HomeVO;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.vo.UserDutyVo;
|
||||||
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lyf
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class HomePageService {
|
||||||
|
@Resource
|
||||||
|
private TbShopInfoMapper shopInfoMapper;
|
||||||
|
@Resource
|
||||||
|
private TbProductSkuMapper productSkuMapper;
|
||||||
|
@Resource
|
||||||
|
private TbPlatformDictMapper platformDictMapper;
|
||||||
|
|
||||||
|
|
||||||
|
public Result homePage(HomeDto homeDto){
|
||||||
|
int beginNo;
|
||||||
|
if(homeDto.getPage() <=0){
|
||||||
|
beginNo = 0;
|
||||||
|
}else{
|
||||||
|
beginNo = (homeDto.getPage() - 1) * homeDto.getSize();
|
||||||
|
}
|
||||||
|
List<HomeVO> homeVO = shopInfoMapper.selectShopInfo(beginNo,homeDto.getSize());
|
||||||
|
List<Integer> objects = new ArrayList<>();
|
||||||
|
for (HomeVO o :homeVO) {
|
||||||
|
objects.add(o.getProductId());
|
||||||
|
}
|
||||||
|
//原价现价
|
||||||
|
List<TbProductSku> tbProductSkus = productSkuMapper.selectDownSku(objects);
|
||||||
|
//销量
|
||||||
|
List<UserDutyVo> userDutyVos = shopInfoMapper.searchUserDutyDetail(objects);
|
||||||
|
//组装数据
|
||||||
|
for (HomeVO o :homeVO) {
|
||||||
|
for (TbProductSku sku :tbProductSkus) {
|
||||||
|
if (o.getProductId().toString().equals(sku.getProductId())){
|
||||||
|
o.setOriginPrice(sku.getOriginPrice() == null?BigDecimal.ZERO:sku.getOriginPrice());
|
||||||
|
o.setSalePrice(sku.getSalePrice() == null?BigDecimal.ZERO:sku.getSalePrice());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (userDutyVos == null){
|
||||||
|
o.setRealSalesNumber(BigDecimal.ZERO);
|
||||||
|
}else {
|
||||||
|
for (UserDutyVo duty : userDutyVos) {
|
||||||
|
if (o.getProductId().equals(duty.getProductId())) {
|
||||||
|
o.setRealSalesNumber(duty.getNumber());
|
||||||
|
}else {
|
||||||
|
o.setRealSalesNumber(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//共省金额
|
||||||
|
o.setSave(o.getOriginPrice().subtract(o.getSalePrice()));
|
||||||
|
if (o.getOriginPrice().compareTo(BigDecimal.ZERO) == 0){
|
||||||
|
o.setDiscount(null);
|
||||||
|
}else {
|
||||||
|
o.setDiscount(o.getSalePrice().divide(o.getOriginPrice(), 2, RoundingMode.DOWN).multiply(new BigDecimal("10")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.success(CodeEnum.SUCCESS,homeVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result homePageUp(String environment){
|
||||||
|
HomeUpVO homeUpVO = new HomeUpVO();
|
||||||
|
//轮播图
|
||||||
|
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType("carousel",environment);
|
||||||
|
homeUpVO.setCarousel(carouselList);
|
||||||
|
//金刚区
|
||||||
|
List<TbPlatformDict> districtList = platformDictMapper.queryAllByType("homeDistrict",environment);
|
||||||
|
homeUpVO.setDistrict(districtList);
|
||||||
|
return Result.success(CodeEnum.SUCCESS,homeUpVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -9,17 +9,16 @@ import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
||||||
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
|
import com.chaozhanggui.system.cashierservice.util.MD5Utils;
|
||||||
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class LoginService {
|
public class LoginService {
|
||||||
|
|
@ -46,7 +45,6 @@ public class LoginService {
|
||||||
TbTokenMapper tbTokenMapper;
|
TbTokenMapper tbTokenMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
RedisUtil redisUtil;
|
RedisUtil redisUtil;
|
||||||
|
|
||||||
|
|
@ -88,8 +86,17 @@ public class LoginService {
|
||||||
userInfo.setTelephone(ObjectUtil.isNotNull(telephone) ? telephone : "");
|
userInfo.setTelephone(ObjectUtil.isNotNull(telephone) ? telephone : "");
|
||||||
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
TbShopInfo tbShopInfo = null;
|
TbShopInfo tbShopInfo = null;
|
||||||
if (ObjectUtil.isEmpty(qrCode)) {
|
if (ObjectUtil.isEmpty(qrCode)) {
|
||||||
tbShopInfo = tbShopInfoMapper.selectByPhone(defaultPhone);
|
tbShopInfo = tbShopInfoMapper.selectByPhone(defaultPhone);
|
||||||
|
|
@ -100,7 +107,6 @@ public class LoginService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TbShopUser tbShopUser = null;
|
TbShopUser tbShopUser = null;
|
||||||
Map<String, String> shopMap = new HashMap<>();
|
Map<String, String> shopMap = new HashMap<>();
|
||||||
if (ObjectUtil.isNotEmpty(tbShopInfo)) {
|
if (ObjectUtil.isNotEmpty(tbShopInfo)) {
|
||||||
|
|
@ -136,7 +142,6 @@ public class LoginService {
|
||||||
tbTokenMapper.insert(tbToken);
|
tbTokenMapper.insert(tbToken);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
map.put("token", token);
|
map.put("token", token);
|
||||||
|
|
@ -152,7 +157,94 @@ public class LoginService {
|
||||||
return Result.fail("登录失败");
|
return Result.fail("登录失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TbUserInfo register(String phone, String password, String nickName) {
|
||||||
|
|
||||||
|
TbUserInfo 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("");
|
||||||
|
userInfo.setNickName(nickName);
|
||||||
|
userInfo.setTelephone(phone);
|
||||||
|
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("APP");
|
||||||
|
userInfo.setIsAttentionMp(Byte.parseByte("0"));
|
||||||
|
userInfo.setSearchWord("||移动端用户");
|
||||||
|
userInfo.setLastLogInAt(System.currentTimeMillis());
|
||||||
|
userInfo.setCreatedAt(System.currentTimeMillis());
|
||||||
|
userInfo.setUpdatedAt(System.currentTimeMillis());
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号 短信验证码 校验
|
||||||
|
*
|
||||||
|
* @param code
|
||||||
|
* @param phone
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean validate(String code, String phone) {
|
||||||
|
if (StringUtils.isNotBlank(code)) {
|
||||||
|
String message = redisUtil.getMessage(phone);
|
||||||
|
boolean tf = Objects.equals(code, message);
|
||||||
|
if (tf) {
|
||||||
|
redisUtil.deleteByKey(phone);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Result appLogin(String username, String password) {
|
||||||
|
TbUserInfo userInfo = tbUserInfoMapper.selectUserByPhone(username, "APP");
|
||||||
|
if (ObjectUtil.isNull(userInfo)) {
|
||||||
|
//注册
|
||||||
|
userInfo=register(username, password, username);
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(password) && !password.equalsIgnoreCase(userInfo.getPassword())) {
|
||||||
|
return Result.fail("密码错误");
|
||||||
|
}
|
||||||
|
//生成token 信息
|
||||||
|
String token = null;
|
||||||
|
try {
|
||||||
|
token = TokenUtil.generateToken(userInfo.getId(), null, userInfo.getTelephone(), userInfo.getNickName());
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
try {
|
||||||
|
map.put("token", token);
|
||||||
|
map.put("userInfo", userInfo);
|
||||||
|
redisUtil.saveMessage(RedisCst.ONLINE_APP_USER.concat(userInfo.getId() + ""), JSON.toJSONString(map));
|
||||||
|
return Result.success(CodeEnum.SUCCESS, map);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
}
|
||||||
|
return Result.fail("登录失败");
|
||||||
|
}
|
||||||
|
|
||||||
public Result createCardNo(String id, String openId) {
|
public Result createCardNo(String id, String openId) {
|
||||||
if (ObjectUtil.isEmpty(id) || ObjectUtil.isEmpty(openId)) {
|
if (ObjectUtil.isEmpty(id) || ObjectUtil.isEmpty(openId)) {
|
||||||
|
|
@ -211,6 +303,7 @@ public class LoginService {
|
||||||
|
|
||||||
return Result.success(CodeEnum.ENCRYPT, map);
|
return Result.success(CodeEnum.ENCRYPT, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
System.out.println(RandomUtil.randomNumbers(10));
|
System.out.println(RandomUtil.randomNumbers(10));
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public class OnlineUserService {
|
||||||
onlineUserDto.setLoginTime(new Date());
|
onlineUserDto.setLoginTime(new Date());
|
||||||
onlineUserDto.setShopId(shopId);
|
onlineUserDto.setShopId(shopId);
|
||||||
try {
|
try {
|
||||||
redisUtils.set("online-token-"+token, onlineUserDto, MILLIS_MINUTE);
|
redisUtils.set("online-token-"+token, onlineUserDto, MILLIS_MINUTE);//30分钟
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
throw new MsgException("登录错误");
|
throw new MsgException("登录错误");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -152,13 +152,13 @@ public class PayService {
|
||||||
if(response.getStatusCodeValue()==200&&ObjectUtil.isNotEmpty(response.getBody())){
|
if(response.getStatusCodeValue()==200&&ObjectUtil.isNotEmpty(response.getBody())){
|
||||||
JSONObject object=JSONObject.parseObject(response.getBody());
|
JSONObject object=JSONObject.parseObject(response.getBody());
|
||||||
if(object.get("code").equals("0")){
|
if(object.get("code").equals("0")){
|
||||||
|
|
||||||
payment.setTradeNumber(object.getJSONObject("data").get("orderNumber").toString());
|
payment.setTradeNumber(object.getJSONObject("data").get("orderNumber").toString());
|
||||||
payment.setUpdatedAt(System.currentTimeMillis());
|
payment.setUpdatedAt(System.currentTimeMillis());
|
||||||
tbOrderPaymentMapper.updateByPrimaryKeySelective(payment);
|
tbOrderPaymentMapper.updateByPrimaryKeySelective(payment);
|
||||||
orderInfo.setStatus("paying");
|
orderInfo.setStatus("paying");
|
||||||
orderInfo.setPayOrderNo(payment.getTradeNumber());
|
orderInfo.setPayOrderNo(payment.getTradeNumber());
|
||||||
|
|
||||||
|
|
||||||
tbOrderInfoMapper.updateByPrimaryKey(orderInfo);
|
tbOrderInfoMapper.updateByPrimaryKey(orderInfo);
|
||||||
String key= RedisCst.TABLE_CART.concat(orderInfo.getTableId()).concat("-").concat(orderInfo.getShopId());
|
String key= RedisCst.TABLE_CART.concat(orderInfo.getTableId()).concat("-").concat(orderInfo.getShopId());
|
||||||
//清除缓存购物车数据
|
//清除缓存购物车数据
|
||||||
|
|
@ -190,7 +190,6 @@ public class PayService {
|
||||||
}
|
}
|
||||||
|
|
||||||
if("paying".equals(orderInfo.getStatus())){
|
if("paying".equals(orderInfo.getStatus())){
|
||||||
|
|
||||||
TbOrderPayment payment= tbOrderPaymentMapper.selectByOrderId(orderInfo.getId().toString());
|
TbOrderPayment payment= tbOrderPaymentMapper.selectByOrderId(orderInfo.getId().toString());
|
||||||
if(ObjectUtil.isNotEmpty(payment)&&ObjectUtil.isNotEmpty(payment.getTradeNumber())){
|
if(ObjectUtil.isNotEmpty(payment)&&ObjectUtil.isNotEmpty(payment.getTradeNumber())){
|
||||||
|
|
||||||
|
|
@ -199,8 +198,6 @@ public class PayService {
|
||||||
if(ObjectUtil.isEmpty(thirdApply)||ObjectUtil.isNull(thirdApply)){
|
if(ObjectUtil.isEmpty(thirdApply)||ObjectUtil.isNull(thirdApply)){
|
||||||
return Result.fail("支付通道不存在");
|
return Result.fail("支付通道不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TradeQueryReq req=new TradeQueryReq();
|
TradeQueryReq req=new TradeQueryReq();
|
||||||
req.setAppId(thirdApply.getAppId());
|
req.setAppId(thirdApply.getAppId());
|
||||||
req.setTimestamp(System.currentTimeMillis());
|
req.setTimestamp(System.currentTimeMillis());
|
||||||
|
|
@ -301,7 +298,6 @@ public class PayService {
|
||||||
|
|
||||||
|
|
||||||
TbMerchantThirdApply thirdApply= tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(shopInfo.getMerchantId()));
|
TbMerchantThirdApply thirdApply= tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(shopInfo.getMerchantId()));
|
||||||
|
|
||||||
if(ObjectUtil.isEmpty(thirdApply)||ObjectUtil.isNull(thirdApply)){
|
if(ObjectUtil.isEmpty(thirdApply)||ObjectUtil.isNull(thirdApply)){
|
||||||
return Result.fail("支付通道不存在");
|
return Result.fail("支付通道不存在");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,11 @@ public enum CodeEnum {
|
||||||
//系统编码
|
//系统编码
|
||||||
SYS_EXCEPTION("999",false,"系统异常","fail"),
|
SYS_EXCEPTION("999",false,"系统异常","fail"),
|
||||||
SUCCESS("0",false,"成功","success"),
|
SUCCESS("0",false,"成功","success"),
|
||||||
|
UPGRADE_REQUIRED("426",false,"成功","success"),
|
||||||
ENCRYPT("0",true,"成功","success"),
|
ENCRYPT("0",true,"成功","success"),
|
||||||
FAIL("1",false,"失败","fail"),
|
FAIL("1",false,"失败","fail"),
|
||||||
|
TOKEN_EXEIST("-2",false,"token不能为空","fail"),
|
||||||
|
TOKEN_EXPIRED("-4",false,"账号已过期,请重新登陆","fail"),
|
||||||
SIGN_FAIL("100013",false,"签名不正确","fail"),
|
SIGN_FAIL("100013",false,"签名不正确","fail"),
|
||||||
|
|
||||||
ORGAN_NO_EXEIST("100010",false,"机构代码不存在或状态异常,请联系服务商","fail"),
|
ORGAN_NO_EXEIST("100010",false,"机构代码不存在或状态异常,请联系服务商","fail"),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.chaozhanggui.system.cashierservice.util;
|
package com.chaozhanggui.system.cashierservice.util;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.chaozhanggui.system.cashierservice.model.OrderDetailPO;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.apache.http.HttpEntity;
|
import org.apache.http.HttpEntity;
|
||||||
import org.apache.http.NameValuePair;
|
import org.apache.http.NameValuePair;
|
||||||
|
|
@ -15,6 +17,7 @@ import org.apache.http.util.EntityUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class FeieyunPrintUtil {
|
public class FeieyunPrintUtil {
|
||||||
|
|
@ -114,6 +117,223 @@ public class FeieyunPrintUtil {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getPrintData(String sn,String pickupNumber,String date,String productName,Integer number,String remark) {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
|
builder.append("<CB>"+pickupNumber+"</CB><BR><BR>");
|
||||||
|
builder.append("<L>时间: "+date+" </L><BR><BR><BR>");
|
||||||
|
|
||||||
|
if(productName.length()>4||remark.length()>4){
|
||||||
|
builder.append("<B><BOLD>"+productName+" "+number+"</BOLD></B><BR><BR>");
|
||||||
|
builder.append("<B><BOLD>"+remark+" </BOLD></B><BR>");
|
||||||
|
}else {
|
||||||
|
builder.append("<B><BOLD>"+productName+" "+number+"</BOLD></B><BR><BR>");
|
||||||
|
builder.append("<B><BOLD>"+remark+" </BOLD></B><BR>");
|
||||||
|
}
|
||||||
|
builder.append("<CUT>");
|
||||||
|
|
||||||
|
String content=builder.toString();
|
||||||
|
|
||||||
|
System.out.println("content:".concat(content));
|
||||||
|
|
||||||
|
//通过POST请求,发送打印信息到服务器
|
||||||
|
RequestConfig requestConfig = RequestConfig.custom()
|
||||||
|
.setSocketTimeout(30000)//读取超时
|
||||||
|
.setConnectTimeout(30000)//连接超时
|
||||||
|
.build();
|
||||||
|
|
||||||
|
CloseableHttpClient httpClient = HttpClients.custom()
|
||||||
|
.setDefaultRequestConfig(requestConfig)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
HttpPost post = new HttpPost(URL);
|
||||||
|
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
|
||||||
|
nvps.add(new BasicNameValuePair("user",USER));
|
||||||
|
String STIME = String.valueOf(System.currentTimeMillis()/1000);
|
||||||
|
nvps.add(new BasicNameValuePair("stime",STIME));
|
||||||
|
nvps.add(new BasicNameValuePair("sig",signature(USER,UKEY,STIME)));
|
||||||
|
nvps.add(new BasicNameValuePair("apiname","Open_printMsg"));//固定值,不需要修改
|
||||||
|
nvps.add(new BasicNameValuePair("sn",sn));
|
||||||
|
nvps.add(new BasicNameValuePair("content",content));
|
||||||
|
nvps.add(new BasicNameValuePair("times","1"));//打印联数
|
||||||
|
|
||||||
|
CloseableHttpResponse response = null;
|
||||||
|
String result = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
post.setEntity(new UrlEncodedFormEntity(nvps,"utf-8"));
|
||||||
|
response = httpClient.execute(post);
|
||||||
|
int statecode = response.getStatusLine().getStatusCode();
|
||||||
|
if(statecode == 200){
|
||||||
|
HttpEntity httpentity = response.getEntity();
|
||||||
|
if (httpentity != null){
|
||||||
|
//服务器返回的JSON字符串,建议要当做日志记录起来
|
||||||
|
result = EntityUtils.toString(httpentity);
|
||||||
|
System.out.println("result:".concat(result));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
finally{
|
||||||
|
try {
|
||||||
|
if(response!=null){
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
post.abort();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
httpClient.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static String getCashPrintData(OrderDetailPO detailPO, String sn, String type, String orderType){
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("<CB>"+detailPO.getMerchantName()+"</CB><BR><BR>");
|
||||||
|
sb.append("<C><BOLD>"+type+"【"+detailPO.getMasterId()+"】</BOLD></C><BR><BR>");
|
||||||
|
sb.append("订单号: "+detailPO.getOrderNo()+" <BR>");
|
||||||
|
sb.append("交易时间: "+detailPO.getTradeDate()+" <BR>");
|
||||||
|
sb.append("收银员: "+detailPO.getOperator()+" <BR><BR><BR>");
|
||||||
|
sb.append("------------------------<BR>");
|
||||||
|
char paddingCharacter = ' ';
|
||||||
|
sb.append("<S>"+String.format("%-15s","品名").replace(' ', paddingCharacter)+String.format("%-4s","数量").replace(' ', paddingCharacter)+String.format("%4s","小计").replace(' ', paddingCharacter)+"</S><BR>");
|
||||||
|
for (OrderDetailPO.Detail detail : detailPO.getDetailList()) {
|
||||||
|
if(detail.getProductName().length()>4){
|
||||||
|
|
||||||
|
int count=getProducrName(detail.getProductName());
|
||||||
|
if(count<=0){
|
||||||
|
int length=15-(detail.getProductName().length()-4);
|
||||||
|
sb.append(""+String.format("%-"+length+"s",detail.getProductName()).replace(' ', paddingCharacter)+String.format("%-4s",detail.getNumber()).replace(' ', paddingCharacter)+String.format("%8s",detail.getAmount()).replace(' ', paddingCharacter)+"<BR>");
|
||||||
|
}else {
|
||||||
|
int length=15+count-(detail.getProductName().length()-4);
|
||||||
|
sb.append(""+String.format("%-"+length+"s",detail.getProductName()).replace(' ', paddingCharacter)+String.format("%-4s",detail.getNumber()).replace(' ', paddingCharacter)+String.format("%8s",detail.getAmount()).replace(' ', paddingCharacter)+"<BR>");
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
sb.append(""+String.format("%-15s",detail.getProductName()).replace(' ', paddingCharacter)+String.format("%-4s",detail.getNumber()).replace(' ', paddingCharacter)+String.format("%8s",detail.getAmount()).replace(' ', paddingCharacter)+"<BR>");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(detail.getSpec()!=null&& ObjectUtil.isNotEmpty(detail.getSpec())){
|
||||||
|
sb.append("规格:"+detail.getSpec()+"<BR>");
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.append("<BR>");
|
||||||
|
|
||||||
|
}
|
||||||
|
sb.append("------------------------<BR>");
|
||||||
|
String t="¥"+detailPO.getReceiptsAmount();
|
||||||
|
t=String.format("%11s",t).replace(' ', paddingCharacter);
|
||||||
|
if(orderType.equals("return")){
|
||||||
|
sb.append("<B>应退"+t+"</B><BR>");
|
||||||
|
}else {
|
||||||
|
sb.append("<B>应收"+t+"</B><BR>");
|
||||||
|
}
|
||||||
|
if(ObjectUtil.isNotEmpty(detailPO.getPayType())&&ObjectUtil.isNotNull(detailPO.getPayType())&&detailPO.getPayType().equals("deposit")){
|
||||||
|
sb.append("储值¥"+detailPO.getReceiptsAmount()+" <BR>");
|
||||||
|
sb.append("------------------------<BR>");
|
||||||
|
sb.append("积分:"+detailPO.getIntegral()+"<BR>");
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.append("余额:"+detailPO.getBalance()+"<BR>");
|
||||||
|
sb.append("------------------------<BR>");
|
||||||
|
|
||||||
|
if(ObjectUtil.isNotEmpty(detailPO.getRemark())&&ObjectUtil.isNotNull(detailPO.getRemark())){
|
||||||
|
sb.append("<L>备注:"+detailPO.getRemark()+"</L><BR>");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sb.append("打印时间:"+DateUtils.getTime(new Date())+"<BR>");
|
||||||
|
|
||||||
|
sb.append("<CUT>");
|
||||||
|
|
||||||
|
String content=sb.toString();
|
||||||
|
|
||||||
|
//通过POST请求,发送打印信息到服务器
|
||||||
|
RequestConfig requestConfig = RequestConfig.custom()
|
||||||
|
.setSocketTimeout(30000)//读取超时
|
||||||
|
.setConnectTimeout(30000)//连接超时
|
||||||
|
.build();
|
||||||
|
|
||||||
|
CloseableHttpClient httpClient = HttpClients.custom()
|
||||||
|
.setDefaultRequestConfig(requestConfig)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
HttpPost post = new HttpPost(URL);
|
||||||
|
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
|
||||||
|
nvps.add(new BasicNameValuePair("user",USER));
|
||||||
|
String STIME = String.valueOf(System.currentTimeMillis()/1000);
|
||||||
|
nvps.add(new BasicNameValuePair("stime",STIME));
|
||||||
|
nvps.add(new BasicNameValuePair("sig",signature(USER,UKEY,STIME)));
|
||||||
|
nvps.add(new BasicNameValuePair("apiname","Open_printMsg"));//固定值,不需要修改
|
||||||
|
nvps.add(new BasicNameValuePair("sn",sn));
|
||||||
|
nvps.add(new BasicNameValuePair("content",content));
|
||||||
|
nvps.add(new BasicNameValuePair("times","1"));//打印联数
|
||||||
|
|
||||||
|
CloseableHttpResponse response = null;
|
||||||
|
String result = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
post.setEntity(new UrlEncodedFormEntity(nvps,"utf-8"));
|
||||||
|
response = httpClient.execute(post);
|
||||||
|
int statecode = response.getStatusLine().getStatusCode();
|
||||||
|
if(statecode == 200){
|
||||||
|
HttpEntity httpentity = response.getEntity();
|
||||||
|
if (httpentity != null){
|
||||||
|
//服务器返回的JSON字符串,建议要当做日志记录起来
|
||||||
|
result = EntityUtils.toString(httpentity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
finally{
|
||||||
|
try {
|
||||||
|
if(response!=null){
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
post.abort();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
httpClient.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static int getProducrName(String str){
|
public static int getProducrName(String str){
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.util;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static java.lang.Math.*;
|
||||||
|
import static java.lang.Math.sin;
|
||||||
|
|
||||||
|
public class LocationUtils {
|
||||||
|
|
||||||
|
public static String district(String keywords) {
|
||||||
|
Map<String, String> param=new HashMap<>();
|
||||||
|
//超掌柜生活-用户端
|
||||||
|
param.put("key","7a7f2e4790ea222660a027352ee3af39");
|
||||||
|
param.put("keywords",keywords);
|
||||||
|
param.put("subdistrict","1");
|
||||||
|
param.put("extensions","base");
|
||||||
|
String s = HttpClientUtil.doGet("https://restapi.amap.com/v3/config/district", param);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将角度转化为弧度
|
||||||
|
*/
|
||||||
|
public static double radians(double d) {
|
||||||
|
return d * Math.PI / 180.0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据两点经纬度坐标计算直线距离
|
||||||
|
* <p>
|
||||||
|
* S = 2arcsin√sin²(a/2)+cos(lat1)*cos(lat2)*sin²(b/2) ̄*6378.137
|
||||||
|
* <p>
|
||||||
|
* 1. lng1 lat1 表示A点经纬度,lng2 lat2 表示B点经纬度;<br>
|
||||||
|
* 2. a=lat1 – lat2 为两点纬度之差 b=lng1 -lng2 为两点经度之差;<br>
|
||||||
|
* 3. 6378.137为地球赤道半径,单位为千米;
|
||||||
|
*
|
||||||
|
* @param lng1 点1经度
|
||||||
|
* @param lat1 点1纬度
|
||||||
|
* @param lng2 点2经度
|
||||||
|
* @param lat2 点2纬度
|
||||||
|
* @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) {
|
||||||
|
//将角度转化为弧度
|
||||||
|
double radLng1 = radians(lng1);
|
||||||
|
double radLat1 = radians(lat1);
|
||||||
|
double radLng2 = radians(lng2);
|
||||||
|
double radLat2 = radians(lat2);
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// // 示例经纬度坐标
|
||||||
|
// double lat1 = 108.954398;
|
||||||
|
// double lon1 = 34.308687;
|
||||||
|
//
|
||||||
|
// double lat2 = 108.953555;
|
||||||
|
// double lon2 = 34.276169;
|
||||||
|
//
|
||||||
|
// // 计算距离
|
||||||
|
// double distance = getDistanceFrom2LngLat(lat1, lon1, lat2, lon2);
|
||||||
|
// System.out.println("Distance between the two points is: " + distance + " km");
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
@ -217,9 +217,9 @@ public class PrinterUtils {
|
||||||
detailList.add(detail);
|
detailList.add(detail);
|
||||||
detailList.add(detail3);
|
detailList.add(detail3);
|
||||||
detailList.add(detail4);
|
detailList.add(detail4);
|
||||||
OrderDetailPO detailPO=new OrderDetailPO("牛叉闪闪","普通打印","#365","DD20240306134718468","2024-03-06 15:00:00","【POS-1】001","79000.80","5049758.96","deposit","0",detailList);
|
// OrderDetailPO detailPO=new OrderDetailPO("牛叉闪闪","普通打印","#365","DD20240306134718468","2024-03-06 15:00:00","【POS-1】001","79000.80","5049758.96","deposit","0",detailList);
|
||||||
|
|
||||||
|
|
||||||
printTickets(1,1,"ZF544PG03W00001",getCashPrintData(detailPO,"结算单"));
|
// printTickets(1,1,"ZF544PG03W00001",getCashPrintData(detailPO,"结算单"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -295,10 +295,10 @@ public class RedisUtils {
|
||||||
* @param timeUnit 类型
|
* @param timeUnit 类型
|
||||||
* @return true成功 false 失败
|
* @return true成功 false 失败
|
||||||
*/
|
*/
|
||||||
public boolean set(String key, Object value, long time, TimeUnit timeUnit) {
|
public boolean set(String key, String value, long time, TimeUnit timeUnit) {
|
||||||
try {
|
try {
|
||||||
if (time > 0) {
|
if (time > 0) {
|
||||||
redisTemplate.opsForValue().set(key, value, time, timeUnit);
|
stringRedisTemplate.opsForValue().set(key, value, time, timeUnit);
|
||||||
} else {
|
} else {
|
||||||
set(key, value);
|
set(key, value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,4 +51,14 @@ public class StringUtil {
|
||||||
return JSON.parseArray(listString);
|
return JSON.parseArray(listString);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String random(int length) {
|
||||||
|
Random random = new Random();
|
||||||
|
String result = "";
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
result += random.nextInt(10);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
package com.chaozhanggui.system.cashierservice.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.aliyun.dysmsapi20170525.Client;
|
||||||
|
import com.aliyun.teaopenapi.models.Config;
|
||||||
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static com.chaozhanggui.system.cashierservice.sign.CodeEnum.SUCCESS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取验证码相关工具
|
||||||
|
* @author 12847
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class ValidateCodeUtil {
|
||||||
|
/**
|
||||||
|
* 阿里云key
|
||||||
|
*/
|
||||||
|
@Value("${aliyun.keyid}")
|
||||||
|
private String ACCESSKEYID;
|
||||||
|
/**
|
||||||
|
* 阿里云secret
|
||||||
|
*/
|
||||||
|
@Value("${aliyun.keysecret}")
|
||||||
|
private String ACCESSKEYSECRET;
|
||||||
|
/**
|
||||||
|
* 十小时
|
||||||
|
*/
|
||||||
|
protected static final long MILLIS_MINUTE = 10 *60 * 60 *1000;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HttpServletRequest request;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取验证码(阿里云)
|
||||||
|
*/
|
||||||
|
public Result requestValidateCodeAli(String phone, String checkCode) {
|
||||||
|
Client client = null;
|
||||||
|
try {
|
||||||
|
client = createClient();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
// 1.发送短信
|
||||||
|
com.aliyun.dysmsapi20170525.models.SendSmsRequest sendSmsRequest = new com.aliyun.dysmsapi20170525.models.SendSmsRequest()
|
||||||
|
.setSignName("银收客")
|
||||||
|
.setTemplateCode("SMS_244665149")
|
||||||
|
.setTemplateParam("{\"code\":" +"'"+checkCode +"'"+"}")
|
||||||
|
.setPhoneNumbers(phone);
|
||||||
|
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
|
||||||
|
try {
|
||||||
|
assert client != null;
|
||||||
|
return Result.success(SUCCESS,client.sendSmsWithOptions(sendSmsRequest, runtime));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return Result.fail(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 发送短信(阿里云)
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public Client createClient() throws Exception {
|
||||||
|
Config config = new Config();
|
||||||
|
config.accessKeyId = ACCESSKEYID;
|
||||||
|
config.accessKeySecret = ACCESSKEYSECRET;
|
||||||
|
return new com.aliyun.dysmsapi20170525.Client(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
server:
|
||||||
|
port: 9888
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://rm-bp1b572nblln4jho2.mysql.rds.aliyuncs.com/fycashier?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false
|
url: jdbc:mysql://rm-bp1b572nblln4jho2.mysql.rds.aliyuncs.com/fycashier?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ wx:
|
||||||
#
|
#
|
||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
active: prod
|
active: dev
|
||||||
websocket:
|
websocket:
|
||||||
port: 6001
|
port: 6001
|
||||||
action: ws://127.0.0.1
|
action: ws://127.0.0.1
|
||||||
|
|
@ -47,3 +47,7 @@ logging:
|
||||||
# 如果是压缩包,里面会多一个名log/ota.2021-11-05.0的日志文件
|
# 如果是压缩包,里面会多一个名log/ota.2021-11-05.0的日志文件
|
||||||
# 如下面的例子,打包之后为: log/2021-11/cashier-client.2020-11-5.0.log,这是一个日志文件
|
# 如下面的例子,打包之后为: log/2021-11/cashier-client.2020-11-5.0.log,这是一个日志文件
|
||||||
file-name-pattern: log/%d{yyyy-MM}/cashierService.%d{yyyy-MM-dd}.%i.log
|
file-name-pattern: log/%d{yyyy-MM}/cashierService.%d{yyyy-MM-dd}.%i.log
|
||||||
|
#阿里云相关配置
|
||||||
|
aliyun:
|
||||||
|
keyid: LTAI5tPdEfYSZcqHbjCrtPRD
|
||||||
|
keysecret: DZjyHBq3nTujF0NMLxnZgsecU8ZCvy
|
||||||
|
|
@ -0,0 +1,248 @@
|
||||||
|
<?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.TbPlatformDictMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbPlatformDict" id="TbPlatformDictMap">
|
||||||
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||||
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="type" column="type" jdbcType="VARCHAR"/>
|
||||||
|
<result property="coverImg" column="cover_img" jdbcType="VARCHAR"/>
|
||||||
|
<result property="shareImg" column="share_img" jdbcType="VARCHAR"/>
|
||||||
|
<result property="video" column="video" jdbcType="VARCHAR"/>
|
||||||
|
<result property="videoCoverImg" column="video_cover_img" jdbcType="VARCHAR"/>
|
||||||
|
<result property="relUrl" column="rel_url" jdbcType="VARCHAR"/>
|
||||||
|
<result property="absUrl" column="abs_url" jdbcType="VARCHAR"/>
|
||||||
|
<result property="createdAt" column="created_at" jdbcType="INTEGER"/>
|
||||||
|
<result property="updatedAt" column="updated_at" jdbcType="INTEGER"/>
|
||||||
|
<result property="isShowCash" column="is_show_cash" jdbcType="INTEGER"/>
|
||||||
|
<result property="isShowMall" column="is_show_mall" jdbcType="INTEGER"/>
|
||||||
|
<result property="isShowApp" column="is_show_app" jdbcType="INTEGER"/>
|
||||||
|
<result property="sort" column="sort" jdbcType="INTEGER"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!--查询单个-->
|
||||||
|
<select id="queryById" resultMap="TbPlatformDictMap">
|
||||||
|
select
|
||||||
|
id, name, type, cover_img, share_img, video, video_cover_img, rel_url, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
|
||||||
|
from tb_platform_dict
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--查询指定行数据-->
|
||||||
|
<select id="queryAllByLimit" resultMap="TbPlatformDictMap">
|
||||||
|
select
|
||||||
|
id, name, type, cover_img, share_img, video, video_cover_img, rel_url, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
|
||||||
|
from tb_platform_dict
|
||||||
|
<where>
|
||||||
|
<if test="id != null">
|
||||||
|
and id = #{id}
|
||||||
|
</if>
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
and name = #{name}
|
||||||
|
</if>
|
||||||
|
<if test="type != null and type != ''">
|
||||||
|
and type = #{type}
|
||||||
|
</if>
|
||||||
|
<if test="coverImg != null and coverImg != ''">
|
||||||
|
and cover_img = #{coverImg}
|
||||||
|
</if>
|
||||||
|
<if test="shareImg != null and shareImg != ''">
|
||||||
|
and share_img = #{shareImg}
|
||||||
|
</if>
|
||||||
|
<if test="video != null and video != ''">
|
||||||
|
and video = #{video}
|
||||||
|
</if>
|
||||||
|
<if test="videoCoverImg != null and videoCoverImg != ''">
|
||||||
|
and video_cover_img = #{videoCoverImg}
|
||||||
|
</if>
|
||||||
|
<if test="relUrl != null and relUrl != ''">
|
||||||
|
and rel_url = #{relUrl}
|
||||||
|
</if>
|
||||||
|
<if test="absUrl != null and absUrl != ''">
|
||||||
|
and abs_url = #{absUrl}
|
||||||
|
</if>
|
||||||
|
<if test="createdAt != null">
|
||||||
|
and created_at = #{createdAt}
|
||||||
|
</if>
|
||||||
|
<if test="updatedAt != null">
|
||||||
|
and updated_at = #{updatedAt}
|
||||||
|
</if>
|
||||||
|
<if test="isShowCash != null">
|
||||||
|
and is_show_cash = #{isShowCash}
|
||||||
|
</if>
|
||||||
|
<if test="isShowMall != null">
|
||||||
|
and is_show_mall = #{isShowMall}
|
||||||
|
</if>
|
||||||
|
<if test="isShowApp != null">
|
||||||
|
and is_show_app = #{isShowApp}
|
||||||
|
</if>
|
||||||
|
<if test="sort != null">
|
||||||
|
and sort = #{sort}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
limit #{pageable.offset}, #{pageable.pageSize}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--统计总行数-->
|
||||||
|
<select id="count" resultType="java.lang.Long">
|
||||||
|
select count(1)
|
||||||
|
from tb_platform_dict
|
||||||
|
<where>
|
||||||
|
<if test="id != null">
|
||||||
|
and id = #{id}
|
||||||
|
</if>
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
and name = #{name}
|
||||||
|
</if>
|
||||||
|
<if test="type != null and type != ''">
|
||||||
|
and type = #{type}
|
||||||
|
</if>
|
||||||
|
<if test="coverImg != null and coverImg != ''">
|
||||||
|
and cover_img = #{coverImg}
|
||||||
|
</if>
|
||||||
|
<if test="shareImg != null and shareImg != ''">
|
||||||
|
and share_img = #{shareImg}
|
||||||
|
</if>
|
||||||
|
<if test="video != null and video != ''">
|
||||||
|
and video = #{video}
|
||||||
|
</if>
|
||||||
|
<if test="videoCoverImg != null and videoCoverImg != ''">
|
||||||
|
and video_cover_img = #{videoCoverImg}
|
||||||
|
</if>
|
||||||
|
<if test="relUrl != null and relUrl != ''">
|
||||||
|
and rel_url = #{relUrl}
|
||||||
|
</if>
|
||||||
|
<if test="absUrl != null and absUrl != ''">
|
||||||
|
and abs_url = #{absUrl}
|
||||||
|
</if>
|
||||||
|
<if test="createdAt != null">
|
||||||
|
and created_at = #{createdAt}
|
||||||
|
</if>
|
||||||
|
<if test="updatedAt != null">
|
||||||
|
and updated_at = #{updatedAt}
|
||||||
|
</if>
|
||||||
|
<if test="isShowCash != null">
|
||||||
|
and is_show_cash = #{isShowCash}
|
||||||
|
</if>
|
||||||
|
<if test="isShowMall != null">
|
||||||
|
and is_show_mall = #{isShowMall}
|
||||||
|
</if>
|
||||||
|
<if test="isShowApp != null">
|
||||||
|
and is_show_app = #{isShowApp}
|
||||||
|
</if>
|
||||||
|
<if test="sort != null">
|
||||||
|
and sort = #{sort}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
<select id="queryAllByType" resultType="com.chaozhanggui.system.cashierservice.entity.TbPlatformDict">
|
||||||
|
select
|
||||||
|
id, name, type, cover_img, share_img, video, video_cover_img, rel_url, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
|
||||||
|
from tb_platform_dict
|
||||||
|
<where>
|
||||||
|
<if test="type != null and type != ''">
|
||||||
|
type = #{type}
|
||||||
|
</if>
|
||||||
|
<if test="environment == app">
|
||||||
|
and is_show_mall = 1
|
||||||
|
</if>
|
||||||
|
<if test="environment == wx">
|
||||||
|
and is_show_app = 1
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--新增所有列-->
|
||||||
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into tb_platform_dict(name, type, cover_img, share_img, video, video_cover_img, rel_url, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort)
|
||||||
|
values (#{name}, #{type}, #{coverImg}, #{shareImg}, #{video}, #{videoCoverImg}, #{relUrl}, #{absUrl}, #{createdAt}, #{updatedAt}, #{isShowCash}, #{isShowMall}, #{isShowApp}, #{sort})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into tb_platform_dict(name, type, cover_img, share_img, video, video_cover_img, rel_url, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort)
|
||||||
|
values
|
||||||
|
<foreach collection="entities" item="entity" separator=",">
|
||||||
|
(#{entity.name}, #{entity.type}, #{entity.coverImg}, #{entity.shareImg}, #{entity.video}, #{entity.videoCoverImg}, #{entity.relUrl}, #{entity.absUrl}, #{entity.createdAt}, #{entity.updatedAt}, #{entity.isShowCash}, #{entity.isShowMall}, #{entity.isShowApp}, #{entity.sort})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into tb_platform_dict(name, type, cover_img, share_img, video, video_cover_img, rel_url, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort)
|
||||||
|
values
|
||||||
|
<foreach collection="entities" item="entity" separator=",">
|
||||||
|
(#{entity.name}, #{entity.type}, #{entity.coverImg}, #{entity.shareImg}, #{entity.video}, #{entity.videoCoverImg}, #{entity.relUrl}, #{entity.absUrl}, #{entity.createdAt}, #{entity.updatedAt}, #{entity.isShowCash}, #{entity.isShowMall}, #{entity.isShowApp}, #{entity.sort})
|
||||||
|
</foreach>
|
||||||
|
on duplicate key update
|
||||||
|
name = values(name),
|
||||||
|
type = values(type),
|
||||||
|
cover_img = values(cover_img),
|
||||||
|
share_img = values(share_img),
|
||||||
|
video = values(video),
|
||||||
|
video_cover_img = values(video_cover_img),
|
||||||
|
rel_url = values(rel_url),
|
||||||
|
abs_url = values(abs_url),
|
||||||
|
created_at = values(created_at),
|
||||||
|
updated_at = values(updated_at),
|
||||||
|
is_show_cash = values(is_show_cash),
|
||||||
|
is_show_mall = values(is_show_mall),
|
||||||
|
is_show_app = values(is_show_app),
|
||||||
|
sort = values(sort)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!--通过主键修改数据-->
|
||||||
|
<update id="update">
|
||||||
|
update tb_platform_dict
|
||||||
|
<set>
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
name = #{name},
|
||||||
|
</if>
|
||||||
|
<if test="type != null and type != ''">
|
||||||
|
type = #{type},
|
||||||
|
</if>
|
||||||
|
<if test="coverImg != null and coverImg != ''">
|
||||||
|
cover_img = #{coverImg},
|
||||||
|
</if>
|
||||||
|
<if test="shareImg != null and shareImg != ''">
|
||||||
|
share_img = #{shareImg},
|
||||||
|
</if>
|
||||||
|
<if test="video != null and video != ''">
|
||||||
|
video = #{video},
|
||||||
|
</if>
|
||||||
|
<if test="videoCoverImg != null and videoCoverImg != ''">
|
||||||
|
video_cover_img = #{videoCoverImg},
|
||||||
|
</if>
|
||||||
|
<if test="relUrl != null and relUrl != ''">
|
||||||
|
rel_url = #{relUrl},
|
||||||
|
</if>
|
||||||
|
<if test="absUrl != null and absUrl != ''">
|
||||||
|
abs_url = #{absUrl},
|
||||||
|
</if>
|
||||||
|
<if test="createdAt != null">
|
||||||
|
created_at = #{createdAt},
|
||||||
|
</if>
|
||||||
|
<if test="updatedAt != null">
|
||||||
|
updated_at = #{updatedAt},
|
||||||
|
</if>
|
||||||
|
<if test="isShowCash != null">
|
||||||
|
is_show_cash = #{isShowCash},
|
||||||
|
</if>
|
||||||
|
<if test="isShowMall != null">
|
||||||
|
is_show_mall = #{isShowMall},
|
||||||
|
</if>
|
||||||
|
<if test="isShowApp != null">
|
||||||
|
is_show_app = #{isShowApp},
|
||||||
|
</if>
|
||||||
|
<if test="sort != null">
|
||||||
|
sort = #{sort},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!--通过主键删除-->
|
||||||
|
<delete id="deleteById">
|
||||||
|
delete from tb_platform_dict where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
||||||
|
|
@ -355,4 +355,19 @@
|
||||||
<select id="selectAll" resultType="com.chaozhanggui.system.cashierservice.entity.TbProductSku">
|
<select id="selectAll" resultType="com.chaozhanggui.system.cashierservice.entity.TbProductSku">
|
||||||
select * from tb_product_sku
|
select * from tb_product_sku
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectDownSku" resultType="com.chaozhanggui.system.cashierservice.entity.TbProductSku">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
tb_product_sku
|
||||||
|
WHERE
|
||||||
|
product_id IN
|
||||||
|
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
GROUP BY
|
||||||
|
product_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -617,4 +617,31 @@
|
||||||
<select id="selectByPhone" resultMap="BaseResultMap">
|
<select id="selectByPhone" resultMap="BaseResultMap">
|
||||||
select * from tb_shop_info where account=#{phone}
|
select * from tb_shop_info where account=#{phone}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectShopInfo" resultType="com.chaozhanggui.system.cashierservice.entity.vo.HomeVO">
|
||||||
|
SELECT
|
||||||
|
shop.shop_name shopName,
|
||||||
|
product.`name` productName,
|
||||||
|
product.cover_img image,
|
||||||
|
product.id productId
|
||||||
|
FROM
|
||||||
|
tb_shop_info shop
|
||||||
|
LEFT JOIN tb_product product ON shop.id = product.shop_id
|
||||||
|
WHERE
|
||||||
|
product.is_hot = 1
|
||||||
|
Limit #{page}, #{size}
|
||||||
|
</select>
|
||||||
|
<select id="searchUserDutyDetail" resultType="com.chaozhanggui.system.cashierservice.entity.vo.UserDutyVo">
|
||||||
|
SELECT
|
||||||
|
sum( num ),
|
||||||
|
product_id
|
||||||
|
FROM
|
||||||
|
tb_shop_user_duty_detail
|
||||||
|
WHERE
|
||||||
|
product_id IN
|
||||||
|
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
GROUP BY
|
||||||
|
product_id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbUserInfoMapper">
|
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbUserInfoMapper">
|
||||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbUserInfo">
|
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbUserInfo">
|
||||||
<id column="id" jdbcType="INTEGER" property="id" />
|
<id column="id" jdbcType="INTEGER" property="id" />
|
||||||
|
<id column="user_id" jdbcType="INTEGER" property="userId" />
|
||||||
<result column="amount" jdbcType="DECIMAL" property="amount" />
|
<result column="amount" jdbcType="DECIMAL" property="amount" />
|
||||||
<result column="charge_amount" jdbcType="DECIMAL" property="chargeAmount" />
|
<result column="charge_amount" jdbcType="DECIMAL" property="chargeAmount" />
|
||||||
<result column="line_of_credit" jdbcType="DECIMAL" property="lineOfCredit" />
|
<result column="line_of_credit" jdbcType="DECIMAL" property="lineOfCredit" />
|
||||||
|
|
@ -47,15 +48,16 @@
|
||||||
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
|
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
|
||||||
<result column="bind_parent_at" jdbcType="BIGINT" property="bindParentAt" />
|
<result column="bind_parent_at" jdbcType="BIGINT" property="bindParentAt" />
|
||||||
<result column="grand_parent_id" jdbcType="VARCHAR" property="grandParentId" />
|
<result column="grand_parent_id" jdbcType="VARCHAR" property="grandParentId" />
|
||||||
|
<result column="password" jdbcType="VARCHAR" property="password" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, amount, charge_amount, line_of_credit, consume_amount, consume_number, total_score,
|
id,user_id, amount, charge_amount, line_of_credit, consume_amount, consume_number, total_score,
|
||||||
lock_score, card_no, card_password, level_id, head_img, nick_name, telephone, wx_ma_app_id,
|
lock_score, card_no, card_password, level_id, head_img, nick_name, telephone, wx_ma_app_id,
|
||||||
birth_day, sex, mini_app_open_id, open_id, union_id, code, type, identify, status,
|
birth_day, sex, mini_app_open_id, open_id, union_id, code, type, identify, status,
|
||||||
parent_id, parent_level, parent_type, project_id, merchant_id, is_resource, is_online,
|
parent_id, parent_level, parent_type, project_id, merchant_id, is_resource, is_online,
|
||||||
is_vip, vip_effect_at, tips, source_path, is_sales_person, is_attention_mp, city,
|
is_vip, vip_effect_at, tips, source_path, is_sales_person, is_attention_mp, city,
|
||||||
search_word, last_log_in_at, last_leave_at, created_at, updated_at, bind_parent_at,
|
search_word, last_log_in_at, last_leave_at, created_at, updated_at, bind_parent_at,
|
||||||
grand_parent_id
|
grand_parent_id,password
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
|
|
@ -69,7 +71,7 @@
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into tb_user_info (id, amount, charge_amount,
|
insert into tb_user_info (id,user_id, amount, charge_amount,
|
||||||
line_of_credit, consume_amount, consume_number,
|
line_of_credit, consume_amount, consume_number,
|
||||||
total_score, lock_score, card_no,
|
total_score, lock_score, card_no,
|
||||||
card_password, level_id, head_img,
|
card_password, level_id, head_img,
|
||||||
|
|
@ -83,9 +85,9 @@
|
||||||
tips, source_path, is_sales_person,
|
tips, source_path, is_sales_person,
|
||||||
is_attention_mp, city, search_word,
|
is_attention_mp, city, search_word,
|
||||||
last_log_in_at, last_leave_at, created_at,
|
last_log_in_at, last_leave_at, created_at,
|
||||||
updated_at, bind_parent_at, grand_parent_id
|
updated_at, bind_parent_at, grand_parent_id,password
|
||||||
)
|
)
|
||||||
values (#{id,jdbcType=INTEGER}, #{amount,jdbcType=DECIMAL}, #{chargeAmount,jdbcType=DECIMAL},
|
values (#{id,jdbcType=INTEGER},#{userId,jdbcType=INTEGER}, #{amount,jdbcType=DECIMAL}, #{chargeAmount,jdbcType=DECIMAL},
|
||||||
#{lineOfCredit,jdbcType=DECIMAL}, #{consumeAmount,jdbcType=DECIMAL}, #{consumeNumber,jdbcType=INTEGER},
|
#{lineOfCredit,jdbcType=DECIMAL}, #{consumeAmount,jdbcType=DECIMAL}, #{consumeNumber,jdbcType=INTEGER},
|
||||||
#{totalScore,jdbcType=INTEGER}, #{lockScore,jdbcType=INTEGER}, #{cardNo,jdbcType=VARCHAR},
|
#{totalScore,jdbcType=INTEGER}, #{lockScore,jdbcType=INTEGER}, #{cardNo,jdbcType=VARCHAR},
|
||||||
#{cardPassword,jdbcType=VARCHAR}, #{levelId,jdbcType=VARCHAR}, #{headImg,jdbcType=VARCHAR},
|
#{cardPassword,jdbcType=VARCHAR}, #{levelId,jdbcType=VARCHAR}, #{headImg,jdbcType=VARCHAR},
|
||||||
|
|
@ -99,7 +101,7 @@
|
||||||
#{tips,jdbcType=VARCHAR}, #{sourcePath,jdbcType=VARCHAR}, #{isSalesPerson,jdbcType=TINYINT},
|
#{tips,jdbcType=VARCHAR}, #{sourcePath,jdbcType=VARCHAR}, #{isSalesPerson,jdbcType=TINYINT},
|
||||||
#{isAttentionMp,jdbcType=TINYINT}, #{city,jdbcType=VARCHAR}, #{searchWord,jdbcType=VARCHAR},
|
#{isAttentionMp,jdbcType=TINYINT}, #{city,jdbcType=VARCHAR}, #{searchWord,jdbcType=VARCHAR},
|
||||||
#{lastLogInAt,jdbcType=BIGINT}, #{lastLeaveAt,jdbcType=BIGINT}, #{createdAt,jdbcType=BIGINT},
|
#{lastLogInAt,jdbcType=BIGINT}, #{lastLeaveAt,jdbcType=BIGINT}, #{createdAt,jdbcType=BIGINT},
|
||||||
#{updatedAt,jdbcType=BIGINT}, #{bindParentAt,jdbcType=BIGINT}, #{grandParentId,jdbcType=VARCHAR}
|
#{updatedAt,jdbcType=BIGINT}, #{bindParentAt,jdbcType=BIGINT}, #{grandParentId,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo">
|
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo">
|
||||||
|
|
@ -108,6 +110,9 @@
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
id,
|
id,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="userId != null and userId != ''">
|
||||||
|
user_id,
|
||||||
|
</if>
|
||||||
<if test="amount != null">
|
<if test="amount != null">
|
||||||
amount,
|
amount,
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -240,11 +245,17 @@
|
||||||
<if test="grandParentId != null">
|
<if test="grandParentId != null">
|
||||||
grand_parent_id,
|
grand_parent_id,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="password != null and password != ''">
|
||||||
|
password
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
#{id,jdbcType=INTEGER},
|
#{id,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="userId != null and userId != ''">
|
||||||
|
#{userId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
<if test="amount != null">
|
<if test="amount != null">
|
||||||
#{amount,jdbcType=DECIMAL},
|
#{amount,jdbcType=DECIMAL},
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -377,11 +388,17 @@
|
||||||
<if test="grandParentId != null">
|
<if test="grandParentId != null">
|
||||||
#{grandParentId,jdbcType=VARCHAR},
|
#{grandParentId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="password != null and password != ''">
|
||||||
|
#{password,jdbcType=VARCHAR}
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo">
|
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo">
|
||||||
update tb_user_info
|
update tb_user_info
|
||||||
<set>
|
<set>
|
||||||
|
<if test="userId != null and userId != ''">
|
||||||
|
user_id = #{userId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
<if test="amount != null">
|
<if test="amount != null">
|
||||||
amount = #{amount,jdbcType=DECIMAL},
|
amount = #{amount,jdbcType=DECIMAL},
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -514,12 +531,16 @@
|
||||||
<if test="grandParentId != null">
|
<if test="grandParentId != null">
|
||||||
grand_parent_id = #{grandParentId,jdbcType=VARCHAR},
|
grand_parent_id = #{grandParentId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="password != null and password != ''">
|
||||||
|
password = #{password,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
</set>
|
</set>
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo">
|
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserInfo">
|
||||||
update tb_user_info
|
update tb_user_info
|
||||||
set amount = #{amount,jdbcType=DECIMAL},
|
set user_id = #{userId,jdbcType=INTEGER},
|
||||||
|
amount = #{amount,jdbcType=DECIMAL},
|
||||||
charge_amount = #{chargeAmount,jdbcType=DECIMAL},
|
charge_amount = #{chargeAmount,jdbcType=DECIMAL},
|
||||||
line_of_credit = #{lineOfCredit,jdbcType=DECIMAL},
|
line_of_credit = #{lineOfCredit,jdbcType=DECIMAL},
|
||||||
consume_amount = #{consumeAmount,jdbcType=DECIMAL},
|
consume_amount = #{consumeAmount,jdbcType=DECIMAL},
|
||||||
|
|
@ -562,7 +583,8 @@
|
||||||
created_at = #{createdAt,jdbcType=BIGINT},
|
created_at = #{createdAt,jdbcType=BIGINT},
|
||||||
updated_at = #{updatedAt,jdbcType=BIGINT},
|
updated_at = #{updatedAt,jdbcType=BIGINT},
|
||||||
bind_parent_at = #{bindParentAt,jdbcType=BIGINT},
|
bind_parent_at = #{bindParentAt,jdbcType=BIGINT},
|
||||||
grand_parent_id = #{grandParentId,jdbcType=VARCHAR}
|
grand_parent_id = #{grandParentId,jdbcType=VARCHAR},
|
||||||
|
password = #{password,jdbcType=VARCHAR}
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
@ -571,4 +593,12 @@
|
||||||
select * from tb_user_info where mini_app_open_id=#{openId}
|
select * from tb_user_info where mini_app_open_id=#{openId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUserByPhone" resultMap="BaseResultMap">
|
||||||
|
select * from tb_user_info where telephone=#{phone} AND source_path=#{source}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByPhone" resultMap="BaseResultMap">
|
||||||
|
select * from tb_user_info where telephone=#{phone} AND source_path='APP' AND user_id is null
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue