同步master
This commit is contained in:
commit
67e31bff07
@ -165,6 +165,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
|
|||||||
Category parentCategory = this.getById(category.getParentId());
|
Category parentCategory = this.getById(category.getParentId());
|
||||||
category.setDeleteFlag(parentCategory.getDeleteFlag());
|
category.setDeleteFlag(parentCategory.getDeleteFlag());
|
||||||
}
|
}
|
||||||
|
this.save(category);
|
||||||
removeCache();
|
removeCache();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,17 @@ public enum OrderTypeEnum {
|
|||||||
*/
|
*/
|
||||||
NORMAL,
|
NORMAL,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 赠品订单
|
||||||
|
*/
|
||||||
|
GIFT,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 虚拟订单
|
* 虚拟订单
|
||||||
*/
|
*/
|
||||||
VIRTUAL;
|
VIRTUAL,
|
||||||
|
/**
|
||||||
|
* 拼团订单
|
||||||
|
*/
|
||||||
|
PINTUAN
|
||||||
}
|
}
|
||||||
|
@ -129,38 +129,43 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|||||||
public void intoDB(TradeDTO tradeDTO) {
|
public void intoDB(TradeDTO tradeDTO) {
|
||||||
//检查TradeDTO信息
|
//检查TradeDTO信息
|
||||||
checkTradeDTO(tradeDTO);
|
checkTradeDTO(tradeDTO);
|
||||||
//订单列表
|
//存放购物车,即业务中的订单
|
||||||
List<Order> orders = new ArrayList<>(tradeDTO.getCartList().size());
|
List<Order> orders = new ArrayList<>(tradeDTO.getCartList().size());
|
||||||
//订单日志
|
//存放自订单/订单日志
|
||||||
List<OrderLog> orderLogs = new ArrayList<>(tradeDTO.getCartList().size());
|
|
||||||
//订单VO列表
|
|
||||||
List<OrderVO> OrderVOList = new ArrayList<>(tradeDTO.getCartList().size());
|
|
||||||
//订单货物列表
|
|
||||||
List<OrderItem> orderItems = new ArrayList<>();
|
List<OrderItem> orderItems = new ArrayList<>();
|
||||||
//循环交易货物列表,新增订单
|
List<OrderLog> orderLogs = new ArrayList<>();
|
||||||
|
//拼团判定,不能参与自己创建的拼团
|
||||||
|
if (tradeDTO.getParentOrderSn() != null) {
|
||||||
|
Order parentOrder = this.getBySn(tradeDTO.getParentOrderSn());
|
||||||
|
if (parentOrder.getMemberId().equals(UserContext.getCurrentUser().getId())) {
|
||||||
|
throw new ServiceException("不能参与自己发起的拼团活动!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//订单集合
|
||||||
|
List<OrderVO> orderVOS = new ArrayList<>();
|
||||||
|
//循环购物车商品集合
|
||||||
tradeDTO.getCartList().forEach(item -> {
|
tradeDTO.getCartList().forEach(item -> {
|
||||||
//构建订单
|
|
||||||
Order order = new Order(item, tradeDTO);
|
Order order = new Order(item, tradeDTO);
|
||||||
//检查订单信息
|
if (OrderTypeEnum.PINTUAN.name().equals(order.getOrderType())) {
|
||||||
checkOrder(order);
|
Pintuan pintuan = pintuanService.getPintuanById(order.getPromotionId());
|
||||||
//新建订单
|
Integer limitNum = pintuan.getLimitNum();
|
||||||
|
if (limitNum != 0 && order.getGoodsNum() > limitNum) {
|
||||||
|
throw new ServiceException("购买数量超过拼团活动限制数量");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//构建orderVO对象
|
||||||
|
OrderVO orderVO = new OrderVO();
|
||||||
|
BeanUtil.copyProperties(order, orderVO);
|
||||||
orders.add(order);
|
orders.add(order);
|
||||||
//记录订单日志
|
String message = "订单[" + item.getSn() + "]创建";
|
||||||
orderLogs.add(new OrderLog(item.getSn(),
|
orderLogs.add(new OrderLog(item.getSn(), UserContext.getCurrentUser().getId(), UserContext.getCurrentUser().getRole().getRole(), UserContext.getCurrentUser().getUsername(), message));
|
||||||
UserContext.getCurrentUser().getId(),
|
|
||||||
UserContext.getCurrentUser().getRole().getRole(),
|
|
||||||
UserContext.getCurrentUser().getUsername(), "订单[" + item.getSn() + "]创建"));
|
|
||||||
|
|
||||||
//添加订单货物
|
|
||||||
item.getSkuList().forEach(
|
item.getSkuList().forEach(
|
||||||
sku -> orderItems.add(new OrderItem(sku, item, tradeDTO))
|
sku -> orderItems.add(new OrderItem(sku, item, tradeDTO))
|
||||||
);
|
);
|
||||||
|
orderVO.setOrderItems(orderItems);
|
||||||
//构建orderVO对象
|
orderVOS.add(orderVO);
|
||||||
OrderVO orderVO = new OrderVO(order, orderItems);
|
|
||||||
OrderVOList.add(orderVO);
|
|
||||||
});
|
});
|
||||||
tradeDTO.setOrderVO(OrderVOList);
|
tradeDTO.setOrderVO(orderVOS);
|
||||||
//批量保存订单
|
//批量保存订单
|
||||||
this.saveBatch(orders);
|
this.saveBatch(orders);
|
||||||
//批量保存 子订单
|
//批量保存 子订单
|
||||||
@ -168,7 +173,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|||||||
// 批量记录订单操作日志
|
// 批量记录订单操作日志
|
||||||
orderLogService.saveBatch(orderLogs);
|
orderLogService.saveBatch(orderLogs);
|
||||||
// 赠品根据店铺单独生成订单
|
// 赠品根据店铺单独生成订单
|
||||||
//todo 优化赠品订单代码逻辑
|
|
||||||
this.generatorGiftOrder(tradeDTO);
|
this.generatorGiftOrder(tradeDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ import com.alipay.api.request.AlipayTradePrecreateRequest;
|
|||||||
import com.alipay.api.request.AlipayTradeWapPayRequest;
|
import com.alipay.api.request.AlipayTradeWapPayRequest;
|
||||||
import com.alipay.api.response.AlipayTradeAppPayResponse;
|
import com.alipay.api.response.AlipayTradeAppPayResponse;
|
||||||
import com.alipay.api.response.AlipayTradePrecreateResponse;
|
import com.alipay.api.response.AlipayTradePrecreateResponse;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -24,7 +25,7 @@ import java.io.PrintWriter;
|
|||||||
* @author Chopper
|
* @author Chopper
|
||||||
* @date 2020/12/15 19:26
|
* @date 2020/12/15 19:26
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
public class AliPayRequest {
|
public class AliPayRequest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,7 +41,7 @@ public class AliPayRequest {
|
|||||||
public static void wapPay(HttpServletResponse response, AlipayTradeWapPayModel model, String returnUrl, String notifyUrl) throws AlipayApiException, IOException {
|
public static void wapPay(HttpServletResponse response, AlipayTradeWapPayModel model, String returnUrl, String notifyUrl) throws AlipayApiException, IOException {
|
||||||
String form = wapPayStr(model, returnUrl, notifyUrl);
|
String form = wapPayStr(model, returnUrl, notifyUrl);
|
||||||
response.setContentType("text/html;charset=UTF-8");
|
response.setContentType("text/html;charset=UTF-8");
|
||||||
|
log.info("支付表单{}", form);
|
||||||
PrintWriter out = response.getWriter();
|
PrintWriter out = response.getWriter();
|
||||||
out.write(form);
|
out.write(form);
|
||||||
out.flush();
|
out.flush();
|
||||||
|
@ -2,6 +2,7 @@ package cn.lili.controller.setting;
|
|||||||
|
|
||||||
import cn.lili.common.enums.ResultUtil;
|
import cn.lili.common.enums.ResultUtil;
|
||||||
import cn.lili.common.vo.ResultMessage;
|
import cn.lili.common.vo.ResultMessage;
|
||||||
|
import cn.lili.modules.base.aspect.DemoSite;
|
||||||
import cn.lili.modules.base.service.RegionService;
|
import cn.lili.modules.base.service.RegionService;
|
||||||
import cn.lili.modules.system.entity.dos.Region;
|
import cn.lili.modules.system.entity.dos.Region;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@ -29,6 +30,7 @@ public class RegionManagerController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private RegionService regionService;
|
private RegionService regionService;
|
||||||
|
|
||||||
|
@DemoSite
|
||||||
@PostMapping(value = "/sync")
|
@PostMapping(value = "/sync")
|
||||||
@ApiOperation(value = "同步高德行政地区数据")
|
@ApiOperation(value = "同步高德行政地区数据")
|
||||||
public void synchronizationData(String url) {
|
public void synchronizationData(String url) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user