merge with dev

pull/6221/head
Gauthier LO 2023-07-04 12:14:07 +02:00
commit 8004443d2a
13 changed files with 80 additions and 26 deletions

View File

@ -180,7 +180,7 @@ public class SqlInjectionUtil {
//value = value.replaceAll("/\\*.*\\*/","");
for (int i = 0; i < xssArr.length; i++) {
if (value.indexOf(xssArr[i]) > -1 || value.startsWith(xssArr[i].trim())) {
if ((value.indexOf(xssArr[i]) > -1 || value.startsWith(xssArr[i].trim())) && value.length() == xssArr[i].trim().length()) {
log.error("请注意存在SQL注入关键词---> {}", xssArr[i]);
log.error("请注意值可能存在SQL注入风险!---> {}", value);
throw new RuntimeException("请注意值可能存在SQL注入风险!--->" + value);

View File

@ -39,6 +39,7 @@ public class ArchiveOrderJob implements Job {
public void execute(JobExecutionContext context) throws JobExecutionException {
LocalDateTime endDateTime = LocalDateTime.now(ZoneId.of(ZoneId.SHORT_IDS.get("CTT")));
LocalDateTime startDateTime = endDateTime.minusDays(DEFAULT_NUMBER_OF_DAYS);
String excludedTrackingNumbersRegex = null;
List<String> shops = DEFAULT_EXCLUDED_SHOPS;
JobDataMap jobDataMap = context.getMergedJobDataMap();
String parameter = ((String) jobDataMap.get("parameter"));
@ -53,6 +54,9 @@ public class ArchiveOrderJob implements Job {
String endDateStr = jsonObject.getString("endDateTime");
endDateTime = LocalDateTime.parse(endDateStr);
}
if (!jsonObject.isNull("excludedTrackingNumbersRegex")) {
excludedTrackingNumbersRegex = jsonObject.getString("excludedTrackingNumbersRegex");
}
if (!jsonObject.isNull("excludedShops")) {
JSONArray shopsArray = jsonObject.getJSONArray("excludedShops");
List<String> shopList = new ArrayList<>();
@ -70,7 +74,7 @@ public class ArchiveOrderJob implements Job {
throw new RuntimeException("EndDateTime must be strictly greater than StartDateTime !");
}
List<String> platformOrderIds = platformOrderService.fetchInvoicedShippedOrdersNotInShops(startDateTime, endDateTime, shops);
List<String> platformOrderIds = platformOrderService.fetchInvoicedShippedOrdersNotInShops(startDateTime, endDateTime, shops, excludedTrackingNumbersRegex);
ExecutorService executor = Executors.newFixedThreadPool(DEFAULT_NUMBER_OF_THREADS);

View File

@ -36,7 +36,6 @@ public class CMKJob implements Job {
private IPlatformOrderService platformOrderService;
private static final Integer DEFAULT_NUMBER_OF_DAYS = 15;
private static final Integer DEFAULT_NUMBER_OF_THREADS = 10;
private static final Integer DEFAULT_MAXIMUM_NUMBER_OF_PARCELS_PER_TRANSACTION = 800;
private static final List<String> DEFAULT_TRANSPORTERS = Arrays.asList("CMK-JJ-PH 法 美 德", "CMK-DB-PH6000", "CMK-DB-PH18000", "CMK-DB-PH10000");
@ -121,4 +120,4 @@ public class CMKJob implements Job {
}
}
}
}

View File

@ -163,7 +163,8 @@ public interface PlatformOrderMapper extends BaseMapper<PlatformOrder> {
List<String> fetchInvoicedShippedOrdersNotInShops(@Param("startDateTime") LocalDateTime startDatetime,
@Param("endDateTime") LocalDateTime endDatetime,
@Param("shops") List<String> shopCodes);
@Param("shops") List<String> shopCodes,
@Param("excludedTrackingNumbersRegex") String excludedTrackingNumbersRegex);
List<PlatformOrderShopSync> fetchOrderInShopsReadyForShopifySync(@Param("shops") List<String> shopCodes);

View File

@ -94,15 +94,23 @@
#{number}
</foreach>;
</select>
<<<<<<< HEAD
<insert id="insertParcelsArchive" parameterType="list">
INSERT INTO parcel_delete(id, create_by, create_time,
update_by, update_time, bill_code,
country, third_bill_code,
order_no, product_code)
=======
<insert id="insertOrIgnoreCMKParcels" parameterType="list">
INSERT IGNORE INTO parcel(id, create_by, create_time, update_by, update_time, bill_code, country,
third_bill_code, order_no, product_code)
>>>>>>> 9c5c7432b6824185b589760c500b696f46f82c58
VALUES
<foreach collection="parcels" separator="," open="" close="" item="parcel" index="index">
(
#{parcel.id},
<<<<<<< HEAD
#{parcel.createBy},
#{parcel.createTime},
#{parcel.updateBy},
@ -114,5 +122,18 @@
#{parcel.productCode}
)
</foreach>;
=======
'cmk api',
NOW(),
'cmk api',
NOW(),
#{parcel.thirdBillCode},
#{parcel.country},
#{parcel.thirdBillCode},
#{parcel.detail.orderNo},
#{parcel.detail.productCode}
)
</foreach>
>>>>>>> 9c5c7432b6824185b589760c500b696f46f82c58
</insert>
</mapper>

View File

@ -80,6 +80,10 @@
)
</foreach>
</insert>
<<<<<<< HEAD
=======
>>>>>>> 9c5c7432b6824185b589760c500b696f46f82c58
<insert id="insertOrIgnoreCMKTraces" parameterType="list">
INSERT IGNORE INTO parcel_trace(id, create_by, create_time, update_by, update_time, parcel_id, scan_time,
description, description_en, trace_location, scan_type)
@ -100,7 +104,12 @@
)
</foreach>
</insert>
<<<<<<< HEAD
<select id="fetchParcelTracesToArchive" resultType="org.jeecg.modules.business.entity.ParcelTrace">
=======
<select id="fetchParcelTracesToArchive" resultType="org.jeecg.modules.business.entity.Parcel">
>>>>>>> 9c5c7432b6824185b589760c500b696f46f82c58
SELECT *
FROM parcel_trace
WHERE parcel_id IN

View File

@ -435,8 +435,10 @@
AND shipping_time &lt;= #{endDateTime}
AND shipping_invoice_number IS NOT NULL
AND erp_status = 3
# Skip CNE packages whose tracking number are not yet up-to-date
AND tracking_number NOT REGEXP '3A5V[0-9]{9}|DY01[0-9]{11}';
<if test="excludedTrackingNumbersRegex != null">
AND tracking_number NOT REGEXP #{excludedTrackingNumbersRegex}
</if>
;
</select>
<select id="fetchOrderInShopsReadyForShopifySync" resultType="org.jeecg.modules.business.entity.PlatformOrderShopSync">

View File

@ -129,12 +129,14 @@ public interface IPlatformOrderService extends IService<PlatformOrder> {
/**
* Fetch platformOrderId of shipped AND invoiced orders, from startDatetime to endDatetime, excluding orders from
* shops whose codes are in shopCodes
* @param startDatetime Start date time
* @param endDatetime End date time
* @param shopCodes Codes for shops which are to be excluded from request
*
* @param startDatetime Start date time
* @param endDatetime End date time
* @param shopCodes Codes for shops which are to be excluded from request
* @param excludedTrackingNumbersRegex Tracking numbers matching the REGEX to be excluded
* @return List of PlatformOrderIDs
*/
List<String> fetchInvoicedShippedOrdersNotInShops(LocalDateTime startDatetime, LocalDateTime endDatetime, List<String> shopCodes);
List<String> fetchInvoicedShippedOrdersNotInShops(LocalDateTime startDatetime, LocalDateTime endDatetime, List<String> shopCodes, String excludedTrackingNumbersRegex);
List<PlatformOrderShopSync> fetchOrderInShopsReadyForShopifySync(List<String> shopCodes);
@ -143,8 +145,14 @@ public interface IPlatformOrderService extends IService<PlatformOrder> {
/**
* Fetch all platform orders between 2 dates and of status erp_status 4 or 5
* this list will then be archived
<<<<<<< HEAD
* @param startDate Start date time
* @param endDate End date time
=======
*
* @param startDate
* @param endDate
>>>>>>> 9c5c7432b6824185b589760c500b696f46f82c58
* @return List of PlatformOrder
*/
List<PlatformOrder> fetchPlatformOrdersToArchive(String startDate, String endDate);

View File

@ -1,7 +1,6 @@
package org.jeecg.modules.business.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.models.auth.In;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.business.controller.UserException;
@ -10,7 +9,6 @@ import org.jeecg.modules.business.domain.shippingInvoice.CompleteInvoice;
import org.jeecg.modules.business.domain.shippingInvoice.ShippingInvoice;
import org.jeecg.modules.business.domain.shippingInvoice.ShippingInvoiceFactory;
import org.jeecg.modules.business.entity.PlatformOrder;
import org.jeecg.modules.business.entity.ShippingInvoiceEntity;
import org.jeecg.modules.business.mapper.*;
import org.jeecg.modules.business.vo.*;
import org.jetbrains.annotations.NotNull;
@ -20,8 +18,13 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.nio.file.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.text.ParseException;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@ -112,8 +115,14 @@ public class PlatformOrderShippingInvoiceService {
}
public Period getValidOrderTimePeriod(List<String> shopIDs, List<Integer> erpStatuses) {
Date begin = platformOrderMapper.findEarliestUninvoicedPlatformOrderTime(shopIDs, erpStatuses);
ZoneId shanghai = ZoneId.of("Asia/Shanghai");
ZoneId paris = ZoneId.of("Europe/Paris");
LocalDateTime ldt = LocalDateTime.ofInstant(begin.toInstant(), shanghai);
Date beginZoned = Date.from(ldt.atZone(paris).toInstant());
Date end = platformOrderMapper.findLatestUninvoicedPlatformOrderTime(shopIDs, erpStatuses);
return new Period(begin, end);
ldt = LocalDateTime.ofInstant(end.toInstant(), shanghai);
Date endZoned = Date.from(ldt.atZone(paris).toInstant());
return new Period(beginZoned, endZoned);
}
/**

View File

@ -225,6 +225,7 @@ public class ParcelServiceImpl extends ServiceImpl<ParcelMapper, Parcel> impleme
}
log.info("Finished inserting {} parcels and their traces into DB.", parcelTraces.size());
}
@Override
@Transactional
public void saveCMKParcelAndTraces(List<CMKParcelTraceData> parcelTraces) {

View File

@ -353,8 +353,8 @@ public class PlatformOrderServiceImpl extends ServiceImpl<PlatformOrderMapper, P
}
@Override
public List<String> fetchInvoicedShippedOrdersNotInShops(LocalDateTime startDatetime, LocalDateTime endDatetime, List<String> shopCodes) {
return platformOrderMap.fetchInvoicedShippedOrdersNotInShops(startDatetime, endDatetime, shopCodes);
public List<String> fetchInvoicedShippedOrdersNotInShops(LocalDateTime startDatetime, LocalDateTime endDatetime, List<String> shopCodes, String excludedTrackingNumbersRegex) {
return platformOrderMap.fetchInvoicedShippedOrdersNotInShops(startDatetime, endDatetime, shopCodes, excludedTrackingNumbersRegex);
}
@Override

View File

@ -1,5 +1,5 @@
server:
port: 8081
port: 8080
tomcat:
max-swallow-size: -1
error:
@ -187,8 +187,8 @@ jeecg:
pc: http://localhost:3100
app: http://localhost:8051
path:
upload: /temp/wia/upload
save: /temp/wia/save
upload: /wia/upload
save: /wia/save
# purchase invoice template
purchaseTemplatePath: /wia/files/Purchase_Invoice_Template.xlsx
@ -203,10 +203,10 @@ jeecg:
completeTemplatePath_EU: /wia/files/Complete_Invoice_Template_EU.xlsx
completeTemplatePath_US: /wia/files/Complete_Invoice_Template_US.xlsx
# where to store generated file
shippingInvoiceDir: /temp/wia/invoices/shipping
shippingInvoiceDetailDir: /temp/wia/invoices/shippingDetail
shippingInvoicePdfDir: /temp/wia/invoices/pdf/shipping
shippingInvoiceDetailPdfDir: /temp/wia/invoices/pdf/shippingDetail
shippingInvoiceDir: /wia/invoices/shipping
shippingInvoiceDetailDir: /wia/invoices/shippingDetail
shippingInvoicePdfDir: /wia/invoices/pdf/shipping
shippingInvoiceDetailPdfDir: /wia/invoices/pdf/shippingDetail
# CDG location
CGS: /wia/files/WIASourcingCGCVF_mai.pdf
#webapp文件路径

View File

@ -2,9 +2,9 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-parent</artifactId>
<version>3.5.0</version>
<version>0.2.5</version>
<packaging>pom</packaging>
<name>JEECG BOOT ${project.version} </name>
<name>WIA APP ${project.version} </name>
<developers>
<developer>