mirror of
https://github.com/weizhiqiang1995/erp-pro.git
synced 2024-12-27 01:52:13 +08:00
Merge remote-tracking branch 'origin/company_server' into company_server
# Conflicts: # skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderServiceImpl.java
This commit is contained in:
commit
b5e5b2ecb7
9 changed files with 65 additions and 31 deletions
|
@ -51,6 +51,15 @@ public class RouteController {
|
|||
routeService.deleteById(inputObject, outputObject);
|
||||
}
|
||||
|
||||
@ApiOperation(id = "queryRouteById", value = "根据id查询路线信息", method = "GET", allUse = "2")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(id = "id", name = "id", value = "路线id", required = "required")
|
||||
})
|
||||
@RequestMapping("/post/RouteController/queryRouteById")
|
||||
public void queryRouteById(InputObject inputObject, OutputObject outputObject) {
|
||||
routeService.selectById(inputObject, outputObject);
|
||||
}
|
||||
|
||||
@ApiOperation(id = "queryRoutesByStartAndEnd", value = "根据起点id--终点id 根据路线长度升序排序", method = "GET", allUse = "2")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(id = "startId", name = "startId", value = "起点id", required = "required"),
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.github.pagehelper.Page;
|
|||
import com.github.pagehelper.PageHelper;
|
||||
import com.skyeye.annotation.service.SkyeyeService;
|
||||
import com.skyeye.base.business.service.impl.SkyeyeBusinessServiceImpl;
|
||||
import com.skyeye.common.constans.CommonNumConstants;
|
||||
import com.skyeye.common.entity.search.CommonPageInfo;
|
||||
import com.skyeye.common.object.InputObject;
|
||||
import com.skyeye.common.object.OutputObject;
|
||||
|
@ -57,6 +58,17 @@ public class RouteServiceImpl extends SkyeyeBusinessServiceImpl<RoutesDao, Route
|
|||
routeStopService.remove(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectById(InputObject inputObject, OutputObject outputObject) {
|
||||
Map params = inputObject.getParams();
|
||||
String id = (String) params.get("id");
|
||||
Routes routes = selectById(id);
|
||||
iAuthUserService.setName(routes,"createId","createName");
|
||||
iAuthUserService.setName(routes,"lastUpdateId","lastUpdateName");
|
||||
outputObject.setBean(routes);
|
||||
outputObject.settotal(CommonNumConstants.NUM_ONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queryRoutesByStartAndEnd(InputObject inputObject, OutputObject outputObject) {
|
||||
Map params = inputObject.getParams();
|
||||
|
|
|
@ -74,7 +74,7 @@ public class OrderItem extends OperatorUserInfo {
|
|||
private Integer count;
|
||||
|
||||
@TableField("comment_state")
|
||||
@Property(value = "是否评价",enumClass = WhetherEnum.class)
|
||||
@Property(value = "是否评价", enumClass = WhetherEnum.class)
|
||||
private Integer commentState;
|
||||
|
||||
@TableField("price")
|
||||
|
|
|
@ -193,7 +193,7 @@ public class OrderCommentServiceImpl extends SkyeyeBusinessServiceImpl<OrderComm
|
|||
return queryWrapper;
|
||||
}
|
||||
|
||||
private List<OrderComment> getOrderCommentListByType(String typeId, Integer type) {
|
||||
private List<OrderComment> getOrderCommentListByType(String typeId, Integer type,String objectId) {
|
||||
QueryWrapper<OrderComment> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(MybatisPlusUtil.toColumns(OrderComment::getType), type)
|
||||
.and(wrap -> {
|
||||
|
@ -202,6 +202,9 @@ public class OrderCommentServiceImpl extends SkyeyeBusinessServiceImpl<OrderComm
|
|||
.or().eq(MybatisPlusUtil.toColumns(OrderComment::getOrderItemId), typeId)// 订单子单id
|
||||
.or().eq(MybatisPlusUtil.toColumns(OrderComment::getOrderId), typeId);// 订单id
|
||||
}).orderByDesc(MybatisPlusUtil.toColumns(OrderComment::getCreateTime));
|
||||
if (StrUtil.isNotEmpty(objectId)) {
|
||||
queryWrapper.eq(MybatisPlusUtil.toColumns(OrderComment::getNormsId), objectId);
|
||||
}
|
||||
List<OrderComment> list = list(queryWrapper);
|
||||
iMaterialService.setDataMation(list, OrderComment::getMaterialId);
|
||||
iMaterialNormsService.setDataMation(list, OrderComment::getNormsId);
|
||||
|
@ -214,10 +217,11 @@ public class OrderCommentServiceImpl extends SkyeyeBusinessServiceImpl<OrderComm
|
|||
public void queryOrderCommentPageList(InputObject inputObject, OutputObject outputObject) {
|
||||
CommonPageInfo commonPageInfo = inputObject.getParams(CommonPageInfo.class);
|
||||
String typeId = commonPageInfo.getTypeId();
|
||||
String objectId = commonPageInfo.getObjectId();
|
||||
Page pages = PageHelper.startPage(commonPageInfo.getPage(), commonPageInfo.getLimit());
|
||||
List<OrderComment> customerFirst = getOrderCommentListByType(typeId, OrderCommentType.CUSTOMERFiRST.getKey());
|
||||
List<OrderComment> customerLater = getOrderCommentListByType(typeId, OrderCommentType.CUSTOMERLATER.getKey());
|
||||
List<OrderComment> merchantReply = getOrderCommentListByType(typeId, OrderCommentType.MERCHANT.getKey());
|
||||
List<OrderComment> customerFirst = getOrderCommentListByType(typeId, OrderCommentType.CUSTOMERFiRST.getKey(),objectId);
|
||||
List<OrderComment> customerLater = getOrderCommentListByType(typeId, OrderCommentType.CUSTOMERLATER.getKey(),objectId);
|
||||
List<OrderComment> merchantReply = getOrderCommentListByType(typeId, OrderCommentType.MERCHANT.getKey(),objectId);
|
||||
if (CollectionUtil.isEmpty(customerFirst)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ public class OrderItemServiceImpl extends SkyeyeBusinessServiceImpl<OrderItemDao
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateCommentStateById(String id){
|
||||
public void updateCommentStateById(String id) {
|
||||
UpdateWrapper<OrderItem> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq(CommonConstants.ID, id)
|
||||
.set(MybatisPlusUtil.toColumns(OrderItem::getCommentState), WhetherEnum.ENABLE_USING.getKey());
|
||||
|
@ -135,7 +135,7 @@ public class OrderItemServiceImpl extends SkyeyeBusinessServiceImpl<OrderItemDao
|
|||
@Override
|
||||
public void UpdateOrderItemState(String orderItemId) {
|
||||
OrderItem orderItem = selectById(orderItemId);
|
||||
if (orderItem.getOrderItemState().equals(CommonNumConstants.NUM_TWO)){
|
||||
if (orderItem.getOrderItemState().equals(CommonNumConstants.NUM_TWO)) {
|
||||
throw new CustomException("该订单已收货");
|
||||
}
|
||||
UpdateWrapper<OrderItem> updateWrapper = new UpdateWrapper<>();
|
||||
|
|
|
@ -13,8 +13,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.skyeye.annotation.service.SkyeyeService;
|
||||
import com.skyeye.base.business.service.impl.SkyeyeBusinessServiceImpl;
|
||||
import com.skyeye.common.constans.CommonCharConstants;
|
||||
import com.skyeye.common.constans.CommonConstants;
|
||||
import com.skyeye.common.constans.CommonNumConstants;
|
||||
import com.skyeye.common.constans.QuartzConstants;
|
||||
|
@ -31,8 +33,6 @@ import com.skyeye.coupon.enums.PromotionDiscountType;
|
|||
import com.skyeye.coupon.enums.PromotionMaterialScope;
|
||||
import com.skyeye.coupon.service.CouponUseMaterialService;
|
||||
import com.skyeye.coupon.service.CouponUseService;
|
||||
import com.skyeye.erp.service.IMaterialNormsService;
|
||||
import com.skyeye.erp.service.IMaterialService;
|
||||
import com.skyeye.eve.rest.quartz.SysQuartzMation;
|
||||
import com.skyeye.eve.service.IAreaService;
|
||||
import com.skyeye.eve.service.IQuartzService;
|
||||
|
@ -47,8 +47,10 @@ import com.skyeye.order.enums.ShopOrderState;
|
|||
import com.skyeye.order.service.OrderItemService;
|
||||
import com.skyeye.order.service.OrderService;
|
||||
import com.skyeye.rest.pay.service.IPayService;
|
||||
import com.skyeye.rest.shopmaterialnorms.sevice.IShopMaterialNormsService;
|
||||
import com.skyeye.store.entity.ShopAddress;
|
||||
import com.skyeye.store.service.ShopAddressService;
|
||||
import com.skyeye.store.service.ShopTradeCartService;
|
||||
import com.xxl.job.core.util.IpUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -78,10 +80,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
|
|||
private IAreaService iAreaService;
|
||||
|
||||
@Autowired
|
||||
private IMaterialService iMaterialService;
|
||||
|
||||
@Autowired
|
||||
private IMaterialNormsService iMaterialNormsService;
|
||||
private IShopMaterialNormsService iShopMaterialNormsService;
|
||||
|
||||
@Autowired
|
||||
private CouponUseService couponUseService;
|
||||
|
@ -101,6 +100,9 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
|
|||
@Autowired
|
||||
private IQuartzService iQuartzService;
|
||||
|
||||
@Autowired
|
||||
private ShopTradeCartService shopTradeCartService;
|
||||
|
||||
@Override
|
||||
public void createPrepose(Order order) {
|
||||
// 订单编号
|
||||
|
@ -130,17 +132,21 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
|
|||
checkAndSetVariable(order);
|
||||
// 活动信息及积分操作方法
|
||||
checkAndSetActive(order);
|
||||
refreshCache(order.getId());
|
||||
}
|
||||
|
||||
private void checkAndSetItemCouponUse(Order order) {// 子单的优惠券操作
|
||||
List<OrderItem> orderItemList = order.getOrderItemList();
|
||||
// 设置商品信息、商品规格信息和优惠券信息
|
||||
iMaterialNormsService.setDataMation(orderItemList, OrderItem::getNormsId);
|
||||
iMaterialService.setDataMation(orderItemList, OrderItem::getMaterialId);
|
||||
List<String> normsIdList = orderItemList.stream().map(OrderItem::getNormsId).collect(Collectors.toList());
|
||||
List<Map<String, Object>> normsListMap = iShopMaterialNormsService.queryShopMaterialByNormsIdList(Joiner.on(CommonCharConstants.COMMA_MARK).join(normsIdList));
|
||||
Map<String, String> normsPriceMap = normsListMap.stream()
|
||||
.collect(Collectors.toMap(map -> map.get("normsId").toString(), map -> map.get("salePrice").toString()));
|
||||
for (OrderItem orderItem : orderItemList) {// 计算每一个子单的总价
|
||||
if (!normsPriceMap.containsKey(orderItem.getNormsId())) {
|
||||
throw new CustomException("商城不存在normsId: " + orderItem.getNormsId());
|
||||
}
|
||||
// 获取子单单价 元 -> 分
|
||||
String salePrice = CalculationUtil.multiply(orderItem.getNormsMation().get("salePrice").toString(), "100");
|
||||
String salePrice = CalculationUtil.multiply(normsPriceMap.get(orderItem.getNormsId()), "100");
|
||||
// 设置子单总价
|
||||
String price = CalculationUtil.multiply(String.valueOf(orderItem.getCount()), salePrice, CommonNumConstants.NUM_SIX);
|
||||
orderItem.setPrice(price);
|
||||
|
@ -249,6 +255,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
|
|||
orderItemService.setValueAndCreateEntity(order, userId);
|
||||
couponUseService.updateState(order.getCouponUseId());// 更新用户领取的优惠券状态
|
||||
startUpTaskQuartz(order.getId(), order.getOddNumber(), DateUtil.getTimeAndToString());
|
||||
shopTradeCartService.deleteMySelect(userId);
|
||||
}
|
||||
|
||||
private void startUpTaskQuartz(String name, String title, String delayedTime) {
|
||||
|
@ -285,9 +292,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
|
|||
ShopOrderState.SIGN.getKey(), // 已签收
|
||||
ShopOrderState.COMPLETED.getKey(), // 已完成
|
||||
ShopOrderState.UNEVALUATE.getKey(), // 待评价
|
||||
ShopOrderState.EVALUATED.getKey(),// 已评价
|
||||
ShopOrderState.PARTIALLYDONE.getKey(),//部分完成
|
||||
ShopOrderState.PARTIALEVALUATION.getKey()});//部分评价
|
||||
ShopOrderState.EVALUATED.getKey()});// 已评价
|
||||
break;
|
||||
case "4":// 已取消
|
||||
stateList = Arrays.asList(new Integer[]{ShopOrderState.CANCELED.getKey()});
|
||||
|
@ -350,9 +355,8 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
|
|||
ShopOrderState.SIGN.getKey(), // 已签收
|
||||
ShopOrderState.COMPLETED.getKey(), // 已完成
|
||||
ShopOrderState.UNEVALUATE.getKey(), // 待评价
|
||||
ShopOrderState.EVALUATED.getKey(),// 已评价
|
||||
ShopOrderState.PARTIALLYDONE.getKey(),//部分完成
|
||||
ShopOrderState.PARTIALEVALUATION.getKey()});//部分评价
|
||||
ShopOrderState.EVALUATED.getKey()});// 已评价
|
||||
ShopOrderState.PARTIALLYDONE.getKey();//部分完成
|
||||
break;
|
||||
case "4":// 已取消
|
||||
stateList = Arrays.asList(new Integer[]{ShopOrderState.CANCELED.getKey()});
|
||||
|
@ -375,7 +379,6 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
|
|||
}
|
||||
String userId = InputObject.getLogParamsStatic().get("id").toString();
|
||||
wrapper.eq(MybatisPlusUtil.toColumns(Order::getCreateId), userId);// 查询自己的订单
|
||||
wrapper.eq(MybatisPlusUtil.toColumns(Order::getType),commonPageInfo.getType());
|
||||
wrapper.orderByDesc(MybatisPlusUtil.toColumns(Order::getCreateTime));
|
||||
List<Order> list = list(wrapper);
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
|
@ -394,7 +397,6 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
|
|||
shopAddressService.setDataMation(list, Order::getAddressId);
|
||||
outputObject.setBeans(JSONUtil.toList(JSONUtil.toJsonStr(list), null));
|
||||
outputObject.settotal(pages.getTotal());
|
||||
refreshCache(idList);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -439,7 +441,6 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
|
|||
iAreaService.setDataMation(order, Order::getTownshipId);
|
||||
shopAddressService.setDataMation(order, Order::getAddressId);
|
||||
pennyToYuan(order);// 分 -> 元
|
||||
refreshCache(id);
|
||||
return order;
|
||||
}
|
||||
|
||||
|
@ -606,7 +607,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
|
|||
orderItemService.UpdateOrderItemState(orderItemId);
|
||||
List<OrderItem> orderItemList = orderItemService.queryOrderItemByParentId(orderId);
|
||||
boolean allTwo = orderItemList.stream().map(OrderItem::getOrderItemState)
|
||||
.allMatch(orderItemState -> orderItemState == CommonNumConstants.NUM_TWO);
|
||||
.allMatch(orderItemState -> orderItemState == CommonNumConstants.NUM_TWO);
|
||||
if (allTwo) {
|
||||
Integer partiallydoneKey = ShopOrderState.COMPLETED.getKey();
|
||||
updateOrderState(orderId, partiallydoneKey);
|
||||
|
@ -616,9 +617,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateOrderState(String orderId, Integer partiallydoneKey) {
|
||||
private void updateOrderState(String orderId, Integer partiallydoneKey) {
|
||||
UpdateWrapper<Order> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq(CommonConstants.ID, orderId);
|
||||
updateWrapper.set(MybatisPlusUtil.toColumns(Order::getState), partiallydoneKey);
|
||||
|
|
|
@ -65,6 +65,6 @@ public class ShopTradeCart extends OperatorUserInfo {
|
|||
private Integer count;
|
||||
|
||||
@TableField("selected")
|
||||
@ApiModelProperty(value = "是否选中", required = "required,num",enumClass = WhetherEnum.class)
|
||||
@ApiModelProperty(value = "是否选中", required = "required,num", enumClass = WhetherEnum.class)
|
||||
private Integer selected;
|
||||
}
|
||||
|
|
|
@ -29,4 +29,6 @@ public interface ShopTradeCartService extends SkyeyeBusinessService<ShopTradeCar
|
|||
void queryShopTradeCartList(InputObject inputObject, OutputObject outputObject);
|
||||
|
||||
void batchChangeSelectedStatus(InputObject inputObject, OutputObject outputObject);
|
||||
|
||||
void deleteMySelect(String userId);
|
||||
}
|
||||
|
|
|
@ -158,6 +158,14 @@ public class ShopTradeCartServiceImpl extends SkyeyeBusinessServiceImpl<ShopTrad
|
|||
update(updateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMySelect(String userId) {
|
||||
QueryWrapper<ShopTradeCart> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(MybatisPlusUtil.toColumns(ShopTradeCart::getSelected), WhetherEnum.ENABLE_USING.getKey())
|
||||
.eq(MybatisPlusUtil.toColumns(ShopTradeCart::getCreateId), userId);
|
||||
remove(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCount(InputObject inputObject, OutputObject outputObject) {
|
||||
Map<String, Object> params = inputObject.getParams();
|
||||
|
|
Loading…
Reference in a new issue