diff --git a/ruoyi-admin/src/main/resources/templates/manage/order/edit.html b/ruoyi-admin/src/main/resources/templates/manage/order/edit.html
index 7b04d888..49cda3ef 100644
--- a/ruoyi-admin/src/main/resources/templates/manage/order/edit.html
+++ b/ruoyi-admin/src/main/resources/templates/manage/order/edit.html
@@ -37,7 +37,7 @@
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
index ee276d92..04ee243a 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
@@ -426,6 +426,9 @@ public class ExcelUtil
if (String.class == fieldType)
{
String s = Convert.toStr(val);
+ if (StringUtils.isNotEmpty(s)) {
+ s = s.trim();
+ }
if (StringUtils.endsWith(s, ".0"))
{
val = StringUtils.substringBefore(s, ".0");
@@ -439,7 +442,7 @@ public class ExcelUtil
}
else
{
- val = Convert.toStr(val);
+ val = s;
}
}
}
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java
index 50aa339f..02444281 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java
@@ -4,6 +4,7 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.shiro.authz.AuthorizationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.dao.DataAccessException;
import org.springframework.validation.BindException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MissingPathVariableException;
@@ -71,6 +72,17 @@ public class GlobalExceptionHandler
return AjaxResult.error(e.getMessage());
}
+ /**
+ * 拦截 SQL 异常
+ */
+ @ExceptionHandler(DataAccessException.class)
+ public AjaxResult handleDataAccessException(DataAccessException e, HttpServletRequest request)
+ {
+ String requestURI = request.getRequestURI();
+ log.error("请求地址'{}',发生SQL异常.", requestURI, e);
+ return AjaxResult.error("数据库操作异常,请稍后重试或联系管理员");
+ }
+
/**
* 系统异常
*/
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/DeliveryList.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/DeliveryList.java
index 751221c1..a0f891f1 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/DeliveryList.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/DeliveryList.java
@@ -4,6 +4,7 @@ import java.util.Date;
import java.util.StringJoiner;
import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excels;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/DeliveryListMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/DeliveryListMapper.java
index d1828522..f45b0bb8 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/DeliveryListMapper.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/DeliveryListMapper.java
@@ -4,6 +4,7 @@ import java.util.List;
import com.ruoyi.sip.domain.DeliveryList;
import com.ruoyi.sip.dto.ApiDataQueryDto;
import com.ruoyi.sip.vo.DeliveryInfoVo;
+import org.apache.ibatis.annotations.Param;
/**
* 发货清单Mapper接口
@@ -62,7 +63,9 @@ public interface DeliveryListMapper
*/
public int deleteDeliveryListByIds(String[] ids);
- List listBySerialNumberList(List deliveryList);
+ List listBySerialNumberList(@Param("list") List deliveryList, @Param("deliveryId") Long deliveryId);
List listNumberInfo(ApiDataQueryDto dto);
+
+ void deleteDeliveryListByDeliveryId(Long deliveryId);
}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OrderInfoMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OrderInfoMapper.java
index 511a84d5..e1d5889f 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OrderInfoMapper.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OrderInfoMapper.java
@@ -110,5 +110,6 @@ public interface OrderInfoMapper
List listMaintenanceByOrderIdList(List orderIdList);
List listExport(OrderList orderList);
+ Integer selectUniqueCount(OrderInfo orderInfo);
}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/DeliveryListServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/DeliveryListServiceImpl.java
index fd928f02..0a97d0ae 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/DeliveryListServiceImpl.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/DeliveryListServiceImpl.java
@@ -122,7 +122,7 @@ public class DeliveryListServiceImpl implements IDeliveryListService {
return AjaxResult.error("发货单中没有产品");
}
List existsProductCodeList = orderLists.stream().map(OrderList::getProductCode).collect(Collectors.toList());
- List notExistsProductCodeList = productCodeList.stream().filter(productCode -> !existsProductCodeList.contains(productCode)).collect(Collectors.toList());
+ List notExistsProductCodeList = productCodeList.stream().filter(productCode -> !existsProductCodeList.contains(productCode)).distinct().collect(Collectors.toList());
if (!notExistsProductCodeList.isEmpty()) {
return AjaxResult.error(StringUtils.format("编码为[{}]的产品在合同请单中未找到,请确认后重试;", String.join(",", notExistsProductCodeList)));
}
@@ -131,12 +131,10 @@ public class DeliveryListServiceImpl implements IDeliveryListService {
list.setDeliveryId(deliveryId);
list.setCreateBy(ShiroUtils.getUserId().toString());
}
- List deliveryLists = deliveryListMapper.listBySerialNumberList(deliveryList);
+ List deliveryLists = deliveryListMapper.listBySerialNumberList(deliveryList,deliveryId);
if (!deliveryLists.isEmpty()){
return AjaxResult.error("产品序列号为[" + deliveryLists.stream().map(DeliveryList::getSerialNumber).collect(Collectors.joining(",")) + "]的产品已存在,请确认后重试;");
}
-
-
deliveryListMapper.insertBatch(deliveryList);
return AjaxResult.success("导入成功");
}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OrderInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OrderInfoServiceImpl.java
index 1ff0573e..36cd0862 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OrderInfoServiceImpl.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OrderInfoServiceImpl.java
@@ -82,12 +82,19 @@ public class OrderInfoServiceImpl implements IOrderInfoService
@Override
public int insertOrderInfo(OrderInfo orderInfo)
{
+ //校验合同号是否重复
+ Integer i = orderInfoMapper.selectUniqueCount(orderInfo);
+ if (i!=null && i>0){
+ throw new ServiceException("合同号+版本号已存在");
+ }
+
orderInfo.setCreateBy(ShiroUtils.getUserId().toString());
int rows = orderInfoMapper.insertOrderInfo(orderInfo);
insertOrderList(orderInfo);
return rows;
}
+
/**
* 修改合同档案
*
@@ -98,6 +105,11 @@ public class OrderInfoServiceImpl implements IOrderInfoService
@Override
public int updateOrderInfo(OrderInfo orderInfo)
{
+ //校验合同号是否重复
+ Integer i = orderInfoMapper.selectUniqueCount(orderInfo);
+ if (i!=null && i>0){
+ throw new ServiceException("合同号+版本号已存在");
+ }
// List orderListList = orderInfo.getOrderListList();
// Map> operateMap =
// orderListList.stream().collect(Collectors.groupingBy(OrderList::getOperateFlag));
diff --git a/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml
index cd73eac2..e625ada5 100644
--- a/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml
+++ b/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml
@@ -62,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
diff --git a/ruoyi-sip/src/main/resources/mapper/manage/DeliveryListMapper.xml b/ruoyi-sip/src/main/resources/mapper/manage/DeliveryListMapper.xml
index 38057c76..1fb23136 100644
--- a/ruoyi-sip/src/main/resources/mapper/manage/DeliveryListMapper.xml
+++ b/ruoyi-sip/src/main/resources/mapper/manage/DeliveryListMapper.xml
@@ -50,6 +50,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
open="(" separator="," close=")">
#{item.serialNumber}
+
+ and delivery_id !=#{deliveryId}
+
+
insert into order_info
diff --git a/ruoyi-sip/src/main/resources/mapper/system/AgentInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/system/AgentInfoMapper.xml
index b01edc4d..5138b2b9 100644
--- a/ruoyi-sip/src/main/resources/mapper/system/AgentInfoMapper.xml
+++ b/ruoyi-sip/src/main/resources/mapper/system/AgentInfoMapper.xml
@@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
diff --git a/ruoyi-sip/src/main/resources/mapper/system/PartnerInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/system/PartnerInfoMapper.xml
index 69a15678..6636cd28 100644
--- a/ruoyi-sip/src/main/resources/mapper/system/PartnerInfoMapper.xml
+++ b/ruoyi-sip/src/main/resources/mapper/system/PartnerInfoMapper.xml
@@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
diff --git a/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml
index 0c248913..69e64cda 100644
--- a/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml
+++ b/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml
@@ -73,7 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"