代码优化,修复订单投诉问题

This commit is contained in:
paulGao 2022-07-04 18:31:36 +08:00
parent a8079e0d35
commit 7b535434ae
9 changed files with 20 additions and 25 deletions

View File

@ -82,7 +82,7 @@ public class OrderComplaintBuyerController {
@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);
}

View File

@ -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;
@ -25,19 +22,10 @@ import org.springframework.web.cors.CorsConfigurationSource;
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

View File

@ -253,14 +253,17 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
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())) {
@ -268,9 +271,11 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
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);
}

View File

@ -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())

View File

@ -36,7 +36,7 @@ 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);
@ -44,10 +44,10 @@ public class StoreCollectionServiceImpl extends ServiceImpl<StoreCollectionMappe
@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
@ -67,7 +67,7 @@ public class StoreCollectionServiceImpl extends ServiceImpl<StoreCollectionMappe
@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));

View File

@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
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;
@ -23,8 +24,11 @@ import java.util.Date;
@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;

View File

@ -23,6 +23,8 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
/**
* 管理端,交易投诉接口
*
@ -74,8 +76,8 @@ public class OrderComplaintManagerController {
})
@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);
}

View File

@ -8,7 +8,6 @@ import cn.lili.common.security.AuthUser;
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;
@ -17,7 +16,6 @@ import cn.lili.modules.permission.entity.dos.AdminUser;
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;
@ -49,8 +47,6 @@ import java.util.List;
public class AdminUserManagerController {
@Autowired
private AdminUserService adminUserService;
@Autowired
private DepartmentService departmentService;
/**
* 会员
*/

View File

@ -68,7 +68,7 @@ public class OrderComplaintStoreController {
@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();
}