Merge branch 'dev' into feat/ydhDeleteTracking

pull/8040/head
Qiuyi LI 2025-02-18 11:42:15 +01:00 committed by GitHub
commit 85d78d2f69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
45 changed files with 1228 additions and 106 deletions

View File

@ -0,0 +1,163 @@
package org.jeecg.modules.business.controller.admin;
import java.util.Arrays;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.business.entity.LabelData;
import org.jeecg.modules.business.service.ILabelDataService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2025-02-06
* @Version: V1.0
*/
@Api(tags="自定义分类")
@RestController
@RequestMapping("/labelData")
@Slf4j
public class LabelDataController extends JeecgController<LabelData, ILabelDataService> {
@Autowired
private ILabelDataService labelDataService;
/**
*
*
* @param labelData
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "自定义分类-分页列表查询")
@ApiOperation(value="自定义分类-分页列表查询", notes="自定义分类-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<LabelData>> queryPageList(LabelData labelData,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<LabelData> queryWrapper = QueryGenerator.initQueryWrapper(labelData, req.getParameterMap());
Page<LabelData> page = new Page<LabelData>(pageNo, pageSize);
IPage<LabelData> pageList = labelDataService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
*
*
* @param labelData
* @return
*/
@AutoLog(value = "自定义分类-添加")
@ApiOperation(value="自定义分类-添加", notes="自定义分类-添加")
@RequiresPermissions("business:label_data:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody LabelData labelData) {
labelDataService.save(labelData);
return Result.OK("添加成功!");
}
/**
*
*
* @param labelData
* @return
*/
@AutoLog(value = "自定义分类-编辑")
@ApiOperation(value="自定义分类-编辑", notes="自定义分类-编辑")
@RequiresPermissions("business:label_data:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody LabelData labelData) {
labelDataService.updateById(labelData);
return Result.OK("编辑成功!");
}
/**
* id
*
* @param id
* @return
*/
@AutoLog(value = "自定义分类-通过id删除")
@ApiOperation(value="自定义分类-通过id删除", notes="自定义分类-通过id删除")
@RequiresPermissions("business:label_data:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
labelDataService.removeById(id);
return Result.OK("删除成功!");
}
/**
*
*
* @param ids
* @return
*/
@AutoLog(value = "自定义分类-批量删除")
@ApiOperation(value="自定义分类-批量删除", notes="自定义分类-批量删除")
@RequiresPermissions("business:label_data:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.labelDataService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* id
*
* @param id
* @return
*/
//@AutoLog(value = "自定义分类-通过id查询")
@ApiOperation(value="自定义分类-通过id查询", notes="自定义分类-通过id查询")
@GetMapping(value = "/queryById")
public Result<LabelData> queryById(@RequestParam(name="id",required=true) String id) {
LabelData labelData = labelDataService.getById(id);
if(labelData==null) {
return Result.error("未找到对应数据");
}
return Result.OK(labelData);
}
/**
* excel
*
* @param request
* @param labelData
*/
@RequiresPermissions("business:label_data:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, LabelData labelData) {
return super.exportXls(request, labelData, LabelData.class, "自定义分类");
}
/**
* excel
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("business:label_data:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, LabelData.class);
}
}

View File

@ -212,9 +212,13 @@ public class PurchaseOrderController {
BeanUtils.copyProperties(purchaseOrderPage, purchaseOrder);
purchaseOrder.setPaymentDocumentString(new String(purchaseOrderPage.getPaymentDocument()));
purchaseOrder.setInventoryDocumentString(new String(purchaseOrderPage.getInventoryDocument()));
Map<String, Responses> responsesMappedByReason = new HashMap<>();
if(purchaseOrderPage.getPlatformOrderId() == null) {
Responses purchaseUpdateResponse = new Responses();
purchaseOrderService.updateById(purchaseOrder);
return Result.OK("sys.api.entryEditSuccess");
purchaseUpdateResponse.addSuccess("updated");
responsesMappedByReason.put("orderUpdate : " + purchaseOrder.getInvoiceNumber(), purchaseUpdateResponse);
return Result.OK("sys.api.entryEditSuccess", responsesMappedByReason);
}
List<String> platformOrderIds = new ArrayList<>(Arrays.asList(purchaseOrderPage.getPlatformOrderId().split(",")));
log.info("Editing purchase order and attributing it to orders : {}", platformOrderIds);
@ -222,7 +226,7 @@ public class PurchaseOrderController {
platformOrderService.removePurchaseInvoiceNumber(purchaseOrder.getInvoiceNumber(), purchaseOrder.getClientId());
List<PlatformOrder> platformOrders = platformOrderService.selectByPlatformOrderIds(platformOrderIds);
log.info("Platform orders found for attribution : {}", platformOrders.stream().map(PlatformOrder::getPlatformOrderId).collect(Collectors.toList()));
Map<String, Responses> responsesMappedByReason = new HashMap<>();
Responses platformOrderIdUpdateResponse = new Responses();
if(!platformOrders.isEmpty()) {
for(PlatformOrder po : platformOrders) {
@ -237,7 +241,7 @@ public class PurchaseOrderController {
platformOrderIdUpdateResponse.getFailures().addAll(platformOrderIds);
}
purchaseOrderService.updateById(purchaseOrder);
responsesMappedByReason.put("Platform Order IDs Update / 平台订单号码更新 : " + purchaseOrder.getInvoiceNumber(), platformOrderIdUpdateResponse);
responsesMappedByReason.put("orderIdUpdate : " + purchaseOrder.getInvoiceNumber(), platformOrderIdUpdateResponse);
return Result.OK("sys.api.entryEditSuccess", responsesMappedByReason);
}

View File

@ -40,6 +40,8 @@ import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
@ -56,6 +58,8 @@ import static org.jeecg.common.util.SqlInjectionUtil.specialFilterContentForDict
@RequestMapping("/sku")
@Slf4j
public class SkuController {
@Autowired
private IShopService shopService;
@Autowired
private ISkuService skuService;
@Autowired
@ -447,9 +451,86 @@ public class SkuController {
@PostMapping("/createMabangSku")
public Result<?> createMabangSku(@RequestBody List<SkuOrderPage> skuList) {
skuList.forEach(sku -> sku.setStatus(3));
log.info("Request to create {} new skus in Mabang", skuList.size());
skuList.forEach(sku -> {
if(sku.getShippingDiscount() == null) {
sku.setShippingDiscount(BigDecimal.ZERO);
} else {
BigDecimal oldValue = sku.getShippingDiscount().divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
sku.setShippingDiscount(BigDecimal.ONE.subtract(oldValue));
}
sku.setStatus(3);
});
return Result.OK(skuListMabangService.publishSkuToMabang(skuList));
}
@RequestMapping(value = "/exportNewMabangSkusXls")
public ModelAndView exportXls(@RequestParam Map<String, String> params) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<NewSkuPage> skuList = parseSkuList(params);
log.info("Exporting new skus to excel ...");
skuList.forEach(sku -> {
if(sku.getShippingDiscount() == null) {
sku.setShippingDiscount(BigDecimal.ONE);
} else {
BigDecimal oldValue = sku.getShippingDiscount().divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
sku.setShippingDiscount(BigDecimal.ONE.subtract(oldValue));
}
sku.setStatus(3);
});
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "新增库存SKU表");
mv.addObject(NormalExcelConstants.CLASS, NewSkuPage.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("新增库存SKU表数据", "导出人:" + sysUser.getRealname(), "新增库存SKU表"));
mv.addObject(NormalExcelConstants.DATA_LIST, skuList);
return mv;
}
private List<NewSkuPage> parseSkuList(Map<String, String> params) {
// Group parameters by "selections[index]"
Map<Integer, Map<String, String>> grouped = new HashMap<>();
for (Map.Entry<String, String> entry : params.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (key.startsWith("selections[")) {
int indexStart = key.indexOf("[") + 1;
int indexEnd = key.indexOf("]");
int index = Integer.parseInt(key.substring(indexStart, indexEnd));
String field = key.substring(key.indexOf("][") + 2, key.length() - 1);
grouped.computeIfAbsent(index, k -> new HashMap<>()).put(field, value);
}
}
// Convert maps to SkuOrderPage objects
return grouped.values().stream()
.map(this::mapToSkuOrderPage)
.collect(Collectors.toList());
}
private NewSkuPage mapToSkuOrderPage(Map<String, String> map) {
NewSkuPage sku = new NewSkuPage();
sku.setMabangSku(map.get("id"));
sku.setZhName(map.get("zhName"));
sku.setEnName(map.get("enName"));
sku.setDeclareEname(map.get("declareEname"));
sku.setDeclareName(map.get("declareName"));
sku.setErpCode(map.get("erpCode"));
sku.setWeight(map.get("weight") != null ? Integer.parseInt(map.get("weight")) : null);
sku.setStatus(map.get("status") != null ? Integer.parseInt(map.get("status")) : 3);
sku.setSensitiveAttribute(map.get("sensitiveAttribute"));
sku.setIsGift(map.get("isGift") != null ? Integer.parseInt(map.get("isGift")) : 2);
sku.setSkuPrice(map.get("skuPrice") != null ? new BigDecimal(map.get("skuPrice")) : BigDecimal.ZERO);
sku.setDeclaredValue(map.get("declaredValue") != null ? new BigDecimal(map.get("declaredValue")) : null);
sku.setShippingDiscount(map.get("shippingDiscount") != null ? new BigDecimal(map.get("shippingDiscount")) : BigDecimal.ZERO);
sku.setServiceFee(map.get("serviceFee") != null ? new BigDecimal(map.get("serviceFee")) : BigDecimal.ZERO);
sku.setWarehouse(map.get("warehouse"));
sku.setSupplier(map.get("supplier"));
sku.setSupplierLink(map.get("supplierLink"));
sku.setImageSource(map.get("imageSource"));
sku.setLabelData(map.get("labelData"));
return sku;
}
@PostMapping("syncSkus")
public Result<?> syncSkus(@RequestBody List<String> erpCodes) {
Map<Sku, String> newSkusNeedTreatmentMap;
@ -496,4 +577,34 @@ public class SkuController {
skuListMabangService.mabangSkuStockUpdate(erpCodes);
return Result.OK();
}
@GetMapping("/unpairedSkus")
public Result<?> unpairedSkus(@RequestParam(name = "shop") String shopCode,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "50") Integer pageSize,
@RequestParam(name = "column", defaultValue = "erp_code") String column,
@RequestParam(name = "order", defaultValue = "ASC") String order
) {
String parsedColumn = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, column.replace("_dictText", ""));
String parsedOrder = order.toUpperCase();
if(!parsedOrder.equals("ASC") && !parsedOrder.equals("DESC")) {
return Result.error(400, "Bad Request");
}
try {
specialFilterContentForDictSql(parsedColumn);
} catch (RuntimeException e) {
return Result.error(400, "Bad Request");
}
String shopId = shopService.getIdByCode(shopCode);
if (shopId == null) return Result.error(404, "Shop not found");
int total = skuListMabangService.countUnpairedSkus(shopId);
List<SkuOrderPage> unpairedSkus = skuListMabangService.unpairedSkus(shopId, pageNo, pageSize, parsedColumn, parsedOrder);
IPage<SkuOrderPage> page = new Page<>();
page.setRecords(unpairedSkus);
page.setCurrent(pageNo);
page.setSize(pageSize);
page.setTotal(total);
return Result.OK(page);
}
}

View File

@ -1,10 +1,19 @@
package org.jeecg.modules.business.controller.admin;
import java.io.IOException;
import java.io.InputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
@ -24,7 +33,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.business.vo.Responses;
import org.jeecg.modules.business.vo.ResponsesWithMsg;
import org.jeecg.modules.business.vo.SkuWeightPage;
import org.jeecg.modules.business.vo.SkuWeightParam;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
@ -32,6 +42,8 @@ import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -61,7 +73,10 @@ public class SkuWeightController extends JeecgController<SkuWeight, ISkuWeightSe
private SkuMongoService skuMongoService;
@Resource
private JeecgBaseConfig jeecgBaseConfig;
private final static Integer NUMBER_OF_SKU_EXCEL_COLUMNS = 3;
private final DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
/**
*
*
@ -153,24 +168,24 @@ public class SkuWeightController extends JeecgController<SkuWeight, ISkuWeightSe
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> selections = new ArrayList<>();
request.getParameterMap().forEach((k,v) -> {
if(k.equals("selections[]")) {
selections.addAll(Arrays.asList(v));
}
});
List<SkuWeight> exportList = skuWeightService.exportToExcel(selections);
List<String> selections = new ArrayList<>();
request.getParameterMap().forEach((k,v) -> {
if(k.equals("selections[]")) {
selections.addAll(Arrays.asList(v));
}
});
List<SkuWeight> exportList = skuWeightService.exportToExcel(selections);
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "SKU重量");
mv.addObject(NormalExcelConstants.CLASS, SkuWeight.class);
ExportParams exportParams=new ExportParams("SKU重量报表", "导出人:" + sysUser.getRealname(), "SKU重量");
exportParams.setImageBasePath(jeecgBaseConfig.getPath().getUpload());
mv.addObject(NormalExcelConstants.PARAMS,exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "SKU重量");
mv.addObject(NormalExcelConstants.CLASS, SkuWeight.class);
ExportParams exportParams=new ExportParams("SKU重量报表", "导出人:" + sysUser.getRealname(), "SKU重量");
exportParams.setImageBasePath(jeecgBaseConfig.getPath().getUpload());
mv.addObject(NormalExcelConstants.PARAMS,exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}
/**
@ -180,10 +195,87 @@ public class SkuWeightController extends JeecgController<SkuWeight, ISkuWeightSe
* @param response
* @return
*/
@RequiresPermissions("business:sku_weight:importExcel")
@Transactional
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, SkuWeight.class);
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) throws IOException {
log.info("Importing Sku weights from Excel...");
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
ResponsesWithMsg responses = new ResponsesWithMsg();
List<SkuWeight> skuWeights = new ArrayList<>();
Map<String, SkuWeight> skuWeightMappedByErpCode = new HashMap<>();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();
try (InputStream inputStream = file.getInputStream()){
Workbook workbook = new XSSFWorkbook(inputStream);
Sheet firstSheet = workbook.getSheetAt(0);
int firstRow = firstSheet.getFirstRowNum();
int lastRow = firstSheet.getLastRowNum();
for (int rowIndex = firstRow + 1; rowIndex <= lastRow; rowIndex++) {
Row row = firstSheet.getRow(rowIndex);
SkuWeight skuWeight = new SkuWeight();
boolean hasError = false;
String erpCode = null;
for (int cellIndex = row.getFirstCellNum(); cellIndex < NUMBER_OF_SKU_EXCEL_COLUMNS; cellIndex++) {
Cell cell = row.getCell(cellIndex, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
String cellValue = cell.getStringCellValue();
if(hasError) continue;
if(cellValue.isEmpty()){
responses.addFailure("Row " + rowIndex + " has empty cell at index " + cellIndex);
hasError = true;
continue;
}
switch (cellIndex) {
case 0:
Sku sku = skuService.getByErpCode(cellValue);
if(sku == null){
responses.addFailure("Row " + rowIndex + " SKU not found : " + cellValue);
hasError = true;
continue;
}
erpCode = cellValue;
skuWeight.setSkuId(sku.getId());
break;
case 1:
skuWeight.setWeight((int) Double.parseDouble(cellValue));
break;
case 2:
Date effectiveDate = formatter.parse(cellValue);
skuWeight.setEffectiveDate(effectiveDate);
break;
}
}
if(hasError) continue;
skuWeights.add(skuWeight);
assert erpCode != null;
skuWeightMappedByErpCode.put(erpCode, skuWeight);
}
log.info("Import weights for skus: {}", skuWeightMappedByErpCode.keySet());
ResponsesWithMsg mabangResponses = skuListMabangService.mabangSkuWeightUpdate(skuWeights);
List<SkuWeight> skuWeightSuccesses = new ArrayList<>();
mabangResponses.getSuccesses().forEach((skuErpCode, messages) -> {
skuWeightSuccesses.add(skuWeightMappedByErpCode.get(skuErpCode));
});
skuWeightSuccesses.forEach(skuWeight -> skuMongoService.upsertSkuWeight(skuWeight));
skuWeightService.saveBatch(skuWeights);
mabangResponses.getSuccesses().forEach(responses::addSuccess);
mabangResponses.getFailures().forEach(responses::addFailure);
} catch (Exception e) {
e.printStackTrace();
String msg = e.getMessage();
log.error(msg, e);
return Result.error("文件导入失败:" + e.getMessage());
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return Result.OK(responses);
}
/**
@ -242,9 +334,11 @@ public class SkuWeightController extends JeecgController<SkuWeight, ISkuWeightSe
skuWeightsMap.put(sku.getErpCode(), skuWeight);
}
List<SkuWeight> skuWeights = new ArrayList<>(skuWeightsMap.values());
Responses responses = skuListMabangService.mabangSkuWeightUpdate(skuWeights);
ResponsesWithMsg responses = skuListMabangService.mabangSkuWeightUpdate(skuWeights);
List<SkuWeight> skuWeightSuccesses = new ArrayList<>();
responses.getSuccesses().forEach(skuErpCode -> skuWeightSuccesses.add(skuWeightsMap.get(skuErpCode)));
responses.getSuccesses().forEach((skuErpCode, messages) -> {
skuWeightSuccesses.add(skuWeightsMap.get(skuErpCode));
});
skuWeightSuccesses.forEach(skuWeight -> skuMongoService.upsertSkuWeight(skuWeight));
skuWeightService.saveBatch(skuWeights);

View File

@ -348,14 +348,17 @@ public class InvoiceController {
InvoiceMetaData metaData;
try {
List<SkuQuantity> skuQuantities = skuService.getSkuQuantitiesFromOrderIds(param.orderIds());
if(skuQuantities.isEmpty()) {
return Result.error("Nothing to invoice.");
}
String purchaseId = purchaseOrderService.addPurchase(skuQuantities ,param.orderIds());
metaData = purchaseOrderService.makeInvoice(purchaseId);
platformOrderService.updatePurchaseInvoiceNumber(param.orderIds(), metaData.getInvoiceCode());
String clientCategory = clientCategoryService.getClientCategoryByClientId(param.clientID());
// if(clientCategory.equals(ClientCategory.CategoryName.CONFIRMED.getName()) || clientCategory.equals(ClientCategory.CategoryName.VIP.getName())) {
// balanceService.updateBalance(param.clientID(), metaData.getCode(), "purchase");
// }
if(clientCategory.equals(ClientCategory.CategoryName.CONFIRMED.getName()) || clientCategory.equals(ClientCategory.CategoryName.VIP.getName())) {
balanceService.updateBalance(param.clientID(), metaData.getInvoiceCode(), "purchase");
}
if(clientCategory.equals(ClientCategory.CategoryName.SELF_SERVICE.getName())) {
String subject = "Self-service purchase invoice";
String destEmail = env.getProperty("spring.mail.username");
@ -554,7 +557,7 @@ public class InvoiceController {
List<PlatformOrderFront> orders = platformOrderService.fetchUninvoicedOrdersByShopForClientFullSQL(shopIdList, Collections.singletonList(1), parsedColumn, parsedOrder, pageNo, pageSize,
productStatuses, shippingAvailable, purchaseAvailable);
int total = orders.get(0).getTotalCount();
int total = !order.isEmpty() ? orders.get(0).getTotalCount() : 0;
IPage<PlatformOrderFront> page = new Page<>();
page.setRecords(orders);

View File

@ -80,6 +80,8 @@ public class ShippingInvoiceController {
@Autowired
private IShippingInvoiceService shippingInvoiceService;
@Autowired
private ISecurityService securityService;
@Autowired
private FreeMarkerConfigurer freemarkerConfigurer;
@Autowired
private EmailService emailService;
@ -284,6 +286,24 @@ public class ShippingInvoiceController {
*/
@GetMapping(value = "/downloadCompleteInvoiceExcel")
public ResponseEntity<?> download(@RequestParam("invoiceNumber") String invoiceNumber, @RequestParam("filetype") String filetype) throws IOException, UserException {
boolean isEmployee = securityService.checkIsEmployee();
Client client;
if (!isEmployee) {
client = clientService.getCurrentClient();
if (client == null) {
log.error("Couldn't find the client for the invoice number : {}", invoiceNumber);
return ResponseEntity.status(HttpStatus.NOT_FOUND)
.contentType(MediaType.TEXT_PLAIN)
.body("");
}
Client invoiceClient = clientService.getClientFromInvoice(invoiceNumber);
if (invoiceClient == null || !invoiceClient.getId().equals(client.getId())) {
log.error("Client {} is trying to download invoice {} which doesn't belong to him.", client.getInternalCode(), invoiceNumber);
return ResponseEntity.status(HttpStatus.FORBIDDEN)
.contentType(MediaType.TEXT_PLAIN)
.body("You are not allowed to download this invoice.");
}
}
String filename = platformOrderShippingInvoiceService.getInvoiceList(invoiceNumber, filetype);
if(!filename.equals("ERROR")) {
File file = new File(filename);

View File

@ -0,0 +1,15 @@
package org.jeecg.modules.business.domain.api.mabang.doSearchSkuListNew;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
// 仓库信息,接口参数传showWarehouse才返回
public class Label {
/**自定义分类ID*/
@JSONField(name = "id")
private long id;
/**自定义分类名称**/
@JSONField(name = "name")
private String name;
}

View File

@ -40,6 +40,11 @@ public class SkuData {
private Integer status;
@JSONField(name="originalSku")
private String originalSku;
/**
* if multiple virtual skus, they need to be separated by ";"
*/
@JSONField(name="virtualSkus")
private String virtualSkus;
@JSONField(name="salePrice")
private BigDecimal salePrice;
@JSONField(name="declareValue")
@ -54,7 +59,12 @@ public class SkuData {
private BigDecimal purchasePrice;
/**默认供应商名称,接口参数传showProvider才返回*/
@JSONField(name="warehouse")
private String warehouse;
private Warehouse[] warehouse;
/** 自定义分类,接口参数传showLabel才返回*/
@JSONField(name="label")
private Label[] label;
@JSONField(name="warehouseName")
private String warehouseName;
/**
* if stockPicture is empty, we use it
*/
@ -81,6 +91,11 @@ public class SkuData {
*/
@JSONField(name="saleRemark")
private String saleRemark;
/**
* json
*/
@JSONField(name="labelData")
private Label[] labelData;
/**
* :1;2
*/
@ -109,7 +124,7 @@ public class SkuData {
/**
* 1: 22
*/
@JSONField(name="is_flammable")
@JSONField(name="is_flammables")
private Integer isFlammable;
/**
* 1 22

View File

@ -31,7 +31,7 @@ public class SkuListRawStream implements NetworkDataStream<SkuListResponse> {
public SkuListResponse attempt() {
log.info("Begin the first request");
this.currentResponse = new SkuListRequest(toSend).send();
if (currentResponse.getData().isEmpty()) {
if (currentResponse.getData() == null || currentResponse.getData().isEmpty()) {
return null;
}
began = true;

View File

@ -48,8 +48,8 @@ public class SkuListRequestBody implements RequestBody {
putNonNull(json, "maxRows", maxRows);
putNonNull(json, "showVirtualSku", showVirtualSku);
putNonNull(json, "showProvider", showProvider);
putNonNull(json, "showWarehouse", showWarehouse);
putNonNull(json, "showLabel", showLabel);
putNonNull(json, "showWarehouse", String.valueOf(showWarehouse));
putNonNull(json, "showLabel", String.valueOf(showLabel));
putNonNull(json, "showAttributes", showAttributes);
return json;
}

View File

@ -0,0 +1,43 @@
package org.jeecg.modules.business.domain.api.mabang.doSearchSkuListNew;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
// 仓库信息,接口参数传showWarehouse才返回
public class Warehouse {
/**仓库编号*/
@JSONField(name = "warehouseId")
private long warehouseId;
/**仓位**/
@JSONField(name = "gridCode")
private String gridCode;
/**库存警戒天数*/
@JSONField(name = "stockWarningDays")
private int stockWarningDays;
/**商品预警天数*/
@JSONField(name="product_warning_days")
private int productWarningDays;
/**仓库名称*/
@JSONField(name = "warehouseName")
private String warehouseName;
/**仓库状态:1启用;2停用*/
@JSONField(name = "status")
private int status;
/**仓库成本价*/
@JSONField(name = "stockCost")
private String stockCost;
/**是否是默认仓库1是;2否*/
@JSONField(name = "isDefault")
private int isDefault;
/**警戒库存*/
@JSONField(name = "stockWarningQuantity")
private int stockWarningQuantity;
/**采购天数*/
@JSONField(name = "purchaseDays")
private int purchaseDays;
@JSONField(name = "minPurchaseQuantity")
private int minPurchaseQuantity;
@JSONField(name = "maxPurchaseQuantity")
private int maxPurchaseQuantity;
}

View File

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
import lombok.Setter;
import org.jeecg.modules.business.domain.api.mabang.RequestBody;
import org.jeecg.modules.business.domain.api.mabang.doSearchSkuListNew.Label;
import org.jeecg.modules.business.domain.api.mabang.doSearchSkuListNew.SkuData;
import java.math.BigDecimal;
@ -24,6 +25,7 @@ public class SkuAddRequestBody implements RequestBody {
private String declareEname;
private String warehouse;
private String remark;
private Label[] labelData;
private Integer hasBattery;
private Integer magnetic;
private Integer powder;
@ -34,6 +36,7 @@ public class SkuAddRequestBody implements RequestBody {
private Integer isGift;
private String supplier;
private String supplierLink;
private String picture;
@Override
public String api() {
@ -51,6 +54,15 @@ public class SkuAddRequestBody implements RequestBody {
putNonNull(json, "declareValue", declareValue);
putNonNull(json, "declareName", declareName);
putNonNull(json, "declareEname", declareEname);
if(labelData != null) {
JSONArray labelDataArray = new JSONArray();
for(Label label : labelData) {
JSONObject labelJson = new JSONObject();
labelJson.put("name", label.getName());
labelDataArray.add(labelJson);
}
json.put("labelData", labelDataArray.toJSONString());
}
JSONArray warehouseData = new JSONArray();
JSONObject warehouse = new JSONObject();
warehouse.put("name", this.warehouse);
@ -74,6 +86,7 @@ public class SkuAddRequestBody implements RequestBody {
supplier.put("flag", 1);
supplierData.add(supplier);
json.put("suppliersData", supplierData.toJSONString());
putNonNull(json, "picture", picture);
return json;
}
@ -85,8 +98,9 @@ public class SkuAddRequestBody implements RequestBody {
this.declareValue = data.getDeclareValue();
this.declareName = data.getDeclareNameZh();
this.declareEname = data.getDeclareNameEn();
this.warehouse = data.getWarehouse();
this.warehouse = data.getWarehouseName();
this.remark = data.getSaleRemark();
this.labelData = data.getLabelData();
this.hasBattery = data.getHasBattery();
this.magnetic = data.getMagnetic();
this.powder = data.getPowder();
@ -97,6 +111,7 @@ public class SkuAddRequestBody implements RequestBody {
this.isGift = data.getIsGift();
this.supplier = data.getSupplier();
this.supplierLink = data.getSupplierLink();
this.picture = data.getSalePicture();
}
private <E> void putNonNull(JSONObject json, String key, E value) {

View File

@ -20,12 +20,21 @@ public class SkuAddResponse extends Response {
private final String stockSku;
private String message;
public SkuAddResponse(Code code, JSONObject data, String stockId, String stockSku) {
super(code);
this.data = data;
this.stockId = stockId;
this.stockSku = stockSku;
}
public SkuAddResponse(Code code, JSONObject data, String stockId, String stockSku, String message) {
super(code);
this.data = data;
this.stockId = stockId;
this.stockSku = stockSku;
this.message = message;
}
/**
* Make an instance by parsing json, it only checks validity of code.

View File

@ -13,20 +13,36 @@ public class CreateFulfillmentRequest extends ShopifyRequest {
private final static String OTHER = "Other";
private enum TransportCompany {
GIULIA_SCHIAPARELLI("https://giuliaschiaparelli.com/apps/parcelpanel?nums=%s","Giulia Schiaparelli","^(?![69][A-Z][0-9]{11}$)(?!LP[0-9]{9}FR$).+$"),
LA_POSTE("https://www.laposte.fr/outils/suivre-vos-envois?code=%s", "La Poste", "[69][A-Z]{1}[0-9]{11}|LP[0-9]{9}FR"),
// 12 [0-9]
/*CJ_LOGISTICS("https://www.cjlogistics.com/ko/tool/parcel/tracking", "CJ대한통운", "57575[0-9]{7}|58476[0-9]{7}|5901[0-9]{8}|57476[0-9]{7}"),
// 14 [0-9]
DPD_BE("https://www.dpdgroup.com/be/mydpd/my-parcels/track?parcelNumber=%s", "DPD", "06086316[0-9]{6}"),
DPD_DE("https://www.dpd.com/de/de/", "DPD", "0150534[0-9]{7}"),
DPD_AT("https://www.mydpd.at", "DPD", "06215167[0-9]{6}"),
GLS_NL_2("https://www.gls-info.nl/tracking", "GLS", "(1437|1000)[0-9]{10}"),
DPD_CH("https://www.dpdgroup.com/ch/mydpd/my-parcels/incoming?parcelNumber=%s", "DPD", "06086328[0-9]{6}"),
CANADA_POST("https://www.canadapost-postescanada.ca/track-reperage/en#/search?searchFor=%s", "Canada Post", "(201255|732131|102303)[0-9]{10}"),
SWISS_POST("https://service.post.ch/ekp-web/ui/entry/search/%s", "Swiss Post", "[0-9]{18}|LW[0-9]{9}CH"),
// 16 [0-9]
CANADA_POST("https://www.canadapost-postescanada.ca/track-reperage/en#/search?searchFor=%s", "Canada Post", "(201255|732131|102303|400864|102977)[0-9]{10}"),
// 18 [0-9]
QUICKPAC("https://quickpac.ch/de/tracking", "Quickpac", "44001091[0-9]{10}"),
ECO_SCOOTING("https://www.ecoscooting.com/tracking/%s", "EcoScooting", "[0-9]{5}00000[0-9]{8}"),
// 19 [0-9]
EARLY_BIRD("https://earlybird.se/", "Early Bird", "[0-9]{19}"),
// 21 [0-9]
DAO("https://www.dao.as/privat/find-din-pakke?stregkode=%s", "DAO", "00057151270[0-9]{10}"),
// 20 [0-9]
DHL_PACKET("https://www.dhl.de/en/privatkunden/pakete-empfangen/verfolgen.html?piececode=%s", "DHL Packet", "0034[0-9]{16}"),
GLS_NL("https://www.gls-info.nl/tracking", "GLS", "[0-9]{20}"),
GLS_NL_2("https://www.gls-info.nl/tracking", "GLS", "(1437|1000)[0-9]{10}"),
USPS("https://tools.usps.com/go/TrackConfirmAction?tRef=fullpage&tLc=2&text28777=&tLabels=%s&tABt=false", "USPS", "926[0-9]{23}|420[0-9]{5}926[0-9]{23}"),
// 22 [0-9]
CTT_EXPRESS("https://www.cttexpress.com/localizador-de-envios/", "CTT Express", "0082800082909[0-9]{9}"),
// 24 [0-9]
AUSTRIAN_POST("https://www.post.at/s/sendungsdetails?snr=%s", "Austrian Post", "15828030053[0-9]{13}"),
// 26/35 [0-9]
USPS("https://tools.usps.com/go/TrackConfirmAction?tRef=fullpage&tLc=2&text28777=&tLabels=%s&tABt=false", "USPS", "926[0-9]{23}|420[0-9]{5}926[0-9]{23}"),
LA_POSTE("https://www.laposte.fr/outils/suivre-vos-envois?code=%s", "La Poste", "[69][A-Z]{1}[0-9]{11}|LP[0-9]{9}FR"),
SWISS_POST("https://service.post.ch/ekp-web/ui/entry/search/%s", "Swiss Post", "[0-9]{18}|LW[0-9]{9}CH"),
DHL_PACKET_WIA("https://www.dhl.de/en/privatkunden/pakete-empfangen/verfolgen.html?piececode=%s", "DHL Packet", "CD[0-9]{9}DE"),
DHL_PARCEL_WIA_NL("https://my.dhlparcel.nl/home/tracktrace/%s/%s?lang=nl_NL", "DHL Parcel", "3S[A-Z]{4}[0-9]{9}"),
DHL_PARCEL_NL("https://my.dhlecommerce.nl/home/tracktrace/%s/%s?lang=nl_NL", "DHL Parcel", "JVGL[0-9]{20}"),
@ -43,14 +59,12 @@ public class CreateFulfillmentRequest extends ShopifyRequest {
EVRI("https://www.evri.com/track/parcel/%s/details", "Evri", "H[0-9A-Z]{5}[0-9]{10}"),
YODEL("https://www.yodel.co.uk/tracking/%s/%s", "Yodel", "JD[0-9]{16}"),
UK_ROYAL_MAIL("https://www.royalmail.com/track-your-item#/tracking-results/%s", "Royal Mail", "(FJ002|WB788)[0-9]{6}GB"),
POST_NL("https://postnl.post/", "PostNL International Mail", "LS[0-9]{9}NL"),
POST_NL("https://postnl.post/", "PostNL International Mail", "L(S|R)[0-9]{9}NL"),
COLI_COLI("https://www.colicoli.fr/trackings?id=%s", "Coli Coli", "CC[0-9]{14}[A-Z]*"),
LUXEMBOURG_POST("https://www.post.lu/particuliers/colis-courrier/track-and-trace#/search", "Luxembourg Post", "LL[0-9]{9}LU"),
CJ_LOGISTICS("https://www.cjlogistics.com/ko/tool/parcel/tracking", "CJ대한통운", "57575[0-9]{7}|58476[0-9]{7}|5901[0-9]{8}|57476[0-9]{7}"),
QUICKPAC("https://quickpac.ch/de/tracking", "Quickpac", "44001091[0-9]{10}"),
CTT_EXPRESS("https://www.cttexpress.com/localizador-de-envios/", "CTT Express", "0082800082909[0-9]{9}"),
PDN_Express("https://pdn.express/nl/track/%s", "PDN Express", "PDN0003[0-9]{6}"),
UNI_EXPRESS("https://www.uniuni.com/tracking/#tracking-detail?no=%s", "Uni Express", "GV24CA[0-9A-Z]{12}"),
UPS("https://www.uniuni.com/tracking/#tracking-detail?no=%s", "UPS", "1Z88[0-9A-Z]{14}"),*/
;
private final String trackingUrl;

View File

@ -24,7 +24,7 @@ import java.util.Map;
*/
@Slf4j
public abstract class Request {
private final static String BASE_URL = "http://xmsmdz.xyldiy.com:8012/api";
private final static String BASE_URL = "http://43.192.16.96:8012/api";
private static final HttpMethod METHOD = HttpMethod.POST;
private static final String KEY = "BpQWy6AtvKcixjePQ4ZMuvBqUyIsXWWX";
private static final String SHOP_CODE = "8ee5c82004c44049b9f22a0ed8dc4db3";

View File

@ -41,13 +41,13 @@ public class AddPortraitTubeJob implements Job {
private static final String TUBE_NEW_40_SKU_SINGLE = "PJ349400032-JCH";
private static final String TUBE_NEW_40_SKU_MULTIPLE = "PJ349400045-JCH";
// private static final String TUBE_NEW_50_SKU_SINGLE = "PJ349500032-JCH";
private static final String TUBE_NEW_50_SKU_SINGLE = "PJ349500032-JCH";
private static final String TUBE_NEW_50_SKU_MULTIPLE = "PJ349500045-JCH";
private static final String TUBE_NEW_60_SKU_SINGLE = "PJ349600032-JCH";
private static final String TUBE_NEW_60_SKU_MULTIPLE = "PJ349600045-JCH";
private static final List<String> TUBE_SKUS = Arrays.asList(TUBE_30_SKU_SINGLE_DOUBLE, TUBE_50_SKU_SINGLE,
TUBE_NEW_40_SKU_MULTIPLE, TUBE_NEW_50_SKU_MULTIPLE, TUBE_NEW_60_SKU_SINGLE,
TUBE_NEW_40_SKU_MULTIPLE, TUBE_NEW_50_SKU_MULTIPLE, TUBE_NEW_60_SKU_SINGLE, TUBE_NEW_50_SKU_SINGLE,
TUBE_NEW_60_SKU_MULTIPLE, TUBE_NEW_40_SKU_SINGLE);
private static final String PREFIX_50_CANVAS = "JJ2501";
private static final String PREFIX_50_CANVAS_CHROME = "JJ2001";
@ -306,7 +306,7 @@ public class AddPortraitTubeJob implements Job {
}
if (tube50SingleCount > 0) {
adequateTubes.add(Pair.of(TUBE_50_SKU_SINGLE, tube50SingleCount));
adequateTubes.add(Pair.of(TUBE_NEW_50_SKU_SINGLE, tube50SingleCount));
}
if (tubeNew60MultipleCount > 0) {
adequateTubes.add(Pair.of(TUBE_NEW_60_SKU_MULTIPLE, tubeNew60MultipleCount));

View File

@ -4,19 +4,23 @@ import lombok.extern.slf4j.Slf4j;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import org.jeecg.modules.business.domain.api.mabang.doSearchSkuListNew.*;
import org.jeecg.modules.business.service.ISkuListMabangService;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Component
public class MabangUnpairedSkuJob implements Job {
@Autowired
private ISkuListMabangService skuListMabangService;
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
JobDataMap jobDataMap = context.getMergedJobDataMap();
@ -40,11 +44,7 @@ public class MabangUnpairedSkuJob implements Job {
return;
}
SkuListRequestBody body = new SkuListRequestBody();
body.setStockSkuList(String.join(",", skuList));
SkuListRawStream rawStream = new SkuListRawStream(body);
UnpairedSkuListStream stream = new UnpairedSkuListStream(rawStream);
List<SkuData> skusFromMabang = stream.all();
List<SkuData> skuDatas = skuListMabangService.fetchUnpairedSkus(skuList);
// System.out.println("skus from mabang : " + skusFromMabang);
}
}

View File

@ -1,24 +1,59 @@
package org.jeecg.modules.business.domain.job;
import lombok.extern.slf4j.Slf4j;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import org.jeecg.modules.business.entity.Sku;
import org.jeecg.modules.business.service.ISkuService;
import org.jeecg.modules.business.service.MigrationService;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Component
public class MongoMigrationJob implements Job {
@Autowired
private MigrationService migrationService;
@Autowired
private ISkuService skuService;
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
log.info("MongoMigrationJob start ..");
migrationService.migrateSkuData();
List<String> skuList = new ArrayList<>();
JobDataMap jobDataMap = context.getMergedJobDataMap();
String parameter = ((String) jobDataMap.get("parameter"));
if (parameter != null) {
try {
JSONObject jsonObject = new JSONObject(parameter);
if(!jsonObject.isNull("skus")) {
for (int i = 0; i < jsonObject.getJSONArray("skus").length(); i++) {
skuList.add(jsonObject.getJSONArray("skus").getString(i));
}
}
} catch (JSONException e) {
log.error("Error while parsing parameter as JSON, falling back to default parameters.");
}
}
if(skuList.isEmpty()) {
log.info("Migrating all skus ..");
migrationService.migrateSkuData();
}
else {
log.info("Migrating skus: {}", skuList);
for(String erpCode : skuList) {
Sku sku = skuService.getByErpCode(erpCode);
migrationService.migrateOneSku(sku);
}
}
log.info("MongoMigrationJob end ..");
}
}

View File

@ -61,7 +61,7 @@ public class ShopifySyncJob implements Job {
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
List<PlatformOrderShopSync> ordersReadyForShopifySync = platformOrderService.fetchOrderInShopsReadyForShopifySync(shops);
Map<String, PlatformOrderShopSync> syncMap = ordersReadyForShopifySync.stream()
.collect(toMap(PlatformOrderShopSync::getPlatformOrderId, Function.identity()));
.collect(toMap(sync -> sync.getPlatformOrderId().split("_")[0], Function.identity()));
List<FulfillmentOrder> fulfillmentOrders = new ArrayList<>();

View File

@ -0,0 +1,55 @@
package org.jeecg.modules.business.entity;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2025-02-06
* @Version: V1.0
*/
@Data
@TableName("label_data")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="label_data对象", description="自定义分类")
public class LabelData implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**自定义分类名称*/
@Excel(name = "自定义分类名称", width = 15)
@ApiModelProperty(value = "自定义分类名称")
private java.lang.String name;
}

View File

@ -0,0 +1,19 @@
package org.jeecg.modules.business.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.business.entity.LabelData;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2025-02-06
* @Version: V1.0
*/
@Repository
public interface LabelDataMapper extends BaseMapper<LabelData> {
}

View File

@ -19,4 +19,8 @@ public interface SensitiveAttributeMapper extends BaseMapper<SensitiveAttribute>
String getHighestPriorityAttributeId(@Param("orderId") String orderId);
List<SensitiveAttribute> listIdAndPriority();
String getNameByAttributes(@Param("attribute") SensitiveAttribute sensitiveAttribute);
SensitiveAttribute getByZhName(@Param("zhName") String zhName);
}

View File

@ -80,4 +80,8 @@ public interface SkuMapper extends BaseMapper<Sku> {
List<Sku> listImgUrls();
List<String> fetchAllClientSkuCodes(@Param("clientCode") String clientCode);
List<String> fetchUnpairedSkus(@Param("shopId") String shopId, @Param("offset") Integer offset, @Param("size") Integer pageSize, @Param("column") String column, @Param("order") String order);
int countUnpairedSkus(@Param("shopId") String shopId);
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.business.entity.SkuWeight;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.business.vo.SkuWeightPage;
import org.springframework.stereotype.Repository;
/**
@ -20,4 +21,9 @@ public interface SkuWeightMapper extends BaseMapper<SkuWeight> {
String searchFirstEmptyWeightSku(@Param("skuIds") List<String> skuIds);
List<SkuWeight> exportToExcel(@Param("skuIds") List<String> skuIds);
List<SkuWeightPage> listLatestWeights();
List<SkuWeightPage> listLatestWeightForSkus(@Param("skuIds") List<String> skuIds);
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.business.mapper.LabelDataMapper">
</mapper>

View File

@ -25,8 +25,24 @@
WHERE po.id = #{orderId}
ORDER BY sa.priority DESC LIMIT 1;
</select>
<select id="listIdAndPriority" resultType="org.jeecg.modules.business.entity.SensitiveAttribute">
SELECT id, priority, zh_name
FROM wia_app.sensitive_attribute
</select>
<select id="listIdAndPriority" resultType="org.jeecg.modules.business.entity.SensitiveAttribute">
SELECT id, priority, zh_name
FROM wia_app.sensitive_attribute
</select>
<select id="getNameByAttributes" resultType="java.lang.String">
SELECT zh_name
FROM sensitive_attribute sa
WHERE sa.is_paste = #{attribute.isPaste}
AND sa.is_knife = #{attribute.isKnife}
AND sa.is_flammable = #{attribute.isFlammable}
AND sa.powder = #{attribute.powder}
AND sa.has_battery = #{attribute.hasBattery}
AND sa.magnetic = #{attribute.magnetic}
AND sa.no_liquid_cosmetic = #{attribute.noLiquidCosmetic}
</select>
<select id="getByZhName" resultType="org.jeecg.modules.business.entity.SensitiveAttribute">
SELECT *
FROM sensitive_attribute sa
WHERE sa.zh_name = #{zhName};
</select>
</mapper>

View File

@ -790,4 +790,30 @@
JOIN client c ON client_sku.client_id = c.id
WHERE c.internal_code = #{clientCode};
</select>
<select id="fetchUnpairedSkus" resultType="java.lang.String">
SELECT poc.sku_id as erp_code
FROM platform_order po
JOIN shop s ON po.shop_id = s.id
JOIN platform_order_content poc ON po.id = poc.platform_order_id
LEFT JOIN sku ON poc.sku_id = sku.id
WHERE sku.id IS NULL
AND po.erp_status IN (1, 2)
AND poc.erp_status &lt;&gt; 5
AND s.id = #{shopId}
GROUP BY poc.sku_id
ORDER BY ${column} ${order}
LIMIT #{offset}, #{size};
</select>
<select id="countUnpairedSkus" resultType="java.lang.Integer">
SELECT COUNT(DISTINCT poc.sku_id)
FROM platform_order_content poc
JOIN platform_order po ON poc.platform_order_id = po.id
JOIN shop s ON po.shop_id = s.id
LEFT JOIN sku ON poc.sku_id = sku.id
WHERE sku.id IS NULL
AND po.erp_status IN (1, 2)
AND poc.erp_status &lt;&gt; 5
AND s.id = #{shopId};
</select>
</mapper>

View File

@ -24,6 +24,45 @@
)
LIMIT 1;
</select>
<select id="listLatestWeights" resultType="org.jeecg.modules.business.vo.SkuWeightPage">
WITH latestSkuWeights AS (
SELECT
sku_id,
weight,
effective_date,
ROW_NUMBER() OVER (PARTITION BY sku_id ORDER BY effective_date DESC) AS rn
FROM sku_weight
)
SELECT s.erp_code,
lsw.effective_date,
lsw.weight
FROM sku s
LEFT JOIN latestSkuWeights lsw ON s.id = lsw.sku_id AND lsw.rn = 1
WHERE s.status = 3
ORDER BY erp_code;
</select>
<select id="listLatestWeightForSkus" resultType="org.jeecg.modules.business.vo.SkuWeightPage">
WITH latestSkuWeights AS (
SELECT
sku_id,
weight,
effective_date,
ROW_NUMBER() OVER (PARTITION BY sku_id ORDER BY effective_date DESC) AS rn
FROM sku_weight
)
SELECT s.erp_code,
lsw.effective_date,
lsw.weight
FROM sku s
LEFT JOIN latestSkuWeights lsw ON s.id = lsw.sku_id AND lsw.rn = 1
WHERE s.status = 3
AND sku_id IN
<foreach collection="skuIds" item="skuId" open="(" separator="," close=")">
#{skuId}
</foreach>
ORDER BY erp_code;
</select>
<select id="exportToExcel" resultType="org.jeecg.modules.business.entity.SkuWeight">
WITH latestSkuWeights AS (
SELECT

View File

@ -17,6 +17,7 @@ import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.*;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@ -125,6 +126,15 @@ public class SkuMongoServiceImpl implements SkuMongoService {
@Override
public void upsertSkuWeight(SkuWeight skuWeight) {
SkuDocument skuDocument = findBySkuId(skuWeight.getSkuId());
Date latestWeightInDB = Optional.ofNullable(skuDocument.getLatestSkuWeight())
.map(SkuDocument.LatestSkuWeight::getEffectiveDate)
.orElse(null);
if(latestWeightInDB != null && latestWeightInDB.toInstant().isAfter(skuWeight.getEffectiveDate().toInstant())) {
log.error("SKU {} weight was not updated in Mongo document, as the effective date {} is older than the one in the database {}",
skuDocument.getErpCode(), skuWeight.getEffectiveDate(), skuDocument.getLatestSkuWeight().getEffectiveDate());
return;
}
Query query = new Query(Criteria.where("skuId").is(skuWeight.getSkuId()));
SkuDocument.LatestSkuWeight latestSkuWeight = SkuDocument.LatestSkuWeight.builder()
.weight(skuWeight.getWeight())

View File

@ -0,0 +1,14 @@
package org.jeecg.modules.business.service;
import org.jeecg.modules.business.entity.LabelData;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2025-02-06
* @Version: V1.0
*/
public interface ILabelDataService extends IService<LabelData> {
}

View File

@ -17,4 +17,8 @@ public interface ISensitiveAttributeService extends IService<SensitiveAttribute>
String getHighestPriorityAttributeId(String orderId);
List<SensitiveAttribute> listIdAndPriority();
String getNameByAttributes(SensitiveAttribute sensitiveAttribute);
SensitiveAttribute getByZhName(String zhName);
}

View File

@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.business.domain.api.mabang.doSearchSkuListNew.SkuData;
import org.jeecg.modules.business.entity.Sku;
import org.jeecg.modules.business.entity.SkuWeight;
import org.jeecg.modules.business.vo.Responses;
import org.jeecg.modules.business.vo.ResponsesWithMsg;
import org.jeecg.modules.business.vo.SkuOrderPage;
import java.util.List;
@ -33,12 +33,18 @@ public interface ISkuListMabangService extends IService<SkuData> {
List<String> parseSkuListToProductCodeList(List<SkuData> erpCodeList) throws Exception;
Map<Sku, String> createSkus(List<SkuData> skuDataList);
Responses publishSkuToMabang(List<SkuOrderPage> skuList);
ResponsesWithMsg publishSkuToMabang(List<SkuOrderPage> skuList);
Map<Sku, String> skuSyncUpsert(List<String> erpCodes);
void updateSkuId();
void mabangSkuStockUpdate(List<String> erpCodes);
Responses mabangSkuWeightUpdate(List<SkuWeight> skuWeights);
ResponsesWithMsg mabangSkuWeightUpdate(List<SkuWeight> skuWeights);
List<SkuData> fetchUnpairedSkus(List<String> stockSkuList);
List<SkuOrderPage> unpairedSkus(String shopId, Integer pageNo, Integer pageSize, String column, String order);
int countUnpairedSkus(String shopId);
}

View File

@ -124,4 +124,8 @@ public interface ISkuService extends IService<Sku> {
List<Sku> listImgUrls();
List<String> fetchAllClientSkuCodes(String clientCode);
List<String> fetchUnpairedSkus(String shopId, int offset, Integer pageSize, String column, String order);
int countUnpairedSkus(String shopId);
}

View File

@ -2,6 +2,7 @@ package org.jeecg.modules.business.service;
import org.jeecg.modules.business.entity.SkuWeight;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.business.vo.SkuWeightPage;
import java.util.List;
@ -17,4 +18,11 @@ public interface ISkuWeightService extends IService<SkuWeight> {
String searchFirstEmptyWeightSku(List<String> skuIds);
List<SkuWeight> exportToExcel(List<String> skuIds);
/**
* used to export all latest weights for front, so instead of fetching skuId, we fetch erpCode
* @return
*/
List<SkuWeightPage> listLatestWeights();
List<SkuWeightPage> listLatestWeightForSkus(List<String> skuIds);
}

View File

@ -0,0 +1,19 @@
package org.jeecg.modules.business.service.impl;
import org.jeecg.modules.business.entity.LabelData;
import org.jeecg.modules.business.mapper.LabelDataMapper;
import org.jeecg.modules.business.service.ILabelDataService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2025-02-06
* @Version: V1.0
*/
@Service
public class LabelDataServiceImpl extends ServiceImpl<LabelDataMapper, LabelData> implements ILabelDataService {
}

View File

@ -35,4 +35,14 @@ public class SensitiveAttributeServiceImpl extends ServiceImpl<SensitiveAttribut
public List<SensitiveAttribute> listIdAndPriority() {
return sensitiveAttributeMapper.listIdAndPriority();
}
@Override
public String getNameByAttributes(SensitiveAttribute sensitiveAttribute) {
return sensitiveAttributeMapper.getNameByAttributes(sensitiveAttribute);
}
@Override
public SensitiveAttribute getByZhName(String zhName) {
return sensitiveAttributeMapper.getByZhName(zhName);
}
}

View File

@ -22,7 +22,7 @@ import org.jeecg.modules.business.entity.*;
import org.jeecg.modules.business.mapper.SkuListMabangMapper;
import org.jeecg.modules.business.mongoService.SkuMongoService;
import org.jeecg.modules.business.service.*;
import org.jeecg.modules.business.vo.Responses;
import org.jeecg.modules.business.vo.ResponsesWithMsg;
import org.jeecg.modules.business.vo.SkuOrderPage;
import org.jeecg.modules.online.cgform.mapper.OnlCgformFieldMapper;
import org.springframework.beans.factory.annotation.Autowired;
@ -466,7 +466,8 @@ public class SkuListMabangServiceImpl extends ServiceImpl<SkuListMabangMapper, S
}
return remark;
}
public Responses publishSkuToMabang(List<SkuOrderPage> skuList) {
public ResponsesWithMsg publishSkuToMabang(List<SkuOrderPage> skuList) {
ResponsesWithMsg responses = new ResponsesWithMsg();
List<SkuData> skuDataList = skuList.stream()
.map(this::SkuOrderPageToSkuData)
.collect(toList());
@ -483,24 +484,20 @@ public class SkuListMabangServiceImpl extends ServiceImpl<SkuListMabangMapper, S
return request.send();
} catch (Exception e) {
log.error("Error publishing sku {} to mabang : {}", requestBody.getStockSku(), e.getMessage());
return new SkuAddResponse(Response.Code.ERROR, null, null, requestBody.getStockSku());
return new SkuAddResponse(Response.Code.ERROR, null, null, requestBody.getStockSku(), e.getMessage());
}
}, executor))
.collect(toList());
List<SkuAddResponse> results = futures.stream().map(CompletableFuture::join).collect(toList());
long successCount = results.stream().filter(SkuAddResponse::success).count();
log.info("{}/{} skus published successfully.", successCount, skuDataList.size());
List<String> successes = results.stream()
.filter(SkuAddResponse::success)
.map(SkuAddResponse::getStockSku)
.collect(toList());
List<String> failures = results.stream()
.filter(response -> !response.success())
.map(SkuAddResponse::getStockSku)
.collect(toList());
Responses responses = new Responses();
responses.setSuccesses(successes);
responses.setFailures(failures);
results.forEach(response -> {
if(response.success()) {
responses.addSuccess(response.getStockSku());
} else {
responses.addFailure(response.getStockSku(), response.getMessage());
}
});
return responses;
}
@ -544,7 +541,12 @@ public class SkuListMabangServiceImpl extends ServiceImpl<SkuListMabangMapper, S
public SkuData SkuOrderPageToSkuData(SkuOrderPage skuOrderPage) {
SensitiveAttribute sensitiveAttribute = sensitiveAttributeService.getById(skuOrderPage.getSensitiveAttribute());
if(sensitiveAttribute == null) {
sensitiveAttribute = sensitiveAttributeService.getByZhName(skuOrderPage.getSensitiveAttribute());
}
SkuData skuData = new SkuData();
if(skuOrderPage.getId() != null)
skuData.setVirtualSkus(skuOrderPage.getId());
skuData.setErpCode(skuOrderPage.getErpCode());
skuData.setNameCN(skuOrderPage.getZhName());
skuData.setNameEN(skuOrderPage.getEnName());
@ -552,7 +554,14 @@ public class SkuListMabangServiceImpl extends ServiceImpl<SkuListMabangMapper, S
skuData.setDeclareNameEn(skuOrderPage.getDeclareEname());
skuData.setSalePrice(skuOrderPage.getSkuPrice());
skuData.setDeclareValue(skuOrderPage.getDeclaredValue());
skuData.setWarehouse(DEFAULT_WAREHOUSE_NAME);
skuData.setWarehouseName(DEFAULT_WAREHOUSE_NAME);
List<Label> labels = new ArrayList<>();
for(String labelName : skuOrderPage.getLabelData().split(",")) {
Label label = new Label();
label.setName(labelName);
labels.add(label);
}
skuData.setLabelData(labels.toArray(new Label[0]));
if(skuOrderPage.getWeight() != null)
skuData.setSaleRemark(skuOrderPage.getWeight().toString());
skuData.setHasBattery(sensitiveAttribute.getHasBattery());
@ -565,9 +574,44 @@ public class SkuListMabangServiceImpl extends ServiceImpl<SkuListMabangMapper, S
skuData.setIsGift(skuOrderPage.getIsGift());
skuData.setSupplier(skuOrderPage.getSupplier());
skuData.setSupplierLink(skuOrderPage.getSupplierLink());
skuData.setSalePicture(skuOrderPage.getImageSource());
return skuData;
}
public SkuOrderPage SkuDataToSkuOrderPage(SkuData skuData) {
SkuOrderPage sop = new SkuOrderPage();
SensitiveAttribute sensitiveAttribute = new SensitiveAttribute();
sensitiveAttribute.setHasBattery(skuData.getHasBattery());
sensitiveAttribute.setPowder(skuData.getPowder());
sensitiveAttribute.setIsFlammable(skuData.getIsFlammable());
sensitiveAttribute.setIsKnife(skuData.getIsKnife());
sensitiveAttribute.setIsPaste(skuData.getIsPaste());
sensitiveAttribute.setMagnetic(skuData.getMagnetic());
sensitiveAttribute.setNoLiquidCosmetic(skuData.getNoLiquidCosmetic());
String sensitiveAttributeName = sensitiveAttributeService.getNameByAttributes(sensitiveAttribute);
sop.setSensitiveAttribute(sensitiveAttributeName);
sop.setId(String.valueOf(skuData.getStockSkuId()));
sop.setErpCode(skuData.getErpCode());
sop.setZhName(skuData.getNameCN());
sop.setEnName(skuData.getNameEN());
sop.setDeclaredValue(skuData.getDeclareValue());
sop.setSkuPrice(skuData.getSalePrice());
if(skuData.getWarehouse() != null)
sop.setWarehouse(skuData.getWarehouse()[0].getWarehouseName());
if(skuData.getLabelData() != null) {
StringBuilder labelDataString = new StringBuilder();
for(Label labelData : skuData.getLabelData()) {
labelDataString.append(labelData.getName()).append(",");
}
sop.setLabelData(labelDataString.toString());
}
sop.setImageSource(skuData.getSalePicture());
sop.setIsGift(skuData.getIsGift());
sop.setSupplier(skuData.getSupplier());
sop.setSupplierLink(skuData.getSupplierLink());
sop.setStatus(skuData.getStatusValue());
return sop;
}
/**
* Call a routine to replace SKU codes (from MabangAPI)
@ -635,14 +679,40 @@ public class SkuListMabangServiceImpl extends ServiceImpl<SkuListMabangMapper, S
}
@Override
public Responses mabangSkuWeightUpdate(List<SkuWeight> skuWeights) {
Responses responses = new Responses();
List<String> failures = new ArrayList<>();
List<Sku> skus = skuService.listByIds(skuWeights.stream()
.map(SkuWeight::getSkuId).collect(toList()));
public ResponsesWithMsg mabangSkuWeightUpdate(List<SkuWeight> skuWeights) {
ResponsesWithMsg responses = new ResponsesWithMsg();
List<String> skuIds = skuWeights.stream()
.map(SkuWeight::getSkuId)
.collect(toList());
List<Sku> skus = skuService.listByIds(skuIds);
// Map skuWeights by skuId, if skuId already in map, keep the skuWeight with the latest effective date
Map<String, SkuWeight> skuWeightMappedById = skuWeights.stream()
.collect(Collectors.toMap(SkuWeight::getSkuId, Function.identity(), (skuWeight1, skuWeight2) -> {
if(skuWeight1.getEffectiveDate().after(skuWeight2.getEffectiveDate())) {
log.info("The weight [{}] for sku [{}] is more recent.", skuWeight1.getWeight() ,skuWeight1.getSkuId());
return skuWeight1;
}
log.info("The weight [{}] for sku [{}] is more recent.", skuWeight2.getWeight() ,skuWeight2.getSkuId());
return skuWeight2;
}));
List<Sku> skusToUpdate = new ArrayList<>();
for(Sku sku : skus) {
SkuWeight latestSkuWeight = skuWeightService.getBySkuId(sku.getId());
if(latestSkuWeight == null) {
skusToUpdate.add(sku);
continue;
}
Date latestEffectiveDate = latestSkuWeight.getEffectiveDate();
Date effectiveDateToImport = skuWeightMappedById.get(sku.getId()).getEffectiveDate();
if(latestEffectiveDate.after(effectiveDateToImport)) {
log.info("Sku {} has a more recent weight in DB. Therefore won't be imported to Mabang", sku.getErpCode());
responses.addSuccess(sku.getErpCode());
continue;
}
skusToUpdate.add(sku);
}
Map<String, String> remarkMappedByErpCode = new HashMap<>();
List<List<String>> skusPartition = Lists.partition(skus.stream().map(Sku::getErpCode).collect(toList()), 50);
List<List<String>> skusPartition = Lists.partition(skusToUpdate.stream().map(Sku::getErpCode).collect(toList()), 50);
for(List<String> skuPartition : skusPartition) {
SkuListRequestBody body = new SkuListRequestBody();
body.setStockSkuList(String.join(",", skuPartition));
@ -664,13 +734,20 @@ public class SkuListMabangServiceImpl extends ServiceImpl<SkuListMabangMapper, S
List<SkuData> skuDataList = skuWeights.stream()
.map(skuWeight -> {
Sku sku = skus.stream()
Sku sku = skusToUpdate.stream()
.filter(s -> s.getId().equals(skuWeight.getSkuId()))
.findFirst()
.orElse(null);
if(null == sku) {
Sku skuInDb = skus.stream()
.filter(s -> s.getId().equals(skuWeight.getSkuId()))
.findFirst()
.orElse(null);
if(null == skuInDb) {
log.error("Sku not found : {}", skuWeight.getSkuId());
failures.add(skuWeight.getSkuId());
responses.addFailure(skuWeight.getSkuId(), "Sku not found");
return null;
}
if(null == sku) {
return null;
}
SkuData skuData = new SkuData();
@ -711,17 +788,48 @@ public class SkuListMabangServiceImpl extends ServiceImpl<SkuListMabangMapper, S
List<SkuChangeResponse> results = futures.stream().map(CompletableFuture::join).collect(toList());
long successCount = results.stream().filter(SkuChangeResponse::success).count();
log.info("{}/{} skus updated successfully.", successCount, skuDataList.size());
List<String> successes = results.stream()
.filter(SkuChangeResponse::success)
.map(SkuChangeResponse::getStockSku)
.collect(toList());
failures.addAll(results.stream()
.filter(response -> !response.success())
.map(SkuChangeResponse::getStockSku)
.collect(toList()));
responses.setSuccesses(successes);
responses.setFailures(failures);
results.forEach(response -> {
if(response.success()) {
responses.addSuccess(response.getStockSku(), "Mabang");
}
else {
responses.addFailure(response.getStockSku(), "Mabang");
}
});
return responses;
}
@Override
public List<SkuData> fetchUnpairedSkus(List<String> stockSkuList) {
List<List<String>> skusPartition = Lists.partition(new ArrayList<>(stockSkuList), 50);
List<SkuData> skuDataList = new ArrayList<>();
for(List<String> skuPartition : skusPartition) {
SkuListRequestBody body = new SkuListRequestBody();
body.setShowWarehouse(1);
body.setShowLabel(1);
body.setStockSkuList(String.join(",", skuPartition));
SkuListRawStream rawStream = new SkuListRawStream(body);
UnpairedSkuListStream stream = new UnpairedSkuListStream(rawStream);
skuDataList.addAll(stream.all());
}
return skuDataList;
}
@Override
public List<SkuOrderPage> unpairedSkus(String shopId, Integer pageNo, Integer pageSize, String column, String order) {
int offset = (pageNo - 1) * pageSize;
List<String> stockSkuList = skuService.fetchUnpairedSkus(shopId, offset, pageSize, column, order);
if(stockSkuList.isEmpty()){
return new ArrayList<>();
}
List<SkuData> skuDataList = fetchUnpairedSkus(stockSkuList);
return skuDataList.stream()
.map(this::SkuDataToSkuOrderPage)
.collect(toList());
}
@Override
public int countUnpairedSkus(String shopId) {
return skuService.countUnpairedSkus(shopId);
}
}

View File

@ -59,8 +59,6 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements ISkuS
@Autowired
private ILogisticChannelPriceService logisticChannelPriceService;
@Autowired
private CountryService countryService;
@Autowired
private IPlatformOrderContentService platformOrderContentService;
@Autowired
private ISkuLogisticChoiceService skuLogisticChoiceService;
@ -619,4 +617,13 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements ISkuS
return skuMapper.fetchAllClientSkuCodes(clientCode);
}
@Override
public List<String> fetchUnpairedSkus(String shopId, int offset, Integer pageSize, String column, String order) {
return skuMapper.fetchUnpairedSkus(shopId, offset, pageSize, column, order);
}
@Override
public int countUnpairedSkus(String shopId) {
return skuMapper.countUnpairedSkus(shopId);
}
}

View File

@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.business.entity.SkuWeight;
import org.jeecg.modules.business.mapper.SkuWeightMapper;
import org.jeecg.modules.business.service.ISkuWeightService;
import org.jeecg.modules.business.vo.SkuWeightPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -37,4 +38,14 @@ public class SkuWeightServiceImpl extends ServiceImpl<SkuWeightMapper, SkuWeight
public List<SkuWeight> exportToExcel(List<String> skuIds) {
return skuWeightMapper.exportToExcel(skuIds);
}
@Override
public List<SkuWeightPage> listLatestWeights() {
return skuWeightMapper.listLatestWeights();
}
@Override
public List<SkuWeightPage> listLatestWeightForSkus(List<String> skuIds) {
return skuWeightMapper.listLatestWeightForSkus(skuIds);
}
}

View File

@ -0,0 +1,132 @@
package org.jeecg.modules.business.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.math.BigDecimal;
/**
* @Description: SKU
* @Author: jeecg-boot
* @Date: 2024-03-25
* @Version: V1.1
*/
@Data
@ApiModel(value = "skuOrderPage对象", description = "SKU表")
public class NewSkuPage {
/**
*
*/
@Excel(name = "马帮动创建Sku", width = 15)
@ApiModelProperty(value = "马帮动创建Sku")
private String mabangSku;
/**
* ID
*/
@Excel(name = "商品", width = 15)
@ApiModelProperty(value = "商品")
private String zhName;
/**
* ID
*/
@Excel(name = "商品英文", width = 15)
@ApiModelProperty(value = "商品英文")
private String enName;
/**
* ERP
*/
@Excel(name = "ERP中商品代码", width = 15)
@ApiModelProperty(value = "ERP中商品代码")
private String erpCode;
/**
*
*/
@Excel(name = "重量", width = 15)
@ApiModelProperty(value = "重量")
private Integer weight;
/**
*
*/
@Excel(name = "图片链接", width = 15)
@ApiModelProperty(value = "图片链接")
private String imageSource;
/**
*
*/
@Excel(name = "运费折扣", width = 15)
@ApiModelProperty(value = "运费折扣")
private BigDecimal shippingDiscount;
/**
*
*/
@Excel(name = "服务费", width = 15)
@ApiModelProperty(value = "服务费")
private BigDecimal serviceFee;
/**
*
* 1:;2:;3:;4:;5:"
* default : 3
*/
@Excel(name = "状态", width = 15)
@ApiModelProperty(value = "状态")
private Integer status;
/**
*
*/
@Excel(name = "敏感属性", width = 15)
@ApiModelProperty(value = "敏感属性")
private String sensitiveAttribute;
/**
*
* 1 2
*/
@Excel(name = "是否赠品", width = 15)
@ApiModelProperty(value = "是否赠品")
private Integer isGift;
/**
* SKU
*/
@ApiModelProperty(value = "SKU价格")
private BigDecimal skuPrice;
/**
*
*/
@Excel(name = "申报价格", width = 15)
@ApiModelProperty(value = "申报价格")
private BigDecimal declaredValue;
/**
*
*/
@Excel(name = "申报中文名称", width = 15)
@ApiModelProperty(value = "申报中文名称")
private String declareName;
/**
*
*/
@Excel(name = "申报英文名称", width = 15)
@ApiModelProperty(value = "申报英文名称")
private String declareEname;
/**
*
*/
@Excel(name = "供应商", width = 15)
@ApiModelProperty(value = "供应商")
private String supplier;
/**
*
*/
@Excel(name = "供应商商品网址", width = 15)
@ApiModelProperty(value = "供应商商品网址")
private String supplierLink;
@Excel(name = "仓库", width = 15)
@ApiModelProperty(value = "仓库")
private String warehouse;
@Excel(name = "自定义分类", width = 15)
@ApiModelProperty(value = "自定义分类")
private String labelData;
}

View File

@ -0,0 +1,45 @@
package org.jeecg.modules.business.vo;
import lombok.Data;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Data
public class ResponsesWithMsg {
private Map<String, List<String>> successes = new HashMap<>();
private Map<String, List<String>> failures = new HashMap<>();
public void addSuccess(String message) {
successes.putIfAbsent(message, new ArrayList<>());
}
public void addSuccess(String key, String message) {
if (!successes.containsKey(key)) {
successes.put(key, new ArrayList<>());
}
successes.get(key).add(message);
}
public void addSuccess(String key, List<String> messages) {
if (!successes.containsKey(key)) {
successes.put(key, new ArrayList<>());
}
successes.get(key).addAll(messages);
}
public void addFailure(String message) {
failures.putIfAbsent(message, new ArrayList<>());
}
public void addFailure(String key, String message) {
if (!failures.containsKey(key)) {
failures.put(key, new ArrayList<>());
}
failures.get(key).add(message);
}
public void addFailure(String key, List<String> messages) {
if (!failures.containsKey(key)) {
failures.put(key, new ArrayList<>());
}
failures.get(key).addAll(messages);
}
}

View File

@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
import java.math.BigDecimal;
@ -131,7 +130,6 @@ public class SkuOrderPage {
/**
* SKU
*/
@ExcelCollection(name = "SKU价格")
@ApiModelProperty(value = "SKU价格")
private java.math.BigDecimal skuPrice;
/**
@ -206,4 +204,12 @@ public class SkuOrderPage {
@Excel(name = "供应商商品网址", width = 15)
@ApiModelProperty(value = "供应商商品网址")
private String supplierLink;
@Excel(name = "仓库", width = 15)
@ApiModelProperty(value = "仓库")
private String warehouse;
@Excel(name ="自定义分类", width = 15)
@ApiModelProperty(value = "自定义分类")
private String labelData;
}

View File

@ -0,0 +1,23 @@
package org.jeecg.modules.business.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.util.Date;
@Data
@ApiModel(value = "sku_weight Page对象", description = "SKU重量")
public class SkuWeightPage {
@Excel(name = "ERP中商品代码", width = 15)
@ApiModelProperty(value = "ERP中商品代码")
private String erpCode;
@Excel(name = "重量", width = 15)
@ApiModelProperty(value = "重量")
private Integer weight;
@Excel(name = "生效日期", width = 15)
@ApiModelProperty(value = "生效日期")
private Date effectiveDate;
}

View File

@ -8,7 +8,7 @@ ${AnsiColor.BRIGHT_BLUE}
${AnsiColor.BRIGHT_GREEN}
WIA APP Version: 3.0.2
WIA APP Version: 3.0.6
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
Website: www.wia-sourcing.com
${AnsiColor.BLACK}

View File

@ -28,7 +28,7 @@
</parent>
<properties>
<wia-app.version>3.0.2</wia-app.version>
<wia-app.version>3.0.6</wia-app.version>
<jeecgboot.version>3.6.3</jeecgboot.version>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>