循环依赖问题,太难搞了,fix bug
This commit is contained in:
parent
38f0feb5b5
commit
3ea6cf91a2
@ -2,4 +2,4 @@
|
||||
spring:
|
||||
aop:
|
||||
auto: true
|
||||
proxy-target-class: true
|
||||
proxy-target-class: true
|
||||
@ -9,6 +9,7 @@ import com.suisung.mall.shop.activity.service.ShopActivityCutpriceService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@ -27,6 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RequestMapping("/admin/shop/shop-activity-cutprice")
|
||||
public class ShopActivityCutpriceController extends BaseControllerImpl {
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopActivityCutpriceService shopActivityCutpriceService;
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ import com.suisung.mall.shop.activity.service.ShopActivityCutpriceHistoryService
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@ -27,6 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RequestMapping("/admin/shop/shop-activity-cutprice-history")
|
||||
public class ShopActivityCutpriceHistoryController {
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopActivityCutpriceHistoryService shopActivityCutpriceHistoryService;
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import com.suisung.mall.common.modules.activity.ShopActivityGroupbooking;
|
||||
import com.suisung.mall.shop.activity.service.ShopActivityGroupbookingService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@ -24,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RequestMapping("/admin/shop/shop-activity-groupbooking")
|
||||
public class ShopActivityGroupbookingController {
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopActivityGroupbookingService shopActivityGroupbookingService;
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@ -39,21 +40,27 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RequestMapping("/mobile/shop/userActivity")
|
||||
public class UserActivityController extends BaseControllerImpl {
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopActivityCutpriceService shopActivityCutpriceService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopActivityCutpriceHistoryService shopActivityCutpriceHistoryService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopActivityGroupbookingService shopActivityGroupbookingService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopActivityGroupbuyStoreService shopActivityGroupbuyStoreService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopUserVoucherService shopUserVoucherService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopStoreActivityBaseService shopStoreActivityBaseService;
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@ import com.suisung.mall.shop.activity.service.ShopActivityCutpriceHistoryService
|
||||
import com.suisung.mall.shop.activity.service.ShopActivityCutpriceService;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreActivityBaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -45,12 +46,15 @@ import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser;
|
||||
@Service
|
||||
public class ShopActivityCutpriceHistoryServiceImpl extends BaseServiceImpl<ShopActivityCutpriceHistoryMapper, ShopActivityCutpriceHistory> implements ShopActivityCutpriceHistoryService {
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopActivityCutpriceService shopActivityCutpriceService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopStoreActivityBaseService shopStoreActivityBaseService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private AccountService accountService;
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@ import com.suisung.mall.shop.activity.service.ShopActivityGroupbookingService;
|
||||
import com.suisung.mall.shop.base.service.AccountBaseConfigService;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreActivityBaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -56,15 +57,19 @@ import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser;
|
||||
@Service
|
||||
public class ShopActivityCutpriceServiceImpl extends BaseServiceImpl<ShopActivityCutpriceMapper, ShopActivityCutprice> implements ShopActivityCutpriceService {
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopActivityGroupbookingHistoryService shopActivityGroupbookingHistoryService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopActivityGroupbookingService shopActivityGroupbookingService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopStoreActivityBaseService shopStoreActivityBaseService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private AccountService accountService;
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@ import com.suisung.mall.shop.store.service.ShopStoreBaseService;
|
||||
import com.suisung.mall.shop.user.service.ShopUserVoucherService;
|
||||
import io.seata.spring.annotation.GlobalTransactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -61,6 +62,7 @@ public class ShopActivityGroupbookingServiceImpl extends BaseServiceImpl<ShopAct
|
||||
@Autowired
|
||||
private ShopActivityGroupbookingService shopActivityGroupbookingService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopStoreActivityBaseService shopStoreActivityBaseService;
|
||||
|
||||
@ -70,18 +72,21 @@ public class ShopActivityGroupbookingServiceImpl extends BaseServiceImpl<ShopAct
|
||||
@Autowired
|
||||
private ShopOrderInfoService shopOrderInfoService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopUserVoucherService shopUserVoucherService;
|
||||
|
||||
@Autowired
|
||||
private ShopOrderReturnService shopOrderReturnService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderBaseService shopOrderBaseService;
|
||||
|
||||
@Autowired
|
||||
private ShopOrderDataService shopOrderDataService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopStoreBaseService shopStoreBaseService;
|
||||
|
||||
|
||||
@ -26,7 +26,6 @@ import com.suisung.mall.common.modules.product.ShopProductIndex;
|
||||
import com.suisung.mall.common.modules.product.ShopProductItem;
|
||||
import com.suisung.mall.common.modules.sixun.SxSyncCategory;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreActivityItem;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreProductCategory;
|
||||
import com.suisung.mall.common.modules.user.ShopUserCart;
|
||||
import com.suisung.mall.common.pojo.dto.ProductSearchDTO;
|
||||
import com.suisung.mall.common.utils.*;
|
||||
@ -53,9 +52,9 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
@ -75,74 +74,58 @@ import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser;
|
||||
@Service
|
||||
public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBaseProductCategoryMapper, ShopBaseProductCategory> implements ShopBaseProductCategoryService {
|
||||
|
||||
private final String LANG = "zh_CN"; // todo 多语言动态
|
||||
@Autowired
|
||||
private UserInfoService userInfoService;
|
||||
|
||||
@Autowired
|
||||
private AccountBaseConfigService accountBaseConfigService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopProductBaseService shopProductBaseService;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseProductAssistService productAssistService;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseProductAssistItemService productAssistItemService;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseProductBrandService productBrandService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopUserCartService shopUserCartService;
|
||||
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopDistributionUserService distributionUserService;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopProductItemService shopProductItemService;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseDistrictService shopBaseDistrictService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopProductIndexService shopProductIndexService;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseProductTagService shopBaseProductTagService;
|
||||
|
||||
@Autowired
|
||||
private EduService eduService;
|
||||
|
||||
@Autowired
|
||||
private AccountService accountService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductImageService shopProductImageService;
|
||||
|
||||
@Autowired
|
||||
private ShopStoreActivityItemService shopStoreActivityItemService;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseProductCategoryMapper shopBaseProductCategoryMapper;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseProductTypeService shopBaseProductTypeService;
|
||||
|
||||
@Autowired
|
||||
private SxSyncCategoryService sxSyncCategoryService;
|
||||
|
||||
@Autowired
|
||||
private ShopStoreBaseService shopStoreBaseService;
|
||||
|
||||
private final String LANG = "zh_CN"; // todo 多语言动态
|
||||
|
||||
@Override
|
||||
public List<ElTree> tree(QueryWrapper<ShopBaseProductCategory> queryWrapper) {
|
||||
List<ShopBaseProductCategory> list = find(queryWrapper);
|
||||
@ -247,11 +230,11 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBase
|
||||
@Override
|
||||
public List<Map> getCategoryTree() {
|
||||
QueryWrapper<ShopBaseProductCategory> queryWrapper = new QueryWrapper<>();
|
||||
String redisKey=RedisConstant.Product_Cate_Key;
|
||||
if(getCurrentUser().isStore()){
|
||||
String redisKey = RedisConstant.Product_Cate_Key;
|
||||
if (getCurrentUser().isStore()) {
|
||||
Integer store_id = Convert.toInt(getCurrentUser().getStore_id());
|
||||
queryWrapper.eq("store_id", store_id);
|
||||
redisKey=RedisConstant.Product_Cate_Key+":"+store_id;
|
||||
redisKey = RedisConstant.Product_Cate_Key + ":" + store_id;
|
||||
}
|
||||
List<Map> cateTree = Convert.toList(Map.class, redisService.get(redisKey));
|
||||
if (CollUtil.isNotEmpty(cateTree)) {
|
||||
@ -946,9 +929,9 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBase
|
||||
|
||||
@Override
|
||||
public Map lists() {
|
||||
String storeId=null;
|
||||
if(getCurrentUser().isStore()){
|
||||
storeId=getCurrentUser().getStore_id();
|
||||
String storeId = null;
|
||||
if (getCurrentUser().isStore()) {
|
||||
storeId = getCurrentUser().getStore_id();
|
||||
}
|
||||
List<ShopBaseProductCategory> shopBaseProductCategories = shopBaseProductCategoryMapper.selectCategoryList(storeId);
|
||||
Map map = new HashMap(1);
|
||||
@ -976,8 +959,8 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBase
|
||||
if (CheckUtil.isNotEmpty(categoryName)) {
|
||||
objectQueryWrapper.like("category_name", categoryName);
|
||||
}
|
||||
String storeId=getParameter("store_id");
|
||||
if(CheckUtil.isNotEmpty(storeId)){
|
||||
String storeId = getParameter("store_id");
|
||||
if (CheckUtil.isNotEmpty(storeId)) {
|
||||
objectQueryWrapper.eq("store_id", storeId);
|
||||
}
|
||||
|
||||
@ -1038,7 +1021,7 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBase
|
||||
throw new ApiException(String.format(I18nUtil._("商品编号 【%s】使用此分类,不可以删除!"), CollUtil.join(product_ids, ",")));
|
||||
}
|
||||
|
||||
String storeId= ContextUtil.getCurrentUser().getStore_id();
|
||||
String storeId = ContextUtil.getCurrentUser().getStore_id();
|
||||
cleanCategoryCache(storeId);
|
||||
|
||||
return remove(category_id);
|
||||
@ -1061,8 +1044,8 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBase
|
||||
if (ObjectUtil.isNotNull(keys)) {
|
||||
redisService.del(keys);
|
||||
}
|
||||
String manageKey=RedisConstant.Product_Cate_Key;//清除管理员的key
|
||||
String storeKey=RedisConstant.Product_Cate_Key+":"+storeId;//清除店铺的key
|
||||
String manageKey = RedisConstant.Product_Cate_Key;//清除管理员的key
|
||||
String storeKey = RedisConstant.Product_Cate_Key + ":" + storeId;//清除店铺的key
|
||||
redisService.del(storeKey);
|
||||
redisService.del(manageKey);
|
||||
|
||||
@ -1141,7 +1124,7 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBase
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ShopBaseProductCategory getCategoryByName(String categoryName,String storeId) {
|
||||
public ShopBaseProductCategory getCategoryByName(String categoryName, String storeId) {
|
||||
QueryWrapper<ShopBaseProductCategory> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("category_name", categoryName);
|
||||
queryWrapper.eq("store_id", storeId);
|
||||
@ -1184,7 +1167,7 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBase
|
||||
*/
|
||||
@Override
|
||||
public ShopBaseProductCategory ConvSxCategoryToShopBaseProductCategory(SxSyncCategory sxSyncCategory) {
|
||||
if(sxSyncCategory==null){
|
||||
if (sxSyncCategory == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -1265,14 +1248,14 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBase
|
||||
if (CollUtil.isEmpty(map)) {
|
||||
QueryWrapper<ShopBaseProductCategory> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("store_id", storeId);
|
||||
// queryWrapper.eq("data_source", 2);
|
||||
// queryWrapper.eq("data_source", 2);
|
||||
List<ShopBaseProductCategory> categoryList = find(queryWrapper);
|
||||
// 类似数据可以放到前端整理
|
||||
List<Map> category_tmp_rows = Convert.toList(Map.class, categoryList);
|
||||
map=new HashMap();
|
||||
map = new HashMap();
|
||||
for (Map category_row : category_tmp_rows) {
|
||||
map.put(category_row.get("category_name"),category_row.get("category_id"));
|
||||
map.put(category_row.get("category_id"),category_row.get("type_id"));
|
||||
map.put(category_row.get("category_name"), category_row.get("category_id"));
|
||||
map.put(category_row.get("category_id"), category_row.get("type_id"));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(map)) redisService.set(cache_key, map, 60 * 60);
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||
|
||||
import java.util.Date;
|
||||
@ -26,35 +27,51 @@ import java.util.stream.Collectors;
|
||||
public class RetryMqMsgJob extends QuartzJobBean {
|
||||
@Override
|
||||
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
Logger logger = LoggerFactory.getLogger(StoreValidTimeJod.class);
|
||||
MqMessageService mqMessageService = SpringUtil.getBean(MqMessageService.class);
|
||||
RabbitTemplate rabbitTemplate = SpringUtil.getBean(RabbitTemplate.class);
|
||||
|
||||
QueryWrapper<MqMessage> mqMessageQueryWrapper = new QueryWrapper<>();
|
||||
mqMessageQueryWrapper.eq("message_status", MqConstant.FAILURE);
|
||||
mqMessageQueryWrapper.lt("message_count", MqConstant.MAX_COUNT);
|
||||
List<MqMessage> mqMessages = mqMessageService.find(mqMessageQueryWrapper);
|
||||
|
||||
mqMessages.forEach(mqMessage -> {
|
||||
mqMessage.setMessage_count(mqMessage.getMessage_count() + 1);
|
||||
if (!mqMessageService.edit(mqMessage)) {
|
||||
logger.error(I18nUtil._("消息消费次数增加失败!"));
|
||||
Logger logger = LoggerFactory.getLogger(RetryMqMsgJob.class);
|
||||
try {
|
||||
MqMessageService mqMessageService = SpringUtil.getBean(MqMessageService.class);
|
||||
// 检查Spring容器是否正在关闭
|
||||
ApplicationContext applicationContext = SpringUtil.getApplicationContext();
|
||||
if (applicationContext == null) {
|
||||
logger.warn("Application context is null, skipping RetryMqMsgJob execution");
|
||||
return;
|
||||
}
|
||||
// 重新投递到队列中
|
||||
rabbitTemplate.convertAndSend(mqMessage.getMessage_to_exchane(), mqMessage.getMessage_routing_key(), mqMessage.getMessage_content(), new CorrelationData(mqMessage.getMessage_id()));
|
||||
});
|
||||
|
||||
// 清理已经消费成功的消息或早于两个月前的消息
|
||||
QueryWrapper<MqMessage> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("message_status", MqConstant.DELIVERED)
|
||||
.or().lt("create_time", DateUtil.offsetMonth(new Date(), -2));
|
||||
List<MqMessage> messages = mqMessageService.lists(queryWrapper, 1, 20).getRecords();
|
||||
List<String> messageIds = messages.stream().map(MqMessage::getMessage_id).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(messageIds)) {
|
||||
if (!mqMessageService.removeByIds(messageIds)) {
|
||||
logger.error(I18nUtil._("消息清理失败!"));
|
||||
|
||||
RabbitTemplate rabbitTemplate = null;
|
||||
try {
|
||||
rabbitTemplate = SpringUtil.getBean(RabbitTemplate.class);
|
||||
} catch (Exception e) {
|
||||
logger.warn("Failed to get RabbitTemplate bean, skipping message retry: {}", e.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
QueryWrapper<MqMessage> mqMessageQueryWrapper = new QueryWrapper<>();
|
||||
mqMessageQueryWrapper.eq("message_status", MqConstant.FAILURE);
|
||||
mqMessageQueryWrapper.lt("message_count", MqConstant.MAX_COUNT);
|
||||
List<MqMessage> mqMessages = mqMessageService.find(mqMessageQueryWrapper);
|
||||
|
||||
for (MqMessage mqMessage : mqMessages) {
|
||||
mqMessage.setMessage_count(mqMessage.getMessage_count() + 1);
|
||||
if (!mqMessageService.edit(mqMessage)) {
|
||||
logger.error(I18nUtil._("消息消费次数增加失败!"));
|
||||
}
|
||||
// 重新投递到队列中
|
||||
rabbitTemplate.convertAndSend(mqMessage.getMessage_to_exchane(), mqMessage.getMessage_routing_key(), mqMessage.getMessage_content(), new CorrelationData(mqMessage.getMessage_id()));
|
||||
}
|
||||
|
||||
// 清理已经消费成功的消息或早于两个月前的消息
|
||||
QueryWrapper<MqMessage> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("message_status", MqConstant.DELIVERED)
|
||||
.or().lt("create_time", DateUtil.offsetMonth(new Date(), -2));
|
||||
List<MqMessage> messages = mqMessageService.lists(queryWrapper, 1, 20).getRecords();
|
||||
List<String> messageIds = messages.stream().map(MqMessage::getMessage_id).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(messageIds)) {
|
||||
if (!mqMessageService.removeByIds(messageIds)) {
|
||||
logger.error(I18nUtil._("消息清理失败!"));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Error executing RetryMqMsgJob: {}", e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -16,9 +16,9 @@ import com.suisung.mall.common.modules.distribution.ShopDistributionPlantformUse
|
||||
import com.suisung.mall.common.modules.distribution.ShopDistributionPlantformUserGeneratedCommission;
|
||||
import com.suisung.mall.common.modules.distribution.ShopDistributionUser;
|
||||
import com.suisung.mall.common.modules.distribution.ShopDistributionUserCommission;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
import com.suisung.mall.common.utils.CheckUtil;
|
||||
import com.suisung.mall.common.utils.I18nUtil;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
import com.suisung.mall.shop.base.service.AccountBaseConfigService;
|
||||
import com.suisung.mall.shop.distribution.mapper.ShopDistributionPlantformUserMapper;
|
||||
import com.suisung.mall.shop.distribution.service.ShopDistributionPlantformUserGeneratedCommissionService;
|
||||
@ -26,6 +26,7 @@ import com.suisung.mall.shop.distribution.service.ShopDistributionPlantformUserS
|
||||
import com.suisung.mall.shop.distribution.service.ShopDistributionUserCommissionService;
|
||||
import com.suisung.mall.shop.distribution.service.ShopDistributionUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -53,6 +54,7 @@ public class ShopDistributionPlantformUserServiceImpl extends BaseServiceImpl<Sh
|
||||
@Autowired
|
||||
private ShopDistributionUserService shopDistributionUserService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopDistributionUserCommissionService distributionUserCommissionService;
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@ import com.suisung.mall.shop.distribution.service.ShopDistributionUserOrderServi
|
||||
import com.suisung.mall.shop.distribution.service.ShopDistributionUserWithdrawService;
|
||||
import io.seata.spring.annotation.GlobalTransactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -47,6 +48,7 @@ public class ShopDistributionUserCommissionServiceImpl extends BaseServiceImpl<S
|
||||
@Autowired
|
||||
private AccountBaseConfigService accountBaseConfigService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopDistributionUserOrderService distributionUserOrderService;
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ import com.suisung.mall.shop.order.service.ShopOrderBaseService;
|
||||
import com.suisung.mall.shop.order.service.ShopOrderInfoService;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreBaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -54,9 +55,11 @@ public class ShopDistributionUserOrderServiceImpl extends BaseServiceImpl<ShopDi
|
||||
@Autowired
|
||||
private ShopDistributionUserService shopDistributionUserService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopDistributionPlantformUserService shopDistributionPlantformUserService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderBaseService shopOrderBaseService;
|
||||
|
||||
|
||||
@ -57,6 +57,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -91,10 +92,13 @@ public class ShopDistributionUserServiceImpl extends BaseServiceImpl<ShopDistrib
|
||||
private AccountBaseConfigService accountBaseConfigService;
|
||||
@Autowired
|
||||
private ShopBaseDistrictService shopBaseDistrictService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopDistributionPlantformUserService plantformUserServicel;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopDistributionUserCommissionService userCommissionService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopDistributionUserOrderService userOrderService;
|
||||
@Autowired
|
||||
|
||||
@ -16,6 +16,7 @@ import com.suisung.mall.shop.message.service.PushMessageService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -32,6 +33,7 @@ import java.io.IOException;
|
||||
@Slf4j
|
||||
public class DelayMessageReceiver {
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private PushMessageService pushMessageService;
|
||||
|
||||
@ -48,15 +50,7 @@ public class DelayMessageReceiver {
|
||||
|
||||
try {
|
||||
// 处理死信消息
|
||||
boolean result = processDeadMessage(message);
|
||||
|
||||
// 根据处理结果确认或拒绝消息
|
||||
if (result) {
|
||||
ackMessage(channel, msg);
|
||||
} else {
|
||||
log.warn("处理过期消息失败,消息将重新入队,消息内容: {}", message);
|
||||
rejectMessage(channel, msg);
|
||||
}
|
||||
processDeadMessage(message, channel, msg);
|
||||
} catch (Exception e) {
|
||||
log.error("处理过期消息时发生异常,消息将重新入队,消息内容: {}", message, e);
|
||||
rejectMessage(channel, msg);
|
||||
@ -69,7 +63,7 @@ public class DelayMessageReceiver {
|
||||
* @param message 消息内容
|
||||
* @return 处理结果 true-成功 false-失败
|
||||
*/
|
||||
private boolean processDeadMessage(JSONObject message) {
|
||||
private boolean processDeadMessage(JSONObject message, Channel channel, Message msg) {
|
||||
log.info("开始处理死信消息: {}", message);
|
||||
|
||||
// 检查消息是否为空
|
||||
@ -83,22 +77,25 @@ public class DelayMessageReceiver {
|
||||
Integer category = message.getInt("category");
|
||||
if (category == null) {
|
||||
log.warn("消息分类为空,无法处理消息: {}", message);
|
||||
ackMessage(channel, msg);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 根据消息分类处理不同类型的消息
|
||||
if (category == MqConstant.DEAD_EVENT_CATE_ORDER_EXPIRED) {
|
||||
// 处理订单超时消息
|
||||
return handleOrderExpiredMessage(message);
|
||||
return handleOrderExpiredMessage(message, channel, msg);
|
||||
} else if (category == MqConstant.DEAD_EVENT_CATE_PRE_ORDER) {
|
||||
// 处理预订单消息
|
||||
return handlePreOrderMessage(message);
|
||||
} else {
|
||||
log.warn("未知的消息分类: {},消息内容: {}", category, message);
|
||||
ackMessage(channel, msg);
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("处理死信消息时发生异常,消息内容: {}", message, e);
|
||||
ackMessage(channel, msg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -109,7 +106,7 @@ public class DelayMessageReceiver {
|
||||
* @param message 消息内容
|
||||
* @return 处理结果
|
||||
*/
|
||||
private boolean handleOrderExpiredMessage(JSONObject message) {
|
||||
private boolean handleOrderExpiredMessage(JSONObject message, Channel channel, Message msg) {
|
||||
try {
|
||||
String orderId = message.getStr("orderId");
|
||||
Integer storeId = message.getInt("storeId");
|
||||
@ -127,9 +124,11 @@ public class DelayMessageReceiver {
|
||||
message.getStr("message"), payload);
|
||||
|
||||
log.info("订单超时消息处理完成,订单号: {}, 店铺ID: {}", orderId, storeId);
|
||||
ackMessage(channel, msg);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("处理订单超时消息时发生异常,消息内容: {}", message, e);
|
||||
ackMessage(channel, msg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import com.suisung.mall.common.constant.CommonConstant;
|
||||
import com.suisung.mall.common.constant.MqConstant;
|
||||
import com.suisung.mall.common.modules.order.ShopOrderInfo;
|
||||
import com.suisung.mall.common.utils.DateTimeUtils;
|
||||
import com.suisung.mall.shop.message.service.MqMessageService;
|
||||
import com.suisung.mall.shop.message.service.PushMessageService;
|
||||
import com.suisung.mall.shop.order.service.ShopOrderBaseService;
|
||||
import com.suisung.mall.shop.order.service.ShopOrderInfoService;
|
||||
@ -37,21 +38,24 @@ import java.util.List;
|
||||
public class OrderPayedListener {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(OrderPayedListener.class);
|
||||
@Autowired
|
||||
private ShopOrderBaseService shopOrderBaseService;
|
||||
@Autowired
|
||||
private ShopOrderInfoService shopOrderInfoService;
|
||||
// @Autowired
|
||||
// private ShopStorePrinterService shopStorePrinterService;
|
||||
// @Autowired
|
||||
// private MqMessageService mqMessageService;
|
||||
@Autowired
|
||||
private SFExpressApiService sfExpressApiService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderBaseService shopOrderBaseService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderInfoService shopOrderInfoService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private SFExpressApiService sfExpressApiService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private PushMessageService pushMessageService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private MqMessageService mqMessageService;
|
||||
|
||||
@RabbitHandler
|
||||
public void listener(String data, Channel channel, Message message) throws IOException, InterruptedException {
|
||||
String messageId = message.getMessageProperties().getMessageId();
|
||||
@ -134,7 +138,17 @@ public class OrderPayedListener {
|
||||
pushMessageService.noticeMerchantEmployeeOrderAction(orderInfoOld.getStore_id(), orderId, title, content, payload);
|
||||
|
||||
// 发送 预过期 MQ 的推送消息
|
||||
shopOrderBaseService.preSendExpiredSFOrderPushMessage(orderInfoOld.getStore_id(), orderId, 1500L); // 25分钟发出过期消息
|
||||
// shopOrderBaseService.preSendExpiredSFOrderPushMessage(orderInfoOld.getStore_id(), orderId, 1500L); // 25分钟发出过期消息
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("category", MqConstant.DEAD_EVENT_CATE_ORDER_EXPIRED); // 消息分类:1-订单超时消息
|
||||
jsonObject.put("orderId", orderId); // 订单ID
|
||||
jsonObject.put("storeId", orderInfoOld.getStore_id()); // 店铺ID
|
||||
jsonObject.put("title", "有一笔已超时的订单!"); // 消息标题
|
||||
jsonObject.put("message", "您有一笔已超时的订单[" + orderId + "],请及时处理。"); // 消息内容
|
||||
|
||||
// 发送延迟消息
|
||||
mqMessageService.sendDelayMessage(jsonObject.toString(), 1500L * 1000); // 转换为毫秒
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -605,5 +605,5 @@ public interface ShopOrderBaseService extends IBaseService<ShopOrderBase> {
|
||||
* @param expireSeconds 配送超时的秒数,单位秒
|
||||
* @return
|
||||
*/
|
||||
Boolean preSendExpiredSFOrderPushMessage(Integer storeId, String orderId, Long expireSeconds);
|
||||
// Boolean preSendExpiredSFOrderPushMessage(Integer storeId, String orderId, Long expireSeconds);
|
||||
}
|
||||
|
||||
@ -111,7 +111,6 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
@ -147,8 +146,10 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
private final Logger logger = LoggerFactory.getLogger(ShopOrderBaseServiceImpl.class);
|
||||
@Autowired
|
||||
private ShopOrderBaseMapper shopOrderBaseMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderInfoService shopOrderInfoService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderReturnService orderReturnService;
|
||||
@Autowired
|
||||
@ -157,6 +158,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
private ShopStoreBaseService shopStoreBaseService;
|
||||
@Autowired
|
||||
private ShopStoreInfoService shopStoreInfoService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderItemService shopOrderItemService;
|
||||
@Autowired
|
||||
@ -169,6 +171,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
private ShopOrderChainCodeService orderChainCodeService;
|
||||
@Autowired
|
||||
private ShopChainBaseService shopChainBaseService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderLogisticsService orderLogisticsService;
|
||||
@Autowired
|
||||
@ -177,10 +180,13 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
private ShopOrderDeliveryAddressService orderDeliveryAddressService;
|
||||
@Autowired
|
||||
private ShopOrderInvoiceService orderInvoiceService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopProductBaseService shopProductBaseService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopProductIndexService shopProductIndexService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopProductItemService shopProductItemService;
|
||||
@Autowired
|
||||
@ -189,12 +195,14 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
private ShopBaseStateCodeService shopBaseStateCodeService;
|
||||
@Autowired
|
||||
private ShopProductValidPeriodService validPeriodService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopActivityGroupbookingService activityGroupbookingService;
|
||||
@Autowired
|
||||
private ShopActivityGroupbookingHistoryService groupbookingHistoryService;
|
||||
@Autowired
|
||||
private ShopOrderStateLogService shopOrderStateLogService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private InvoicingStockBillService invoicingStockBillService;
|
||||
@Autowired
|
||||
@ -217,14 +225,17 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
private AccountService accountService;
|
||||
@Autowired
|
||||
private ShopUserInvoiceService shopUserInvoiceService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopUserCartService shopUserCartService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopStoreActivityBaseService shopStoreActivityBaseService;
|
||||
@Autowired
|
||||
private ShopStoreEmployeeService storeEmployeeService;
|
||||
@Autowired
|
||||
private ShopUserProductBuyService shopUserProductBuyService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopUserVoucherService shopUserVoucherService;
|
||||
@Autowired
|
||||
@ -235,16 +246,20 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
private ShopActivityPfGroupbuyStoreHistoryService activityPfGroupbuyStoreHistoryService;
|
||||
@Autowired
|
||||
private ShopActivityCutpriceService activityCutpriceService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopBaseProductCategoryService shopBaseProductCategoryService;
|
||||
@Autowired
|
||||
private InvoicingCustomerBaseService invoicingCustomerBaseService;
|
||||
@Autowired
|
||||
private UserInfoService userInfoService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderBaseService shopOrderBaseService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderReturnService shopOrderReturnService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopActivityGroupbuyStoreService shopActivityGroupbuyStoreService;
|
||||
@Autowired
|
||||
@ -279,6 +294,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
private EduService eduService;
|
||||
@Autowired
|
||||
private ShopStoreActivityCodeService shopStoreActivityCodeService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private MqMessageService mqMessageService;
|
||||
@Autowired
|
||||
@ -8816,28 +8832,28 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
* @param expireSeconds 过期时间(秒)
|
||||
* @return 是否发送成功
|
||||
*/
|
||||
@Async
|
||||
@Override
|
||||
public Boolean preSendExpiredSFOrderPushMessage(Integer storeId, String orderId, Long expireSeconds) {
|
||||
try {
|
||||
// 构建延迟消息内容
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("category", MqConstant.DEAD_EVENT_CATE_ORDER_EXPIRED); // 消息分类:1-订单超时消息
|
||||
jsonObject.put("orderId", orderId); // 订单ID
|
||||
jsonObject.put("storeId", storeId); // 店铺ID
|
||||
jsonObject.put("title", "有一笔已超时的订单!"); // 消息标题
|
||||
jsonObject.put("message", "您有一笔已超时的订单[" + orderId + "],请及时处理。"); // 消息内容
|
||||
|
||||
// 发送延迟消息
|
||||
mqMessageService.sendDelayMessage(jsonObject.toString(), expireSeconds * 1000); // 转换为毫秒
|
||||
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("发送延迟订单超时消息失败,店铺ID:{},订单ID:{},过期时间:{}秒",
|
||||
storeId, orderId, expireSeconds, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// @Async("asyncExecutor")
|
||||
// @Override
|
||||
// public Boolean preSendExpiredSFOrderPushMessage(Integer storeId, String orderId, Long expireSeconds) {
|
||||
// try {
|
||||
// // 构建延迟消息内容
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("category", MqConstant.DEAD_EVENT_CATE_ORDER_EXPIRED); // 消息分类:1-订单超时消息
|
||||
// jsonObject.put("orderId", orderId); // 订单ID
|
||||
// jsonObject.put("storeId", storeId); // 店铺ID
|
||||
// jsonObject.put("title", "有一笔已超时的订单!"); // 消息标题
|
||||
// jsonObject.put("message", "您有一笔已超时的订单[" + orderId + "],请及时处理。"); // 消息内容
|
||||
//
|
||||
// // 发送延迟消息
|
||||
// mqMessageService.sendDelayMessage(jsonObject.toString(), expireSeconds * 1000); // 转换为毫秒
|
||||
//
|
||||
// return true;
|
||||
// } catch (Exception e) {
|
||||
// log.error("发送延迟订单超时消息失败,店铺ID:{},订单ID:{},过期时间:{}秒",
|
||||
// storeId, orderId, expireSeconds, e);
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 取货单号格式化
|
||||
|
||||
@ -140,6 +140,7 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
||||
private ShopOrderReturnMapper shopOrderReturnMapper;
|
||||
@Autowired
|
||||
private ShopOrderReturnItemService orderReturnItemService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopStoreBaseService shopStoreBaseService;
|
||||
@Autowired
|
||||
|
||||
@ -16,6 +16,7 @@ import com.suisung.mall.shop.product.mapper.ShopProductIndexMapper;
|
||||
import com.suisung.mall.shop.product.service.ShopProductBaseService;
|
||||
import com.suisung.mall.shop.product.service.ShopProductIndexService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -41,6 +42,7 @@ public class ShopProductIndexServiceImpl extends BaseServiceImpl<ShopProductInde
|
||||
@Autowired
|
||||
private ShopProductIndexMapper shopProductIndexMapper;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopProductBaseService shopProductBaseService;
|
||||
|
||||
|
||||
@ -37,6 +37,7 @@ import com.suisung.mall.common.modules.store.ShopStoreActivityBase;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreActivityItem;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreBase;
|
||||
import com.suisung.mall.common.utils.*;
|
||||
import com.suisung.mall.core.web.service.RedisService;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
import com.suisung.mall.shop.activity.service.*;
|
||||
import com.suisung.mall.shop.base.service.AccountBaseConfigService;
|
||||
@ -59,6 +60,7 @@ import com.suisung.mall.shop.user.service.ShopUserVoucherService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -83,18 +85,37 @@ import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser;
|
||||
public class ShopStoreActivityBaseServiceImpl extends BaseServiceImpl<ShopStoreActivityBaseMapper, ShopStoreActivityBase> implements ShopStoreActivityBaseService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ShopStoreActivityBaseServiceImpl.class);
|
||||
@Lazy
|
||||
@Autowired
|
||||
ShopOrderBaseService shopOrderBaseService;
|
||||
@Autowired
|
||||
ShopUserVoucherService shopUserVoucherService;
|
||||
@Autowired
|
||||
private ShopProductIndexService shopProductIndexService;
|
||||
private ShopStoreActivityBaseMapper shopStoreActivityBaseMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopActivityMarketingHistoryService shopActivityMarketingHistoryService;
|
||||
private ShopProductItemService shopProductItemService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopProductBaseService shopProductBaseService;
|
||||
@Autowired
|
||||
private ShopStoreActivityItemService shopStoreActivityItemService;
|
||||
@Autowired
|
||||
private ShopBaseActivityTypeService baseActivityTypeService;
|
||||
@Autowired
|
||||
private ShopStoreBaseService shopStoreBaseService;
|
||||
@Autowired
|
||||
private ShopBaseActivityTypeService shopBaseActivityTypeService;
|
||||
private ShopProductIndexService shopProductIndexService;
|
||||
@Autowired
|
||||
private ShopBaseStateCodeService shopBaseStateCodeService;
|
||||
@Autowired
|
||||
private ShopBaseCurrencyService shopBaseCurrencyService;
|
||||
@Autowired
|
||||
private ShopProductImageService shopProductImageService;
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
@Autowired
|
||||
private ShopActivityMarketingHistoryService shopActivityMarketingHistoryService;
|
||||
@Autowired
|
||||
private UserInfoService userInfoService;
|
||||
@Autowired
|
||||
@ -108,30 +129,22 @@ public class ShopStoreActivityBaseServiceImpl extends BaseServiceImpl<ShopStoreA
|
||||
@Autowired
|
||||
private ShopActivityCutpriceService shopActivityCutpriceService;
|
||||
@Autowired
|
||||
private ShopProductItemService shopProductItemService;
|
||||
@Autowired
|
||||
private ShopBaseCurrencyService shopBaseCurrencyService;
|
||||
@Autowired
|
||||
private ShopProductImageService shopProductImageService;
|
||||
@Autowired
|
||||
private ShopProductBaseService shopProductBaseService;
|
||||
@Autowired
|
||||
private ShopActivityLotteryHistoryService shopActivityLotteryHistoryService;
|
||||
@Autowired
|
||||
private ShopStoreActivityItemService shopStoreActivityItemService;
|
||||
@Autowired
|
||||
private ShopActivityGroupbuyStoreHistoryService activityGroupbuyStoreHistoryService;
|
||||
@Autowired
|
||||
private ShopActivityGroupbookingService shopActivityGroupbookingService;
|
||||
@Autowired
|
||||
private ShopBaseStateCodeService shopBaseStateCodeService;
|
||||
@Autowired
|
||||
private ShopStoreActivityCodeService shopStoreActivityCodeService;
|
||||
@Autowired
|
||||
private ShopOrderDataService shopOrderDataService;
|
||||
@Autowired
|
||||
private AccountBaseConfigService accountBaseConfigService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopBaseActivityTypeService shopBaseActivityTypeService;
|
||||
|
||||
/**
|
||||
* 返回随机金额数组 (分为单位)
|
||||
*
|
||||
|
||||
@ -11,6 +11,7 @@ import com.suisung.mall.shop.product.service.ShopProductBaseService;
|
||||
import com.suisung.mall.shop.store.mapper.ShopStoreAnalyticsMapper;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreAnalyticsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -30,6 +31,7 @@ import java.util.Map;
|
||||
@Service
|
||||
public class ShopStoreAnalyticsServiceImpl extends BaseServiceImpl<ShopStoreAnalyticsMapper, ShopStoreAnalytics> implements ShopStoreAnalyticsService {
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopProductBaseService shopProductBaseService;
|
||||
|
||||
|
||||
@ -133,6 +133,7 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
||||
private InvoicingWarehouseBaseService invoicingWarehouseBaseService;
|
||||
@Autowired
|
||||
private ShopStoreBaseMapper shopStoreBaseMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopStoreAnalyticsService shopStoreAnalyticsService;
|
||||
@Autowired
|
||||
|
||||
@ -14,6 +14,7 @@ import com.suisung.mall.shop.store.service.ShopStoreAnalyticsService;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreBaseService;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -43,6 +44,7 @@ public class ShopStoreInfoServiceImpl extends BaseServiceImpl<ShopStoreInfoMappe
|
||||
@Autowired
|
||||
private ShopStoreBaseService shopStoreBaseService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopStoreAnalyticsService shopStoreAnalyticsService;
|
||||
|
||||
|
||||
@ -55,6 +55,7 @@ import com.suisung.mall.shop.user.service.ShopUserVoucherService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -83,6 +84,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
private final static Integer CART_TYPE_BUY = 1; //购买
|
||||
private final static Integer CART_TYPE_POINT = 2; //赠品
|
||||
private final static Integer CART_TYPE_GIFT = 3; //积分兑换
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopProductItemService shopProductItemService;
|
||||
@Autowired
|
||||
@ -91,10 +93,12 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
private ShopChainBaseService shopChainBaseService;
|
||||
@Autowired
|
||||
private ShopChainItemService shopChainItemService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopProductBaseService shopProductBaseService;
|
||||
@Autowired
|
||||
private ShopStoreTransportTypeService shopStoreTransportTypeService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopStoreActivityBaseService shopStoreActivityBaseService;
|
||||
@Autowired
|
||||
@ -103,6 +107,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
private AccountService accountService;
|
||||
@Autowired
|
||||
private ShopStoreProductCategoryService productCategoryService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopProductIndexService productIndexService;
|
||||
@Autowired
|
||||
@ -123,6 +128,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
private ShopUserVoucherService shopUserVoucherService;
|
||||
@Autowired
|
||||
private PayService payService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderBaseService shopOrderBaseService;
|
||||
@Autowired
|
||||
@ -139,6 +145,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
private MessageService messageService;
|
||||
@Autowired
|
||||
private ShopProductInfoService shopProductInfoService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopProductIndexService shopProductIndexService;
|
||||
@Autowired
|
||||
|
||||
@ -35,6 +35,7 @@ import com.suisung.mall.shop.store.service.ShopStoreBaseService;
|
||||
import com.suisung.mall.shop.user.mapper.ShopUserVoucherMapper;
|
||||
import com.suisung.mall.shop.user.service.ShopUserVoucherService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -57,27 +58,24 @@ import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser;
|
||||
@Service
|
||||
public class ShopUserVoucherServiceImpl extends BaseServiceImpl<ShopUserVoucherMapper, ShopUserVoucher> implements ShopUserVoucherService {
|
||||
|
||||
@Autowired
|
||||
MessageService messageService;
|
||||
@Autowired
|
||||
private ShopUserVoucherMapper shopUserVoucherMapper;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopStoreActivityBaseService storeActivityBaseService;
|
||||
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopStoreBaseService shopStoreBaseService;
|
||||
|
||||
@Autowired
|
||||
private ShopBaseCurrencyService shopBaseCurrencyService;
|
||||
|
||||
@Autowired
|
||||
private ShopStoreActivityShareService shopStoreActivityShareService;
|
||||
|
||||
@Autowired
|
||||
private PayService payService;
|
||||
|
||||
@Autowired
|
||||
MessageService messageService;
|
||||
|
||||
@Override
|
||||
public Map getActivityTotalVoucher(List<Integer> activity_ids, Integer user_id) {
|
||||
Map<String, Object> queryMap = new HashMap<>();
|
||||
@ -369,14 +367,10 @@ public class ShopUserVoucherServiceImpl extends BaseServiceImpl<ShopUserVoucherM
|
||||
shopUserVoucher.setVoucher_state_id(StateCode.VOUCHER_STATE_USED);
|
||||
shopUserVoucher.setUser_voucher_activetime(date);
|
||||
boolean flag = edit(shopUserVoucher);
|
||||
if (flag) {
|
||||
return true;
|
||||
}
|
||||
return flag;
|
||||
} else {
|
||||
throw new ApiException(I18nUtil._("核销码无效或已过期,核销失败!"));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,5 +6,7 @@ spring:
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
# main:
|
||||
# lazy-initialization: true
|
||||
file:
|
||||
upload-dir: /tmp/excel_uploads
|
||||
Loading…
Reference in New Issue
Block a user