Merge remote-tracking branch 'origin/master'

ljl-dsPurchaseOrder^2
qiushengjie2010 1 year ago
commit 5b82505186

@ -1,69 +0,0 @@
package com.ms.api.dto.dsorder;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
@Data
public class ResultDTO {
public final static String SUCCESS = "success";
public final static String FAIL = "fail";
private String result;
private String reason;
private String code;
private String message;
private Map<String, Object> data = new HashMap<>();
public boolean isSuccess() {
return "success".equals(result);
}
public static ResultDTO success() {
ResultDTO result = new ResultDTO();
result.setResult(SUCCESS);
result.setReason("成功");
result.setCode(SUCCESS);
result.setMessage("成功");
return result;
}
public static ResultDTO success(Map<String, Object> data) {
ResultDTO result = new ResultDTO();
result.setResult(SUCCESS);
result.setReason("成功");
result.setCode(SUCCESS);
result.setMessage("成功");
result.setData(data);
return result;
}
public static ResultDTO fail() {
ResultDTO result = new ResultDTO();
result.setResult(FAIL);
result.setReason("失败");
result.setCode(FAIL);
result.setMessage("失败");
return result;
}
public static ResultDTO fail(String message) {
ResultDTO result = new ResultDTO();
result.setResult(FAIL);
result.setReason(message);
result.setCode(FAIL);
result.setMessage(message);
return result;
}
public static ResultDTO fail(String code, String message) {
ResultDTO result = new ResultDTO();
result.setResult(FAIL);
result.setReason(message);
result.setCode(code);
result.setMessage(message);
return result;
}
}

@ -447,7 +447,15 @@ public class OpOrderServiceImpl implements OpOrderService {
OpOrder insertOrderData = BeanUtil.toBean(orderInfo, OpOrder.class);
log.info("start insertUpdateOpOrder {}", insertOrderData);
opOrderMapper.insertOrUpdate(insertOrderData);
OpOrder orderObj = opOrderMapper.selectByOrderId(order.getOrderId());
if (orderObj == null) {
opOrderMapper.insertSelective(insertOrderData);
} else {
OpOrder updateOrderData = insertOrderData;
updateOrderData.setGmtCreate(null);
updateOrderData.setOpOrderId(orderObj.getOpOrderId());
opOrderMapper.updateByPrimaryKeySelective(updateOrderData);
}
// TODO: 2023/8/31 op_order_user_open_id
// log.info("start saveOpOrderUserOpenId ");
@ -563,7 +571,7 @@ public class OpOrderServiceImpl implements OpOrderService {
// TODO: 2023/9/1 表基本没有 全部跳过
// processWaybillWarningStatus(shopId, orderId, orderInfo);
} catch (Exception e) {
log.error("processOpOrder数据操作异常rollback: ", e.getMessage());
log.error("processOpOrder数据操作异常rollback: ", e);
dataSourceTransactionManager.rollback(transactionStatus);
return ApiResult.fail("数据操作异常");
}
@ -1655,7 +1663,7 @@ public class OpOrderServiceImpl implements OpOrderService {
throw new RuntimeException("请先选择订单");
}
List<OpOrder> orderList = getListByOrderIds(orderIds);
Boolean isSuccess = orderPrintService.batchSetIsolationOrders(Arrays.asList(shopId), orderIds);
Boolean isSuccess = orderPrintService.batchSetIsolationOrders(Collections.singletonList(shopId), orderIds);
if (!isSuccess) {
throw new RuntimeException("操作失败");
}
@ -1668,7 +1676,7 @@ public class OpOrderServiceImpl implements OpOrderService {
throw new RuntimeException("请先选择订单");
}
List<OpOrder> orderList = getListByOrderIds(orderIds);
Boolean isSuccess = orderPrintService.batchCancelIsolationOrders(Arrays.asList(shopId), orderIds);
Boolean isSuccess = orderPrintService.batchCancelIsolationOrders(Collections.singletonList(shopId), orderIds);
if (!isSuccess) {
throw new RuntimeException("订单取消隔离失败");
}
@ -1676,13 +1684,13 @@ public class OpOrderServiceImpl implements OpOrderService {
}
@Override
public Long tryRsyncOpOrder(Long shopid, String app, Integer priority, Date forceStart) {
List<OpOrderRsyncQueue> list = opOrderRsyncQueueMapper.getByShopId(Arrays.asList(shopid.toString()));
public Long tryRsyncOpOrder(Long shopId, String app, Integer priority, Date forceStart) {
List<OpOrderRsyncQueue> list = opOrderRsyncQueueMapper.getListByShopId(Collections.singletonList(shopId.toString()));
OpOrderRsyncQueue queueInfo = ObjectUtil.isEmpty(list) ? null : list.get(0);
Long queueId = 0L;
Long queueId;
if (ObjectUtil.isNull(queueInfo)) {
queueInfo = new OpOrderRsyncQueue();
queueInfo.setShopId(shopid);
queueInfo.setShopId(shopId);
queueInfo.setApp(app);
queueInfo.setHostname("");
queueInfo.setGmtForceStart(forceStart);
@ -1694,9 +1702,15 @@ public class OpOrderServiceImpl implements OpOrderService {
queueInfo.setPageCount(0);
queueInfo.setCompletedPageCount(0);
queueInfo.setStatus(StatusConst.wait);
queueInfo.setGmtCreate(new Date());
opOrderRsyncQueueMapper.insertUpdate(queueInfo);
OpOrderRsyncQueue obj = opOrderRsyncQueueMapper.getByShopId(shopId);
if (obj == null) {
queueInfo.setGmtCreate(new Date());
opOrderRsyncQueueMapper.insertSelective(queueInfo);
} else {
queueInfo.setOpOrderRsyncQueueId(obj.getOpOrderRsyncQueueId());
opOrderRsyncQueueMapper.updateByPrimaryKeySelective(queueInfo);
}
queueId = queueInfo.getOpOrderRsyncQueueId();
if (ObjectUtil.isNotNull(queueId) && queueId > 0) {
String queueRedisKey = RedisKeyConst.getQueueRedisKey(TblConst.op_order_rsync_queue, false);
@ -1722,13 +1736,13 @@ public class OpOrderServiceImpl implements OpOrderService {
@Override
public Map<String, Object> checkRsyncDataFinished(List<String> shopIds) {
Map<String, Object> result = new HashMap<String, Object>();
Map<String, Object> result = new HashMap<>();
result.put("orderRsyncFinished", 1);
result.put("synchronizingUserIds", new ArrayList<>());
if (ObjectUtil.isEmpty(shopIds)) {
return result;
}
List<OpOrderRsyncQueue> opOrderRsyncQueueList = opOrderRsyncQueueMapper.getByShopId(shopIds);
List<OpOrderRsyncQueue> opOrderRsyncQueueList = opOrderRsyncQueueMapper.getListByShopId(shopIds);
result.put("orderRsyncFinished", ObjectUtil.isNotEmpty(opOrderRsyncQueueList) ? 0 : 1);
result.put("synchronizingUserIds", opOrderRsyncQueueList.stream().map(OpOrderRsyncQueue::getShopId).collect(Collectors.toList()));
return result;

@ -50,7 +50,7 @@ public class ShopAuthCallbackService extends SPIBaseService implements Extension
String reqBody = req.getData().getBody();
String key = cloudAppSecret.replaceAll("-", "");
reqBody = SecurityTool.decryptDoudianCallback(reqBody, key);
log.info("receive callback body: ", reqBody);
log.info("receive callback body: " + reqBody);
JSONObject bodyObj = JSONObject.parseObject(reqBody);
Integer msgType = bodyObj.getInteger("msg_type");

@ -58,7 +58,7 @@ public class GetRecommendProductListService extends SPIBaseService implements Ex
List<Category> categoryList = categoryService.getAllLeafProductCatListFromTos(shopId.intValue(), false);
Collections.shuffle(categoryList);
if (ObjectUtil.isNotEmpty(dsCateLeafArray) && ObjectUtil.isNotEmpty(dsCateLeafArray)) {
if (ObjectUtil.isNotEmpty(dsCateLeafArray) && ObjectUtil.isNotEmpty(categoryList)) {
final int eachCateProductChooseCount = 15;
int categoryIndex = 0;
HashSet<String> sourceItemIdSet = new HashSet<>();

@ -17,7 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
public class CreateSyncCategoryQueueTimerService extends TimerBaseService implements ExtensionServiceHandler<ItemDTO, Ret> {
@Autowired
CreateSyncCategoryQueueTaskService createSyncCategoryQueueTaskService;
private CreateSyncCategoryQueueTaskService createSyncCategoryQueueTaskService;
@Override
public BaseResponse<Ret> handle(BaseRequest<ItemDTO> req) {

@ -17,7 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
public class SyncShopCategoryQueueTimerService extends TimerBaseService implements ExtensionServiceHandler<ItemDTO, Ret> {
@Autowired
SyncShopCategoryQueueTaskService syncShopCategoryQueueTaskService;
private SyncShopCategoryQueueTaskService syncShopCategoryQueueTaskService;
@Override
public BaseResponse<Ret> handle(BaseRequest<ItemDTO> req) {

@ -89,7 +89,7 @@ public class SecurityTool {
public static void main(String[] args) {
// String msgSecret = "rzYLiyrSFtW8vSQWrlRTtsSHcH6KZdJGEpCGNZRjNcdXrn1HR39YSMXhj7z36gbeHdqPqR2zbkzO2CMOJz6l1aDFX5ZYTYHsLAIdOyN3RyQYJDihcLzhlACdNf/fEf28srQI37N/7+gVwSApAmnvP7CvBg8X5Hb+2A2cK13jMT8GAskYsNieL982MMPiAZmAF8ktAqN2bLJo/IpxYrW+OXLudrRylWXeLa5fbqO+pZVAtItoGN995lf6iPF8JnWJpQaSBPVuUgU/6Ns5sFWl7A==";
String msgSecret = "rzYLiyrSFtW8vSQWrlRTtsSHcH6KZdJGEpCGNZRjNcdXrn1HR39YSMXhj7z36gbeHdqPqR2zbkzO2CMOJz6l1aDFX5ZYTYHsLAIdOyN3RyTiAMe+84MuHM3uxeNkW/JIxvG0fighkM9qD7AtihaXkyzm2EJbnIUO4O4kWmgJxiNDhfqndhNEK/zzTxWvrgIUlZ+cJNDGjiA7XOab5l105cSVdFmay9I74sH907Bg+jz7w8JDIy5hbAK7rphu1Bv9eVQr4ct4wazka/T1/U2AvA==";
String msgSecret = "rzYLiyrSFtW8vSQWrlRTtsSHcH6KZdJGEpCGNZRjNcdXrn1HR39YSMXhj7z36gbeHdqPqR2zbkzO2CMOJz6l1aDFX5ZYTYHsLAIdOyN3RyTiAMe+84MuHM3uxeNkW/JIKQHQ0OBWp23RHqn1mxKaiaij7cG+jkAC/nrQW027QRqWW+y74MK5v79h3ex4BvlIcPq6hALSMAso7pWuo7KTUjI+QRM8CBafWYNRzcYMl3jyEKZTozWHHKXb+aZMVcjS1hiNNTRTAfZWFfkutSk2kA==";
String appSecret = "4c927c89-d55c-42cf-805c-694269a4b165";
String key = appSecret.replaceAll("-", "");
String decrypt = decryptDoudianCallback(msgSecret,key);

@ -35,7 +35,6 @@ public class OrderUtil {
private final AfterSaleService afterSaleService;
@Transactional(rollbackFor = Exception.class)
public ApiResult rsyncOrder(ShopBO shopBO, List<String> orderIds) {
if (ObjectUtil.isEmpty(orderIds)) {
// autoTriggerRsyncData(orderIds);

@ -24,7 +24,9 @@ public interface OpOrderRsyncQueueMapper {
int updateByPrimaryKey(OpOrderRsyncQueue record);
List<OpOrderRsyncQueue> getByShopId(@Param("shopIds") List<String> shopid);
List<OpOrderRsyncQueue> getListByShopId(@Param("shopIds") List<String> shopid);
OpOrderRsyncQueue getByShopId(Long shopId);
int insertUpdate(OpOrderRsyncQueue queueInfo);

@ -40,7 +40,13 @@
from op_order_rsync_queue
where op_order_rsync_queue_id = #{opOrderRsyncQueueId,jdbcType=BIGINT}
</select>
<select id="getByShopId" resultType="com.ms.dal.entity.OpOrderRsyncQueue">
<select id="getByShopId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from op_order_rsync_queue
where shop_id = #{shopId,jdbcType=BIGINT}
</select>
<select id="getListByShopId" resultType="com.ms.dal.entity.OpOrderRsyncQueue">
select *
from op_order_rsync_queue
where 1=1

Loading…
Cancel
Save