Skip to content

Commit

Permalink
代码优化,修复订单投诉问题
Browse files Browse the repository at this point in the history
  • Loading branch information
LeiGaoRobot committed Jul 4, 2022
1 parent a8079e0 commit 7b53543
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public ResultMessage<OrderComplaint> add(@Valid OrderComplaintDTO orderComplaint
@PostMapping("/communication")
public ResultMessage<OrderComplaintCommunicationVO> addCommunication(@RequestParam String complainId, @RequestParam String content) {
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
OrderComplaintCommunicationVO communicationVO = new OrderComplaintCommunicationVO(complainId, content, CommunicationOwnerEnum.BUYER.name(), currentUser.getId(), currentUser.getNickName());
OrderComplaintCommunicationVO communicationVO = new OrderComplaintCommunicationVO(complainId, content, CommunicationOwnerEnum.BUYER.name(), currentUser.getNickName(), currentUser.getId());
orderComplaintCommunicationService.addCommunication(communicationVO);
return ResultUtil.data(communicationVO);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package cn.lili.controller.security;

import cn.lili.cache.Cache;
import cn.lili.common.security.CustomAccessDeniedHandler;
import cn.lili.common.properties.IgnoredUrlsProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
Expand All @@ -25,19 +22,10 @@
public class CommonSecurityConfig extends WebSecurityConfigurerAdapter {


/**
* 忽略验权配置
*/
@Autowired
private IgnoredUrlsProperties ignoredUrlsProperties;
/**
* spring security -》 权限不足处理
*/
@Autowired
private CustomAccessDeniedHandler accessDeniedHandler;
@Autowired
private Cache<String> cache;
@Autowired
private CorsConfigurationSource corsConfigurationSource;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,24 +253,29 @@ private void updateGoodsIndexPromotions(String promotionsJsonStr) {
try {
log.info("更新商品索引促销信息: {}", promotionsJsonStr);
JSONObject jsonObject = JSONUtil.parseObj(promotionsJsonStr);
// 转换为详细的促销信息(注:促销信息必须继承自 BasePromotions,且必须保证派生类存在与sdk包下)
BasePromotions promotions = (BasePromotions) jsonObject.get("promotions",
ClassLoaderUtil.loadClass(jsonObject.get("promotionsType").toString()));
// 获取促销唯一key,由 促销类型 + 促销id 组成
String esPromotionKey = jsonObject.get("esPromotionKey").toString();
if (PromotionsScopeTypeEnum.PORTION_GOODS.name().equals(promotions.getScopeType())) {
PromotionGoodsSearchParams searchParams = new PromotionGoodsSearchParams();
searchParams.setPromotionId(promotions.getId());
List<PromotionGoods> promotionGoodsList = this.promotionGoodsService.listFindAll(searchParams);
List<String> skuIds = promotionGoodsList.stream().map(PromotionGoods::getSkuId).collect(Collectors.toList());
// 更新商品索引促销信息(删除原索引中相关的促销信息,更新索引中促销信息)
this.goodsIndexService.deleteEsGoodsPromotionByPromotionKey(skuIds, esPromotionKey);
this.goodsIndexService.updateEsGoodsIndexByList(promotionGoodsList, promotions, esPromotionKey);
} else if (PromotionsScopeTypeEnum.PORTION_GOODS_CATEGORY.name().equals(promotions.getScopeType())) {
GoodsSearchParams searchParams = new GoodsSearchParams();
searchParams.setCategoryPath(promotions.getScopeId());
List<GoodsSku> goodsSkuByList = this.goodsSkuService.getGoodsSkuByList(searchParams);
List<String> skuIds = goodsSkuByList.stream().map(GoodsSku::getId).collect(Collectors.toList());
// 更新商品索引促销信息(删除原索引中相关的促销信息,更新索引中促销信息)
this.goodsIndexService.deleteEsGoodsPromotionByPromotionKey(skuIds, esPromotionKey);
this.goodsIndexService.updateEsGoodsIndexPromotions(skuIds, promotions, esPromotionKey);
} else if (PromotionsScopeTypeEnum.ALL.name().equals(promotions.getScopeType())) {
// 更新商品索引促销信息(删除原索引中相关的促销信息,更新索引中促销信息)
this.goodsIndexService.deleteEsGoodsPromotionByPromotionKey(esPromotionKey);
this.goodsIndexService.updateEsGoodsIndexAllByList(promotions, esPromotionKey);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class CouponExecute implements EveryDayExecute {
*/
@Override
public void execute() {
//将过期优惠券变更为过期状体
//将过期优惠券变更为过期状态
LambdaUpdateWrapper<MemberCoupon> updateWrapper = new LambdaUpdateWrapper<MemberCoupon>()
.eq(MemberCoupon::getMemberCouponStatus, MemberCouponStatusEnum.NEW.name())
.le(MemberCoupon::getEndTime, new Date())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ public class StoreCollectionServiceImpl extends ServiceImpl<StoreCollectionMappe

@Override
public IPage<StoreCollectionVO> storeCollection(PageVO pageVo) {
QueryWrapper<StoreCollectionVO> queryWrapper = new QueryWrapper();
QueryWrapper<StoreCollectionVO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("sc.member_id", UserContext.getCurrentUser().getId());
queryWrapper.orderByDesc("sc.create_time");
return this.baseMapper.storeCollectionVOList(PageUtil.initPage(pageVo), queryWrapper);
}

@Override
public boolean isCollection(String storeId) {
QueryWrapper<StoreCollection> queryWrapper = new QueryWrapper();
QueryWrapper<StoreCollection> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("member_id", UserContext.getCurrentUser().getId());
queryWrapper.eq("store_id", storeId);
return Optional.ofNullable(this.getOne(queryWrapper)).isPresent();
return Optional.ofNullable(this.getOne(queryWrapper, false)).isPresent();
}

@Override
Expand All @@ -67,7 +67,7 @@ public StoreCollection addStoreCollection(String storeId) {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean deleteStoreCollection(String storeId) {
QueryWrapper<StoreCollection> queryWrapper = new QueryWrapper();
QueryWrapper<StoreCollection> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("member_id", UserContext.getCurrentUser().getId());
queryWrapper.eq("store_id", storeId);
storeService.updateStoreCollectionNum(new CollectionDTO(storeId, -1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.format.annotation.DateTimeFormat;

Expand All @@ -23,8 +24,11 @@
@Data
@TableName("li_sms_reach")
@ApiModel(value = "短信任务")
@EqualsAndHashCode(callSuper = true)
public class SmsReach extends BaseIdEntity {

private static final long serialVersionUID = -8106666482841131277L;

@ApiModelProperty(value = "签名名称", required = true)
private String signName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Objects;

/**
* 管理端,交易投诉接口
*
Expand Down Expand Up @@ -74,8 +76,8 @@ public ResultMessage<OrderComplaintVO> update(OrderComplaintVO orderComplainVO)
})
@PostMapping("/communication")
public ResultMessage<OrderComplaintCommunicationVO> addCommunication(@RequestParam String complainId, @RequestParam String content) {
AuthUser currentUser = UserContext.getCurrentUser();
OrderComplaintCommunicationVO communicationVO = new OrderComplaintCommunicationVO(complainId, content, CommunicationOwnerEnum.PLATFORM.name(), currentUser.getId(), currentUser.getUsername());
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
OrderComplaintCommunicationVO communicationVO = new OrderComplaintCommunicationVO(complainId, content, CommunicationOwnerEnum.PLATFORM.name(), currentUser.getUsername(), currentUser.getId());
orderComplaintCommunicationService.addCommunication(communicationVO);
return ResultUtil.data(communicationVO);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import cn.lili.common.security.context.UserContext;
import cn.lili.common.security.enums.UserEnums;
import cn.lili.common.security.token.Token;
import cn.lili.common.utils.StringUtils;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.common.vo.SearchVO;
Expand All @@ -17,7 +16,6 @@
import cn.lili.modules.permission.entity.dto.AdminUserDTO;
import cn.lili.modules.permission.entity.vo.AdminUserVO;
import cn.lili.modules.permission.service.AdminUserService;
import cn.lili.modules.permission.service.DepartmentService;
import cn.lili.modules.verification.entity.enums.VerificationEnums;
import cn.lili.modules.verification.service.VerificationService;
import cn.lili.mybatis.util.PageUtil;
Expand Down Expand Up @@ -49,8 +47,6 @@
public class AdminUserManagerController {
@Autowired
private AdminUserService adminUserService;
@Autowired
private DepartmentService departmentService;
/**
* 会员
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public ResultMessage<IPage<OrderComplaint>> get(OrderComplaintSearchParams searc
@PostMapping("/communication")
public ResultMessage<OrderComplaintCommunicationVO> addCommunication(@RequestParam String complainId, @RequestParam String content) {
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
OrderComplaintCommunicationVO communicationVO = new OrderComplaintCommunicationVO(complainId, content, CommunicationOwnerEnum.STORE.name(), currentUser.getStoreId(), currentUser.getUsername());
OrderComplaintCommunicationVO communicationVO = new OrderComplaintCommunicationVO(complainId, content, CommunicationOwnerEnum.STORE.name(), currentUser.getUsername(), currentUser.getStoreId());
orderComplaintCommunicationService.addCommunication(communicationVO);
return ResultUtil.success();
}
Expand Down

0 comments on commit 7b53543

Please sign in to comment.