Compare commits
2 Commits
729d67f8f3
...
540820281d
| Author | SHA1 | Date | |
|---|---|---|---|
| 540820281d | |||
| 1c60f938b6 |
@ -100,19 +100,19 @@
|
||||
-->
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
<version>2.7.18</version>
|
||||
</dependency>
|
||||
<!-- <!– https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa –>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-data-jpa</artifactId>-->
|
||||
<!-- <version>2.7.18</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-jpa -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-jpa</artifactId>
|
||||
<version>2.7.18</version>
|
||||
</dependency>
|
||||
<!-- <!– https://mvnrepository.com/artifact/org.springframework.data/spring-data-jpa –>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.data</groupId>-->
|
||||
<!-- <artifactId>spring-data-jpa</artifactId>-->
|
||||
<!-- <version>2.7.18</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!--excel工具-->
|
||||
<dependency>
|
||||
|
||||
@ -57,6 +57,9 @@ public interface PayService {
|
||||
@PostMapping(value = "/admin/pay/payController/editPayConsumeTrade")
|
||||
boolean editPayConsumeTrade(@RequestBody Map params);
|
||||
|
||||
@PostMapping(value = "/admin/pay/payController/saveOrUpdatePayUserResource")
|
||||
boolean saveOrUpdatePayUserResource(@RequestBody PayUserResource params);
|
||||
|
||||
@PostMapping(value = "/admin/pay/payController/points")
|
||||
boolean points(@RequestParam(name = "user_id") Integer user_id,
|
||||
@RequestParam(name = "points") BigDecimal points,
|
||||
|
||||
@ -71,6 +71,12 @@ public class AccountUserBase implements Serializable {
|
||||
@ApiModelProperty(value = "快速登录码")
|
||||
private String user_quickcode;
|
||||
|
||||
@ApiModelProperty(value = "用户身份:0-个人身份;1-企业身份;")
|
||||
private String user_type;
|
||||
|
||||
@ApiModelProperty(value = "公司id")
|
||||
private String user_company_id;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "用户权限集合")
|
||||
private List<AdminRightsGroup> roles;
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
|
||||
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
|
||||
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
|
||||
* Vestibulum commodo. Ut rhoncus gravida arcu.
|
||||
*/
|
||||
|
||||
package com.suisung.mall.common.pojo.req;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(description = "第三方会员同步请求参数")
|
||||
public class SyncThirdMemberReq implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("会员手机号")
|
||||
private String user_mobile;
|
||||
@ApiModelProperty("会员昵称")
|
||||
private String user_nickname;
|
||||
@ApiModelProperty("会员真实姓名")
|
||||
private String user_realname;
|
||||
@ApiModelProperty("会员性别:1-男;2-女;")
|
||||
private Integer user_gender;
|
||||
@ApiModelProperty("会员生日 yyyy-MM-dd")
|
||||
private String user_birthday;
|
||||
@ApiModelProperty("会员等级:v1...v9")
|
||||
private String user_level;
|
||||
@ApiModelProperty("会员卡号")
|
||||
private String user_level_card;
|
||||
@ApiModelProperty("会员积分值")
|
||||
private BigDecimal user_points;
|
||||
@ApiModelProperty("会员余额")
|
||||
private BigDecimal user_money;
|
||||
@ApiModelProperty("加入时间")
|
||||
private Date join_time;
|
||||
}
|
||||
@ -2,8 +2,12 @@ package com.suisung.mall.common.utils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
@Slf4j
|
||||
public class DateTimeUtils {
|
||||
@ -11,4 +15,18 @@ public class DateTimeUtils {
|
||||
public static String formatDateTime(LocalDateTime localDateTime, String pattern) {
|
||||
return localDateTime.format(DateTimeFormatter.ofPattern(pattern));
|
||||
}
|
||||
|
||||
public static Date parseDate(String dateString, String pattern) {
|
||||
SimpleDateFormat format = new SimpleDateFormat(pattern);
|
||||
try {
|
||||
Date date = format.parse(dateString);
|
||||
return date;
|
||||
} catch (ParseException e) {
|
||||
log.error(e.getMessage());
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
// 设置年、月(注意:月份从 0 开始,即 0 表示一月)、日、时、分、秒
|
||||
calendar.set(2000, 0, 1, 15, 30, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,12 +7,10 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.SecureRandom;
|
||||
import java.text.MessageFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -223,6 +221,23 @@ public final class StringUtils extends org.apache.commons.lang3.StringUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成唯一码
|
||||
* @param length
|
||||
* @return
|
||||
*/
|
||||
public static String generateUniqueCode(int length) {
|
||||
SecureRandom secureRandom = new SecureRandom();
|
||||
// 计算所需的字节数,根据 Base64 编码的特性,3 个字节编码为 4 个字符
|
||||
int numBytes = (int) Math.ceil((length * 3.0 / 4.0));
|
||||
byte[] randomBytes = new byte[numBytes];
|
||||
secureRandom.nextBytes(randomBytes);
|
||||
|
||||
String base64 = Base64.getUrlEncoder().withoutPadding().encodeToString(randomBytes);
|
||||
// 截取所需长度的子串
|
||||
return base64.substring(0, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* 全地址去除省市区,保留详细地址
|
||||
*
|
||||
|
||||
@ -151,7 +151,17 @@ public class PayController {
|
||||
return false;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/saveOrUpdatePayUserResource", method = RequestMethod.POST)
|
||||
public boolean saveOrUpdatePayUserResource(@RequestBody PayUserResource payUserResource) {
|
||||
boolean flag;
|
||||
try {
|
||||
flag = payUserResourceService.saveOrUpdate(payUserResource);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取交易订单", notes = "获取交易订单")
|
||||
|
||||
@ -61,6 +61,7 @@ import io.seata.spring.annotation.GlobalTransactional;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
|
||||
@ -292,12 +292,12 @@
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.suisung.mall</groupId>
|
||||
<artifactId>mall-account</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.suisung.mall</groupId>-->
|
||||
<!-- <artifactId>mall-account</artifactId>-->
|
||||
<!-- <version>1.0-SNAPSHOT</version>-->
|
||||
<!-- <scope>compile</scope>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!--打票机 使用的库 结束-->
|
||||
|
||||
|
||||
@ -136,7 +136,7 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBase
|
||||
@Autowired
|
||||
private ShopBaseProductTypeService shopBaseProductTypeService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private SxSyncCategoryService sxSyncCategoryService;
|
||||
|
||||
private final String LANG = "zh_CN"; // todo 多语言动态
|
||||
|
||||
@ -40,7 +40,7 @@ public class OrderPayedListener {
|
||||
// private ShopStorePrinterService shopStorePrinterService;
|
||||
// @Autowired
|
||||
// private MqMessageService mqMessageService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private SFExpressApiService sfExpressApiService;
|
||||
|
||||
@RabbitHandler
|
||||
|
||||
@ -101,6 +101,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
@ -109,7 +110,6 @@ import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
@ -277,13 +277,13 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
private ThreadPoolExecutor executor;
|
||||
@Autowired
|
||||
private ShopActivityCutpriceService shopActivityCutpriceService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopOrderDeliveryAddressService shopOrderDeliveryAddressService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreSameCityTransportBaseService shopStoreSameCityTransportBaseService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopMessageTemplateService shopMessageTemplateService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreSfOrderService shopStoreSfOrderService;
|
||||
|
||||
|
||||
@ -8350,7 +8350,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
QueryWrapper<ShopOrderItem> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("order_id", shopOrderId);
|
||||
List<ShopOrderItem> shopOrderItemList = shopOrderItemService.list(queryWrapper);
|
||||
if (shopOrderBase == null || shopOrderData==null || CollUtil.isEmpty(shopOrderItemList)) {
|
||||
if (shopOrderBase == null || shopOrderData == null || CollUtil.isEmpty(shopOrderItemList)) {
|
||||
logger.error("无法获取订单信息!");
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -103,10 +103,10 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMappe
|
||||
@Autowired
|
||||
private ShopOrderInvoiceService shopOrderInvoiceService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopOrderStateLogService shopOrderStateLogService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopBaseStateCodeService shopBaseStateCodeService;
|
||||
|
||||
@Autowired
|
||||
|
||||
@ -555,9 +555,11 @@ public class ShopPageBaseServiceImpl extends BaseServiceImpl<ShopPageBaseMapper,
|
||||
}
|
||||
|
||||
List<Long> item_ids = new ArrayList<>();
|
||||
List<Serializable> item_ids_key = shopProductItemService.findKey(new QueryWrapper<ShopProductItem>().in("item_id", item_id_104).eq("item_enable", 1001));
|
||||
if (CollUtil.isNotEmpty(item_ids_key)) {
|
||||
item_ids = Convert.toList(Long.class, item_ids_key);
|
||||
if(CollUtil.isNotEmpty(item_id_104)) {
|
||||
List<Serializable> item_ids_key = shopProductItemService.findKey(new QueryWrapper<ShopProductItem>().in("item_id", item_id_104).eq("item_enable", 1001));
|
||||
if (CollUtil.isNotEmpty(item_ids_key)) {
|
||||
item_ids = Convert.toList(Long.class, item_ids_key);
|
||||
}
|
||||
}
|
||||
|
||||
JSONArray data1 = new JSONArray();
|
||||
|
||||
@ -8,6 +8,7 @@ import com.suisung.mall.common.pojo.dto.ProductRecommendDTO;
|
||||
import com.suisung.mall.common.pojo.dto.ProductSearchDTO;
|
||||
import com.suisung.mall.core.web.service.IBaseService;
|
||||
import com.suisung.mall.shop.product.pojo.vo.ProductVo;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@ -253,6 +254,7 @@ public interface ShopProductBaseService extends IBaseService<ShopProductBase> {
|
||||
|
||||
/**
|
||||
* 获取一个商品基本信息
|
||||
*
|
||||
* @param product_id
|
||||
* @param store_id
|
||||
* @return
|
||||
@ -261,6 +263,7 @@ public interface ShopProductBaseService extends IBaseService<ShopProductBase> {
|
||||
|
||||
/**
|
||||
* 根据店铺Id和商品货号,获取商品Id
|
||||
*
|
||||
* @param store_id
|
||||
* @param product_number
|
||||
* @return
|
||||
@ -276,6 +279,8 @@ public interface ShopProductBaseService extends IBaseService<ShopProductBase> {
|
||||
* @param storeId
|
||||
* @return
|
||||
*/
|
||||
Boolean syncSxGoodsToShopProductBase(String storeId);
|
||||
Boolean syncSxGoodsToShopProductBase(String storeId);
|
||||
|
||||
Pair<Boolean, String> saveProduct(ShopProductBase shopProductBase, ShopProductIndex shopProductIndex, ShopProductData shopProductData, ShopProductDetail shopProductDetail, ShopProductInfo shopProductInfo, List<ShopProductItem> shopProductItemList, List<ShopProductImage> shopProductImageList, ShopProductValidPeriod shopProductValidPeriod, List<ShopProductAssistIndex> shopProductAssistIndexList);
|
||||
|
||||
}
|
||||
|
||||
@ -100,99 +100,99 @@ import static io.seata.common.util.LambdaUtils.distinctByKey;
|
||||
@Service
|
||||
public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseMapper, ShopProductBase> implements ShopProductBaseService {
|
||||
private final Logger logger = LoggerFactory.getLogger(ShopProductBaseServiceImpl.class);
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopBaseProductCategoryService shopBaseProductCategoryService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopProductMetaService shopProductMetaService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopProductPreSaleService shopProductPreSaleService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopProductBaseService shopProductBaseService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreAnalyticsService shopStoreAnalyticsService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopProductAnalyticsService shopProductAnalyticsService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopProductDetailService shopProductDetailService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopProductInfoService shopProductInfoService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopProductValidPeriodService shopProductValidPeriodService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopProductItemService shopProductItemService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private AccountBaseConfigService accountBaseConfigService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopBaseCurrencyService shopBaseCurrencyService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopUserCartService shopUserCartService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreTransportTypeService transportTypeService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopBaseProductCategoryService productCategoryService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopProductIndexService shopProductIndexService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopProductImageService shopProductImageService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreBaseService shopStoreBaseService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopBaseProductSpecService baseProductSpecService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopBaseStoreGradeService baseStoreGradeService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopProductAssistIndexService assistIndexService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopProductDataService shopProductDataService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopProductItemSeqService shopProductItemSeqService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopProductValidPeriodService validPeriodService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopUserSearchHistoryService shopUserSearchHistoryService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopBaseStateCodeService shopBaseStateCodeService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopProductBaseMapper shopProductBaseMapper;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreActivityBaseService shopStoreActivityBaseService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreActivityItemService shopStoreActivityItemService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopActivityGroupbookingService shopActivityGroupbookingService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopBaseProductTypeService shopBaseProductTypeService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopNumberSeqService shopNumberSeqService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private EduService eduService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopBaseDistrictService shopBaseDistrictService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopBaseContractTypeService shopBaseContractTypeService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopBaseMarketCategoryService shopBaseMarketCategoryService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private MessageService messageService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopOrderItemService shopOrderItemService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private SearchService searchService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopChainItemService shopChainItemService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopUserProductBrowseService shopUserProductBrowseService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopUserProductBuyService shopUserProductBuyService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopUserFavoritesItemService shopUserFavoritesItemService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private MqMessageService mqMessageService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ThreadPoolExecutor executor;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopBaseLangMetaService shopBaseLangMetaService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private SxSyncGoodsService sxSyncGoodsService;
|
||||
|
||||
@Override
|
||||
@ -680,6 +680,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
||||
* @param shopProductAssistIndexList 辅助信息表
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Pair<Boolean, String> saveProduct(ShopProductBase shopProductBase, ShopProductIndex shopProductIndex, ShopProductData shopProductData, ShopProductDetail shopProductDetail, ShopProductInfo shopProductInfo, List<ShopProductItem> shopProductItemList, List<ShopProductImage> shopProductImageList, ShopProductValidPeriod shopProductValidPeriod, List<ShopProductAssistIndex> shopProductAssistIndexList) {
|
||||
Integer store_id = shopProductBase.getStore_id();
|
||||
if (store_id == null) {
|
||||
|
||||
@ -15,6 +15,7 @@ import com.suisung.mall.shop.sfexpress.service.SFExpressApiService;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreSfOrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
|
||||
@ -31,9 +32,9 @@ import java.util.concurrent.Executors;
|
||||
@RequestMapping("/mobile/shop/sf-express")
|
||||
public class SFExpressController {
|
||||
private final ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||
@Resource
|
||||
@Autowired
|
||||
private SFExpressApiService sfExpressApiService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreSfOrderService shopStoreSfOrderService;
|
||||
|
||||
@ApiOperation(value = "顺丰同城店铺发单", notes = "顺丰同城店铺发单")
|
||||
|
||||
@ -31,6 +31,7 @@ import com.suisung.mall.shop.sfexpress.service.SFExpressApiService;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreSfOrderService;
|
||||
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.data.util.Pair;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -54,13 +55,13 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
@Value("${sf-express.dev_id}")
|
||||
private Integer devId;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreSfOrderService shopStoreSfOrderService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopOrderBaseService shopOrderBaseService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopOrderInfoService shopOrderInfoService;
|
||||
|
||||
@Override
|
||||
|
||||
@ -17,6 +17,7 @@ import com.suisung.mall.shop.sixun.service.SxSyncGoodsService;
|
||||
import com.suisung.mall.shop.sixun.service.SxSyncVipService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@ -28,19 +29,19 @@ import javax.annotation.Resource;
|
||||
@RestController
|
||||
@RequestMapping("/admin/sixun")
|
||||
public class SxSyncController {
|
||||
@Resource
|
||||
@Autowired
|
||||
private SxSyncCategoryService sxSyncCategoryService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private SxSyncVipService sxSyncVipService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private SxSyncGoodsService sxSyncGoodsService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopBaseProductCategoryService shopBaseProductCategoryService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopProductBaseService shopProductBaseService;
|
||||
|
||||
@ApiOperation(value = "获取思迅商品分类新增到数据库", notes = "获取思迅商品分类新增到数据库")
|
||||
|
||||
@ -46,7 +46,7 @@ public class ShopStoreBaseController extends BaseControllerImpl {
|
||||
@Autowired
|
||||
private ShopBaseStoreGradeService shopBaseStoreGradeService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreSameCityTransportBaseService transportBaseService;
|
||||
|
||||
@ApiOperation(value = "店铺基础信息表-分页列表查询", notes = "店铺基础信息表-分页列表查询")
|
||||
|
||||
@ -9,6 +9,7 @@ import com.suisung.mall.shop.store.service.ShopStorePrinterService;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportBaseService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@ -22,13 +23,13 @@ import java.math.BigDecimal;
|
||||
@RequestMapping("/admin/shop/store/printer")
|
||||
public class ShopStorePrinterController {
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStorePrinterService shopStorePrinterService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreSameCityTransportBaseService shopStoreSameCityTransportBaseService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreEmployeeService shopStoreEmployeeService;
|
||||
|
||||
@ApiOperation(value = "内部测试案例", notes = "内部测试案例")
|
||||
|
||||
@ -7,6 +7,7 @@ import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportBaseService
|
||||
import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -16,10 +17,10 @@ import javax.annotation.Resource;
|
||||
@RequestMapping("/admin/shop/store/same-city-transport")
|
||||
public class ShopStoreSameCityTransportBaseController {
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreSameCityTransportBaseService transportBaseService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreSameCityTransportService transportService;
|
||||
|
||||
@ApiOperation(value = "获取同城配送运费设置详情", notes = "获取同城配送运费设置详情")
|
||||
|
||||
@ -4,6 +4,7 @@ import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportBaseService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@ -16,7 +17,7 @@ import javax.annotation.Resource;
|
||||
@RequestMapping("/mobile/shop/store/same-city-transport")
|
||||
public class ShopStoreSameCityTransportBaseMobileController {
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreSameCityTransportBaseService transportBaseService;
|
||||
|
||||
@ApiOperation(value = "下单前检测同城订单配送是否符合要求", notes = "下单前检测同城订单配送是否符合要求")
|
||||
|
||||
@ -23,6 +23,7 @@ import com.suisung.mall.shop.store.mapper.ShopStoreEmployeeMapper;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreEmployeeRightsGroupService;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreEmployeeService;
|
||||
import io.seata.spring.annotation.GlobalTransactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -44,16 +45,16 @@ import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser;
|
||||
@Service
|
||||
public class ShopStoreEmployeeServiceImpl extends BaseServiceImpl<ShopStoreEmployeeMapper, ShopStoreEmployee> implements ShopStoreEmployeeService {
|
||||
|
||||
// @Resource
|
||||
// @Autowired
|
||||
// private ShopStoreEmployeeService shopStoreEmployeeService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private AccountService accountService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreEmployeeRightsGroupService shopStoreEmployeeRightsGroupService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreEmployeeMapper shopStoreEmployeeMapper;
|
||||
|
||||
@Override
|
||||
|
||||
@ -36,6 +36,7 @@ import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportBaseService
|
||||
import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -54,9 +55,9 @@ import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser;
|
||||
public class ShopStoreSameCityTransportBaseServiceImpl extends BaseServiceImpl<ShopStoreSameCityTransportBaseMapper, ShopStoreSameCityTransportBase> implements ShopStoreSameCityTransportBaseService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ShopStoreSameCityTransportBaseServiceImpl.class);
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreSameCityTransportService shopStoreSameCityTransportService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreBaseService shopStoreBaseService;
|
||||
|
||||
/**
|
||||
|
||||
@ -9,21 +9,24 @@
|
||||
package com.suisung.mall.shop.sync.controller;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.modules.base.ShopBaseProductBrand;
|
||||
import com.suisung.mall.common.pojo.req.SyncThirdMemberReq;
|
||||
import com.suisung.mall.common.pojo.res.ThirdApiRes;
|
||||
import com.suisung.mall.shop.sync.service.SyncThirdDataService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "第三方数据同步")
|
||||
@RestController
|
||||
@RequestMapping("/shop/sync/third")
|
||||
public class SyncThirdDataController {
|
||||
@Resource
|
||||
@Autowired
|
||||
private SyncThirdDataService syncThirdDataService;
|
||||
|
||||
|
||||
@ -53,7 +56,7 @@ public class SyncThirdDataController {
|
||||
|
||||
@ApiOperation(value = "会员数据同步", notes = "会员数据同步")
|
||||
@RequestMapping(value = "/member", method = RequestMethod.POST)
|
||||
public ThirdApiRes syncMember(@RequestBody String reqBody) {
|
||||
public ThirdApiRes syncMember(@RequestBody List<SyncThirdMemberReq> memberList) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ public interface SyncAppService {
|
||||
|
||||
/**
|
||||
* 根据 appId 获取一条记录
|
||||
*
|
||||
* @param appId
|
||||
* @return
|
||||
*/
|
||||
@ -22,6 +23,7 @@ public interface SyncAppService {
|
||||
|
||||
/**
|
||||
* 根据关键字搜索记录分页列表
|
||||
*
|
||||
* @param keyword
|
||||
* @param status
|
||||
* @param pageNum
|
||||
@ -32,6 +34,7 @@ public interface SyncAppService {
|
||||
|
||||
/**
|
||||
* 新增一条记录
|
||||
*
|
||||
* @param syncApp
|
||||
* @return
|
||||
*/
|
||||
@ -39,6 +42,7 @@ public interface SyncAppService {
|
||||
|
||||
/**
|
||||
* 修改一条记录
|
||||
*
|
||||
* @param syncApp
|
||||
* @return
|
||||
*/
|
||||
@ -46,6 +50,7 @@ public interface SyncAppService {
|
||||
|
||||
/**
|
||||
* 修改 app key 和 app 密钥
|
||||
*
|
||||
* @param appId
|
||||
* @param appKey
|
||||
* @param appSecret
|
||||
@ -55,6 +60,7 @@ public interface SyncAppService {
|
||||
|
||||
/**
|
||||
* 删除一条记录
|
||||
*
|
||||
* @param appId
|
||||
* @return
|
||||
*/
|
||||
@ -62,6 +68,7 @@ public interface SyncAppService {
|
||||
|
||||
/**
|
||||
* 删除一条记录
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
package com.suisung.mall.shop.sync.service;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import com.suisung.mall.common.modules.base.ShopBaseProductBrand;
|
||||
import com.suisung.mall.common.pojo.req.SyncThirdMemberReq;
|
||||
import com.suisung.mall.common.pojo.res.ThirdApiRes;
|
||||
|
||||
import java.util.List;
|
||||
@ -18,6 +18,7 @@ public interface SyncThirdDataService {
|
||||
|
||||
/**
|
||||
* 批量保存商品的分类
|
||||
*
|
||||
* @param categoryListJSON
|
||||
* @return
|
||||
*/
|
||||
@ -25,8 +26,23 @@ public interface SyncThirdDataService {
|
||||
|
||||
/**
|
||||
* 批量保存商品品牌记录
|
||||
*
|
||||
* @param brandListJSON
|
||||
* @return
|
||||
*/
|
||||
ThirdApiRes saveOrUpdateShopBaseProductBrandBatch(JSONArray brandListJSON);
|
||||
|
||||
/**
|
||||
* 批量保存商品记录
|
||||
* @param goodsListJSON
|
||||
* @return
|
||||
*/
|
||||
ThirdApiRes saveOrUpdateGoodsBatch(JSONArray goodsListJSON);
|
||||
|
||||
/**
|
||||
* 批量保存会员记录
|
||||
* @param memberList
|
||||
* @return
|
||||
*/
|
||||
ThirdApiRes saveOrUpdateMemberBatch(List<SyncThirdMemberReq> memberList);
|
||||
}
|
||||
|
||||
@ -12,22 +12,19 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.suisung.mall.common.modules.sixun.SxSyncGoods;
|
||||
import com.suisung.mall.common.modules.sync.SyncApp;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
import com.suisung.mall.shop.sixun.mapper.SxSyncGoodsMapper;
|
||||
import com.suisung.mall.shop.sixun.service.SxSyncGoodsService;
|
||||
import com.suisung.mall.shop.sync.mapper.SyncAppMapper;
|
||||
import com.suisung.mall.shop.sync.service.SyncAppService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Service
|
||||
public class SyncAppServiceImpl extends BaseServiceImpl<SyncAppMapper, SyncApp> implements SyncAppService {
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private SyncAppMapper syncAppMapper;
|
||||
|
||||
/**
|
||||
@ -63,12 +60,12 @@ public class SyncAppServiceImpl extends BaseServiceImpl<SyncAppMapper, SyncApp>
|
||||
QueryWrapper<SyncApp> queryWrapper2 = new QueryWrapper<>();
|
||||
queryWrapper2.like("intro", keyword).or((Consumer<QueryWrapper<SyncApp>>) queryWrapper);
|
||||
|
||||
if(status!=null && status>0){
|
||||
queryWrapper.eq("status",status);
|
||||
queryWrapper2.eq("status",status);
|
||||
if (status != null && status > 0) {
|
||||
queryWrapper.eq("status", status);
|
||||
queryWrapper2.eq("status", status);
|
||||
}
|
||||
|
||||
return lists(queryWrapper2,pageNum,pageSize);
|
||||
return lists(queryWrapper2, pageNum, pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,7 +76,7 @@ public class SyncAppServiceImpl extends BaseServiceImpl<SyncAppMapper, SyncApp>
|
||||
*/
|
||||
@Override
|
||||
public Boolean addSyncApp(SyncApp syncApp) {
|
||||
if(syncApp==null){
|
||||
if (syncApp == null) {
|
||||
return false;
|
||||
}
|
||||
return add(syncApp);
|
||||
@ -93,7 +90,7 @@ public class SyncAppServiceImpl extends BaseServiceImpl<SyncAppMapper, SyncApp>
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateSyncApp(SyncApp syncApp) {
|
||||
if(syncApp==null){
|
||||
if (syncApp == null) {
|
||||
return false;
|
||||
}
|
||||
return updateById(syncApp);
|
||||
|
||||
@ -8,38 +8,78 @@
|
||||
|
||||
package com.suisung.mall.shop.sync.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.suisung.mall.common.api.StateCode;
|
||||
import com.suisung.mall.common.constant.CommonConstant;
|
||||
import com.suisung.mall.common.exception.ApiException;
|
||||
import com.suisung.mall.common.feignService.AccountService;
|
||||
import com.suisung.mall.common.feignService.PayService;
|
||||
import com.suisung.mall.common.modules.account.AccountUserBase;
|
||||
import com.suisung.mall.common.modules.account.AccountUserInfo;
|
||||
import com.suisung.mall.common.modules.base.ShopBaseProductBrand;
|
||||
import com.suisung.mall.common.modules.base.ShopBaseProductCategory;
|
||||
import com.suisung.mall.common.modules.base.ShopBaseProductType;
|
||||
import com.suisung.mall.common.modules.pay.PayUserResource;
|
||||
import com.suisung.mall.common.modules.product.*;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreBase;
|
||||
import com.suisung.mall.common.pojo.req.SyncThirdMemberReq;
|
||||
import com.suisung.mall.common.pojo.res.ThirdApiRes;
|
||||
import com.suisung.mall.common.utils.DateTimeUtils;
|
||||
import com.suisung.mall.common.utils.I18nUtil;
|
||||
import com.suisung.mall.common.utils.StringUtils;
|
||||
import com.suisung.mall.shop.base.service.ShopBaseProductBrandService;
|
||||
import com.suisung.mall.shop.base.service.ShopBaseProductCategoryService;
|
||||
import com.suisung.mall.shop.base.service.ShopBaseProductTypeService;
|
||||
import com.suisung.mall.shop.product.service.ShopProductBaseService;
|
||||
import com.suisung.mall.shop.product.service.impl.ShopProductBaseServiceImpl;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreBaseService;
|
||||
import com.suisung.mall.shop.sync.service.SyncThirdDataService;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class SyncThirdDataServiceImpl implements SyncThirdDataService {
|
||||
@Resource
|
||||
private final Logger logger = LoggerFactory.getLogger(ShopProductBaseServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private ShopBaseProductBrandService productBrandService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopBaseProductCategoryService productCategoryService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopBaseProductTypeService productTypeService;
|
||||
|
||||
@Autowired
|
||||
private AccountService accountService;
|
||||
|
||||
@Autowired
|
||||
private PayService payService;
|
||||
|
||||
@Autowired
|
||||
ShopProductBaseService shopProductBaseService;
|
||||
|
||||
@Autowired
|
||||
ShopStoreBaseService shopStoreBaseService;
|
||||
|
||||
private int limitCnt = 300;
|
||||
|
||||
/**
|
||||
* 批量保存商品的分类
|
||||
*
|
||||
@ -59,13 +99,15 @@ public class SyncThirdDataServiceImpl implements SyncThirdDataService {
|
||||
return new ThirdApiRes().fail(1004, I18nUtil._("请求参数有误!"));
|
||||
}
|
||||
|
||||
if (list != null && list.size() > 500) {
|
||||
return new ThirdApiRes().fail(1004, I18nUtil._("单次同步记录最多500条!"));
|
||||
if (list != null && list.size() > limitCnt) {
|
||||
return new ThirdApiRes().fail(1004, I18nUtil._("单次同步记录最多"+limitCnt+"条!"));
|
||||
}
|
||||
|
||||
String storeId = "3";
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).setStore_id("3"); // app 记录传进来
|
||||
list.get(i).setStore_id(storeId); // app 记录传进来
|
||||
list.get(i).setData_source(2); // 思迅数据来源
|
||||
list.get(i).setCategory_is_enable(1);
|
||||
|
||||
@ -116,7 +158,10 @@ public class SyncThirdDataServiceImpl implements SyncThirdDataService {
|
||||
}
|
||||
}
|
||||
|
||||
return new ThirdApiRes().success("成功同步" + count + "条记录!", count);
|
||||
Map<String, Integer> resp = new HashMap<>();
|
||||
resp.put("count", count);
|
||||
|
||||
return new ThirdApiRes().success("成功同步" + count + "条记录!", resp);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -138,13 +183,15 @@ public class SyncThirdDataServiceImpl implements SyncThirdDataService {
|
||||
return new ThirdApiRes().fail(1004, I18nUtil._("请求参数有误!"));
|
||||
}
|
||||
|
||||
if (goodBrandList != null && goodBrandList.size() > 500) {
|
||||
return new ThirdApiRes().fail(1004, I18nUtil._("单次同步记录最多500条!"));
|
||||
if (goodBrandList != null && goodBrandList.size() > limitCnt) {
|
||||
return new ThirdApiRes().fail(1004, I18nUtil._("单次同步记录最多"+limitCnt+"条!"));
|
||||
}
|
||||
|
||||
Integer storeId = 3;
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < goodBrandList.size(); i++) {
|
||||
goodBrandList.get(i).setStore_id(3); // app 记录传进来
|
||||
goodBrandList.get(i).setStore_id(storeId); // app 记录传进来
|
||||
// 处理大分类字段
|
||||
JSONObject o = (JSONObject) brandListJSON.get(i);
|
||||
if (o != null && StrUtil.isNotBlank(o.getStr("category"))) {
|
||||
@ -157,6 +204,223 @@ public class SyncThirdDataServiceImpl implements SyncThirdDataService {
|
||||
count += productBrandService.saveOrUpdateBrand2(goodBrandList.get(i));
|
||||
}
|
||||
|
||||
return new ThirdApiRes().success("成功同步" + count + "条记录!", count);
|
||||
Map<String, Integer> resp = new HashMap<>();
|
||||
resp.put("count", count);
|
||||
|
||||
return new ThirdApiRes().success("成功同步" + count + "条记录!", resp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量保存商品记录
|
||||
*
|
||||
* @param goodsListJSON
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ThirdApiRes saveOrUpdateGoodsBatch(JSONArray goodsListJSON) {
|
||||
// TODO 验签、appid,必要参数判断
|
||||
|
||||
if (ObjectUtil.isEmpty(goodsListJSON)) {
|
||||
return new ThirdApiRes().fail(1003, I18nUtil._("缺少必要参数!"));
|
||||
}
|
||||
|
||||
List<ShopBaseProductBrand> goodBrandList = JSONUtil.toList(goodsListJSON, ShopBaseProductBrand.class);
|
||||
if (goodBrandList == null) {
|
||||
return new ThirdApiRes().fail(1004, I18nUtil._("请求参数有误!"));
|
||||
}
|
||||
|
||||
if (goodsListJSON.size() > limitCnt) {
|
||||
return new ThirdApiRes().fail(1004, I18nUtil._("单次同步记录最多"+limitCnt+"条!"));
|
||||
}
|
||||
|
||||
Integer storeId = 3;
|
||||
|
||||
int count = 0;
|
||||
for (JSONObject jsonObj : goodsListJSON.jsonIter()) {
|
||||
Date currentDate = new Date();
|
||||
|
||||
Integer categoryId = Convert.toInt(jsonObj.get("first_category_name"), 0);
|
||||
Integer storeIdInt = Convert.toInt(storeId);
|
||||
ShopStoreBase store_row = shopStoreBaseService.get(storeId);
|
||||
if (store_row == null) {
|
||||
throw new ApiException(I18nUtil._("无法获取店铺信息!"));
|
||||
}
|
||||
|
||||
ShopProductBase shopProductBase = new ShopProductBase();
|
||||
shopProductBase.setProduct_sale_time(Convert.toDate(DateUtil.current() + 600)); //10分钟
|
||||
shopProductBase.setStore_id(storeIdInt);
|
||||
shopProductBase.setProduct_number((String) jsonObj.get("first_category_name"));
|
||||
shopProductBase.setProduct_name((String) jsonObj.get("first_category_name"));
|
||||
shopProductBase.setStore_name(store_row.getStore_name());
|
||||
shopProductBase.setProduct_tips("");
|
||||
shopProductBase.setProduct_video("");
|
||||
shopProductBase.setTransport_type_id(StateCode.DELIVERY_TYPE_SAME_CITY);
|
||||
shopProductBase.setProduct_state_id(StateCode.PRODUCT_STATE_NORMAL);
|
||||
shopProductBase.setProduct_inventory_lock(1002); //库存锁定(ENUM):1001-下单锁定;1002-支付锁定;
|
||||
shopProductBase.setProduct_fx_enable(0); // 供应商是否允许批发市场分销
|
||||
shopProductBase.setProduct_dist_enable(0); // 是否允许三级分销
|
||||
shopProductBase.setProduct_from(1005);// 商品来源(ENUM):1000-发布;1001-天猫;1002-淘宝;1003-阿里巴巴;1004-京东;1005-思迅;
|
||||
shopProductBase.setProduct_add_time(currentDate.getTime());
|
||||
|
||||
|
||||
// ShopProductIndex
|
||||
ShopProductIndex shopProductIndex = new ShopProductIndex();
|
||||
shopProductIndex.setProduct_add_time(currentDate.getTime());
|
||||
shopProductIndex.setProduct_sale_time(DateUtil.current() + 600); //10分钟
|
||||
shopProductIndex.setStore_category_ids(""); // 店铺分类编号(DOT)
|
||||
shopProductIndex.setProduct_tags("");// 商品标签(DOT)
|
||||
shopProductIndex.setBrand_id(0);
|
||||
shopProductIndex.setProduct_name(shopProductBase.getProduct_name()); // 产品名称:店铺平台先在对用表中检索后通过id检索,检索使用
|
||||
shopProductIndex.setProduct_name_index(shopProductIndex.getProduct_name()); // 名称索引关键字(DOT)
|
||||
shopProductIndex.setCategory_id(categoryId); // 商品分类
|
||||
shopProductIndex.setProduct_fx_enable(0); // 供应商是否允许批发市场分销
|
||||
shopProductIndex.setProduct_dist_enable(0); // 是否允许三级分销
|
||||
shopProductIndex.setStore_id(storeIdInt);
|
||||
shopProductIndex.setStore_type(store_row.getStore_type());
|
||||
shopProductIndex.setKind_id(StateCode.PRODUCT_KIND_ENTITY);// 实体商品
|
||||
shopProductIndex.setStore_is_open(store_row.getStore_is_open());
|
||||
shopProductIndex.setStore_is_selfsupport(store_row.getStore_is_selfsupport());
|
||||
shopProductIndex.setStore_longitude(store_row.getStore_longitude());
|
||||
shopProductIndex.setStore_latitude(store_row.getStore_latitude());
|
||||
|
||||
shopProductIndex.setCard_type_id(0);
|
||||
shopProductIndex.setVoucher_activity_id("");
|
||||
shopProductIndex.setCoupon_type_id(0);// product_assist_data // 辅助属性值列(DOT)
|
||||
shopProductIndex.setProduct_transport_id(String.valueOf(StateCode.DELIVERY_TYPE_SAME_CITY));
|
||||
|
||||
ShopBaseProductCategory category_row = productCategoryService.get(categoryId);
|
||||
if (ObjectUtil.isNotEmpty(category_row)) {
|
||||
Integer type_id = category_row.getType_id();
|
||||
shopProductIndex.setType_id(type_id);
|
||||
}
|
||||
|
||||
// shop_product_data
|
||||
ShopProductData shopProductData = new ShopProductData();
|
||||
// product_id // 产品id
|
||||
shopProductData.setProduct_edit_time(currentDate);
|
||||
|
||||
// shop_product_detail
|
||||
ShopProductDetail shopProductDetail = new ShopProductDetail();
|
||||
shopProductDetail.setProduct_detail("");
|
||||
shopProductDetail.setProduct_param("");
|
||||
shopProductDetail.setProduct_service("");
|
||||
shopProductDetail.setProduct_tags("");
|
||||
|
||||
// shop_product_info
|
||||
ShopProductInfo shopProductInfo = new ShopProductInfo();
|
||||
shopProductInfo.setProduct_number((String) jsonObj.get("first_category_name"));// SPU商家编码:货号
|
||||
shopProductInfo.setProduct_assist("");
|
||||
shopProductInfo.setProduct_spec("");
|
||||
shopProductInfo.setProduct_buy_limit(0); // 不限购
|
||||
//商品规格
|
||||
shopProductInfo.setSpec_ids("");
|
||||
|
||||
List<ShopProductItem> shopProductItemList = new ArrayList<>();
|
||||
ShopProductItem shopProductItem = new ShopProductItem();
|
||||
shopProductItem.setStore_id(storeIdInt);
|
||||
shopProductItem.setCategory_id(categoryId);
|
||||
shopProductItem.setItem_unit_price((BigDecimal) jsonObj.get("first_category_name"));
|
||||
shopProductItem.setItem_advice_price((BigDecimal) jsonObj.get("first_category_name"));
|
||||
shopProductItem.setItem_market_price((BigDecimal) jsonObj.get("first_category_name"));
|
||||
shopProductItem.setItem_unit_points((BigDecimal) jsonObj.get("first_category_name"));
|
||||
shopProductItem.setItem_quantity((Integer) jsonObj.get("first_category_name")); // 库存
|
||||
shopProductItem.setItem_quantity_frozen(0);
|
||||
shopProductItem.setItem_number((String) jsonObj.get("first_category_name"));// SKU商家编码
|
||||
shopProductItem.setItem_barcode((String) jsonObj.get("first_category_name")); // 条形码正常情况下就是货号
|
||||
shopProductItem.setItem_is_default(1);
|
||||
shopProductItem.setItem_enable(1);
|
||||
|
||||
shopProductItemList.add(shopProductItem);
|
||||
|
||||
// 保存数据
|
||||
Pair<Boolean, String> pair = shopProductBaseService.saveProduct(shopProductBase, shopProductIndex, shopProductData, shopProductDetail, shopProductInfo, shopProductItemList, new ArrayList<ShopProductImage>(), new ShopProductValidPeriod(), new ArrayList<ShopProductAssistIndex>());
|
||||
if (!pair.getFirst()) {
|
||||
logger.error(pair.getSecond());
|
||||
continue;
|
||||
}
|
||||
|
||||
count += 1;
|
||||
}
|
||||
|
||||
Map<String, Integer> resp = new HashMap<>();
|
||||
resp.put("count", count);
|
||||
|
||||
return new ThirdApiRes().success("成功同步" + count + "条记录!", resp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量保存会员记录
|
||||
*
|
||||
* @param memberList
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ThirdApiRes saveOrUpdateMemberBatch(List<SyncThirdMemberReq> memberList) {
|
||||
if (CollUtil.isEmpty(memberList)) {
|
||||
return new ThirdApiRes().fail(1003, I18nUtil._("缺少必要参数!"));
|
||||
}
|
||||
|
||||
String storeId = "3";
|
||||
if (memberList.size() > limitCnt) {
|
||||
return new ThirdApiRes().fail(1004, I18nUtil._("单次同步记录最多" + limitCnt + "条!"));
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (SyncThirdMemberReq member : memberList) {
|
||||
// account_user_base
|
||||
AccountUserBase accountUserBase = new AccountUserBase();
|
||||
accountUserBase.setUser_account(StringUtils.generateUniqueCode(8));
|
||||
accountUserBase.setUser_nickname(member.getUser_nickname());
|
||||
accountUserBase.setUser_state(2);// 状态(ENUM):0-锁定;1-未激活;2-已激活;
|
||||
accountUserBase.setUser_is_admin(0);
|
||||
accountUserBase.setStore_ids(storeId);
|
||||
accountUserBase.setRights_group_id("0");// 普通用户
|
||||
accountUserBase.setUser_type("0");
|
||||
|
||||
String user_key = IdUtil.simpleUUID();
|
||||
String user_salt = IdUtil.simpleUUID();
|
||||
String user_token = IdUtil.simpleUUID();
|
||||
accountUserBase.setUser_salt(user_salt);
|
||||
accountUserBase.setUser_token(user_token);
|
||||
accountUserBase.setUser_key(user_key);
|
||||
accountUserBase.setUser_password(SecureUtil.md5(user_salt + SecureUtil.md5(IdUtil.simpleUUID())));
|
||||
|
||||
Boolean success = accountService.saveOrUpdateUserBase(accountUserBase);
|
||||
|
||||
Integer userId = accountUserBase.getUser_id();
|
||||
|
||||
// account_user_info
|
||||
AccountUserInfo accountUserInfo = new AccountUserInfo();
|
||||
accountUserInfo.setUser_id(userId);// todo
|
||||
accountUserInfo.setUser_type_id(0);
|
||||
accountUserInfo.setUser_mobile(member.getUser_mobile());
|
||||
accountUserInfo.setUser_level_card(member.getUser_level_card());
|
||||
//user_level_id
|
||||
accountUserInfo.setUser_level_id(1); // todo select id
|
||||
accountUserInfo.setUser_gender(member.getUser_gender());
|
||||
accountUserInfo.setUser_mobile(member.getUser_mobile());
|
||||
accountUserInfo.setUser_intl(CommonConstant.IDD_ZH_CN);
|
||||
accountUserInfo.setUser_birthday(DateTimeUtils.parseDate(member.getUser_birthday(), "yyyy-MM-dd"));
|
||||
success = accountService.saveOrUpdateUserInfo(accountUserInfo);
|
||||
|
||||
if (member.getUser_money() != null || member.getUser_points() != null) {
|
||||
// 用户支付资源,积分,余额
|
||||
PayUserResource payUserResource = new PayUserResource();
|
||||
payUserResource.setUser_id(userId);
|
||||
payUserResource.setUser_money(member.getUser_money());
|
||||
payUserResource.setUser_money_frozen(BigDecimal.ZERO);
|
||||
payUserResource.setUser_points(member.getUser_points());
|
||||
payUserResource.setUser_points_frozen(BigDecimal.ZERO);
|
||||
|
||||
success = payService.saveOrUpdatePayUserResource(payUserResource);
|
||||
}
|
||||
|
||||
if(success) {count += 1;}
|
||||
}
|
||||
|
||||
Map<String, Integer> resp = new HashMap<>();
|
||||
resp.put("count", count);
|
||||
|
||||
return new ThirdApiRes().success("成功同步" + count + "条记录!", resp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
@Autowired
|
||||
private ShopProductImageService shopProductImageService;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private ShopStoreSameCityTransportBaseService shopStoreSameCityTransportBaseService;
|
||||
|
||||
@Override
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<if test="param.product_id != null">
|
||||
AND b.product_id = #{param.product_id}
|
||||
</if>
|
||||
<if test="param.item_id != null">
|
||||
<if test="param.item_id != null and param.item_id.size() > 0">
|
||||
AND i.item_id in
|
||||
<foreach collection="param.item_id" item="item_id" index="index" open="(" close=")" separator=",">
|
||||
#{item_id}
|
||||
@ -28,8 +28,8 @@
|
||||
</if>
|
||||
<if test="param.category_ids != null">
|
||||
AND b.category_id in
|
||||
<foreach collection="param.category_ids" item="category_id" index="index" open="(" close=")"
|
||||
separator=",">#{category_id}
|
||||
<foreach collection="param.category_ids" item="category_id" index="index" open="(" close=")" separator=",">
|
||||
#{category_id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.product_name != null and param.product_name !=''">
|
||||
|
||||
11
pom.xml
11
pom.xml
@ -94,6 +94,7 @@
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!--MyBatis Plus 依赖-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
@ -321,6 +322,12 @@
|
||||
<mysql.user>root</mysql.user>
|
||||
<mysql.pwd>B1x1GuKZr55PPmox</mysql.pwd>
|
||||
<mysql.driver>com.mysql.cj.jdbc.Driver</mysql.driver>
|
||||
<!-- <mysql.host>127.0.0.1</mysql.host>-->
|
||||
<!-- <mysql.port>3306</mysql.port>-->
|
||||
<!-- <mysql.db>mall_dev</mysql.db>-->
|
||||
<!-- <mysql.user>root</mysql.user>-->
|
||||
<!-- <mysql.pwd>123456</mysql.pwd>-->
|
||||
<!-- <mysql.driver>com.mysql.cj.jdbc.Driver</mysql.driver>-->
|
||||
<!-- redis配置 -->
|
||||
<redis.host>114.132.210.208</redis.host>
|
||||
<redis.database>15</redis.database>
|
||||
@ -490,6 +497,10 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.spotify</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user