wangjiuyun 2025-05-29 18:02:04 +08:00
commit 82c78d9b23
14 changed files with 53 additions and 12 deletions

View File

@ -37,7 +37,7 @@
<div class="form-group">
<label class="col-sm-4 control-label is-required">版本号:</label>
<div class="col-sm-8">
<input name="versionCode" th:field="*{versionCode}" class="form-control" type="text" max="100" min="0" required>
<input name="versionCode" th:field="*{versionCode}" class="form-control" type="number" max="100" min="0" required>
</div>
</div>
</div>

View File

@ -426,6 +426,9 @@ public class ExcelUtil<T>
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<T>
}
else
{
val = Convert.toStr(val);
val = s;
}
}
}

View File

@ -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("数据库操作异常,请稍后重试或联系管理员");
}
/**
*
*/

View File

@ -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;

View File

@ -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<DeliveryList> listBySerialNumberList(List<DeliveryList> deliveryList);
List<DeliveryList> listBySerialNumberList(@Param("list") List<DeliveryList> deliveryList, @Param("deliveryId") Long deliveryId);
List<DeliveryInfoVo> listNumberInfo(ApiDataQueryDto dto);
void deleteDeliveryListByDeliveryId(Long deliveryId);
}

View File

@ -110,5 +110,6 @@ public interface OrderInfoMapper
List<OrderList> listMaintenanceByOrderIdList(List<Long> orderIdList);
List<OrderList> listExport(OrderList orderList);
Integer selectUniqueCount(OrderInfo orderInfo);
}

View File

@ -122,7 +122,7 @@ public class DeliveryListServiceImpl implements IDeliveryListService {
return AjaxResult.error("发货单中没有产品");
}
List<String> existsProductCodeList = orderLists.stream().map(OrderList::getProductCode).collect(Collectors.toList());
List<String> notExistsProductCodeList = productCodeList.stream().filter(productCode -> !existsProductCodeList.contains(productCode)).collect(Collectors.toList());
List<String> 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<DeliveryList> deliveryLists = deliveryListMapper.listBySerialNumberList(deliveryList);
List<DeliveryList> 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("导入成功");
}

View File

@ -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<OrderList> orderListList = orderInfo.getOrderListList();
// Map<String, List<OrderList>> operateMap =
// orderListList.stream().collect(Collectors.groupingBy(OrderList::getOperateFlag));

View File

@ -62,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</select>
<select id="selectCountByCode" resultType="java.lang.Integer">
select count(1) from customer_info where customer_code = #{customerCode}
select count(1) from customer_info where customer_code = #{customerCode} and status=0
<if test="id != null">and id != #{id}</if>
</select>

View File

@ -50,6 +50,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
open="(" separator="," close=")">
#{item.serialNumber}
</foreach>
<if test="deliveryId!=null">
and delivery_id !=#{deliveryId}
</if>
</select>
<select id="listNumberInfo" resultType="com.ruoyi.sip.vo.DeliveryInfoVo">
SELECT
@ -107,12 +110,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<insert id="insertBatch">
insert into delivery_list (delivery_id, product_code, serial_number, remark, created_at, updated_at,create_by)
insert ignore into delivery_list (delivery_id, product_code, serial_number, remark, created_at, updated_at,create_by)
values
<foreach collection="list" item="item" index="index"
separator=",">
(#{item.deliveryId}, #{item.productCode}, #{item.serialNumber}, #{item.remark}, now(),now(),#{item.createBy})
</foreach>
</insert>
<update id="updateDeliveryList" parameterType="DeliveryList">
@ -139,5 +143,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<delete id="deleteDeliveryListByDeliveryId">
delete from delivery_list where delivery_id = #{deliveryId}
</delete>
</mapper>

View File

@ -256,6 +256,10 @@
</if>
</where>
</select>
<select id="selectUniqueCount" resultType="java.lang.Integer">
select count(1) from order_info where order_code = #{orderCode} and version_code=#{versionCode} and status=0
<if test="id != null">and id != #{id}</if>
</select>
<insert id="insertOrderInfo" parameterType="OrderInfo" useGeneratedKeys="true" keyProperty="id">
insert into order_info

View File

@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectCountByCode" resultType="java.lang.Integer">
select count(1) from agent_info
where agent_code=#{agentCode}
where agent_code=#{agentCode} and status=0
<if test="id != null">and id!=#{id}</if>
</select>

View File

@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</select>
<select id="selectCountByCode" resultType="java.lang.Integer">
select count(1) from partner_info where partner_code = #{partnerCode}
select count(1) from partner_info where partner_code = #{partnerCode} and status=0
<if test="id != null">and id != #{id}</if>
</select>

View File

@ -73,7 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="selectCountByCode" resultType="java.lang.Integer">
select count(1) from product_info where product_code=#{productCode}
select count(1) from product_info where product_code=#{productCode} and status=0
<if test="id!=null ">
and id!=#{id}
</if>