Commit ff5a1f6a by 张新旗

小程序,订单代码提交

parent a34c00d8
...@@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.AjaxResult; ...@@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.service.impl.AppServiceImpl; import com.ruoyi.system.service.impl.AppServiceImpl;
import com.ruoyi.system.service.impl.OrderServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -17,12 +18,19 @@ public class AppController { ...@@ -17,12 +18,19 @@ public class AppController {
private TokenService tokenService; private TokenService tokenService;
@Autowired @Autowired
private AppServiceImpl appService; private AppServiceImpl appService;
@RequestMapping("/getShop") @Autowired
public AjaxResult getShop(String lng,String lat){ private OrderServiceImpl orderService;
return AjaxResult.success(appService.getShop(lng,lat));
@RequestMapping("/getMyOrder")
public AjaxResult getMyOrder(HttpServletRequest request){
LoginUser loginUser = tokenService.getLoginUser(request);
if(loginUser ==null){
return AjaxResult.error("请先登录");
} }
String openId = loginUser.getOpenId();
return AjaxResult.success(orderService.getMyOrder(openId));
}
} }
package com.ruoyi.web.controller.coffee;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.system.domain.Machine;
import com.ruoyi.system.domain.vo.PushBean;
import com.ruoyi.system.jiguang.impl.JiGuangPushServiceImpl;
import com.ruoyi.system.service.impl.MachineServiceImpl;
import com.ruoyi.system.service.impl.OrderServiceImpl;
import com.ruoyi.system.service.impl.OrderTakingServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.security.core.parameters.P;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@RestController
@RequestMapping("/application")
public class ApplicationController {
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Autowired
private MachineServiceImpl machineService;
@Autowired
JiGuangPushServiceImpl jiGuangPushService;
@Autowired
private OrderTakingServiceImpl orderTakingService;
@Autowired
private OrderServiceImpl orderService;
@RequestMapping("/saveData")
public AjaxResult saveApplicationData(@RequestParam("machineCode")String machineCode, @RequestBody String body){
String id = UUID.randomUUID().toString();
String key = machineCode+"_"+id;
stringRedisTemplate.opsForValue().set(key, body);
stringRedisTemplate.expire(id,1, TimeUnit.HOURS);
return AjaxResult.success(id);
}
@RequestMapping("/getData")
public AjaxResult getApplicationData(String key){
String s = stringRedisTemplate.opsForValue().get(key);
stringRedisTemplate.delete(key);
String[] keys = key.split("_");
//推送数据给安卓
PushBean pushBean = new PushBean();
Map<String,String> map = new HashMap();
map.put("type","1");
map.put("code","200");
jiGuangPushService.push(keys[0],map);
return AjaxResult.success(s);
}
@RequestMapping("/jgRegister")
public AjaxResult jgRegister(String machineCode,String registerId){
Machine machine = new Machine();
machine.setId(machineCode);
machine.setRegister(registerId);
return AjaxResult.success(machineService.updateMachine(machine));
}
@RequestMapping("/getOrderTaking")
public AjaxResult getOrderTaking(String machineCode){
return AjaxResult.success(orderTakingService.getMachineInfo(machineCode));
}
@RequestMapping("/getOrderInfo")
public AjaxResult getOrderInfo(String machineCode){
return AjaxResult.success(orderService.getOrderInfo(machineCode));
}
}
...@@ -4,12 +4,14 @@ import com.ruoyi.common.core.domain.AjaxResult; ...@@ -4,12 +4,14 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.service.impl.OrderTakingServiceImpl; import com.ruoyi.system.service.impl.OrderTakingServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
/** /**
* 点单信息 * 点单信息
*/ */
@RestController("/orderTaking") @RestController
@RequestMapping(("/orderTaking"))
public class OrderTakingController { public class OrderTakingController {
@Autowired @Autowired
private OrderTakingServiceImpl orderTakingService; private OrderTakingServiceImpl orderTakingService;
......
package com.ruoyi.web.controller.coffee; package com.ruoyi.web.controller.coffee;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.QRCodeUtil; import com.ruoyi.common.utils.QRCodeUtil;
import com.ruoyi.framework.web.service.WeixinServiceImpl; import com.ruoyi.framework.web.service.WeixinServiceImpl;
import com.ruoyi.system.service.impl.AppServiceImpl;
import com.ruoyi.system.service.impl.OrderTakingServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -18,14 +21,24 @@ public class WeixinController { ...@@ -18,14 +21,24 @@ public class WeixinController {
@Autowired @Autowired
WeixinServiceImpl weixinService; WeixinServiceImpl weixinService;
@Autowired
private AppServiceImpl appService;
@Autowired
private OrderTakingServiceImpl orderTakingService;
//这个就是那个使用传code进来的接口 //这个就是那个使用传code进来的接口
@GetMapping("/login") @PostMapping("/login")
public AjaxResult login(@RequestParam("code") String code, @RequestParam("encryptedData") String encryptedData, @RequestParam("iv") String iv,@RequestParam(required = false) String source){ public AjaxResult login(@RequestBody String body){
JSONObject param = JSONObject.parseObject(body);
String code =param.getString("code");
String encryptedData = param.getString("encryptedData");
String iv = param.getString("iv");
String source = param.getString("source");
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
String token = weixinService.login(code,encryptedData,iv,source); String token = weixinService.login(code,encryptedData,iv,source);
ajax.put(Constants.TOKEN, token); ajax.put(Constants.TOKEN, token);
return null; return ajax;
} }
@RequestMapping("/wxNotify") @RequestMapping("/wxNotify")
...@@ -36,6 +49,22 @@ public class WeixinController { ...@@ -36,6 +49,22 @@ public class WeixinController {
throw new ServiceException("微信回调发生异常"); throw new ServiceException("微信回调发生异常");
} }
} }
@RequestMapping("/test")
public String test(){
return weixinService.test();
}
@RequestMapping("/getShop")
public AjaxResult getShop(@RequestParam(required = false) String lng,@RequestParam(required = false)String lat){
return AjaxResult.success(appService.getShop(lng,lat));
}
@GetMapping(value = "/infoByShop")
public AjaxResult infoByShop(String shopId)
{
return AjaxResult.success(orderTakingService.getInfoByShop(shopId));
}
} }
...@@ -4,6 +4,8 @@ import java.util.Collection; ...@@ -4,6 +4,8 @@ import java.util.Collection;
import java.util.Map; import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.exception.ServiceException;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing; import org.aspectj.lang.annotation.AfterThrowing;
...@@ -67,8 +69,12 @@ public class LogAspect ...@@ -67,8 +69,12 @@ public class LogAspect
{ {
// 获取当前的用户 // 获取当前的用户
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = null;
try{
loginUser = SecurityUtils.getLoginUser();
}catch (ServiceException serviceException){
log.error("获取用户数据为空");
}
// *========数据库日志=========*// // *========数据库日志=========*//
SysOperLog operLog = new SysOperLog(); SysOperLog operLog = new SysOperLog();
operLog.setStatus(BusinessStatus.SUCCESS.ordinal()); operLog.setStatus(BusinessStatus.SUCCESS.ordinal());
......
...@@ -97,7 +97,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter ...@@ -97,7 +97,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求 // 过滤请求
.authorizeRequests() .authorizeRequests()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/register", "/captchaImage","/weixin/**","/tool/gen/**").anonymous() .antMatchers("/login", "/register", "/captchaImage","/weixin/**","/application/**").anonymous()
.antMatchers( .antMatchers(
HttpMethod.GET, HttpMethod.GET,
"/", "/",
......
...@@ -2,6 +2,7 @@ package com.ruoyi.framework.web.service; ...@@ -2,6 +2,7 @@ package com.ruoyi.framework.web.service;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.QRCodeUtil; import com.ruoyi.common.utils.QRCodeUtil;
...@@ -84,7 +85,7 @@ public class WeixinServiceImpl { ...@@ -84,7 +85,7 @@ public class WeixinServiceImpl {
public String getSessionKeyOrOpenId(String code) { public String getSessionKeyOrOpenId(String code) {
String url = "https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type=authorization_code"; String url = "https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type=authorization_code";
String replaceUrl = url.replace("{0}", appid).replace("{1}", secret).replace("{2}", code); String replaceUrl = url.replace("{0}", appid).replace("{1}", secret).replace("{2}", code);
String res = restTemplate.getForObject(url,String.class); String res = restTemplate.getForObject(replaceUrl,String.class);
return res; return res;
} }
...@@ -94,6 +95,7 @@ public class WeixinServiceImpl { ...@@ -94,6 +95,7 @@ public class WeixinServiceImpl {
JSONObject openInfo = JSONObject.parseObject(sessionKeyOrOpenId); JSONObject openInfo = JSONObject.parseObject(sessionKeyOrOpenId);
String cutomerId = openInfo.getString("openid"); String cutomerId = openInfo.getString("openid");
String encData = this.wxDecrypt(encryptedData, sessionKeyOrOpenId, iv); String encData = this.wxDecrypt(encryptedData, sessionKeyOrOpenId, iv);
log.info("当前用户的信息为:【{}】",encData);
Customer customer = customerMapper.selectCustomerById(cutomerId); Customer customer = customerMapper.selectCustomerById(cutomerId);
JSONObject encDataInf = JSONObject.parseObject(encData); JSONObject encDataInf = JSONObject.parseObject(encData);
if(customer ==null){ if(customer ==null){
...@@ -117,10 +119,14 @@ public class WeixinServiceImpl { ...@@ -117,10 +119,14 @@ public class WeixinServiceImpl {
} }
private LoginUser transLoginUser(Customer customer,String encData){ private LoginUser transLoginUser(Customer customer,String encData){
LoginUser loginUser = new LoginUser(); SysUser user = new SysUser();
user.setUserName(customer.getUserName());
LoginUser loginUser = new LoginUser(user,null);
loginUser.setLoginTime(System.currentTimeMillis()); loginUser.setLoginTime(System.currentTimeMillis());
loginUser.setOpenId(customer.getId()); loginUser.setOpenId(customer.getId());
loginUser.setExt(encData); loginUser.setExt(encData);
return loginUser; return loginUser;
} }
...@@ -287,4 +293,11 @@ public class WeixinServiceImpl { ...@@ -287,4 +293,11 @@ public class WeixinServiceImpl {
} }
return null; return null;
} }
public String test() {
Customer customer = new Customer();
customer.setUserName("zxq");
customer.setId("111");
return tokenService.createToken(transLoginUser(customer,null));
}
} }
...@@ -51,6 +51,16 @@ public class Machine extends BaseEntity ...@@ -51,6 +51,16 @@ public class Machine extends BaseEntity
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt; private Date updatedAt;
public String getRegister() {
return register;
}
public void setRegister(String register) {
this.register = register;
}
private String register;
public void setId(String id) public void setId(String id)
{ {
this.id = id; this.id = id;
......
...@@ -78,7 +78,7 @@ public class Order extends BaseEntity ...@@ -78,7 +78,7 @@ public class Order extends BaseEntity
private String source; private String source;
/** 订单状态 0 创建未校验 1 未支付 2 已支付 3 支付制作中 4 制作完成未取 5 待取超时 6 正常完成 7 未支付取消 8 支付后制作前取消 9 制作中取消 10 制作完成取消 11 已退款 12 部分退款 50 其他人工干预状态 */ /** 订单状态 0 创建未校验 1 未支付 2 已支付 3 支付制作中 4 制作完成未取 5 待取超时 6 正常完成 7 未支付取消 8 支付后制作前取消 9 制作中取消 10 制作完成取消 11 已退款 12 部分退款 50 其他人工干预状态 */
@Excel(name = "订单状态 0 创建未校验 1 未支付 2 已支付 3 支付制作中 4 制作完成未取 5 待取超时 6 正常完成 7 未支付取消 8 支付后制作前取消 9 制作中取消 10 制作完成取消 11 已退款 12 部分退款 50 其他人工干预状态") @Excel(name = "订单状态 0 未支付取消 1 未支付 2 已支付 3 待制作 4 支付制作中 5 制作完成未取 6 取餐中 7 取餐完成 8 支付后制作前取消 9 制作中取消 10 制作完成取消 11 已退款 12 部分退款 50 其他人工干预状态")
private String state; private String state;
/** 创建时间 */ /** 创建时间 */
......
...@@ -65,6 +65,16 @@ public class OrderDetail extends BaseEntity ...@@ -65,6 +65,16 @@ public class OrderDetail extends BaseEntity
@Excel(name = "商品分类") @Excel(name = "商品分类")
private String goodsCategory; private String goodsCategory;
public Goods getGoods() {
return goods;
}
public void setGoods(Goods goods) {
this.goods = goods;
}
private Goods goods;
/** 创建时间 */ /** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
......
package com.ruoyi.system.domain.vo; package com.ruoyi.system.domain.vo;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.Date; import java.util.Date;
public class OrderQuery { public class OrderQuery extends BaseEntity {
//d订单号 //d订单号
private String orderNo; private String orderNo;
......
...@@ -3,7 +3,7 @@ package com.ruoyi.system.domain.vo.orderTaking; ...@@ -3,7 +3,7 @@ package com.ruoyi.system.domain.vo.orderTaking;
import java.util.List; import java.util.List;
public class GoodsVo { public class GoodsVo {
private String goodId; private String goodsId;
private String name; private String name;
private String price; private String price;
...@@ -17,12 +17,12 @@ public class GoodsVo { ...@@ -17,12 +17,12 @@ public class GoodsVo {
private List<SkuVo> skus; private List<SkuVo> skus;
public String getGoodId() { public String getGoodsId() {
return goodId; return goodsId;
} }
public void setGoodId(String goodId) { public void setGoodsId(String goodsId) {
this.goodId = goodId; this.goodsId = goodsId;
} }
public String getName() { public String getName() {
...@@ -65,12 +65,12 @@ public class GoodsVo { ...@@ -65,12 +65,12 @@ public class GoodsVo {
this.desc = desc; this.desc = desc;
} }
public String getRemark() { public String getRemarks() {
return remark; return remarks;
} }
public void setRemark(String remark) { public void setRemarks(String remarks) {
this.remark = remark; this.remarks = remarks;
} }
public String getTags() { public String getTags() {
...@@ -81,19 +81,20 @@ public class GoodsVo { ...@@ -81,19 +81,20 @@ public class GoodsVo {
this.tags = tags; this.tags = tags;
} }
public List<SpecVo> getSpecs() {
public String getSpecs() {
return specs; return specs;
} }
public void setSpecs(List<SpecVo> specs) { public void setSpecs(String specs) {
this.specs = specs; this.specs = specs;
} }
private String discount; private String discount;
private String pics; private String pics;
private String desc; private String desc;
private String remark; private String remarks;
private String tags; private String tags;
private List<SpecVo> specs; private String specs;
} }
...@@ -2,7 +2,7 @@ package com.ruoyi.system.domain.vo.orderTaking; ...@@ -2,7 +2,7 @@ package com.ruoyi.system.domain.vo.orderTaking;
import java.io.Serializable; import java.io.Serializable;
public class SkuRule implements Serializable { public class SkuRuleVo implements Serializable {
private String specId; private String specId;
private String specName; private String specName;
......
...@@ -32,15 +32,27 @@ public class SkuVo implements Serializable { ...@@ -32,15 +32,27 @@ public class SkuVo implements Serializable {
this.price = price; this.price = price;
} }
public List<SpecRuleVo> getRules() { public String getRules() {
return rules; return rules;
} }
public void setRules(List<SpecRuleVo> rules) { public String getIsDefault() {
return isDefault;
}
public void setIsDefault(String isDefault) {
this.isDefault = isDefault;
}
public void setRules(String rules) {
this.rules = rules; this.rules = rules;
} }
private String price; private String price;
private List<SpecRuleVo> rules; private String rules;
/**
* 0 默认
*/
private String isDefault;
} }
...@@ -32,4 +32,24 @@ public class SpecRuleVo implements Serializable { ...@@ -32,4 +32,24 @@ public class SpecRuleVo implements Serializable {
} }
private String price; private String price;
public String getIsDefault() {
return isDefault;
}
public void setIsDefault(String isDefault) {
this.isDefault = isDefault;
}
public String getIsRecommend() {
return isRecommend;
}
public void setIsRecommend(String isRecommend) {
this.isRecommend = isRecommend;
}
private String isDefault;
private String isRecommend;
} }
package com.ruoyi.system.jiguang.impl; package com.ruoyi.system.jiguang.impl;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.vo.PushBean; import com.ruoyi.system.domain.vo.PushBean;
import com.ruoyi.system.jiguang.JiGuangPushService; import com.ruoyi.system.jiguang.JiGuangPushService;
import com.ruoyi.system.jiguang.MyJiGuangPushService; import com.ruoyi.system.jiguang.MyJiGuangPushService;
import com.ruoyi.system.mapper.MachineMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 推送服务 * 推送服务
...@@ -20,6 +24,8 @@ public class JiGuangPushServiceImpl implements JiGuangPushService { ...@@ -20,6 +24,8 @@ public class JiGuangPushServiceImpl implements JiGuangPushService {
private static final int max_size = 800; private static final int max_size = 800;
@Autowired @Autowired
private MyJiGuangPushService jPushService; private MyJiGuangPushService jPushService;
@Autowired
private MachineMapper machineMapper;
/** /**
* 推送全部, 不支持附加信息 * 推送全部, 不支持附加信息
* @return * @return
...@@ -85,4 +91,14 @@ public class JiGuangPushServiceImpl implements JiGuangPushService { ...@@ -85,4 +91,14 @@ public class JiGuangPushServiceImpl implements JiGuangPushService {
} }
return regList.toArray(new String[0]); return regList.toArray(new String[0]);
} }
public void push(String key, Map<String, String> map) {
String s = machineMapper.selectRegister(key);
if(StringUtils.isNotEmpty(s)){
PushBean pushBean = new PushBean();
pushBean.setExtras(map);
pushAndroid(pushBean,key);
}
}
} }
...@@ -60,4 +60,5 @@ public interface MachineMapper ...@@ -60,4 +60,5 @@ public interface MachineMapper
public int deleteMachineByIds(String[] ids); public int deleteMachineByIds(String[] ids);
int unbound(String id); int unbound(String id);
String selectRegister(String id);
} }
...@@ -3,6 +3,7 @@ package com.ruoyi.system.mapper; ...@@ -3,6 +3,7 @@ package com.ruoyi.system.mapper;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
import com.ruoyi.system.domain.Order; import com.ruoyi.system.domain.Order;
import com.ruoyi.system.domain.vo.OrderQuery;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
...@@ -64,4 +65,10 @@ public interface OrderMapper ...@@ -64,4 +65,10 @@ public interface OrderMapper
int selectSalesVolume(@Param("shopId") Long shopId,@Param("goodsId") Long goodsId); int selectSalesVolume(@Param("shopId") Long shopId,@Param("goodsId") Long goodsId);
BigDecimal selectSalesAmount(@Param("shopId") long id); BigDecimal selectSalesAmount(@Param("shopId") long id);
List<Order> selectByUserId(String userId);
List<Order> selectOrderByQuery(OrderQuery order);
List<Order> selectOrder(@Param("status") List<String> status,@Param("machineId") String machineCode);
} }
...@@ -66,4 +66,6 @@ public interface IOrderService ...@@ -66,4 +66,6 @@ public interface IOrderService
public int deleteOrderById(String id); public int deleteOrderById(String id);
AjaxResult check(Order order); AjaxResult check(Order order);
List<Order> getMyOrder(String openId);
} }
...@@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl; ...@@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.Shop; import com.ruoyi.system.domain.Shop;
import com.ruoyi.system.mapper.ShopMapper; import com.ruoyi.system.mapper.ShopMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -17,7 +18,15 @@ public class AppServiceImpl { ...@@ -17,7 +18,15 @@ public class AppServiceImpl {
@Autowired @Autowired
private ShopMapper shopMapper; private ShopMapper shopMapper;
public List<Shop> getShop(String lng,String lat) { public List<Shop> getShop(String lng,String lat) {
if(StringUtils.isNotEmpty(lng)||StringUtils.isNotEmpty(lat)){
Shop shop = new Shop();
shop.setState("1");
shop.setIsDefault(0L);
shop.setIsDefault(1);
List<Shop> shops = shopMapper.selectShopList(shop);
return shops;
}
Shop shop = new Shop(); Shop shop = new Shop();
shop.setState("1"); shop.setState("1");
shop.setIsDefault(0L); shop.setIsDefault(0L);
......
...@@ -115,6 +115,7 @@ public class GoodsServiceImpl implements IGoodsService ...@@ -115,6 +115,7 @@ public class GoodsServiceImpl implements IGoodsService
ruleNodeList.add(ruleNode); ruleNodeList.add(ruleNode);
} }
}else{ }else{
ruleNodeList.clear();
for (RuleNode<SpecRule> ruleNode : ruleNodes) { for (RuleNode<SpecRule> ruleNode : ruleNodes) {
putRuleNodeChild(ruleNode,specRules,ruleNodeList); putRuleNodeChild(ruleNode,specRules,ruleNodeList);
} }
......
...@@ -3,7 +3,9 @@ package com.ruoyi.system.service.impl; ...@@ -3,7 +3,9 @@ package com.ruoyi.system.service.impl;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
...@@ -12,6 +14,8 @@ import com.ruoyi.common.utils.spring.SpringUtils; ...@@ -12,6 +14,8 @@ import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.OrderDetail; import com.ruoyi.system.domain.OrderDetail;
import com.ruoyi.system.domain.ShopGoodsSku; import com.ruoyi.system.domain.ShopGoodsSku;
import com.ruoyi.system.domain.vo.OrderQuery; import com.ruoyi.system.domain.vo.OrderQuery;
import com.ruoyi.system.mapper.GoodsMapper;
import com.ruoyi.system.mapper.OrderDetailMapper;
import com.ruoyi.system.mapper.ShopGoodsSkuMapper; import com.ruoyi.system.mapper.ShopGoodsSkuMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
...@@ -35,6 +39,10 @@ public class OrderServiceImpl implements IOrderService ...@@ -35,6 +39,10 @@ public class OrderServiceImpl implements IOrderService
private OrderMapper orderMapper; private OrderMapper orderMapper;
@Autowired @Autowired
private ShopGoodsSkuMapper shopGoodsSkuMapper; private ShopGoodsSkuMapper shopGoodsSkuMapper;
@Autowired
private OrderDetailMapper orderDetailMapper;
@Autowired
private GoodsMapper goodsMapper;
...@@ -47,7 +55,14 @@ public class OrderServiceImpl implements IOrderService ...@@ -47,7 +55,14 @@ public class OrderServiceImpl implements IOrderService
@Override @Override
public Order selectOrderById(String id) public Order selectOrderById(String id)
{ {
return orderMapper.selectOrderById(id); Order order = orderMapper.selectOrderById(id);
OrderDetail orderDetail = new OrderDetail();
orderDetail.setOrderId(order.getId());
List<OrderDetail> orderDetails = orderDetailMapper.selectOrderDetailList(orderDetail);
for (OrderDetail detail : orderDetails) {
detail.setGoods(goodsMapper.selectGoodsById(detail.getGoodsId()));
}
return order;
} }
/** /**
...@@ -59,7 +74,7 @@ public class OrderServiceImpl implements IOrderService ...@@ -59,7 +74,7 @@ public class OrderServiceImpl implements IOrderService
@Override @Override
public List<Order> selectOrderList(OrderQuery order) public List<Order> selectOrderList(OrderQuery order)
{ {
return null; return orderMapper.selectOrderByQuery(order);
} }
/** /**
...@@ -156,6 +171,20 @@ public class OrderServiceImpl implements IOrderService ...@@ -156,6 +171,20 @@ public class OrderServiceImpl implements IOrderService
return AjaxResult.success(); return AjaxResult.success();
} }
@Override
public List<Order> getMyOrder(String openId) {
List<Order> orders = orderMapper.selectByUserId(openId);
for (Order order : orders) {
OrderDetail orderDetail = new OrderDetail();
orderDetail.setOrderId(order.getId());
List<OrderDetail> orderDetails = orderDetailMapper.selectOrderDetailList(orderDetail);
for (OrderDetail detail : orderDetails) {
detail.setGoods(goodsMapper.selectGoodsById(detail.getGoodsId()));
}
}
return orders;
}
/** /**
* 获取机器顺序号 * 获取机器顺序号
* @param shopId * @param shopId
...@@ -196,4 +225,28 @@ public class OrderServiceImpl implements IOrderService ...@@ -196,4 +225,28 @@ public class OrderServiceImpl implements IOrderService
int randomNumber = new Random().nextInt(99); int randomNumber = new Random().nextInt(99);
return "N"+format+channel+format1+randomNumber; return "N"+format+channel+format1+randomNumber;
} }
public List<JSONObject> getOrderInfo(String machineCode) {
List<String> status = Arrays.asList("3","4","5");
List<Order> orders = orderMapper.selectOrder(status, machineCode);
Map<String, List<Order>> collect = orders.stream().collect(Collectors.groupingBy(Order::getState));
List<JSONObject> objects = new ArrayList<>();
for(String key:collect.keySet()){
JSONObject jsonObject =new JSONObject();
objects.add(jsonObject);
jsonObject.put("state",key);
List<Order> orders1 = collect.get(key);
List<JSONObject> jsonObjects = new ArrayList<>();
jsonObject.put("orders",jsonObjects);
for (Order order : orders1) {
JSONObject jsonObject1 = new JSONObject();
jsonObjects.add(jsonObject1);
jsonObject1.put("orderId",order.getId());
jsonObject1.put("orderNum",order.getOrderNum());
jsonObject1.put("orderNo",order.getOrderNo());
}
}
return objects;
}
} }
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.*;
import com.ruoyi.system.domain.vo.orderTaking.*; import com.ruoyi.system.domain.vo.orderTaking.*;
import com.ruoyi.system.mapper.*; import com.ruoyi.system.mapper.*;
...@@ -67,6 +69,7 @@ public class OrderTakingServiceImpl { ...@@ -67,6 +69,7 @@ public class OrderTakingServiceImpl {
orderTakingVo.setTips(sysConfigService.selectConfigByKey("tips.address")); orderTakingVo.setTips(sysConfigService.selectConfigByKey("tips.address"));
List<CategoryVo> categoryVos = new ArrayList<>(); List<CategoryVo> categoryVos = new ArrayList<>();
CategoryVo preferentialCategoryVo = new CategoryVo(); CategoryVo preferentialCategoryVo = new CategoryVo();
categoryVos.add(preferentialCategoryVo);
preferentialCategoryVo.setId(0L); preferentialCategoryVo.setId(0L);
preferentialCategoryVo.setName("今日特惠"); preferentialCategoryVo.setName("今日特惠");
//查询出该店铺今日特惠的商品 //查询出该店铺今日特惠的商品
...@@ -75,12 +78,14 @@ public class OrderTakingServiceImpl { ...@@ -75,12 +78,14 @@ public class OrderTakingServiceImpl {
for (GoodsVo goodsVo : goodsVos) { for (GoodsVo goodsVo : goodsVos) {
GoodsTag goodsTag = new GoodsTag(); GoodsTag goodsTag = new GoodsTag();
goodsTag.setState("1"); goodsTag.setState("1");
goodsTag.setGoodsId(Long.parseLong(goodsVo.getGoodId())); goodsVo.setSpecs(buildGoodsSpec(goodsVo.getSpecs()));
goodsTag.setGoodsId(Long.parseLong(goodsVo.getGoodsId()));
List<GoodsTag> goodsTags = goodsTagMapper.selectGoodsTagList(goodsTag); List<GoodsTag> goodsTags = goodsTagMapper.selectGoodsTagList(goodsTag);
String tags = JSONArray.toJSONString(goodsTags.stream().map(GoodsTag::getTag).collect(Collectors.toList())); String tags = JSONArray.toJSONString(goodsTags.stream().map(GoodsTag::getTag).collect(Collectors.toList()));
goodsVo.setTags(tags); goodsVo.setTags(tags);
//获取产品信息 //获取产品信息
List<SkuVo> skuVos = shopGoodsSkuMapper.selectSkuByGoodAndShop(shopId, goodsVo.getGoodId()); List<SkuVo> skuVos = shopGoodsSkuMapper.selectSkuByGoodAndShop(shopId, goodsVo.getGoodsId());
buildSkuRules(skuVos);
goodsVo.setSkus(skuVos); goodsVo.setSkus(skuVos);
} }
//普通分类的产品 //普通分类的产品
...@@ -91,25 +96,30 @@ public class OrderTakingServiceImpl { ...@@ -91,25 +96,30 @@ public class OrderTakingServiceImpl {
categoryVo.setId(Long.parseLong(category.getId())); categoryVo.setId(Long.parseLong(category.getId()));
categoryVo.setName(category.getName()); categoryVo.setName(category.getName());
List<Goods> goodsList = shopGoodsMapper.selectShopCategoryGoodsByCategoryId(shopId, category.getId()); List<Goods> goodsList = shopGoodsMapper.selectShopCategoryGoodsByCategoryId(shopId, category.getId());
List<GoodsVo> goodsVoList = new ArrayList<>();
categoryVo.setGoods(goodsVoList);
for (Goods good : goodsList) { for (Goods good : goodsList) {
GoodsVo goodsVo =new GoodsVo(); GoodsVo goodsVo =new GoodsVo();
goodsVo.setGoodId(String.valueOf(good.getId())); goodsVo.setGoodsId(String.valueOf(good.getId()));
goodsVo.setName(good.getName()); goodsVo.setName(good.getName());
goodsVo.setDesc(good.getDesc()); goodsVo.setDesc(good.getDesc());
goodsVo.setDiscount(good.getDiscount().stripTrailingZeros().toString()); goodsVo.setDiscount(good.getDiscount().stripTrailingZeros().toPlainString());
goodsVo.setPrice(good.getPrice().stripTrailingZeros().toString()); goodsVo.setPrice(good.getPrice().stripTrailingZeros().toPlainString());
goodsVo.setPics(good.getPics()); goodsVo.setPics(good.getPics());
goodsVo.setRemark(good.getRemark()); goodsVo.setRemarks(good.getRemarks());
goodsVo.setSpecs(JSONArray.parseArray(good.getSpec(),SpecVo.class)); goodsVo.setSpecs(good.getSpec());
goodsVo.setSpecs(buildGoodsSpec(goodsVo.getSpecs()));
GoodsTag goodsTag = new GoodsTag(); GoodsTag goodsTag = new GoodsTag();
goodsTag.setState("1"); goodsTag.setState("1");
goodsTag.setGoodsId(Long.parseLong(goodsVo.getGoodId())); goodsTag.setGoodsId(Long.parseLong(goodsVo.getGoodsId()));
List<GoodsTag> goodsTags = goodsTagMapper.selectGoodsTagList(goodsTag); List<GoodsTag> goodsTags = goodsTagMapper.selectGoodsTagList(goodsTag);
String tags = JSONArray.toJSONString(goodsTags.stream().map(GoodsTag::getTag).collect(Collectors.toList())); String tags = JSONArray.toJSONString(goodsTags.stream().map(GoodsTag::getTag).collect(Collectors.toList()));
goodsVo.setTags(tags); goodsVo.setTags(tags);
//获取产品信息 //获取产品信息
List<SkuVo> skuVos = shopGoodsSkuMapper.selectSkuByGoodAndShop(shopId, goodsVo.getGoodId()); List<SkuVo> skuVos = shopGoodsSkuMapper.selectSkuByGoodAndShop(shopId, goodsVo.getGoodsId());
buildSkuRules(skuVos);
goodsVo.setSkus(skuVos); goodsVo.setSkus(skuVos);
goodsVoList.add(goodsVo);
} }
categoryVos.add(categoryVo); categoryVos.add(categoryVo);
} }
...@@ -120,28 +130,82 @@ public class OrderTakingServiceImpl { ...@@ -120,28 +130,82 @@ public class OrderTakingServiceImpl {
recommendVos.add(recommendVo); recommendVos.add(recommendVo);
ShopRecommend shopRecommend = new ShopRecommend(); ShopRecommend shopRecommend = new ShopRecommend();
shopRecommend.setShopId(String.valueOf(shopId)); shopRecommend.setShopId(String.valueOf(shopId));
shopRecommend.setGoodsId(goodsVo.getGoodId()); shopRecommend.setGoodsId(goodsVo.getGoodsId());
shopRecommend.setType("1"); shopRecommend.setType("1");
ShopRecommend shopRecommend1 = shopRecommendMapper.selectShopRecommendList(shopRecommend).get(0); ShopRecommend shopRecommend1 = shopRecommendMapper.selectShopRecommendList(shopRecommend).get(0);
recommendVo.setDesc(shopRecommend1.getDesc()); recommendVo.setDesc(shopRecommend1.getDesc());
recommendVo.setGoodsName(shopRecommend1.getGoodsName()); recommendVo.setGoodsName(shopRecommend1.getGoodsName());
recommendVo.setPic(shopRecommend1.getPic()); recommendVo.setPic(shopRecommend1.getPic());
recommendVo.setGoods(recommendGoods); recommendVo.setGoods(recommendGoods);
goodsVo.setSpecs(buildGoodsSpec(goodsVo.getSpecs()));
GoodsTag goodsTag = new GoodsTag(); GoodsTag goodsTag = new GoodsTag();
goodsTag.setState("1"); goodsTag.setState("1");
goodsTag.setGoodsId(Long.parseLong(goodsVo.getGoodId())); goodsTag.setGoodsId(Long.parseLong(goodsVo.getGoodsId()));
List<GoodsTag> goodsTags = goodsTagMapper.selectGoodsTagList(goodsTag); List<GoodsTag> goodsTags = goodsTagMapper.selectGoodsTagList(goodsTag);
String tags = JSONArray.toJSONString(goodsTags.stream().map(GoodsTag::getTag).collect(Collectors.toList())); String tags = JSONArray.toJSONString(goodsTags.stream().map(GoodsTag::getTag).collect(Collectors.toList()));
goodsVo.setTags(tags); goodsVo.setTags(tags);
//获取产品信息 //获取产品信息
List<SkuVo> skuVos = shopGoodsSkuMapper.selectSkuByGoodAndShop(shopId, goodsVo.getGoodId()); List<SkuVo> skuVos = shopGoodsSkuMapper.selectSkuByGoodAndShop(shopId, goodsVo.getGoodsId());
buildSkuRules(skuVos);
goodsVo.setSkus(skuVos); goodsVo.setSkus(skuVos);
} }
orderTakingVo.setRecommends(recommendVos);
orderTakingVo.setCategorys(categoryVos); orderTakingVo.setCategorys(categoryVos);
return orderTakingVo; return orderTakingVo;
} }
private void buildSkuRules(List<SkuVo> skuVos) {
for (SkuVo skuVo : skuVos) {
String rules = skuVo.getRules();
List<SpecRule> specRuleList = JSONObject.parseArray(rules, SpecRule.class);
boolean boo =true;
List<SkuRuleVo> skuRuleVos = new ArrayList<>();
for (SpecRule specRule : specRuleList) {
SkuRuleVo skuRuleVo = new SkuRuleVo();
skuRuleVos.add(skuRuleVo);
skuRuleVo.setPrice(specRule.getAmount().stripTrailingZeros().toPlainString());
skuRuleVo.setRuleId(String.valueOf(specRule.getId()));
skuRuleVo.setSpecId(String.valueOf(specRule.getSpecId()));
if(0L == specRule.getIsDefault()){
boo =false;
}
}
skuVo.setIsDefault("0");
if(boo){
skuVo.setIsDefault("1");
}
skuVo.setRules(JSONObject.toJSONString(skuRuleVos));
}
}
private String buildGoodsSpec(String specs) {
List<Spec> specList = JSONObject.parseArray(specs,Spec.class);
List<SpecVo> specVos = new ArrayList<>();
for (Spec spec : specList) {
SpecVo specVo = new SpecVo();
specVos.add(specVo);
specVo.setSpecId(String.valueOf(spec.getId()));
specVo.setSpecName(spec.getName());
List<SpecRuleVo> specRuleVos = new ArrayList<>();
specVo.setRules(specRuleVos);
for (SpecRule specRule : spec.getSpecRules()) {
SpecRuleVo specRuleVo = new SpecRuleVo();
specRuleVos.add(specRuleVo);
specRuleVo.setRuleId(String.valueOf(specRule.getId()));
specRuleVo.setPrice(specRule.getAmount().stripTrailingZeros().toPlainString());
specRuleVo.setRuleName(specRule.getName());
specRuleVo.setIsDefault(String.valueOf(specRule.getIsDefault()));
specRuleVo.setIsRecommend(specRule.getIsRecommend());
}
}
return JSONObject.toJSONString(specVos);
}
/** /**
* 机器点单屏信息 * 机器点单屏信息
* { * {
......
...@@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl; ...@@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.system.domain.Goods; import com.ruoyi.system.domain.Goods;
...@@ -52,6 +53,7 @@ public class ShopRecommendServiceImpl implements IShopRecommendService ...@@ -52,6 +53,7 @@ public class ShopRecommendServiceImpl implements IShopRecommendService
public List<Goods> selectShopRecommendList(ShopRecommend shopRecommend) public List<Goods> selectShopRecommendList(ShopRecommend shopRecommend)
{ {
List<Goods> goodsList = shopRecommendMapper.selectShopRecommendGoods(shopRecommend.getShopId(),shopRecommend.getType()); List<Goods> goodsList = shopRecommendMapper.selectShopRecommendGoods(shopRecommend.getShopId(),shopRecommend.getType());
goodsList = goodsList.stream().distinct().collect(Collectors.toList());
for (Goods goods : goodsList) { for (Goods goods : goodsList) {
goods.setSalesVolume(orderMapper.selectSalesVolume(Long.parseLong(shopRecommend.getShopId()),goods.getId())); goods.setSalesVolume(orderMapper.selectSalesVolume(Long.parseLong(shopRecommend.getShopId()),goods.getId()));
} }
......
...@@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
</select> </select>
<select id="selectCustomerById" parameterType="Long" resultMap="CustomerResult"> <select id="selectCustomerById" resultMap="CustomerResult">
<include refid="selectCustomerVo"/> <include refid="selectCustomerVo"/>
where id = #{id} where id = #{id}
</select> </select>
...@@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertCustomer" parameterType="Customer" useGeneratedKeys="true" keyProperty="id"> <insert id="insertCustomer" parameterType="Customer" useGeneratedKeys="true" keyProperty="id">
insert into customer insert into customer
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="userName != null">user_name,</if> <if test="userName != null">user_name,</if>
<if test="phone != null">phone,</if> <if test="phone != null">phone,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
...@@ -42,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -42,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="soucre != null">soucre,</if> <if test="soucre != null">soucre,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="userName != null">#{userName},</if> <if test="userName != null">#{userName},</if>
<if test="phone != null">#{phone},</if> <if test="phone != null">#{phone},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
......
...@@ -92,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -92,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<select id="selectByShopId" resultMap="GoodsCategoryResult"> <select id="selectByShopId" resultMap="GoodsCategoryResult">
select DISTINCT gc.* from goods_category gc ,goods g , select DISTINCT gc.* from goods_category gc ,goods g ,
shop_goods sg where gc.id =g.id and g.id =sg.goods_id shop_goods sg where g.id =sg.goods_id and g.category =gc.id
and sg.shop_id =#{shopId} and sg.shop_id =#{shopId}
order by gc.turn order by gc.turn
</select> </select>
......
...@@ -40,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -40,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertMachine" parameterType="Machine" useGeneratedKeys="true" keyProperty="id"> <insert id="insertMachine" parameterType="Machine" useGeneratedKeys="true" keyProperty="id">
insert into machine insert into machine
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">id,</if>
<if test="shopId != null and shopId != ''">shop_id,</if> <if test="shopId != null and shopId != ''">shop_id,</if>
<if test="code != null and code != ''">code,</if> <if test="code != null and code != ''">code,</if>
<if test="type != null and type != ''">type,</if> <if test="type != null and type != ''">type,</if>
...@@ -49,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -49,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updatedAt != null">updated_at,</if> <if test="updatedAt != null">updated_at,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">#{id},</if>
<if test="shopId != null and shopId != ''">#{shopId},</if> <if test="shopId != null and shopId != ''">#{shopId},</if>
<if test="code != null and code != ''">#{code},</if> <if test="code != null and code != ''">#{code},</if>
<if test="type != null and type != ''">#{type},</if> <if test="type != null and type != ''">#{type},</if>
...@@ -69,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -69,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="bindTime != null">bind_time = #{bindTime},</if> <if test="bindTime != null">bind_time = #{bindTime},</if>
<if test="createdAt != null">created_at = #{createdAt},</if> <if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if> <if test="updatedAt != null">updated_at = #{updatedAt},</if>
<if test="register != null">register = #{register},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
...@@ -86,4 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -86,4 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="unbound"> <update id="unbound">
update machine set shopId =null where id =#{id} update machine set shopId =null where id =#{id}
</update> </update>
<select id="selectRegister" resultType="string">
select register from machine where id =#{id}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectOrderVo"> <sql id="selectOrderVo">
select id, order_no, order_num, user_id, user_name, user_phone, pay_time, finish_time, amount, goods_num, pick_code, shop_id, machine_id, source, state, created_at, updated_at,shelf_at from order select id, order_no, order_num, user_id, user_name, user_phone, pay_time, finish_time, amount, goods_num, pick_code, shop_id, machine_id, source, state, created_at, updated_at,shelf_at from `order`
</sql> </sql>
<select id="selectOrderList" parameterType="Order" resultMap="OrderResult"> <select id="selectOrderList" parameterType="Order" resultMap="OrderResult">
...@@ -161,4 +161,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -161,4 +161,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and or2.state !='2' and or2.state !='2'
and shop_id =#{shopId} and shop_id =#{shopId}
</select> </select>
<select id="selectByUserId" resultMap="OrderResult">
<include refid="selectOrderVo"/>
where
user_id =#{user_id} order by created_at desc
</select>
<select id="selectOrderByQuery" resultMap="OrderResult">
<include refid="selectOrderVo"/>
<where>
<if test="orderNo!=null ">
and order_no =#{orderNo}
</if>
</where>
</select>
<select id="selectOrder" resultMap="OrderResult">
<include refid="selectOrderVo"/>
<where>
state in
<foreach item="item" index="index" collection="status"
open="(" separator="," close=")">
#{item}
</foreach>
and machine_id = #{machineId}
</where>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -102,13 +102,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -102,13 +102,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
gs.price as price, gs.price as price,
gs.rule_list as rules gs.rule_list as rules
from from
shop_goods_sku sgs , goods_sku gs ,
goods_sku gs shop_goods_sku sgs
where where
sgs.shop_id = #{shopId} gs.id = sgs.sku_id
and sgs.goods_id = #{goodsId}
and sgs.goods_id = gs.goods_id
and gs.is_deleted = '0' and gs.is_deleted = '0'
and sgs.goods_id =#{goodsId}
and sgs.shop_id =#{shopId}
</select> </select>
<update id="updateSkuStatus"> <update id="updateSkuStatus">
update shop_goods_sku set state =#{status} update shop_goods_sku set state =#{status}
......
...@@ -21,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -21,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectShopRecommendVo"> <sql id="selectShopRecommendVo">
select id, shop_id, machine_id, goods_id, goods_name, pic, turn, desc, type, state, rec_date, created_at, updated_at from shop_recommend select id, shop_id, machine_id, goods_id, goods_name, pic, turn, `desc`, type, state, rec_date, created_at, updated_at from shop_recommend
</sql> </sql>
<select id="selectShopRecommendList" parameterType="ShopRecommend" resultMap="ShopRecommendResult"> <select id="selectShopRecommendList" parameterType="ShopRecommend" resultMap="ShopRecommendResult">
...@@ -33,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -33,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if> <if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
<if test="pic != null and pic != ''"> and pic = #{pic}</if> <if test="pic != null and pic != ''"> and pic = #{pic}</if>
<if test="turn != null and turn != ''"> and turn = #{turn}</if> <if test="turn != null and turn != ''"> and turn = #{turn}</if>
<if test="desc != null and desc != ''"> and desc = #{desc}</if> <if test="desc != null and desc != ''"> and `desc` = #{desc}</if>
<if test="type != null and type != ''"> and type = #{type}</if> <if test="type != null and type != ''"> and type = #{type}</if>
<if test="state != null and state != ''"> and state = #{state}</if> <if test="state != null and state != ''"> and state = #{state}</if>
<if test="recDate != null "> and rec_date = #{recDate}</if> <if test="recDate != null "> and rec_date = #{recDate}</if>
...@@ -56,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -56,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsName != null and goodsName != ''">goods_name,</if> <if test="goodsName != null and goodsName != ''">goods_name,</if>
<if test="pic != null and pic != ''">pic,</if> <if test="pic != null and pic != ''">pic,</if>
<if test="turn != null and turn != ''">turn,</if> <if test="turn != null and turn != ''">turn,</if>
<if test="desc != null and desc != ''">desc,</if> <if test="desc != null and desc != ''">`desc`,</if>
<if test="type != null and type != ''">type,</if> <if test="type != null and type != ''">type,</if>
<if test="state != null and state != ''">state,</if> <if test="state != null and state != ''">state,</if>
<if test="recDate != null">rec_date,</if> <if test="recDate != null">rec_date,</if>
...@@ -88,7 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -88,7 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsName != null and goodsName != ''">goods_name = #{goodsName},</if> <if test="goodsName != null and goodsName != ''">goods_name = #{goodsName},</if>
<if test="pic != null and pic != ''">pic = #{pic},</if> <if test="pic != null and pic != ''">pic = #{pic},</if>
<if test="turn != null and turn != ''">turn = #{turn},</if> <if test="turn != null and turn != ''">turn = #{turn},</if>
<if test="desc != null and desc != ''">desc = #{desc},</if> <if test="desc != null and desc != ''">`desc` = #{desc},</if>
<if test="type != null and type != ''">type = #{type},</if> <if test="type != null and type != ''">type = #{type},</if>
<if test="state != null and state != ''">state = #{state},</if> <if test="state != null and state != ''">state = #{state},</if>
<if test="recDate != null">rec_date = #{recDate},</if> <if test="recDate != null">rec_date = #{recDate},</if>
...@@ -110,12 +110,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -110,12 +110,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<select id="selectShopGoodsByTyepe" resultType="com.ruoyi.system.domain.vo.orderTaking.GoodsVo"> <select id="selectShopGoodsByTyepe" resultType="com.ruoyi.system.domain.vo.orderTaking.GoodsVo">
select select
g.id as goodId , g.id as goodsId ,
g.name as name, g.name as name,
g.price as price, g.price as price,
g.discount as discount, g.discount as discount,
g.pics , g.pics ,
g.spec, g.spec as specs,
g.`desc`, g.`desc`,
g.remarks g.remarks
from from
...@@ -124,7 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -124,7 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where where
sr.goods_id = g.id sr.goods_id = g.id
and sr.`type` = #{type} and sr.`type` = #{type}
and sr.shop_id =#{shop_id} and sr.shop_id =#{shopId}
and sr.state ='1' and g.is_deleted ='0' and sr.state ='1' and g.is_deleted ='0'
order by order by
sr.turn sr.turn
...@@ -153,7 +153,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -153,7 +153,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and g.is_deleted = 0 and g.is_deleted = 0
and sr.shop_id =sg.shop_id and sr.shop_id =sg.shop_id
and sr.`type` =#{type} and sr.`type` =#{type}
and sr.shop_id =#{shop_id} and sr.shop_id =#{shopId}
order by order by
sr.turn sr.turn
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment