|
@@ -1,9 +1,16 @@
|
|
|
package com.fs.handwrite.service.impl;
|
|
package com.fs.handwrite.service.impl;
|
|
|
|
|
|
|
|
|
|
+import com.fs.common.core.domain.AjaxResult;
|
|
|
|
|
+import com.fs.common.exception.CustomException;
|
|
|
import com.fs.handwrite.domain.HandwriteCollection;
|
|
import com.fs.handwrite.domain.HandwriteCollection;
|
|
|
import com.fs.handwrite.mapper.HandwriteCollectionMapper;
|
|
import com.fs.handwrite.mapper.HandwriteCollectionMapper;
|
|
|
import com.fs.handwrite.service.IHandwriteCollectionService;
|
|
import com.fs.handwrite.service.IHandwriteCollectionService;
|
|
|
|
|
+import com.fs.hisStore.domain.FsStoreOrderScrm;
|
|
|
|
|
+import com.fs.hisStore.mapper.FsStoreOrderScrmMapper;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.dao.DuplicateKeyException;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -14,12 +21,16 @@ import java.util.List;
|
|
|
* @author fs
|
|
* @author fs
|
|
|
* @date 2024-01-01
|
|
* @date 2024-01-01
|
|
|
*/
|
|
*/
|
|
|
|
|
+@Slf4j
|
|
|
@Service
|
|
@Service
|
|
|
public class HandwriteCollectionServiceImpl implements IHandwriteCollectionService
|
|
public class HandwriteCollectionServiceImpl implements IHandwriteCollectionService
|
|
|
{
|
|
{
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private HandwriteCollectionMapper handwriteCollectionMapper;
|
|
private HandwriteCollectionMapper handwriteCollectionMapper;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private FsStoreOrderScrmMapper storeOrderScrmMapper;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public HandwriteCollection selectHandwriteCollectionById(Integer id)
|
|
public HandwriteCollection selectHandwriteCollectionById(Integer id)
|
|
|
{
|
|
{
|
|
@@ -37,7 +48,11 @@ public class HandwriteCollectionServiceImpl implements IHandwriteCollectionServi
|
|
|
{
|
|
{
|
|
|
handwriteCollection.setCreateTime(new Date());
|
|
handwriteCollection.setCreateTime(new Date());
|
|
|
handwriteCollection.setUpdateTime(new Date());
|
|
handwriteCollection.setUpdateTime(new Date());
|
|
|
- return handwriteCollectionMapper.insertHandwriteCollection(handwriteCollection);
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ return handwriteCollectionMapper.insertHandwriteCollection(handwriteCollection);
|
|
|
|
|
+ } catch (DuplicateKeyException e) {
|
|
|
|
|
+ throw new CustomException("订单号已存在,请勿重复添加");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -58,4 +73,23 @@ public class HandwriteCollectionServiceImpl implements IHandwriteCollectionServi
|
|
|
{
|
|
{
|
|
|
return handwriteCollectionMapper.deleteHandwriteCollectionById(id);
|
|
return handwriteCollectionMapper.deleteHandwriteCollectionById(id);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public AjaxResult checkOrderCode(String orderCode) {
|
|
|
|
|
+ // 首先查询订单表是否存在该订单号
|
|
|
|
|
+ FsStoreOrderScrm fsStoreOrderScrm = storeOrderScrmMapper.selectFsStoreOrderByOrderCode(orderCode);
|
|
|
|
|
+ if (fsStoreOrderScrm == null) {
|
|
|
|
|
+ log.error("商城订单不存在!orderCode:{}", orderCode);
|
|
|
|
|
+ return AjaxResult.error("商城订单不存在!");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 其次查询手写信息采集表中是否已存在此订单号
|
|
|
|
|
+ HandwriteCollection queryCondition = new HandwriteCollection();
|
|
|
|
|
+ queryCondition.setOrderCode(orderCode);
|
|
|
|
|
+ List<HandwriteCollection> handwriteCollections = handwriteCollectionMapper.selectHandwriteCollectionList(queryCondition);
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(handwriteCollections)) {
|
|
|
|
|
+ log.error("订单号已上传,请勿重复添加!orderCode:{}", orderCode);
|
|
|
|
|
+ return AjaxResult.error("订单号已上传,请勿重复添加!");
|
|
|
|
|
+ }
|
|
|
|
|
+ return AjaxResult.success();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|