Commit 4afda118 by 张新旗

代码永远在路上

parent f6385ca0
......@@ -7,14 +7,7 @@ import com.alibaba.fastjson.JSONObject;
import com.soss.system.domain.Goods;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.soss.common.annotation.Log;
import com.soss.common.core.controller.BaseController;
import com.soss.common.core.domain.AjaxResult;
......@@ -37,8 +30,8 @@ public class ShopController extends BaseController
private IShopService shopService;
@GetMapping(value = "/turn")
public AjaxResult turn(Long shopId,Long fristGoodsId,Long lastGoodsId){
return AjaxResult.success(shopService.turn(shopId,fristGoodsId,lastGoodsId));
public AjaxResult turn(@RequestParam Long shopId,@RequestParam Long goodsId, @RequestParam String pointer){
return AjaxResult.success(shopService.turn(shopId,goodsId,pointer));
}
......
......@@ -30,9 +30,9 @@ public class ShopRecommendController extends BaseController
@GetMapping("/turn")
public AjaxResult turn(Long shopId,String firstGoodsId,String lastGoodsId,String type)
public AjaxResult turn(Long shopId,String goodsId,String pointer,String type)
{
return AjaxResult.success(shopRecommendService.turn(shopId,firstGoodsId,lastGoodsId,type));
return AjaxResult.success(shopRecommendService.turn(shopId,goodsId,pointer,type));
}
/**
......
......@@ -37,7 +37,6 @@ public class WeixinController {
String encryptedData = param.getString("encryptedData");
String iv = param.getString("iv");
String source = param.getString("source");
AjaxResult ajax = AjaxResult.success();
String token = weixinService.login(code,encryptedData,iv,source);
ajax.put(Constants.TOKEN, token);
......
......@@ -82,12 +82,12 @@ weixin:
secret: da8a0b08436dd3ce560be429f14e768a
mchid: 1625511257
key: WcCsQZXavaPXQEKuTGJlGOkzzTPxTPsr
notify-url: http://114.115.234.81:8080/weixin/native/notify
notify-url: https://hooloo-api.gdatac.com/weixin/native/notify
trade-type: JSAPI
url: https://api.mch.weixin.qq.com/pay/unifiedorder
query-url: https://api.mch.weixin.qq.com/pay/orderquery
cert-path: classpath:apiclient_cert.p12
refund-url: http://114.115.234.81:8080/weixin/refundNotify
refund-url: https://hooloo-api.gdatac.com/weixin/refundNotify
#mqtt:
# url: tcp://iot-06z00dhgql5j8bw.mqtt.iothub.aliyuncs.com:1883
# clientId: h5kgirX6kNQ.XQ_000001A|securemode=2,signmethod=hmacsha256,timestamp=1651746531320|
......
......@@ -420,7 +420,7 @@ public class WeixinServiceImpl {
stringRedisTemplate.expire(uid,1, TimeUnit.DAYS);
jsonObject.put("secret",uid);
order.setPickCode(QRCodeUtil.getBase64QRCode(jsonObject.toJSONString()));
order.setPickCode(jsonObject.toJSONString());
orderMapper.updateOrder(order);
orderOperationLogService.insertOrderOperationLog("已付款",order.getId(),"付款成功",order.getUserName(),"付款");
......
......@@ -100,8 +100,18 @@ public class Goods extends BaseEntity
this.shelfAt = shelfAt;
}
public Date getRecommendDate() {
return recommendDate;
}
public void setRecommendDate(Date recommendDate) {
this.recommendDate = recommendDate;
}
@JsonFormat(pattern = "yyyy-MM-dd")
private Date shelfAt;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:dd")
private Date recommendDate;
public Integer getSalesVolume() {
return salesVolume;
......
......@@ -2,6 +2,7 @@ package com.soss.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.soss.common.annotation.Excel;
......@@ -29,6 +30,7 @@ public class OrderOperationLog extends BaseEntity
private String operation;
/** $column.columnComment */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:dd")
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Date createAt;
......
......@@ -46,9 +46,11 @@ public class OrderRefund extends BaseEntity
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt;
private Order order;
private String refundNo;
public String getRefundNo() {
return refundNo;
}
......@@ -85,7 +87,6 @@ public class OrderRefund extends BaseEntity
this.order = order;
}
private Order order;
public void setId(String id)
{
......
......@@ -17,7 +17,7 @@ public interface OrderSnapshotMapper
* @param orderId 订单快照主键
* @return 订单快照
*/
public OrderSnapshot selectOrderSnapshotByOrderId(String orderId);
public OrderSnapshot selectOrderSnapshotByOrderId(Long orderId);
/**
* 查询订单快照列表
......
......@@ -66,4 +66,6 @@ public interface ShopRecommendMapper
List<GoodsVo> selectShopGoodsByTyepe(@Param("type") String s, @Param("shopId") Long shopId);
List<Goods> selectShopRecommendGoods(@Param("shopId") String shopId,@Param("type") String type);
void deleteByShopIdGoods(Long shopId, List<String> goodsIds);
}
......@@ -19,7 +19,7 @@ public interface IOrderSnapshotService
* @param orderId 订单快照主键
* @return 订单快照
*/
public OrderSnapshot selectOrderSnapshotByOrderId(String orderId);
public OrderSnapshot selectOrderSnapshotByOrderId(Long orderId);
/**
* 查询订单快照列表
......
......@@ -70,7 +70,7 @@ public interface IShopService
List<GoodsSku> getSkuByGoodsId(long shopId, long goodsId);
String turn(Long shopId, Long fristGoodsId, Long lastGoodsId);
String turn(Long shopId, Long goodsId, String pointer);
List<String> getShopCity();
......
......@@ -100,7 +100,7 @@ public class MachineApiServiceImpl {
ObjectMapper objectMapper = new ObjectMapper();
String orderInfo = objectMapper.writeValueAsString(order);
JSONObject orderJson = JSONObject.parseObject(orderInfo);
// orderJson.put("goodsNum",1);
orderJson.put("goodsNum",orderJson.getLong("goodsNum"));
orderJson.put("machineId",orderJson.getLong("machineId"));
orderJson.put("shopId",orderJson.getLong("shopId"));
orderJson.put("state",orderJson.getLong("state"));
......
......@@ -3,11 +3,16 @@ package com.soss.system.service.impl;
import java.util.Date;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
import com.soss.common.core.domain.AjaxResult;
import com.soss.common.exception.ServiceException;
import com.soss.common.utils.GenerateCode;
import com.soss.common.utils.StringUtils;
import com.soss.system.domain.Order;
import com.soss.system.domain.OrderDetail;
import com.soss.system.domain.OrderSnapshot;
import com.soss.system.mapper.OrderMapper;
import com.soss.system.mapper.OrderSnapshotMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.soss.system.mapper.OrderRefundMapper;
......@@ -29,6 +34,8 @@ public class OrderRefundServiceImpl implements IOrderRefundService
private OrderServiceImpl orderService;
@Autowired
private OrderMapper orderMapper;
@Autowired
private OrderSnapshotMapper orderSnapshotMapper;
/**
* 查询订单退款
......@@ -54,6 +61,9 @@ public class OrderRefundServiceImpl implements IOrderRefundService
List<OrderRefund> orderRefunds = orderRefundMapper.selectOrderRefundList(orderRefund);
for (OrderRefund refund : orderRefunds) {
Order order = orderService.selectOrderById(refund.getOrderId());
OrderSnapshot orderSnapshot = orderSnapshotMapper.selectOrderSnapshotByOrderId(order.getId());
List<OrderDetail> orderDetails = JSONObject.parseArray(orderSnapshot.getSnapshot(), OrderDetail.class);
order.setOrderDetails(orderDetails);
refund.setOrder(order);
}
return orderRefunds;
......@@ -80,7 +90,10 @@ public class OrderRefundServiceImpl implements IOrderRefundService
// 4 支付制作中 5 制作完成未取 6 取餐中 7 取餐完成
}else if("4".equals(state)||"5".equals(state)||"6".equals(state)||"7".equals(state)){
String desc = orderRefund.getDesc();
if(StringUtils.isEmpty(desc)){
return AjaxResult.error("请联系客服进行退款");
}
}else{
return AjaxResult.error("该订单状态不允许退款");
}
......
......@@ -33,7 +33,7 @@ public class OrderSnapshotServiceImpl implements IOrderSnapshotService
* @return 订单快照
*/
@Override
public OrderSnapshot selectOrderSnapshotByOrderId(String orderId)
public OrderSnapshot selectOrderSnapshotByOrderId(Long orderId)
{
return orderSnapshotMapper.selectOrderSnapshotByOrderId(orderId);
}
......
......@@ -6,6 +6,8 @@ import java.util.stream.Collectors;
import com.soss.system.domain.Goods;
import com.soss.system.domain.Machine;
import com.soss.system.domain.ShopGoods;
import com.soss.system.mapper.GoodsCategoryMapper;
import com.soss.system.mapper.MachineMapper;
import com.soss.system.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -29,6 +31,8 @@ public class ShopRecommendServiceImpl implements IShopRecommendService
private MachineMapper machineMapper;
@Autowired
private OrderMapper orderMapper;
@Autowired
private GoodsCategoryMapper goodsCategoryMapper;
/**
* 查询推荐和今日特惠
......@@ -54,6 +58,7 @@ public class ShopRecommendServiceImpl implements IShopRecommendService
List<Goods> goodsList = shopRecommendMapper.selectShopRecommendGoods(shopRecommend.getShopId(),shopRecommend.getType());
goodsList = goodsList.stream().distinct().collect(Collectors.toList());
for (Goods goods : goodsList) {
goods.setCategoryName(goodsCategoryMapper.selectGoodsCategoryById(String.valueOf(goods.getId())).getName());
goods.setSalesVolume(orderMapper.selectSalesVolume(Long.parseLong(shopRecommend.getShopId()),goods.getId()));
}
return goodsList;
......@@ -114,14 +119,38 @@ public class ShopRecommendServiceImpl implements IShopRecommendService
}
@Override
public String turn(Long shopId, String fistId, String lastId, String type) {
public String turn(Long shopId, String goodsId, String pointer, String type) {
ShopRecommend shopRecommend = new ShopRecommend();
shopRecommend.setShopId(String.valueOf(shopId));
shopRecommend.setType(type);
shopRecommend.setGoodsId(fistId);
List<ShopRecommend> shopRecommends = shopRecommendMapper.selectShopRecommendList(shopRecommend);
int size = shopRecommends.size();
String lastGoodsId = null;
for(int i =0;i<size;i++){
ShopRecommend shopGood = shopRecommends.get(i);
if(goodsId.equals(shopGood.getGoodsId())){
if("1".equals(pointer)){
int index = i-1;
if(index<0){
lastGoodsId =shopGood.getGoodsId();
}else{
lastGoodsId = shopRecommends.get(index).getGoodsId();
}
}else if("2".equals(pointer)){
int index=i+1;
if(index>=size){
lastGoodsId =shopGood.getGoodsId();
}else{
lastGoodsId = shopRecommends.get(index).getGoodsId();
}
}
}
}
shopRecommend.setGoodsId(goodsId);
ShopRecommend frist = shopRecommendMapper.selectShopRecommendList(shopRecommend).get(0);
String turn = frist.getTurn();
shopRecommend.setGoodsId(lastId);
shopRecommend.setGoodsId(lastGoodsId);
ShopRecommend last = shopRecommendMapper.selectShopRecommendList(shopRecommend).get(0);
frist.setType(last.getTurn());
last.setTurn(turn);
......
......@@ -224,10 +224,33 @@ public class ShopServiceImpl implements IShopService
}
@Override
public String turn(Long shopId, Long fristGoodsId, Long lastGoodsId) {
public String turn(Long shopId, Long goodsId, String pointer) {
ShopGoods shopGoods = new ShopGoods();
shopGoods.setShopId(shopId);
shopGoods.setGoodsId(fristGoodsId);
List<ShopGoods> shopGoodsList = shopGoodsMapper.selectShopGoodsList(shopGoods);
int size = shopGoodsList.size();
Long lastGoodsId = null;
for(int i =0;i<size;i++){
ShopGoods shopGood = shopGoodsList.get(i);
if(goodsId.equals(shopGood.getGoodsId())){
if("1".equals(pointer)){
int index = i-1;
if(index<0){
lastGoodsId =shopGood.getGoodsId();
}else{
lastGoodsId = shopGoodsList.get(index).getGoodsId();
}
}else if("2".equals(pointer)){
int index=i+1;
if(index>=size){
lastGoodsId =shopGood.getGoodsId();
}else{
lastGoodsId = shopGoodsList.get(index).getGoodsId();
}
}
}
}
shopGoods.setGoodsId(goodsId);
ShopGoods fristShopGoods = shopGoodsMapper.selectShopGoodsList(shopGoods).get(0);
String turn = fristShopGoods.getTurn();
shopGoods.setGoodsId(lastGoodsId);
......@@ -253,6 +276,7 @@ public class ShopServiceImpl implements IShopService
List<String> goodsIds = JSONObject.parseArray(string, String.class);
shopGoodsSkuMapper.deleteByGoodsIds(shopId,goodsIds);
shopGoodsMapper.deleteByShopIdGoods(shopId,goodsIds);
shopRecommendMapper.deleteByShopIdGoods(shopId,goodsIds);
return null;
}
......
......@@ -150,7 +150,7 @@ public class SpecServiceImpl implements ISpecService
spec.setUpdatedAt(new Date());
int i = specMapper.updateSpec(spec);
List<SpecRule> specRules = spec.getSpecRules();
if(specRules!=null &&specRules.size()>0){
if(specRules ==null || specRules.size()>0){
return i;
}
specRuleMapper.deleteSpecRuleBySpecId(spec.getId());
......
......@@ -140,7 +140,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
g.pics,
g.`desc`,
g.remarks,
g.code
g.code,
sr.rec_date as recommendDate
from
shop s ,
shop_recommend sr,
......@@ -154,4 +155,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by
sr.turn
</select>
<delete id="deleteByShopIdGoods">
delete from shop_recommend where shop_id =#{shopId}
and goods_id in
<foreach collection="goodsIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper>
\ No newline at end of file
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