mirror of https://github.com/jeecgboot/jeecg-boot
Merge branch 'dev' into feat/ydhDeleteTracking
commit
85d78d2f69
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -212,9 +212,13 @@ public class PurchaseOrderController {
|
||||||
BeanUtils.copyProperties(purchaseOrderPage, purchaseOrder);
|
BeanUtils.copyProperties(purchaseOrderPage, purchaseOrder);
|
||||||
purchaseOrder.setPaymentDocumentString(new String(purchaseOrderPage.getPaymentDocument()));
|
purchaseOrder.setPaymentDocumentString(new String(purchaseOrderPage.getPaymentDocument()));
|
||||||
purchaseOrder.setInventoryDocumentString(new String(purchaseOrderPage.getInventoryDocument()));
|
purchaseOrder.setInventoryDocumentString(new String(purchaseOrderPage.getInventoryDocument()));
|
||||||
|
Map<String, Responses> responsesMappedByReason = new HashMap<>();
|
||||||
if(purchaseOrderPage.getPlatformOrderId() == null) {
|
if(purchaseOrderPage.getPlatformOrderId() == null) {
|
||||||
|
Responses purchaseUpdateResponse = new Responses();
|
||||||
purchaseOrderService.updateById(purchaseOrder);
|
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(",")));
|
List<String> platformOrderIds = new ArrayList<>(Arrays.asList(purchaseOrderPage.getPlatformOrderId().split(",")));
|
||||||
log.info("Editing purchase order and attributing it to orders : {}", platformOrderIds);
|
log.info("Editing purchase order and attributing it to orders : {}", platformOrderIds);
|
||||||
|
@ -222,7 +226,7 @@ public class PurchaseOrderController {
|
||||||
platformOrderService.removePurchaseInvoiceNumber(purchaseOrder.getInvoiceNumber(), purchaseOrder.getClientId());
|
platformOrderService.removePurchaseInvoiceNumber(purchaseOrder.getInvoiceNumber(), purchaseOrder.getClientId());
|
||||||
List<PlatformOrder> platformOrders = platformOrderService.selectByPlatformOrderIds(platformOrderIds);
|
List<PlatformOrder> platformOrders = platformOrderService.selectByPlatformOrderIds(platformOrderIds);
|
||||||
log.info("Platform orders found for attribution : {}", platformOrders.stream().map(PlatformOrder::getPlatformOrderId).collect(Collectors.toList()));
|
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();
|
Responses platformOrderIdUpdateResponse = new Responses();
|
||||||
if(!platformOrders.isEmpty()) {
|
if(!platformOrders.isEmpty()) {
|
||||||
for(PlatformOrder po : platformOrders) {
|
for(PlatformOrder po : platformOrders) {
|
||||||
|
@ -237,7 +241,7 @@ public class PurchaseOrderController {
|
||||||
platformOrderIdUpdateResponse.getFailures().addAll(platformOrderIds);
|
platformOrderIdUpdateResponse.getFailures().addAll(platformOrderIds);
|
||||||
}
|
}
|
||||||
purchaseOrderService.updateById(purchaseOrder);
|
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);
|
return Result.OK("sys.api.entryEditSuccess", responsesMappedByReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@ import javax.servlet.ServletRequest;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -56,6 +58,8 @@ import static org.jeecg.common.util.SqlInjectionUtil.specialFilterContentForDict
|
||||||
@RequestMapping("/sku")
|
@RequestMapping("/sku")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class SkuController {
|
public class SkuController {
|
||||||
|
@Autowired
|
||||||
|
private IShopService shopService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISkuService skuService;
|
private ISkuService skuService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -447,9 +451,86 @@ public class SkuController {
|
||||||
|
|
||||||
@PostMapping("/createMabangSku")
|
@PostMapping("/createMabangSku")
|
||||||
public Result<?> createMabangSku(@RequestBody List<SkuOrderPage> skuList) {
|
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));
|
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")
|
@PostMapping("syncSkus")
|
||||||
public Result<?> syncSkus(@RequestBody List<String> erpCodes) {
|
public Result<?> syncSkus(@RequestBody List<String> erpCodes) {
|
||||||
Map<Sku, String> newSkusNeedTreatmentMap;
|
Map<Sku, String> newSkusNeedTreatmentMap;
|
||||||
|
@ -496,4 +577,34 @@ public class SkuController {
|
||||||
skuListMabangService.mabangSkuStockUpdate(erpCodes);
|
skuListMabangService.mabangSkuStockUpdate(erpCodes);
|
||||||
return Result.OK();
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,19 @@
|
||||||
package org.jeecg.modules.business.controller.admin;
|
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 java.util.*;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
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.apache.shiro.SecurityUtils;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
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 lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
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.jeecg.modules.business.vo.SkuWeightParam;
|
||||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.*;
|
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 org.springframework.web.servlet.ModelAndView;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
@ -62,6 +74,9 @@ public class SkuWeightController extends JeecgController<SkuWeight, ISkuWeightSe
|
||||||
@Resource
|
@Resource
|
||||||
private JeecgBaseConfig jeecgBaseConfig;
|
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");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
*
|
*
|
||||||
|
@ -180,10 +195,87 @@ public class SkuWeightController extends JeecgController<SkuWeight, ISkuWeightSe
|
||||||
* @param response
|
* @param response
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("business:sku_weight:importExcel")
|
@Transactional
|
||||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
return super.importExcel(request, response, SkuWeight.class);
|
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);
|
skuWeightsMap.put(sku.getErpCode(), skuWeight);
|
||||||
}
|
}
|
||||||
List<SkuWeight> skuWeights = new ArrayList<>(skuWeightsMap.values());
|
List<SkuWeight> skuWeights = new ArrayList<>(skuWeightsMap.values());
|
||||||
Responses responses = skuListMabangService.mabangSkuWeightUpdate(skuWeights);
|
ResponsesWithMsg responses = skuListMabangService.mabangSkuWeightUpdate(skuWeights);
|
||||||
List<SkuWeight> skuWeightSuccesses = new ArrayList<>();
|
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));
|
skuWeightSuccesses.forEach(skuWeight -> skuMongoService.upsertSkuWeight(skuWeight));
|
||||||
skuWeightService.saveBatch(skuWeights);
|
skuWeightService.saveBatch(skuWeights);
|
||||||
|
|
|
@ -348,14 +348,17 @@ public class InvoiceController {
|
||||||
InvoiceMetaData metaData;
|
InvoiceMetaData metaData;
|
||||||
try {
|
try {
|
||||||
List<SkuQuantity> skuQuantities = skuService.getSkuQuantitiesFromOrderIds(param.orderIds());
|
List<SkuQuantity> skuQuantities = skuService.getSkuQuantitiesFromOrderIds(param.orderIds());
|
||||||
|
if(skuQuantities.isEmpty()) {
|
||||||
|
return Result.error("Nothing to invoice.");
|
||||||
|
}
|
||||||
String purchaseId = purchaseOrderService.addPurchase(skuQuantities ,param.orderIds());
|
String purchaseId = purchaseOrderService.addPurchase(skuQuantities ,param.orderIds());
|
||||||
metaData = purchaseOrderService.makeInvoice(purchaseId);
|
metaData = purchaseOrderService.makeInvoice(purchaseId);
|
||||||
platformOrderService.updatePurchaseInvoiceNumber(param.orderIds(), metaData.getInvoiceCode());
|
platformOrderService.updatePurchaseInvoiceNumber(param.orderIds(), metaData.getInvoiceCode());
|
||||||
|
|
||||||
String clientCategory = clientCategoryService.getClientCategoryByClientId(param.clientID());
|
String clientCategory = clientCategoryService.getClientCategoryByClientId(param.clientID());
|
||||||
// if(clientCategory.equals(ClientCategory.CategoryName.CONFIRMED.getName()) || clientCategory.equals(ClientCategory.CategoryName.VIP.getName())) {
|
if(clientCategory.equals(ClientCategory.CategoryName.CONFIRMED.getName()) || clientCategory.equals(ClientCategory.CategoryName.VIP.getName())) {
|
||||||
// balanceService.updateBalance(param.clientID(), metaData.getCode(), "purchase");
|
balanceService.updateBalance(param.clientID(), metaData.getInvoiceCode(), "purchase");
|
||||||
// }
|
}
|
||||||
if(clientCategory.equals(ClientCategory.CategoryName.SELF_SERVICE.getName())) {
|
if(clientCategory.equals(ClientCategory.CategoryName.SELF_SERVICE.getName())) {
|
||||||
String subject = "Self-service purchase invoice";
|
String subject = "Self-service purchase invoice";
|
||||||
String destEmail = env.getProperty("spring.mail.username");
|
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,
|
List<PlatformOrderFront> orders = platformOrderService.fetchUninvoicedOrdersByShopForClientFullSQL(shopIdList, Collections.singletonList(1), parsedColumn, parsedOrder, pageNo, pageSize,
|
||||||
productStatuses, shippingAvailable, purchaseAvailable);
|
productStatuses, shippingAvailable, purchaseAvailable);
|
||||||
int total = orders.get(0).getTotalCount();
|
int total = !order.isEmpty() ? orders.get(0).getTotalCount() : 0;
|
||||||
|
|
||||||
IPage<PlatformOrderFront> page = new Page<>();
|
IPage<PlatformOrderFront> page = new Page<>();
|
||||||
page.setRecords(orders);
|
page.setRecords(orders);
|
||||||
|
|
|
@ -80,6 +80,8 @@ public class ShippingInvoiceController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IShippingInvoiceService shippingInvoiceService;
|
private IShippingInvoiceService shippingInvoiceService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private ISecurityService securityService;
|
||||||
|
@Autowired
|
||||||
private FreeMarkerConfigurer freemarkerConfigurer;
|
private FreeMarkerConfigurer freemarkerConfigurer;
|
||||||
@Autowired
|
@Autowired
|
||||||
private EmailService emailService;
|
private EmailService emailService;
|
||||||
|
@ -284,6 +286,24 @@ public class ShippingInvoiceController {
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/downloadCompleteInvoiceExcel")
|
@GetMapping(value = "/downloadCompleteInvoiceExcel")
|
||||||
public ResponseEntity<?> download(@RequestParam("invoiceNumber") String invoiceNumber, @RequestParam("filetype") String filetype) throws IOException, UserException {
|
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);
|
String filename = platformOrderShippingInvoiceService.getInvoiceList(invoiceNumber, filetype);
|
||||||
if(!filename.equals("ERROR")) {
|
if(!filename.equals("ERROR")) {
|
||||||
File file = new File(filename);
|
File file = new File(filename);
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -40,6 +40,11 @@ public class SkuData {
|
||||||
private Integer status;
|
private Integer status;
|
||||||
@JSONField(name="originalSku")
|
@JSONField(name="originalSku")
|
||||||
private String originalSku;
|
private String originalSku;
|
||||||
|
/**
|
||||||
|
* if multiple virtual skus, they need to be separated by ";"
|
||||||
|
*/
|
||||||
|
@JSONField(name="virtualSkus")
|
||||||
|
private String virtualSkus;
|
||||||
@JSONField(name="salePrice")
|
@JSONField(name="salePrice")
|
||||||
private BigDecimal salePrice;
|
private BigDecimal salePrice;
|
||||||
@JSONField(name="declareValue")
|
@JSONField(name="declareValue")
|
||||||
|
@ -54,7 +59,12 @@ public class SkuData {
|
||||||
private BigDecimal purchasePrice;
|
private BigDecimal purchasePrice;
|
||||||
/**默认供应商名称,接口参数传showProvider才返回*/
|
/**默认供应商名称,接口参数传showProvider才返回*/
|
||||||
@JSONField(name="warehouse")
|
@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
|
* if stockPicture is empty, we use it
|
||||||
*/
|
*/
|
||||||
|
@ -81,6 +91,11 @@ public class SkuData {
|
||||||
*/
|
*/
|
||||||
@JSONField(name="saleRemark")
|
@JSONField(name="saleRemark")
|
||||||
private String saleRemark;
|
private String saleRemark;
|
||||||
|
/**
|
||||||
|
* 自定义分类json格式
|
||||||
|
*/
|
||||||
|
@JSONField(name="labelData")
|
||||||
|
private Label[] labelData;
|
||||||
/**
|
/**
|
||||||
* 是否含电池:1是;2否
|
* 是否含电池:1是;2否
|
||||||
*/
|
*/
|
||||||
|
@ -109,7 +124,7 @@ public class SkuData {
|
||||||
/**
|
/**
|
||||||
* 是否为易燃品 1: 是 2:不是,默认为2
|
* 是否为易燃品 1: 是 2:不是,默认为2
|
||||||
*/
|
*/
|
||||||
@JSONField(name="is_flammable")
|
@JSONField(name="is_flammables")
|
||||||
private Integer isFlammable;
|
private Integer isFlammable;
|
||||||
/**
|
/**
|
||||||
* 是否为刀具 1:是 2:不是,默认为2
|
* 是否为刀具 1:是 2:不是,默认为2
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class SkuListRawStream implements NetworkDataStream<SkuListResponse> {
|
||||||
public SkuListResponse attempt() {
|
public SkuListResponse attempt() {
|
||||||
log.info("Begin the first request");
|
log.info("Begin the first request");
|
||||||
this.currentResponse = new SkuListRequest(toSend).send();
|
this.currentResponse = new SkuListRequest(toSend).send();
|
||||||
if (currentResponse.getData().isEmpty()) {
|
if (currentResponse.getData() == null || currentResponse.getData().isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
began = true;
|
began = true;
|
||||||
|
|
|
@ -48,8 +48,8 @@ public class SkuListRequestBody implements RequestBody {
|
||||||
putNonNull(json, "maxRows", maxRows);
|
putNonNull(json, "maxRows", maxRows);
|
||||||
putNonNull(json, "showVirtualSku", showVirtualSku);
|
putNonNull(json, "showVirtualSku", showVirtualSku);
|
||||||
putNonNull(json, "showProvider", showProvider);
|
putNonNull(json, "showProvider", showProvider);
|
||||||
putNonNull(json, "showWarehouse", showWarehouse);
|
putNonNull(json, "showWarehouse", String.valueOf(showWarehouse));
|
||||||
putNonNull(json, "showLabel", showLabel);
|
putNonNull(json, "showLabel", String.valueOf(showLabel));
|
||||||
putNonNull(json, "showAttributes", showAttributes);
|
putNonNull(json, "showAttributes", showAttributes);
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.jeecg.modules.business.domain.api.mabang.RequestBody;
|
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 org.jeecg.modules.business.domain.api.mabang.doSearchSkuListNew.SkuData;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
@ -24,6 +25,7 @@ public class SkuAddRequestBody implements RequestBody {
|
||||||
private String declareEname;
|
private String declareEname;
|
||||||
private String warehouse;
|
private String warehouse;
|
||||||
private String remark;
|
private String remark;
|
||||||
|
private Label[] labelData;
|
||||||
private Integer hasBattery;
|
private Integer hasBattery;
|
||||||
private Integer magnetic;
|
private Integer magnetic;
|
||||||
private Integer powder;
|
private Integer powder;
|
||||||
|
@ -34,6 +36,7 @@ public class SkuAddRequestBody implements RequestBody {
|
||||||
private Integer isGift;
|
private Integer isGift;
|
||||||
private String supplier;
|
private String supplier;
|
||||||
private String supplierLink;
|
private String supplierLink;
|
||||||
|
private String picture;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String api() {
|
public String api() {
|
||||||
|
@ -51,6 +54,15 @@ public class SkuAddRequestBody implements RequestBody {
|
||||||
putNonNull(json, "declareValue", declareValue);
|
putNonNull(json, "declareValue", declareValue);
|
||||||
putNonNull(json, "declareName", declareName);
|
putNonNull(json, "declareName", declareName);
|
||||||
putNonNull(json, "declareEname", declareEname);
|
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();
|
JSONArray warehouseData = new JSONArray();
|
||||||
JSONObject warehouse = new JSONObject();
|
JSONObject warehouse = new JSONObject();
|
||||||
warehouse.put("name", this.warehouse);
|
warehouse.put("name", this.warehouse);
|
||||||
|
@ -74,6 +86,7 @@ public class SkuAddRequestBody implements RequestBody {
|
||||||
supplier.put("flag", 1);
|
supplier.put("flag", 1);
|
||||||
supplierData.add(supplier);
|
supplierData.add(supplier);
|
||||||
json.put("suppliersData", supplierData.toJSONString());
|
json.put("suppliersData", supplierData.toJSONString());
|
||||||
|
putNonNull(json, "picture", picture);
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,8 +98,9 @@ public class SkuAddRequestBody implements RequestBody {
|
||||||
this.declareValue = data.getDeclareValue();
|
this.declareValue = data.getDeclareValue();
|
||||||
this.declareName = data.getDeclareNameZh();
|
this.declareName = data.getDeclareNameZh();
|
||||||
this.declareEname = data.getDeclareNameEn();
|
this.declareEname = data.getDeclareNameEn();
|
||||||
this.warehouse = data.getWarehouse();
|
this.warehouse = data.getWarehouseName();
|
||||||
this.remark = data.getSaleRemark();
|
this.remark = data.getSaleRemark();
|
||||||
|
this.labelData = data.getLabelData();
|
||||||
this.hasBattery = data.getHasBattery();
|
this.hasBattery = data.getHasBattery();
|
||||||
this.magnetic = data.getMagnetic();
|
this.magnetic = data.getMagnetic();
|
||||||
this.powder = data.getPowder();
|
this.powder = data.getPowder();
|
||||||
|
@ -97,6 +111,7 @@ public class SkuAddRequestBody implements RequestBody {
|
||||||
this.isGift = data.getIsGift();
|
this.isGift = data.getIsGift();
|
||||||
this.supplier = data.getSupplier();
|
this.supplier = data.getSupplier();
|
||||||
this.supplierLink = data.getSupplierLink();
|
this.supplierLink = data.getSupplierLink();
|
||||||
|
this.picture = data.getSalePicture();
|
||||||
}
|
}
|
||||||
|
|
||||||
private <E> void putNonNull(JSONObject json, String key, E value) {
|
private <E> void putNonNull(JSONObject json, String key, E value) {
|
||||||
|
|
|
@ -20,12 +20,21 @@ public class SkuAddResponse extends Response {
|
||||||
|
|
||||||
private final String stockSku;
|
private final String stockSku;
|
||||||
|
|
||||||
|
private String message;
|
||||||
|
|
||||||
public SkuAddResponse(Code code, JSONObject data, String stockId, String stockSku) {
|
public SkuAddResponse(Code code, JSONObject data, String stockId, String stockSku) {
|
||||||
super(code);
|
super(code);
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.stockId = stockId;
|
this.stockId = stockId;
|
||||||
this.stockSku = stockSku;
|
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.
|
* Make an instance by parsing json, it only checks validity of code.
|
||||||
|
|
|
@ -13,20 +13,36 @@ public class CreateFulfillmentRequest extends ShopifyRequest {
|
||||||
private final static String OTHER = "Other";
|
private final static String OTHER = "Other";
|
||||||
|
|
||||||
private enum TransportCompany {
|
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"),
|
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_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_DE("https://www.dpd.com/de/de/", "DPD", "0150534[0-9]{7}"),
|
||||||
DPD_AT("https://www.mydpd.at", "DPD", "06215167[0-9]{6}"),
|
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}"),
|
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}"),
|
// 16 [0-9]
|
||||||
SWISS_POST("https://service.post.ch/ekp-web/ui/entry/search/%s", "Swiss Post", "[0-9]{18}|LW[0-9]{9}CH"),
|
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}"),
|
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}"),
|
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}"),
|
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("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}"),
|
// 22 [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}"),
|
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}"),
|
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_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_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}"),
|
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}"),
|
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}"),
|
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"),
|
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]*"),
|
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"),
|
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}"),
|
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}"),
|
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;
|
private final String trackingUrl;
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public abstract class Request {
|
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 HttpMethod METHOD = HttpMethod.POST;
|
||||||
private static final String KEY = "BpQWy6AtvKcixjePQ4ZMuvBqUyIsXWWX";
|
private static final String KEY = "BpQWy6AtvKcixjePQ4ZMuvBqUyIsXWWX";
|
||||||
private static final String SHOP_CODE = "8ee5c82004c44049b9f22a0ed8dc4db3";
|
private static final String SHOP_CODE = "8ee5c82004c44049b9f22a0ed8dc4db3";
|
||||||
|
|
|
@ -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_SINGLE = "PJ349400032-JCH";
|
||||||
private static final String TUBE_NEW_40_SKU_MULTIPLE = "PJ349400045-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_50_SKU_MULTIPLE = "PJ349500045-JCH";
|
||||||
private static final String TUBE_NEW_60_SKU_SINGLE = "PJ349600032-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 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,
|
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);
|
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 = "JJ2501";
|
||||||
private static final String PREFIX_50_CANVAS_CHROME = "JJ2001";
|
private static final String PREFIX_50_CANVAS_CHROME = "JJ2001";
|
||||||
|
@ -306,7 +306,7 @@ public class AddPortraitTubeJob implements Job {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tube50SingleCount > 0) {
|
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) {
|
if (tubeNew60MultipleCount > 0) {
|
||||||
adequateTubes.add(Pair.of(TUBE_NEW_60_SKU_MULTIPLE, tubeNew60MultipleCount));
|
adequateTubes.add(Pair.of(TUBE_NEW_60_SKU_MULTIPLE, tubeNew60MultipleCount));
|
||||||
|
|
|
@ -4,19 +4,23 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.codehaus.jettison.json.JSONException;
|
import org.codehaus.jettison.json.JSONException;
|
||||||
import org.codehaus.jettison.json.JSONObject;
|
import org.codehaus.jettison.json.JSONObject;
|
||||||
import org.jeecg.modules.business.domain.api.mabang.doSearchSkuListNew.*;
|
import org.jeecg.modules.business.domain.api.mabang.doSearchSkuListNew.*;
|
||||||
|
import org.jeecg.modules.business.service.ISkuListMabangService;
|
||||||
import org.quartz.Job;
|
import org.quartz.Job;
|
||||||
import org.quartz.JobDataMap;
|
import org.quartz.JobDataMap;
|
||||||
import org.quartz.JobExecutionContext;
|
import org.quartz.JobExecutionContext;
|
||||||
import org.quartz.JobExecutionException;
|
import org.quartz.JobExecutionException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class MabangUnpairedSkuJob implements Job {
|
public class MabangUnpairedSkuJob implements Job {
|
||||||
|
@Autowired
|
||||||
|
private ISkuListMabangService skuListMabangService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
JobDataMap jobDataMap = context.getMergedJobDataMap();
|
JobDataMap jobDataMap = context.getMergedJobDataMap();
|
||||||
|
@ -40,11 +44,7 @@ public class MabangUnpairedSkuJob implements Job {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkuListRequestBody body = new SkuListRequestBody();
|
List<SkuData> skuDatas = skuListMabangService.fetchUnpairedSkus(skuList);
|
||||||
body.setStockSkuList(String.join(",", skuList));
|
|
||||||
SkuListRawStream rawStream = new SkuListRawStream(body);
|
|
||||||
UnpairedSkuListStream stream = new UnpairedSkuListStream(rawStream);
|
|
||||||
List<SkuData> skusFromMabang = stream.all();
|
|
||||||
// System.out.println("skus from mabang : " + skusFromMabang);
|
// System.out.println("skus from mabang : " + skusFromMabang);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,59 @@
|
||||||
package org.jeecg.modules.business.domain.job;
|
package org.jeecg.modules.business.domain.job;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
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.jeecg.modules.business.service.MigrationService;
|
||||||
import org.quartz.Job;
|
import org.quartz.Job;
|
||||||
|
import org.quartz.JobDataMap;
|
||||||
import org.quartz.JobExecutionContext;
|
import org.quartz.JobExecutionContext;
|
||||||
import org.quartz.JobExecutionException;
|
import org.quartz.JobExecutionException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class MongoMigrationJob implements Job {
|
public class MongoMigrationJob implements Job {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MigrationService migrationService;
|
private MigrationService migrationService;
|
||||||
|
@Autowired
|
||||||
|
private ISkuService skuService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
log.info("MongoMigrationJob start ..");
|
log.info("MongoMigrationJob start ..");
|
||||||
|
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();
|
migrationService.migrateSkuData();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
log.info("Migrating skus: {}", skuList);
|
||||||
|
for(String erpCode : skuList) {
|
||||||
|
Sku sku = skuService.getByErpCode(erpCode);
|
||||||
|
migrationService.migrateOneSku(sku);
|
||||||
|
}
|
||||||
|
}
|
||||||
log.info("MongoMigrationJob end ..");
|
log.info("MongoMigrationJob end ..");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class ShopifySyncJob implements Job {
|
||||||
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
||||||
List<PlatformOrderShopSync> ordersReadyForShopifySync = platformOrderService.fetchOrderInShopsReadyForShopifySync(shops);
|
List<PlatformOrderShopSync> ordersReadyForShopifySync = platformOrderService.fetchOrderInShopsReadyForShopifySync(shops);
|
||||||
Map<String, PlatformOrderShopSync> syncMap = ordersReadyForShopifySync.stream()
|
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<>();
|
List<FulfillmentOrder> fulfillmentOrders = new ArrayList<>();
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -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> {
|
||||||
|
|
||||||
|
}
|
|
@ -19,4 +19,8 @@ public interface SensitiveAttributeMapper extends BaseMapper<SensitiveAttribute>
|
||||||
String getHighestPriorityAttributeId(@Param("orderId") String orderId);
|
String getHighestPriorityAttributeId(@Param("orderId") String orderId);
|
||||||
|
|
||||||
List<SensitiveAttribute> listIdAndPriority();
|
List<SensitiveAttribute> listIdAndPriority();
|
||||||
|
|
||||||
|
String getNameByAttributes(@Param("attribute") SensitiveAttribute sensitiveAttribute);
|
||||||
|
|
||||||
|
SensitiveAttribute getByZhName(@Param("zhName") String zhName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,4 +80,8 @@ public interface SkuMapper extends BaseMapper<Sku> {
|
||||||
List<Sku> listImgUrls();
|
List<Sku> listImgUrls();
|
||||||
|
|
||||||
List<String> fetchAllClientSkuCodes(@Param("clientCode") String clientCode);
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.jeecg.modules.business.entity.SkuWeight;
|
import org.jeecg.modules.business.entity.SkuWeight;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.jeecg.modules.business.vo.SkuWeightPage;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,4 +21,9 @@ public interface SkuWeightMapper extends BaseMapper<SkuWeight> {
|
||||||
String searchFirstEmptyWeightSku(@Param("skuIds") List<String> skuIds);
|
String searchFirstEmptyWeightSku(@Param("skuIds") List<String> skuIds);
|
||||||
|
|
||||||
List<SkuWeight> exportToExcel(@Param("skuIds") List<String> skuIds);
|
List<SkuWeight> exportToExcel(@Param("skuIds") List<String> skuIds);
|
||||||
|
|
||||||
|
List<SkuWeightPage> listLatestWeights();
|
||||||
|
|
||||||
|
List<SkuWeightPage> listLatestWeightForSkus(@Param("skuIds") List<String> skuIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>
|
|
@ -29,4 +29,20 @@
|
||||||
SELECT id, priority, zh_name
|
SELECT id, priority, zh_name
|
||||||
FROM wia_app.sensitive_attribute
|
FROM wia_app.sensitive_attribute
|
||||||
</select>
|
</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>
|
</mapper>
|
|
@ -790,4 +790,30 @@
|
||||||
JOIN client c ON client_sku.client_id = c.id
|
JOIN client c ON client_sku.client_id = c.id
|
||||||
WHERE c.internal_code = #{clientCode};
|
WHERE c.internal_code = #{clientCode};
|
||||||
</select>
|
</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 <> 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 <> 5
|
||||||
|
AND s.id = #{shopId};
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -24,6 +24,45 @@
|
||||||
)
|
)
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
</select>
|
</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">
|
<select id="exportToExcel" resultType="org.jeecg.modules.business.entity.SkuWeight">
|
||||||
WITH latestSkuWeights AS (
|
WITH latestSkuWeights AS (
|
||||||
SELECT
|
SELECT
|
||||||
|
|
|
@ -17,6 +17,7 @@ import org.springframework.data.mongodb.core.MongoTemplate;
|
||||||
import org.springframework.data.mongodb.core.query.*;
|
import org.springframework.data.mongodb.core.query.*;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -125,6 +126,15 @@ public class SkuMongoServiceImpl implements SkuMongoService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void upsertSkuWeight(SkuWeight skuWeight) {
|
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()));
|
Query query = new Query(Criteria.where("skuId").is(skuWeight.getSkuId()));
|
||||||
SkuDocument.LatestSkuWeight latestSkuWeight = SkuDocument.LatestSkuWeight.builder()
|
SkuDocument.LatestSkuWeight latestSkuWeight = SkuDocument.LatestSkuWeight.builder()
|
||||||
.weight(skuWeight.getWeight())
|
.weight(skuWeight.getWeight())
|
||||||
|
|
|
@ -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> {
|
||||||
|
|
||||||
|
}
|
|
@ -17,4 +17,8 @@ public interface ISensitiveAttributeService extends IService<SensitiveAttribute>
|
||||||
String getHighestPriorityAttributeId(String orderId);
|
String getHighestPriorityAttributeId(String orderId);
|
||||||
|
|
||||||
List<SensitiveAttribute> listIdAndPriority();
|
List<SensitiveAttribute> listIdAndPriority();
|
||||||
|
|
||||||
|
String getNameByAttributes(SensitiveAttribute sensitiveAttribute);
|
||||||
|
|
||||||
|
SensitiveAttribute getByZhName(String zhName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.domain.api.mabang.doSearchSkuListNew.SkuData;
|
||||||
import org.jeecg.modules.business.entity.Sku;
|
import org.jeecg.modules.business.entity.Sku;
|
||||||
import org.jeecg.modules.business.entity.SkuWeight;
|
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 org.jeecg.modules.business.vo.SkuOrderPage;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -33,12 +33,18 @@ public interface ISkuListMabangService extends IService<SkuData> {
|
||||||
List<String> parseSkuListToProductCodeList(List<SkuData> erpCodeList) throws Exception;
|
List<String> parseSkuListToProductCodeList(List<SkuData> erpCodeList) throws Exception;
|
||||||
Map<Sku, String> createSkus(List<SkuData> skuDataList);
|
Map<Sku, String> createSkus(List<SkuData> skuDataList);
|
||||||
|
|
||||||
Responses publishSkuToMabang(List<SkuOrderPage> skuList);
|
ResponsesWithMsg publishSkuToMabang(List<SkuOrderPage> skuList);
|
||||||
|
|
||||||
Map<Sku, String> skuSyncUpsert(List<String> erpCodes);
|
Map<Sku, String> skuSyncUpsert(List<String> erpCodes);
|
||||||
void updateSkuId();
|
void updateSkuId();
|
||||||
|
|
||||||
void mabangSkuStockUpdate(List<String> erpCodes);
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,4 +124,8 @@ public interface ISkuService extends IService<Sku> {
|
||||||
List<Sku> listImgUrls();
|
List<Sku> listImgUrls();
|
||||||
|
|
||||||
List<String> fetchAllClientSkuCodes(String clientCode);
|
List<String> fetchAllClientSkuCodes(String clientCode);
|
||||||
|
|
||||||
|
List<String> fetchUnpairedSkus(String shopId, int offset, Integer pageSize, String column, String order);
|
||||||
|
|
||||||
|
int countUnpairedSkus(String shopId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.business.service;
|
||||||
|
|
||||||
import org.jeecg.modules.business.entity.SkuWeight;
|
import org.jeecg.modules.business.entity.SkuWeight;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.jeecg.modules.business.vo.SkuWeightPage;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -17,4 +18,11 @@ public interface ISkuWeightService extends IService<SkuWeight> {
|
||||||
String searchFirstEmptyWeightSku(List<String> skuIds);
|
String searchFirstEmptyWeightSku(List<String> skuIds);
|
||||||
|
|
||||||
List<SkuWeight> exportToExcel(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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
}
|
|
@ -35,4 +35,14 @@ public class SensitiveAttributeServiceImpl extends ServiceImpl<SensitiveAttribut
|
||||||
public List<SensitiveAttribute> listIdAndPriority() {
|
public List<SensitiveAttribute> listIdAndPriority() {
|
||||||
return sensitiveAttributeMapper.listIdAndPriority();
|
return sensitiveAttributeMapper.listIdAndPriority();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getNameByAttributes(SensitiveAttribute sensitiveAttribute) {
|
||||||
|
return sensitiveAttributeMapper.getNameByAttributes(sensitiveAttribute);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SensitiveAttribute getByZhName(String zhName) {
|
||||||
|
return sensitiveAttributeMapper.getByZhName(zhName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.jeecg.modules.business.entity.*;
|
||||||
import org.jeecg.modules.business.mapper.SkuListMabangMapper;
|
import org.jeecg.modules.business.mapper.SkuListMabangMapper;
|
||||||
import org.jeecg.modules.business.mongoService.SkuMongoService;
|
import org.jeecg.modules.business.mongoService.SkuMongoService;
|
||||||
import org.jeecg.modules.business.service.*;
|
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.business.vo.SkuOrderPage;
|
||||||
import org.jeecg.modules.online.cgform.mapper.OnlCgformFieldMapper;
|
import org.jeecg.modules.online.cgform.mapper.OnlCgformFieldMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -466,7 +466,8 @@ public class SkuListMabangServiceImpl extends ServiceImpl<SkuListMabangMapper, S
|
||||||
}
|
}
|
||||||
return remark;
|
return remark;
|
||||||
}
|
}
|
||||||
public Responses publishSkuToMabang(List<SkuOrderPage> skuList) {
|
public ResponsesWithMsg publishSkuToMabang(List<SkuOrderPage> skuList) {
|
||||||
|
ResponsesWithMsg responses = new ResponsesWithMsg();
|
||||||
List<SkuData> skuDataList = skuList.stream()
|
List<SkuData> skuDataList = skuList.stream()
|
||||||
.map(this::SkuOrderPageToSkuData)
|
.map(this::SkuOrderPageToSkuData)
|
||||||
.collect(toList());
|
.collect(toList());
|
||||||
|
@ -483,24 +484,20 @@ public class SkuListMabangServiceImpl extends ServiceImpl<SkuListMabangMapper, S
|
||||||
return request.send();
|
return request.send();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error publishing sku {} to mabang : {}", requestBody.getStockSku(), e.getMessage());
|
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))
|
}, executor))
|
||||||
.collect(toList());
|
.collect(toList());
|
||||||
List<SkuAddResponse> results = futures.stream().map(CompletableFuture::join).collect(toList());
|
List<SkuAddResponse> results = futures.stream().map(CompletableFuture::join).collect(toList());
|
||||||
long successCount = results.stream().filter(SkuAddResponse::success).count();
|
long successCount = results.stream().filter(SkuAddResponse::success).count();
|
||||||
log.info("{}/{} skus published successfully.", successCount, skuDataList.size());
|
log.info("{}/{} skus published successfully.", successCount, skuDataList.size());
|
||||||
List<String> successes = results.stream()
|
results.forEach(response -> {
|
||||||
.filter(SkuAddResponse::success)
|
if(response.success()) {
|
||||||
.map(SkuAddResponse::getStockSku)
|
responses.addSuccess(response.getStockSku());
|
||||||
.collect(toList());
|
} else {
|
||||||
List<String> failures = results.stream()
|
responses.addFailure(response.getStockSku(), response.getMessage());
|
||||||
.filter(response -> !response.success())
|
}
|
||||||
.map(SkuAddResponse::getStockSku)
|
});
|
||||||
.collect(toList());
|
|
||||||
Responses responses = new Responses();
|
|
||||||
responses.setSuccesses(successes);
|
|
||||||
responses.setFailures(failures);
|
|
||||||
return responses;
|
return responses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,7 +541,12 @@ public class SkuListMabangServiceImpl extends ServiceImpl<SkuListMabangMapper, S
|
||||||
|
|
||||||
public SkuData SkuOrderPageToSkuData(SkuOrderPage skuOrderPage) {
|
public SkuData SkuOrderPageToSkuData(SkuOrderPage skuOrderPage) {
|
||||||
SensitiveAttribute sensitiveAttribute = sensitiveAttributeService.getById(skuOrderPage.getSensitiveAttribute());
|
SensitiveAttribute sensitiveAttribute = sensitiveAttributeService.getById(skuOrderPage.getSensitiveAttribute());
|
||||||
|
if(sensitiveAttribute == null) {
|
||||||
|
sensitiveAttribute = sensitiveAttributeService.getByZhName(skuOrderPage.getSensitiveAttribute());
|
||||||
|
}
|
||||||
SkuData skuData = new SkuData();
|
SkuData skuData = new SkuData();
|
||||||
|
if(skuOrderPage.getId() != null)
|
||||||
|
skuData.setVirtualSkus(skuOrderPage.getId());
|
||||||
skuData.setErpCode(skuOrderPage.getErpCode());
|
skuData.setErpCode(skuOrderPage.getErpCode());
|
||||||
skuData.setNameCN(skuOrderPage.getZhName());
|
skuData.setNameCN(skuOrderPage.getZhName());
|
||||||
skuData.setNameEN(skuOrderPage.getEnName());
|
skuData.setNameEN(skuOrderPage.getEnName());
|
||||||
|
@ -552,7 +554,14 @@ public class SkuListMabangServiceImpl extends ServiceImpl<SkuListMabangMapper, S
|
||||||
skuData.setDeclareNameEn(skuOrderPage.getDeclareEname());
|
skuData.setDeclareNameEn(skuOrderPage.getDeclareEname());
|
||||||
skuData.setSalePrice(skuOrderPage.getSkuPrice());
|
skuData.setSalePrice(skuOrderPage.getSkuPrice());
|
||||||
skuData.setDeclareValue(skuOrderPage.getDeclaredValue());
|
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)
|
if(skuOrderPage.getWeight() != null)
|
||||||
skuData.setSaleRemark(skuOrderPage.getWeight().toString());
|
skuData.setSaleRemark(skuOrderPage.getWeight().toString());
|
||||||
skuData.setHasBattery(sensitiveAttribute.getHasBattery());
|
skuData.setHasBattery(sensitiveAttribute.getHasBattery());
|
||||||
|
@ -565,9 +574,44 @@ public class SkuListMabangServiceImpl extends ServiceImpl<SkuListMabangMapper, S
|
||||||
skuData.setIsGift(skuOrderPage.getIsGift());
|
skuData.setIsGift(skuOrderPage.getIsGift());
|
||||||
skuData.setSupplier(skuOrderPage.getSupplier());
|
skuData.setSupplier(skuOrderPage.getSupplier());
|
||||||
skuData.setSupplierLink(skuOrderPage.getSupplierLink());
|
skuData.setSupplierLink(skuOrderPage.getSupplierLink());
|
||||||
|
skuData.setSalePicture(skuOrderPage.getImageSource());
|
||||||
return skuData;
|
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)
|
* Call a routine to replace SKU codes (from MabangAPI)
|
||||||
|
@ -635,14 +679,40 @@ public class SkuListMabangServiceImpl extends ServiceImpl<SkuListMabangMapper, S
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Responses mabangSkuWeightUpdate(List<SkuWeight> skuWeights) {
|
public ResponsesWithMsg mabangSkuWeightUpdate(List<SkuWeight> skuWeights) {
|
||||||
Responses responses = new Responses();
|
ResponsesWithMsg responses = new ResponsesWithMsg();
|
||||||
List<String> failures = new ArrayList<>();
|
List<String> skuIds = skuWeights.stream()
|
||||||
List<Sku> skus = skuService.listByIds(skuWeights.stream()
|
.map(SkuWeight::getSkuId)
|
||||||
.map(SkuWeight::getSkuId).collect(toList()));
|
.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<>();
|
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) {
|
for(List<String> skuPartition : skusPartition) {
|
||||||
SkuListRequestBody body = new SkuListRequestBody();
|
SkuListRequestBody body = new SkuListRequestBody();
|
||||||
body.setStockSkuList(String.join(",", skuPartition));
|
body.setStockSkuList(String.join(",", skuPartition));
|
||||||
|
@ -664,13 +734,20 @@ public class SkuListMabangServiceImpl extends ServiceImpl<SkuListMabangMapper, S
|
||||||
|
|
||||||
List<SkuData> skuDataList = skuWeights.stream()
|
List<SkuData> skuDataList = skuWeights.stream()
|
||||||
.map(skuWeight -> {
|
.map(skuWeight -> {
|
||||||
Sku sku = skus.stream()
|
Sku sku = skusToUpdate.stream()
|
||||||
.filter(s -> s.getId().equals(skuWeight.getSkuId()))
|
.filter(s -> s.getId().equals(skuWeight.getSkuId()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.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());
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
SkuData skuData = new SkuData();
|
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());
|
List<SkuChangeResponse> results = futures.stream().map(CompletableFuture::join).collect(toList());
|
||||||
long successCount = results.stream().filter(SkuChangeResponse::success).count();
|
long successCount = results.stream().filter(SkuChangeResponse::success).count();
|
||||||
log.info("{}/{} skus updated successfully.", successCount, skuDataList.size());
|
log.info("{}/{} skus updated successfully.", successCount, skuDataList.size());
|
||||||
List<String> successes = results.stream()
|
results.forEach(response -> {
|
||||||
.filter(SkuChangeResponse::success)
|
if(response.success()) {
|
||||||
.map(SkuChangeResponse::getStockSku)
|
responses.addSuccess(response.getStockSku(), "Mabang");
|
||||||
.collect(toList());
|
}
|
||||||
failures.addAll(results.stream()
|
else {
|
||||||
.filter(response -> !response.success())
|
responses.addFailure(response.getStockSku(), "Mabang");
|
||||||
.map(SkuChangeResponse::getStockSku)
|
}
|
||||||
.collect(toList()));
|
});
|
||||||
|
|
||||||
responses.setSuccesses(successes);
|
|
||||||
responses.setFailures(failures);
|
|
||||||
return responses;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,8 +59,6 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements ISkuS
|
||||||
@Autowired
|
@Autowired
|
||||||
private ILogisticChannelPriceService logisticChannelPriceService;
|
private ILogisticChannelPriceService logisticChannelPriceService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CountryService countryService;
|
|
||||||
@Autowired
|
|
||||||
private IPlatformOrderContentService platformOrderContentService;
|
private IPlatformOrderContentService platformOrderContentService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISkuLogisticChoiceService skuLogisticChoiceService;
|
private ISkuLogisticChoiceService skuLogisticChoiceService;
|
||||||
|
@ -619,4 +617,13 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements ISkuS
|
||||||
return skuMapper.fetchAllClientSkuCodes(clientCode);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.modules.business.entity.SkuWeight;
|
import org.jeecg.modules.business.entity.SkuWeight;
|
||||||
import org.jeecg.modules.business.mapper.SkuWeightMapper;
|
import org.jeecg.modules.business.mapper.SkuWeightMapper;
|
||||||
import org.jeecg.modules.business.service.ISkuWeightService;
|
import org.jeecg.modules.business.service.ISkuWeightService;
|
||||||
|
import org.jeecg.modules.business.vo.SkuWeightPage;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -37,4 +38,14 @@ public class SkuWeightServiceImpl extends ServiceImpl<SkuWeightMapper, SkuWeight
|
||||||
public List<SkuWeight> exportToExcel(List<String> skuIds) {
|
public List<SkuWeight> exportToExcel(List<String> skuIds) {
|
||||||
return skuWeightMapper.exportToExcel(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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@ -131,7 +130,6 @@ public class SkuOrderPage {
|
||||||
/**
|
/**
|
||||||
* SKU价格
|
* SKU价格
|
||||||
*/
|
*/
|
||||||
@ExcelCollection(name = "SKU价格")
|
|
||||||
@ApiModelProperty(value = "SKU价格")
|
@ApiModelProperty(value = "SKU价格")
|
||||||
private java.math.BigDecimal skuPrice;
|
private java.math.BigDecimal skuPrice;
|
||||||
/**
|
/**
|
||||||
|
@ -206,4 +204,12 @@ public class SkuOrderPage {
|
||||||
@Excel(name = "供应商商品网址", width = 15)
|
@Excel(name = "供应商商品网址", width = 15)
|
||||||
@ApiModelProperty(value = "供应商商品网址")
|
@ApiModelProperty(value = "供应商商品网址")
|
||||||
private String supplierLink;
|
private String supplierLink;
|
||||||
|
|
||||||
|
@Excel(name = "仓库", width = 15)
|
||||||
|
@ApiModelProperty(value = "仓库")
|
||||||
|
private String warehouse;
|
||||||
|
|
||||||
|
@Excel(name ="自定义分类", width = 15)
|
||||||
|
@ApiModelProperty(value = "自定义分类")
|
||||||
|
private String labelData;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -8,7 +8,7 @@ ${AnsiColor.BRIGHT_BLUE}
|
||||||
|
|
||||||
|
|
||||||
${AnsiColor.BRIGHT_GREEN}
|
${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}
|
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
|
||||||
Website: www.wia-sourcing.com
|
Website: www.wia-sourcing.com
|
||||||
${AnsiColor.BLACK}
|
${AnsiColor.BLACK}
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -28,7 +28,7 @@
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<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>
|
<jeecgboot.version>3.6.3</jeecgboot.version>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
|
Loading…
Reference in New Issue