mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
板材、余料字段检验
This commit is contained in:
+4
@@ -25,6 +25,10 @@ public interface OrderPlanApi {
|
||||
CommonResult<Boolean> getOrderPlan(@RequestParam("machineId") Long id);
|
||||
|
||||
|
||||
@GetMapping(PREFIX +"/apiGetOrder")
|
||||
@Operation(summary = "查询生产单对应的板材已全部开料")
|
||||
@Parameter(name = "orderId", description = "生产单ID", required = true)
|
||||
CommonResult<Boolean> getOrder(@RequestParam("orderId") Long orderId);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
+16
@@ -120,6 +120,22 @@ public class OrderPlanApiImpl implements OrderPlanApi{
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> getOrder(Long orderId) {
|
||||
|
||||
List<Long> planIds = goodsMapper.selectNoPlanOrders(orderId, getUserOrganId());
|
||||
|
||||
List<Long> planList = planIds.stream().filter(f -> f == 0).toList();
|
||||
|
||||
if(planIds.isEmpty() || !planList.isEmpty()){
|
||||
return CommonResult.success(false);
|
||||
}
|
||||
List<Long> planIdList = planMapper.selectPLanList(planIds, getUserOrganId());
|
||||
|
||||
return CommonResult.success(planIdList.isEmpty());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 机台数据源数据查询
|
||||
|
||||
+2
-2
@@ -15,9 +15,9 @@ public class BlockPlaceInfo {
|
||||
private Long bi;
|
||||
|
||||
@Schema(description = "小板编号")
|
||||
private Long bo;
|
||||
private String bo;
|
||||
|
||||
public BlockPlaceInfo(Long bi, Long bo) {
|
||||
public BlockPlaceInfo(Long bi, String bo) {
|
||||
this.bi = bi;
|
||||
this.bo = bo;
|
||||
}
|
||||
|
||||
+16
@@ -212,5 +212,21 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
List<Long> selectNoPlanOrdersList(@Param("orderIds") List<Long> orderIds, @Param("organId") Long organId);
|
||||
|
||||
|
||||
List<Long> selectNoPlanOrders(@Param("orderId") Long orderId, @Param("organId") Long organId);
|
||||
|
||||
|
||||
default List<GoodsDO> selectNoPlanOrdersListByOrderIds(List<Long> orderIds, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eq(GoodsDO::getOrganId, organId)
|
||||
.eq(GoodsDO::getDeleted, false)
|
||||
.inIfPresent(GoodsDO::getOrderId,orderIds)
|
||||
.eq(GoodsDO::getPlanId,0)
|
||||
.select(GoodsDO::getOrderId));
|
||||
|
||||
}
|
||||
|
||||
List<Long> selectOrderPlanList(@Param("orderIds") List<Long> orderIds,@Param("organId") Long organId);
|
||||
|
||||
List<Long> selectPlanOrderListByOrderIds(@Param("orderIds") List<Long> orderIds,@Param("organId") Long organId);
|
||||
|
||||
}
|
||||
+17
-3
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.cf.imes.framework.common.enums.OrderPackageStatusEnum;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@@ -259,12 +260,25 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
|
||||
|
||||
|
||||
default List<OrderDO> selectNoPlanOrderList(Long organId, List<Integer> statusList) {
|
||||
default List<OrderDO> selectOrderList(List<Long> orderIds, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<OrderDO>()
|
||||
.eqIfPresent(OrderDO::getOrganId, organId)
|
||||
.eq(OrderDO::getDeleted, false)
|
||||
.in(OrderDO::getStatus,statusList)
|
||||
.select(OrderDO::getId));
|
||||
.inIfPresent(OrderDO::getId,orderIds)
|
||||
.eq(OrderDO::getStatus, OrderStatusEnum.FINISH_PRODUCTION.getStatus()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
default List<OrderDO> selectOrderPackList(List<Long> orderIds, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<OrderDO>()
|
||||
.eqIfPresent(OrderDO::getOrganId, organId)
|
||||
.eq(OrderDO::getDeleted, false)
|
||||
.inIfPresent(OrderDO::getId,orderIds)
|
||||
.eq(OrderDO::getPackaged, OrderPackageStatusEnum.PACKAGED.getStatus()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+9
-1
@@ -5,7 +5,10 @@ import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.OrderPlanStatisticsAreaRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.OrderPlanStatisticsCountRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.PlanPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.PlateOptimize;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
|
||||
@@ -117,6 +120,11 @@ public interface PlanMapper extends BaseMapperX<PlanDO> {
|
||||
|
||||
|
||||
|
||||
List<Long> selectPLanList(@Param("planIds") List<Long> planIds, @Param("organId") Long organId);
|
||||
|
||||
|
||||
|
||||
|
||||
// List<PlanDO> seleTestSQL(@Param("sql") String sql);
|
||||
|
||||
}
|
||||
+9
-2
@@ -162,7 +162,7 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
|
||||
|
||||
|
||||
default List<PlateDO> selectPlateByPlateNo(List<Long> plateNo, Long organId) {
|
||||
default List<PlateDO> selectPlateByPlateNo(List<String> plateNo, Long organId) {
|
||||
return selectList(new LambdaQueryWrapperX<PlateDO>()
|
||||
.eq(PlateDO::getOrganId,organId)
|
||||
.eq(PlateDO::getDeleted,false)
|
||||
@@ -237,7 +237,14 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
|
||||
}
|
||||
|
||||
// List<PlateDO> selectTestSQL(@Param("sql") String sql);
|
||||
|
||||
|
||||
default PlateDO selectByPlateNo(Long plateNo, Long organId) {
|
||||
return selectOne(new LambdaQueryWrapperX<PlateDO>()
|
||||
.eq(PlateDO::getOrganId,organId)
|
||||
.eq(PlateDO::getDeleted,false)
|
||||
.eq(PlateDO::getPlateNo, plateNo));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+62
-12
@@ -8,6 +8,7 @@ import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
||||
import co.elastic.clients.elasticsearch._types.FieldValue;
|
||||
import co.elastic.clients.elasticsearch.core.*;
|
||||
import co.elastic.clients.elasticsearch.core.search.Hit;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.cf.imes.framework.common.enums.OrderStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.PlanStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
@@ -41,6 +42,7 @@ import com.cf.imes.module.executor.enums.ErrorCodeConstants;
|
||||
import com.cf.imes.module.system.api.dataSource.DataSourceApi;
|
||||
import com.cf.imes.module.system.api.machine.MachineApi;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -56,6 +58,7 @@ import java.util.stream.Stream;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.*;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.parseObject;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_NOT_EXISTS;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.PLAN_NOT_EXISTS;
|
||||
@@ -159,7 +162,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
}
|
||||
|
||||
|
||||
List<Long> plateNo = new ArrayList<>();
|
||||
List<String> plateNo = new ArrayList<>();
|
||||
|
||||
// 创建一个列表存储 BlockPlaceInfo 对象,将优化的小板信息拿出,获取到小板编号,查询生产单,修改生产单的状态
|
||||
List<BlockPlaceInfo> outputList = new ArrayList<>();
|
||||
@@ -174,7 +177,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
if (jsonArray.isArray()) {
|
||||
for (JsonNode jsonNode : jsonArray) {
|
||||
Long bi = jsonNode.get("bi").asLong();
|
||||
Long bo = jsonNode.get("bo").asLong();
|
||||
String bo = jsonNode.get("bo").asText();
|
||||
outputList.add(new BlockPlaceInfo(bi,bo));
|
||||
}
|
||||
}
|
||||
@@ -191,8 +194,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
List<PlateDO> plateDOS = plateMapper.selectPlateByPlateNo(plateNo.stream().distinct().toList(), getUserOrganId());
|
||||
|
||||
|
||||
List<Long> orderIds = plateDOS.stream().map(PlateDO::getOrderId).distinct().toList();
|
||||
|
||||
List<Long> orderIds = new ArrayList<>(plateDOS.stream().map(PlateDO::getOrderId).distinct().toList());
|
||||
|
||||
|
||||
// 修改生产单的状态
|
||||
@@ -203,7 +205,6 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
|
||||
// 获取原排单的开料大板数 + 新增的开料大板数
|
||||
long cutedBoardNumber = cutedBoardInfo.getCutedBoardNumber() == null ? 0 : cutedBoardInfo.getCutedBoardNumber();
|
||||
|
||||
|
||||
// 获取原排单的已开料的大板编号
|
||||
@@ -217,7 +218,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
goodsNo.stream().filter(str -> !cutedBoardList.contains(str)))
|
||||
.toList());
|
||||
|
||||
cutedBoardNumber = cutedBoardList.size();
|
||||
long cutedBoardNumber = cutedBoardList.size();
|
||||
|
||||
// 将需要更新更新的数据更新到原数据中
|
||||
cutedBoardInfo.setCutedBoardNumber(cutedBoardNumber);
|
||||
@@ -251,6 +252,23 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
planMapper.updateById(planDO);
|
||||
|
||||
|
||||
List<Long> deleteOrderIds = goodsMapper.selectNoPlanOrdersListByOrderIds(orderIds, getUserOrganId()).stream().map(GoodsDO::getOrderId).distinct().toList();
|
||||
|
||||
orderIds.removeAll(deleteOrderIds);
|
||||
|
||||
if(!orderIds.isEmpty()) {
|
||||
|
||||
List<Long> orderIdList = goodsMapper.selectOrderPlanList(orderIds, getUserOrganId());
|
||||
|
||||
List<OrderDO> orderDOS = orderMapper.selectOrderPackList(orderIdList, getUserOrganId());
|
||||
|
||||
if (!orderDOS.isEmpty()) {
|
||||
List<OrderDO> orderDOList = orderDOS.stream().map(m -> m.setStatus(OrderStatusEnum.FINISH_PRODUCTION.getStatus())).toList();
|
||||
orderMapper.updateBatch(orderDOList);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return Boolean.TRUE;
|
||||
@@ -319,16 +337,48 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
if(cutedBoardInfo.getCutedBoardNumber() == 0){
|
||||
|
||||
// planDO.setStatus(PlanStatusEnum.NOCUTTING.getStatus());
|
||||
// planDO.setProduceTime(null);
|
||||
planMapper.updatePlanStatus(planId,PlanStatusEnum.NOCUTTING.getStatus(),getUserOrganId());
|
||||
|
||||
List<Long> orderIdList = JSON.parseArray(planDO.getOrderNos()).toJavaList(Long.class);
|
||||
|
||||
orderIdList.removeAll(goodsMapper.selectPlanOrderListByOrderIds(orderIdList,getUserOrganId()));
|
||||
|
||||
|
||||
if(!orderIdList.isEmpty()) {
|
||||
List<OrderDO> orderDOList = orderMapper.selectBatchIds(orderIdList);
|
||||
orderMapper.updateBatch(orderDOList.stream()
|
||||
.map(m -> m.setStatus(OrderStatusEnum.SORTED.getStatus()))
|
||||
.toList());
|
||||
}
|
||||
|
||||
return Boolean.TRUE;
|
||||
|
||||
}
|
||||
|
||||
if(planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus()) && cutedBoardInfo.getCutedBoardNumber() > 0 && cutedBoardInfo.getCutedBoardNumber() < optimizeBoardModelDO.getBoardCount() ){
|
||||
// planDO.setStatus(PlanStatusEnum.OPENING.getStatus());
|
||||
// planDO.setProduceTime(null);
|
||||
planMapper.updatePlanStatus(planId,PlanStatusEnum.OPENING.getStatus(),getUserOrganId());
|
||||
// if(planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus()) && cutedBoardInfo.getCutedBoardNumber() > 0 && cutedBoardInfo.getCutedBoardNumber() < optimizeBoardModelDO.getBoardCount() ){
|
||||
//
|
||||
// planMapper.updatePlanStatus(planId,PlanStatusEnum.OPENING.getStatus(),getUserOrganId());
|
||||
// }
|
||||
|
||||
planMapper.updatePlanStatus(planId,PlanStatusEnum.OPENING.getStatus(),getUserOrganId());
|
||||
|
||||
|
||||
// 判断取消开料的大板对应的生产单号的状态,修改状态
|
||||
List<PlatePlaceInfo> asJsonObject = parseObject(optimizeBoardModelDO.getBlockPlaceInfo(), new TypeReference<>() {});
|
||||
|
||||
List<String> plateNo = new ArrayList<>();
|
||||
|
||||
for (Long aLong : goodsNo) {
|
||||
plateNo.addAll(asJsonObject.stream().filter(f->f.getBi().equals(aLong)).map(PlatePlaceInfo::getBo).toList());
|
||||
}
|
||||
|
||||
List<Long> orderIds = plateMapper.selectPlateByPlateNo(plateNo, getUserOrganId()).stream().map(PlateDO::getOrderId).toList();
|
||||
|
||||
List<OrderDO> orderDOS = orderMapper.selectOrderList(orderIds, getUserOrganId());
|
||||
|
||||
if(!orderDOS.isEmpty()){
|
||||
List<OrderDO> orderDOList = orderDOS.stream().map(m -> m.setStatus(OrderStatusEnum.IN_PRODUCTION.getStatus())).toList();
|
||||
orderMapper.updateBatch(orderDOList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+8
-2
@@ -197,10 +197,16 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
List<OrderDO> orderDOList = orderMapper.selectBatchIds(orderIdList);
|
||||
|
||||
orderDOList.forEach(m -> m.setStatus(OrderStatusEnum.SORTED.getStatus()));
|
||||
List<OrderDO> orderDOS = orderDOList.stream()
|
||||
.filter(f -> !f.getStatus().equals(OrderStatusEnum.IN_PRODUCTION.getStatus()))
|
||||
.map(m -> m.setStatus(OrderStatusEnum.SORTED.getStatus()))
|
||||
.toList();
|
||||
|
||||
orderMapper.updateBatch(orderDOList);
|
||||
// orderDOList.forEach(m -> m.setStatus(OrderStatusEnum.SORTED.getStatus()));
|
||||
|
||||
if(!orderDOS.isEmpty()) {
|
||||
orderMapper.updateBatch(orderDOS);
|
||||
}
|
||||
planMapper.insertBatch(planDOS);
|
||||
|
||||
|
||||
|
||||
+14
-9
@@ -14,7 +14,6 @@ import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.es.core.service.ESDocumentService;
|
||||
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
@@ -40,8 +39,6 @@ import com.cf.imes.module.executor.service.plan.PlanService;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.SnowflakeIdWorker3rd;
|
||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -56,6 +53,8 @@ import java.util.stream.Collectors;
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.ES_ERROR_UPDATE;
|
||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.parseObject;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.service.optimizeplan.OptimizePlanService.ORDER_PLATE_MODEL;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
@@ -144,17 +143,19 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
try {
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
// ObjectMapper mapper = new ObjectMapper();
|
||||
//
|
||||
// // 解析 JSON 字符串
|
||||
// JsonNode jsonNode = mapper.readTree(optimizeBoardModelDO.getBlockPlaceInfo());
|
||||
|
||||
// List<PlatePlaceInfo> asJsonObject = mapper.convertValue(jsonNode, new TypeReference<>() {});
|
||||
|
||||
// 解析 JSON 字符串
|
||||
JsonNode jsonNode = mapper.readTree(optimizeBoardModelDO.getBlockPlaceInfo());
|
||||
|
||||
Long placeBlockNumber = optimizeBoardModelDO.getPlaceBlockNumber() - 1;
|
||||
|
||||
List<PlatePlaceInfo> asJsonObject = mapper.convertValue(jsonNode, new TypeReference<>() {});
|
||||
List<PlatePlaceInfo> asJsonObject = parseObject(optimizeBoardModelDO.getBlockPlaceInfo(), new TypeReference<>() {});
|
||||
|
||||
|
||||
String blockPlaceInfo = JsonUtils.toJsonString(
|
||||
String blockPlaceInfo = toJsonString(
|
||||
asJsonObject.stream()
|
||||
.filter(f -> !f.getBo().equals(plateDO.getPlateNo()))
|
||||
.toList());
|
||||
@@ -338,6 +339,10 @@ public class PlateServiceImpl implements PlateService {
|
||||
AssertUtils.notEmpty(reqVO.getBodyId(),ORDER_BODY_ERROR);
|
||||
AssertUtils.notEmpty(reqVO.getOrderId(),ORDER_ERROR);
|
||||
|
||||
if(reqVO.getMultiple() < 1 ){
|
||||
throw exception(PLATE_MULTIPLE_ERROR);
|
||||
}
|
||||
|
||||
GoodsDO goodsDO = goodsMapper.selectGoodsId(reqVO.getOrderId(), reqVO.getGoodsId(), getUserOrganId());
|
||||
|
||||
|
||||
|
||||
+47
@@ -443,5 +443,52 @@
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectNoPlanOrders" resultType="java.lang.Long">
|
||||
|
||||
select distinct plan_id
|
||||
from order_goods
|
||||
where organ_id = #{organId}
|
||||
and deleted = false
|
||||
and order_id = #{orderId};
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
<select id="selectOrderPlanList" resultType="java.lang.Long">
|
||||
|
||||
select distinct og.order_id
|
||||
|
||||
from order_goods og
|
||||
left join order_plan op on og.organ_id = op.organ_id and og.deleted = op.deleted and og.plan_id = op.id
|
||||
|
||||
where og.organ_id = #{organId}
|
||||
and og.deleted = false
|
||||
and og.order_id in
|
||||
<foreach item="orderIds" collection="orderIds" open="(" separator="," close=")">
|
||||
#{orderIds}
|
||||
</foreach>
|
||||
and op.status = 2
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectPlanOrderListByOrderIds" resultType="java.lang.Long">
|
||||
|
||||
select distinct og.order_id
|
||||
|
||||
from order_goods og
|
||||
left join order_plan op on og.organ_id = op.organ_id and og.deleted = op.deleted and og.plan_id = op.id
|
||||
|
||||
where og.organ_id = #{organId}
|
||||
and og.deleted = false
|
||||
and og.order_id in
|
||||
<foreach item="orderIds" collection="orderIds" open="(" separator="," close=")">
|
||||
#{orderIds}
|
||||
</foreach>
|
||||
and op.status in (1,2)
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
+14
@@ -122,6 +122,20 @@
|
||||
and status !=0;
|
||||
|
||||
|
||||
</select>
|
||||
<select id="selectPLanList" resultType="java.lang.Long">
|
||||
|
||||
select id
|
||||
from order_plan
|
||||
where organ_id = #{organId}
|
||||
and deleted = false
|
||||
and id in
|
||||
<foreach item="planIds" collection="planIds" open="(" separator="," close=")">
|
||||
#{planIds}
|
||||
</foreach>
|
||||
and status in (0,1);
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@@ -174,8 +174,12 @@
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.8</version> <!-- 使用最新版本 -->
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-module-prod-executor-api</artifactId>
|
||||
<version>2.0.0-jdk8-snapshot</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
+8
-2
@@ -1,13 +1,12 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.plate;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.*;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
@@ -19,15 +18,19 @@ import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
|
||||
public class PlatePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "客户的商品编号", example = "1")
|
||||
@Size(max = 32, message = "商品编号长度不能超过32个字符")
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品名称", example = "赵六")
|
||||
@Size(max = 64, message = "商品名称长度不能超过64个字符")
|
||||
private String goodsName;
|
||||
|
||||
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板")
|
||||
@Size(max = 64, message = "材质长度不能超过64个字符")
|
||||
private String material;
|
||||
|
||||
@Schema(description = "颜色")
|
||||
@Size(max = 32, message = "颜色长度不能超过32个字符")
|
||||
private String color;
|
||||
|
||||
@Schema(description = "纹理")
|
||||
@@ -46,12 +49,15 @@ public class PlatePageReqVO extends PageParam {
|
||||
// private Double price;
|
||||
|
||||
@Schema(description = "品牌")
|
||||
@Size(max = 64, message = "品牌长度不能超过64个字符")
|
||||
private String brand;
|
||||
|
||||
@Schema(description = "规格")
|
||||
@Size(max = 64, message = "规格长度不能超过64个字符")
|
||||
private String spec;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
@Size(max = 255, message = "备注长度不能超过255个字符")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
|
||||
+6
-7
@@ -1,11 +1,9 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.plate;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.cf.imes.module.manage.validation.length.ValidLength;
|
||||
import com.cf.imes.module.manage.validation.texture.ValidBoolean;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
@@ -20,7 +18,7 @@ public class PlateSaveReqVO {
|
||||
|
||||
@Schema(description = "客户的商品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotEmpty(message = "客户的商品编号不能为空")
|
||||
@Size(max = 30, message = "客户的商品编号长度不能超过32个字符")
|
||||
@Size(max = 32, message = "商品编号长度不能超过32个字符")
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@@ -30,12 +28,12 @@ public class PlateSaveReqVO {
|
||||
|
||||
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板不能为空")
|
||||
@Size(max = 64, message = "商品材料长度不能超过64个字符")
|
||||
@Size(max = 64, message = "材质长度不能超过64个字符")
|
||||
private String material;
|
||||
|
||||
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "颜色不能为空")
|
||||
@Size(max = 32, message = "商品颜色长度不能超过32个字符")
|
||||
@Size(max = 32, message = "颜色长度不能超过32个字符")
|
||||
private String color;
|
||||
|
||||
@Schema(description = "纹理", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@@ -61,14 +59,15 @@ public class PlateSaveReqVO {
|
||||
// private Double price;
|
||||
|
||||
@Schema(description = "品牌")
|
||||
@Size(max = 64, message = "商品品牌长度不能超过64个字符")
|
||||
@Size(max = 64, message = "品牌长度不能超过64个字符")
|
||||
private String brand;
|
||||
|
||||
@Schema(description = "规格")
|
||||
@Size(max = 64, message = "商品规格长度不能超过64个字符")
|
||||
@Size(max = 64, message = "规格长度不能超过64个字符")
|
||||
private String spec;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
@Size(max = 255, message = "备注长度不能超过255个字符")
|
||||
private String remark;
|
||||
|
||||
private Long organId;
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.manage.framework.rpc.config;
|
||||
|
||||
import com.cf.imes.module.executor.api.plan.OrderPlanApi;
|
||||
import com.cf.imes.module.system.api.organ.OrganApi;
|
||||
import com.cf.imes.module.system.api.permission.PermissionApi;
|
||||
import com.cf.imes.module.system.api.process.ProcessApi;
|
||||
@@ -9,6 +10,6 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {AdminUserApi.class, OrganApi.class, ProcessApi.class, SettingApi.class,PermissionApi.class})
|
||||
@EnableFeignClients(clients = {AdminUserApi.class, OrganApi.class, ProcessApi.class, SettingApi.class,PermissionApi.class, OrderPlanApi.class})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
||||
+41
-6
@@ -4,15 +4,13 @@ package com.cf.imes.module.manage.service.pack;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.enums.OrderItemTypeEnum;
|
||||
import com.cf.imes.framework.common.enums.OrderPackageStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.OrderPackageTypeEnum;
|
||||
import com.cf.imes.framework.common.enums.UserSettingTypeEnum;
|
||||
import com.cf.imes.framework.common.enums.*;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.Assert.AssertUtils;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.QueryWrapperX;
|
||||
import com.cf.imes.module.executor.api.plan.OrderPlanApi;
|
||||
import com.cf.imes.module.manage.controller.admin.pack.prePack.PackPlateList;
|
||||
import com.cf.imes.module.manage.controller.admin.pack.prePack.PrePackOptimizeInfo;
|
||||
import com.cf.imes.module.manage.controller.admin.pack.prePack.PrePackReqVO;
|
||||
@@ -80,7 +78,6 @@ public class PackServiceImpl implements PackService {
|
||||
@Resource
|
||||
private OrdersMapper ordersMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private SnowflakeIdWorker3rd idWorker;
|
||||
|
||||
@@ -91,6 +88,9 @@ public class PackServiceImpl implements PackService {
|
||||
@Resource
|
||||
private SettingApi settingApi;
|
||||
|
||||
@Resource
|
||||
private OrderPlanApi orderPlanApi;
|
||||
|
||||
|
||||
// 打包分页查询
|
||||
@Override
|
||||
@@ -374,6 +374,7 @@ public class PackServiceImpl implements PackService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public OrderPackRespVO updateParts(OrderPartsReqVO reqVO) {
|
||||
|
||||
validateOrdersExists(reqVO.getOrderId(),null);
|
||||
|
||||
// 判断包裹ID是否为空,为空,走新增,不为空,走更新
|
||||
if (reqVO.getPackId() == null) {
|
||||
@@ -404,6 +405,7 @@ public class PackServiceImpl implements PackService {
|
||||
|
||||
OrderPackageDO orderPackageDO = orderPackageMapper.selectByPackId(reqVO.getPackId(),reqVO.getOrderId(), getUserOrganId());
|
||||
|
||||
AssertUtils.notEmpty(orderPackageDO,ORDER_PACK_DATA_ERROR);
|
||||
List<OrderItemDO> orderItemDOS = orderItemMapper.selectPackList(reqVO.getPackId(), reqVO.getOrderId(), getUserOrganId());
|
||||
List<Long> partsList = orderItemDOS.stream().map(OrderItemDO::getPartsId).distinct().toList();
|
||||
|
||||
@@ -460,7 +462,7 @@ public class PackServiceImpl implements PackService {
|
||||
|
||||
OrderPackageDO packageDO = orderPackageMapper.selectById(packageID);
|
||||
|
||||
AssertUtils.notEmpty(packageDO,ORDER_PACK_DATA_ERROR );
|
||||
AssertUtils.notEmpty(packageDO,ORDER_PACK_DATA_NULL_ERROR );
|
||||
|
||||
Long orderId = packageDO.getOrderId();
|
||||
|
||||
@@ -469,6 +471,11 @@ public class PackServiceImpl implements PackService {
|
||||
AssertUtils.notEmpty(orderDO,ORDER_NO_DATA_ERROR);
|
||||
|
||||
orderDO.setPackaged(OrderPackageStatusEnum.UNPACKED.getStatus());
|
||||
|
||||
if(orderDO.getStatus().equals(OrderStatusEnum.FINISH_PRODUCTION.getStatus())){
|
||||
orderDO.setStatus(OrderStatusEnum.IN_PRODUCTION.getStatus());
|
||||
}
|
||||
|
||||
ordersMapper.updateById(orderDO);
|
||||
|
||||
packageDO.setStatus(OrderPackageStatusEnum.UNPACKED.getStatus());
|
||||
@@ -484,6 +491,7 @@ public class PackServiceImpl implements PackService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public OrderPackRespVO updatePack(OrderPackReqVO packageVO) {
|
||||
|
||||
validateOrdersExists(packageVO.getOrderId(),null);
|
||||
|
||||
// 判断包裹ID是否为空,为空,走新增,不为空,走更新
|
||||
if (packageVO.getPackId() == null) {
|
||||
@@ -509,6 +517,9 @@ public class PackServiceImpl implements PackService {
|
||||
|
||||
|
||||
OrderPackageDO orderPackageDO = orderPackageMapper.selectByPackId(packageVO.getPackId(),packageVO.getOrderId(), getUserOrganId());
|
||||
|
||||
AssertUtils.notEmpty(orderPackageDO,ORDER_PACK_DATA_ERROR);
|
||||
|
||||
List<OrderItemDO> orderItemDOS = orderItemMapper.selectPackList(packageVO.getPackId(), packageVO.getOrderId(), getUserOrganId());
|
||||
List<Long> plateList = orderItemDOS.stream().map(OrderItemDO::getPlateId).distinct().toList();
|
||||
|
||||
@@ -588,9 +599,16 @@ public class PackServiceImpl implements PackService {
|
||||
// 修改生产单的打包状态为已打包
|
||||
orderDO.setPackaged(OrderPackageStatusEnum.PACKAGED.getStatus());
|
||||
|
||||
|
||||
if(orderPlanApi.getOrder(orderId).getData()){
|
||||
orderDO.setStatus(OrderStatusEnum.FINISH_PRODUCTION.getStatus());
|
||||
}
|
||||
|
||||
|
||||
ordersMapper.updateById(orderDO);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -622,6 +640,8 @@ public class PackServiceImpl implements PackService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteOrderPack(PackReqVO reqVO) {
|
||||
|
||||
|
||||
|
||||
// 判断包裹的类型是否为其他类型,如果是,则删除其包裹信息
|
||||
if (reqVO.getIsOther()) {
|
||||
|
||||
@@ -900,6 +920,9 @@ public class PackServiceImpl implements PackService {
|
||||
if (orderItemDoPartsList.isEmpty()) {
|
||||
OrderDO orderDO = ordersMapper.selectById(reqVO.getOrderId());
|
||||
orderDO.setPackaged(OrderPackageStatusEnum.PACKAGED.getStatus());
|
||||
if(orderPlanApi.getOrder(reqVO.getOrderId()).getData()){
|
||||
orderDO.setStatus(OrderStatusEnum.FINISH_PRODUCTION.getStatus());
|
||||
}
|
||||
ordersMapper.updateById(orderDO);
|
||||
}
|
||||
|
||||
@@ -952,6 +975,18 @@ public class PackServiceImpl implements PackService {
|
||||
}
|
||||
|
||||
|
||||
private void validateOrdersExists(Long orderId, Long packId) {
|
||||
|
||||
OrderDO orderDO = ordersMapper.selectById(orderId);
|
||||
AssertUtils.notEmpty(orderDO,ORDER_PACK_ERROR);
|
||||
|
||||
if(packId != null){
|
||||
OrderPackageDO orderPackageDO = orderPackageMapper.selectById(packId);
|
||||
AssertUtils.notEmpty(orderPackageDO,ORDER_PACK_DATA_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 类型转换
|
||||
private OrderPackRespVO typeConversion(OrderPackageDO orderPackageDO) {
|
||||
return OrderPackRespVO.builder()
|
||||
|
||||
+4
-1
@@ -302,7 +302,7 @@ public class ErrorCodeConstants {
|
||||
public static final ErrorCode ORDER_PLAN_ERROR = new ErrorCode(1_002_041_008, "当前排单对应的生产单数据有异常,请查看生产单信息或联系客服");
|
||||
public static final ErrorCode ORDER_PLAN_PLATE_MODEL_DATE_ERROR = new ErrorCode(1_002_041_009, "当前排单对应的板材造型数据为空,请检查板材信息或者联系客服");
|
||||
public static final ErrorCode ORDER_GOODS_DATA_ERROR = new ErrorCode(1_002_041_010, "当前大板数据异常,请检查大板信息或者联系客服");
|
||||
public static final ErrorCode ORDER_PACK_DATA_ERROR = new ErrorCode(1_002_041_011, "当前包裹数据为空,请重新查看包裹数据或联系客服");
|
||||
public static final ErrorCode ORDER_PACK_DATA_NULL_ERROR = new ErrorCode(1_002_041_011, "当前包裹数据为空,请重新查看包裹数据或联系客服");
|
||||
public static final ErrorCode ORDER_BODY_DATA_ERROR = new ErrorCode(1_002_041_012, "当前柜体对应的板材数据为空,无法删除");
|
||||
public static final ErrorCode ORDER_PLAN_NO_OPTIMIZE_ERROR = new ErrorCode(1_002_041_013, "当前排单还未保存优化结果,无法进行开料");
|
||||
public static final ErrorCode ORDER_PLAN_NO_OPTIMIZE_UPDATE_ERROR = new ErrorCode(1_002_041_014, "当前排单还未保存优化结果,无法对开料结果进行修改");
|
||||
@@ -311,6 +311,9 @@ public class ErrorCodeConstants {
|
||||
public static final ErrorCode ORDER_BODY_ERROR = new ErrorCode(1_002_041_015, "当前板材没有选择柜体,请选择");
|
||||
public static final ErrorCode ORDER_ERROR = new ErrorCode(1_002_041_015, "当前板材没有选择生产单,请选择");
|
||||
public static final ErrorCode MACHINE_NO_DATA_ERROR = new ErrorCode(1_002_041_016, "当前所选机台有误,请检查机台信息或重新选择机台");
|
||||
public static final ErrorCode PLATE_MULTIPLE_ERROR = new ErrorCode(1_002_041_017, "板材倍数有误,倍数必须大于 0");
|
||||
public static final ErrorCode ORDER_PACK_ERROR = new ErrorCode(1_002_041_018, "当前生产单信息有误,请重新选择包裹");
|
||||
public static final ErrorCode ORDER_PACK_DATA_ERROR = new ErrorCode(1_002_041_019, "当前包裹信息有误,请重新选择包裹");
|
||||
|
||||
|
||||
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.cf.imes.module.system.enums.label;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 标签模板类型枚举
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/15 10:46
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum LabelTemplateType {
|
||||
/**
|
||||
* 板材包裹
|
||||
*/
|
||||
PLATEPACKAGELABEL("platePackageLabel"),
|
||||
|
||||
/**
|
||||
* 机台标签
|
||||
*/
|
||||
MACHINELABEL("machineLabel"),
|
||||
|
||||
/**
|
||||
* 配件包裹标签
|
||||
*/
|
||||
PARTSPACKAGELABEL("partsPackageLabel"),
|
||||
|
||||
/**
|
||||
* 订单包裹标签
|
||||
*/
|
||||
ORDERPACKAGELABEL("orderPackageLabel");
|
||||
|
||||
private String type;
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.dept.vo.dept;
|
||||
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.module.system.controller.admin.dept.vo.dept;
|
||||
|
||||
import com.cf.imes.framework.common.validation.Mobile;
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
package com.cf.imes.module.system.controller.admin.dict.vo.data;
|
||||
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.validation.InEnum;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -23,7 +22,7 @@ public class DictDataPageReqVO extends PageParam {
|
||||
private String dictType;
|
||||
|
||||
@Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1")
|
||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
|
||||
@CommonStatus
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
||||
+6
-4
@@ -1,8 +1,7 @@
|
||||
package com.cf.imes.module.system.controller.admin.dict.vo.data;
|
||||
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.validation.InEnum;
|
||||
import com.cf.imes.module.system.validation.system.dict.CssClassValid;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.dict.CssClassValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -38,17 +37,20 @@ public class DictDataSaveReqVO {
|
||||
|
||||
@Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "状态不能为空")
|
||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
|
||||
@CommonStatus
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "颜色类型,default、primary、success、info、warning、danger", example = "default")
|
||||
@Size(max = 100, message = "颜色类型长度不能超过100个字符")
|
||||
private String colorType;
|
||||
|
||||
@Schema(description = "css 样式", example = "btn-visible")
|
||||
@CssClassValid
|
||||
@Size(max = 100, message = "css 样式长度不能超过100个字符")
|
||||
private String cssClass;
|
||||
|
||||
@Schema(description = "备注", example = "我是一个角色")
|
||||
@Size(max = 255, message = "备注长度不能超过255个字符")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
|
||||
+3
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.system.controller.admin.dict.vo.type;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -17,6 +18,7 @@ import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
|
||||
public class DictTypePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "字典类型名称,模糊匹配", example = "晨丰")
|
||||
@Size(max = 100, message = "字典类型名称长度不能超过100个字符")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "字典类型,模糊匹配", example = "sys_common_sex")
|
||||
@@ -24,6 +26,7 @@ public class DictTypePageReqVO extends PageParam {
|
||||
private String type;
|
||||
|
||||
@Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1")
|
||||
@CommonStatus
|
||||
private Integer status;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
|
||||
+3
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.dict.vo.type;
|
||||
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -26,9 +27,11 @@ public class DictTypeSaveReqVO {
|
||||
|
||||
@Schema(description = "状态,参见 CommonStatusEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "状态不能为空")
|
||||
@CommonStatus
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "快乐的备注")
|
||||
@Size(max = 255, message = "备注长度不能超过255个字符")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
|
||||
+2
-46
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.labeltemplate;
|
||||
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.module.system.validation.label.LabelTemplateTypeValid;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -8,22 +8,13 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import com.cf.imes.framework.excel.core.util.ExcelUtils;
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
import com.cf.imes.module.system.controller.admin.labeltemplate.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.labeltemplate.LabelTemplateDO;
|
||||
import com.cf.imes.module.system.service.labeltemplate.LabelTemplateService;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Tag(name = "标签模板管理")
|
||||
@@ -61,24 +52,6 @@ public class LabelTemplateController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得标签模板")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:label-template:query')")
|
||||
@OperateLog(enable = false)
|
||||
public CommonResult<LabelTemplateRespVO> getLabelTemplate(@RequestParam("id") Long id) {
|
||||
return success(labelTemplateService.getLabelTemplate(id));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得标签模板分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:label-template:query')")
|
||||
@OperateLog(enable = false)
|
||||
public CommonResult<PageResult<LabelTemplateRespVO>> getLabelTemplatePage(@Valid LabelTemplatePageReqVO pageReqVO) {
|
||||
PageResult<LabelTemplateDO> pageResult = labelTemplateService.getLabelTemplatePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, LabelTemplateRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/group-list")
|
||||
@Operation(summary = "获得分组标签模板列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:label-template:query')")
|
||||
@@ -92,7 +65,7 @@ public class LabelTemplateController {
|
||||
@Parameter(name = "type", description = "标签类型", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('system:label-template:query','sysTagDesignManager:query')")
|
||||
@OperateLog(enable = false)
|
||||
public CommonResult<LabelTemplateRespVO> getDefaultLabelTemplate(@RequestParam("type") String type) {
|
||||
public CommonResult<LabelTemplateRespVO> getDefaultLabelTemplate(@RequestParam("type") @LabelTemplateTypeValid String type) {
|
||||
return success(labelTemplateService.getDefaultLabelTemplate(type));
|
||||
}
|
||||
|
||||
@@ -102,21 +75,4 @@ public class LabelTemplateController {
|
||||
public CommonResult<Boolean> setDefaultTemplate(@RequestParam Long id) {
|
||||
return success(labelTemplateService.setDefaultTemplate(id));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出标签模板 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('system:label-template:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportLabelTemplateExcel(@Valid LabelTemplatePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<LabelTemplateDO> list = labelTemplateService.getLabelTemplatePage(pageReqVO).getList()
|
||||
.stream().map(m->m.setTemplate(JsonUtils.unzipString(m.getTemplate()))).collect(Collectors.toList());
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "标签模板.xls", "数据", LabelTemplateRespVO.class,
|
||||
BeanUtils.toBean(list, LabelTemplateRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+4
-1
@@ -1,10 +1,11 @@
|
||||
package com.cf.imes.module.system.controller.admin.labeltemplate.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
@@ -16,9 +17,11 @@ import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
|
||||
public class LabelTemplatePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "标签类型", example = "2")
|
||||
@Size(max = 50, message = "标签类型长度不能超过50个字符")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "标签名称", example = "王五")
|
||||
@Size(max = 50, message = "标签名称长度不能超过50个字符")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
|
||||
+4
@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@Schema(description = "管理后台 - 标签模板新增/修改 Request VO")
|
||||
@Data
|
||||
@@ -14,14 +15,17 @@ public class LabelTemplateSaveReqVO {
|
||||
|
||||
@Schema(description = "标签类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "标签类型不能为空")
|
||||
@Size(max = 50, message = "标签类型长度不能超过50个字符")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "标签名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@NotEmpty(message = "标签名称不能为空")
|
||||
@Size(max = 50, message = "标签名称长度不能超过50个字符")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
@Size(max = 255, message = "备注长度不能超过255个字符")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.module.system.controller.admin.notice.vo;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.cf.imes.module.system.controller.admin.organ.vo.organ;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.validation.Mobile;
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.module.system.controller.admin.organ.vo.organ;
|
||||
|
||||
import com.cf.imes.framework.common.validation.Mobile;
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class OrganSaveReqVO {
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "绑定域名", example = "https://www.cf.com")
|
||||
@Size(max = 256, message = "绑定域名长度不能超过256个字符")
|
||||
@Size(max = 255, message = "绑定域名长度不能超过255个字符")
|
||||
private String website;
|
||||
|
||||
@Schema(description = "组织套餐编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.module.system.controller.admin.organ.vo.packages;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -28,7 +28,7 @@ public class TenantPackagePageReqVO extends PageParam {
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "好")
|
||||
@Size(max = 256, message = "备注长度不能超过256个字符")
|
||||
@Size(max = 255, message = "备注长度不能超过255个字符")
|
||||
private String remark;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.organ.vo.packages;
|
||||
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -27,13 +27,13 @@ public class TenantPackageSaveReqVO {
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "好")
|
||||
@Size(max = 256, message = "备注长度不能超过256个字符")
|
||||
@Size(max = 255, message = "备注长度不能超过255个字符")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "关联的菜单编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "关联的菜单编号不能为空")
|
||||
// todo 目前可用菜单数量大概在两百出头,暂时设置为300,后期扩展可以调整
|
||||
@Size(max = 300, message = "关联的菜单编号数量不能超过300")
|
||||
@Size(max = 300, message = "关联的菜单编号数量不能超过300个")
|
||||
private Set<Long> menuIds;
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class PermissionController {
|
||||
@GetMapping("/list-role-menus")
|
||||
// @PreAuthorize("@ss.hasPermission('system:permission:assign-role-menu')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('system:permission:assign-role-menu','base:permission:assign-role-menu')")
|
||||
public CommonResult<Set<Long>> getRoleMenuList(Long roleId) {
|
||||
public CommonResult<Set<Long>> getRoleMenuList(@RequestParam("roleId") Long roleId) {
|
||||
return success(permissionService.getRoleMenuListByRoleId(roleId));
|
||||
}
|
||||
|
||||
|
||||
+7
-1
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.permission;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
@@ -33,8 +34,10 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.ROLE_NOT_EXISTS;
|
||||
import static java.util.Collections.singleton;
|
||||
|
||||
@Tag(name = "管理后台 - 角色")
|
||||
@@ -99,6 +102,9 @@ public class RoleController {
|
||||
@PreAuthorize("@ss.hasAnyPermissions('system:role:query','base:role:query')")
|
||||
public CommonResult<RoleRespVO> getRole(@RequestParam("id") Long id) {
|
||||
RoleDO role = roleService.getRole(id);
|
||||
if (ObjectUtil.isNull(role)) {
|
||||
throw exception(ROLE_NOT_EXISTS);
|
||||
}
|
||||
return success(BeanUtils.toBean(role, RoleRespVO.class));
|
||||
}
|
||||
|
||||
@@ -106,7 +112,7 @@ public class RoleController {
|
||||
@Operation(summary = "获得角色分页")
|
||||
// @PreAuthorize("@ss.hasPermission('system:role:query')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('system:role:query','base:role:query')")
|
||||
public CommonResult<PageResult<RoleRespVO>> getRolePage(RolePageReqVO pageReqVO) {
|
||||
public CommonResult<PageResult<RoleRespVO>> getRolePage(@Valid RolePageReqVO pageReqVO) {
|
||||
PageResult<RoleDO> pageResult = roleService.getRolePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, RoleRespVO.class));
|
||||
}
|
||||
|
||||
+6
@@ -1,18 +1,24 @@
|
||||
package com.cf.imes.module.system.controller.admin.permission.vo.menu;
|
||||
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@Schema(description = "管理后台 - 菜单列表 Request VO")
|
||||
@Data
|
||||
public class MenuListReqVO {
|
||||
|
||||
@Schema(description = "菜单名称,模糊匹配", example = "晨丰")
|
||||
@Size(max = 50, message = "菜单名称长度不能超过50个字符")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "菜单状态,参见 CommonStatusEnum 枚举类", example = "1")
|
||||
@CommonStatus
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1")
|
||||
@CommonStatus
|
||||
private Integer visiable;
|
||||
}
|
||||
|
||||
+6
-1
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.permission.vo.menu;
|
||||
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -21,6 +22,7 @@ public class MenuSaveVO {
|
||||
|
||||
@Schema(description = "权限标识,仅菜单类型为按钮时,才需要传递", example = "sys:menu:add")
|
||||
@Size(max = 100)
|
||||
@Size(max = 100, message = "权限标识长度不能超过100个字符")
|
||||
private String permission;
|
||||
|
||||
@Schema(description = "类型,参见 MenuTypeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@@ -40,17 +42,20 @@ public class MenuSaveVO {
|
||||
private String path;
|
||||
|
||||
@Schema(description = "菜单图标,仅菜单类型为菜单或者目录时,才需要传", example = "/menu/list")
|
||||
@Size(max = 100, message = "菜单图标长度不能超过100个字符")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "组件路径,仅菜单类型为菜单时,才需要传", example = "system/post/index")
|
||||
@Size(max = 200, message = "组件路径不能超过255个字符")
|
||||
@Size(max = 255, message = "组件路径不能超过255个字符")
|
||||
private String component;
|
||||
|
||||
@Schema(description = "组件名", example = "SystemUser")
|
||||
@Size(max = 255, message = "组件名长度不能超过255个字符")
|
||||
private String componentName;
|
||||
|
||||
@Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "状态不能为空")
|
||||
@CommonStatus
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否可见", example = "false")
|
||||
|
||||
+3
@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -16,6 +17,8 @@ public class PermissionAssignRoleMenuReqVO {
|
||||
private Long roleId;
|
||||
|
||||
@Schema(description = "菜单编号列表", example = "1,3,5")
|
||||
// todo 目前可用菜单数量大概在两百出头,暂时设置为300,后期扩展可以调整
|
||||
@Size(max = 300, message = "关联的菜单编号数量不能超过300个")
|
||||
private Set<Long> menuIds = Collections.emptySet(); // 兜底
|
||||
|
||||
@Schema(description = "组织id")
|
||||
|
||||
+2
@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -16,6 +17,7 @@ public class PermissionAssignRoleUserReqVO {
|
||||
private Long roleId;
|
||||
|
||||
@Schema(description = "用户编号列表", example = "1,3,5")
|
||||
@Size(max = 300, message = "关联的用户编号数量不能超过300个")
|
||||
private Set<Long> userIds = Collections.emptySet();
|
||||
|
||||
@Schema(description = "组织id")
|
||||
|
||||
+5
@@ -1,11 +1,13 @@
|
||||
package com.cf.imes.module.system.controller.admin.permission.vo.role;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
@@ -16,12 +18,15 @@ import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
|
||||
public class RolePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "角色名称,模糊匹配", example = "晨丰")
|
||||
@Size(max = 30, message = "角色名称长度不能超过30个字符")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "角色标识,模糊匹配", example = "chenfeng")
|
||||
@Size(max = 100, message = "角色标识长度不能超过100个字符")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1")
|
||||
@CommonStatus
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]")
|
||||
|
||||
+3
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.permission.vo.role;
|
||||
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -29,9 +30,11 @@ public class RoleSaveReqVO {
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "备注", example = "我是一个角色")
|
||||
@Size(max = 255, message = "备注长度不能超过255个字符")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "状态 0开启1关闭" )
|
||||
@CommonStatus
|
||||
private Integer status;
|
||||
|
||||
private Long organId;
|
||||
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.permission.vo.role;
|
||||
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.validation.InEnum;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -17,7 +16,7 @@ public class RoleUpdateStatusReqVO {
|
||||
|
||||
@Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "状态不能为空")
|
||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
|
||||
@CommonStatus
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
||||
+8
@@ -1,12 +1,16 @@
|
||||
package com.cf.imes.module.system.controller.admin.sms.vo.log;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.validation.Mobile;
|
||||
import com.cf.imes.module.system.validation.sms.SmsReceiveStatusValid;
|
||||
import com.cf.imes.module.system.validation.sms.SmsSendStatusValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
@@ -24,9 +28,12 @@ public class SmsLogPageReqVO extends PageParam {
|
||||
private Long templateId;
|
||||
|
||||
@Schema(description = "手机号", example = "15601691300")
|
||||
@Mobile
|
||||
@Size(max = 11, message = "手机号长度不能超过 11 个字符")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "发送状态,参见 SmsSendStatusEnum 枚举类", example = "1")
|
||||
@SmsSendStatusValid
|
||||
private Integer sendStatus;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@@ -34,6 +41,7 @@ public class SmsLogPageReqVO extends PageParam {
|
||||
private LocalDateTime[] sendTime;
|
||||
|
||||
@Schema(description = "接收状态,参见 SmsReceiveStatusEnum 枚举类", example = "0")
|
||||
@SmsReceiveStatusValid
|
||||
private Integer receiveStatus;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
|
||||
+8
-4
@@ -1,12 +1,15 @@
|
||||
package com.cf.imes.module.system.controller.admin.sms.vo.template;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.sms.SmsTemplateTypeValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
@@ -17,19 +20,20 @@ import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
|
||||
@ToString(callSuper = true)
|
||||
public class SmsTemplatePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "短信签名", example = "1")
|
||||
@Schema(description = "短信模板类型", example = "1")
|
||||
@SmsTemplateTypeValid
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "开启状态", example = "1")
|
||||
@CommonStatus
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "模板编码,模糊匹配", example = "test_01")
|
||||
@Size(max = 64, message = "模板编码长度不能超过64个字符")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "模板内容,模糊匹配", example = "你好,{name}。你长的太{like}啦!")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "短信 API 的模板编号,模糊匹配", example = "4383920")
|
||||
@Size(max = 64, message = "短信 API 的模板编号长度不能超过64个字符")
|
||||
private String apiTemplateId;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
|
||||
+5
@@ -1,5 +1,7 @@
|
||||
package com.cf.imes.module.system.controller.admin.sms.vo.template;
|
||||
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.sms.SmsTemplateTypeValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
@@ -15,10 +17,12 @@ public class SmsTemplateSaveReqVO {
|
||||
|
||||
@Schema(description = "短信类型,参见 SmsTemplateTypeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "短信类型不能为空")
|
||||
@SmsTemplateTypeValid
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "开启状态,参见 CommonStatusEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "开启状态不能为空")
|
||||
@CommonStatus
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "模板编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "test_01")
|
||||
@@ -37,6 +41,7 @@ public class SmsTemplateSaveReqVO {
|
||||
private String content;
|
||||
|
||||
@Schema(description = "备注", example = "哈哈哈")
|
||||
@Length(max = 255, message = "备注长度不能超过255个字符")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "短信 API 的模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "4383920")
|
||||
|
||||
+6
@@ -1,9 +1,11 @@
|
||||
package com.cf.imes.module.system.controller.admin.sms.vo.template;
|
||||
|
||||
import com.cf.imes.framework.common.validation.Mobile;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Map;
|
||||
|
||||
@Schema(description = "管理后台 - 短信模板的发送 Request VO")
|
||||
@@ -12,13 +14,17 @@ public class SmsTemplateSendReqVO {
|
||||
|
||||
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601691300")
|
||||
@NotNull(message = "手机号不能为空")
|
||||
@Mobile
|
||||
@Size(max = 11, message = "手机号长度不能超过11个字符")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "模板编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "test_01")
|
||||
@NotNull(message = "模板编码不能为空")
|
||||
@Size(max = 64, message = "模板编码长度不能超过64个字符")
|
||||
private String templateCode;
|
||||
|
||||
@Schema(description = "模板参数")
|
||||
@Size(max = 10, message = "模板参数数量不能超过10个")
|
||||
private Map<String, Object> templateParams;
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.user.vo.profile;
|
||||
|
||||
import com.cf.imes.module.system.validation.system.user.Sex;
|
||||
import com.cf.imes.module.system.validation.user.SexValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class UserProfileUpdateReqVO {
|
||||
private String email;
|
||||
|
||||
@Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1")
|
||||
@Sex
|
||||
@SexValid
|
||||
private Integer sex;
|
||||
|
||||
private Long organId;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.cf.imes.module.system.controller.admin.user.vo.user;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.validation.Mobile;
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
package com.cf.imes.module.system.controller.admin.user.vo.user;
|
||||
|
||||
import com.cf.imes.framework.common.validation.Mobile;
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.system.user.Sex;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.user.SexValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class UserSaveReqVO {
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "备注", example = "我是一个用户")
|
||||
@Size(max = 256, message = "备注长度不能超过256个字符")
|
||||
@Size(max = 255, message = "备注长度不能超过255个字符")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "部门ID", example = "我是一个用户")
|
||||
@@ -45,7 +45,7 @@ public class UserSaveReqVO {
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1")
|
||||
@Sex
|
||||
@SexValid
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "用户头像", example = "https://www.cf.com/xxx.png")
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.user.vo.user;
|
||||
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
-1
@@ -19,7 +19,6 @@ public interface SmsTemplateMapper extends BaseMapperX<SmsTemplateDO> {
|
||||
.eqIfPresent(SmsTemplateDO::getType, reqVO.getType())
|
||||
.eqIfPresent(SmsTemplateDO::getStatus, reqVO.getStatus())
|
||||
.likeIfPresent(SmsTemplateDO::getCode, reqVO.getCode())
|
||||
.likeIfPresent(SmsTemplateDO::getContent, reqVO.getContent())
|
||||
.likeIfPresent(SmsTemplateDO::getApiTemplateId, reqVO.getApiTemplateId())
|
||||
.betweenIfPresent(SmsTemplateDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(SmsTemplateDO::getId));
|
||||
|
||||
-18
@@ -2,8 +2,6 @@ package com.cf.imes.module.system.service.labeltemplate;
|
||||
|
||||
import java.util.*;
|
||||
import com.cf.imes.module.system.controller.admin.labeltemplate.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.labeltemplate.LabelTemplateDO;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@@ -36,22 +34,6 @@ public interface LabelTemplateService {
|
||||
*/
|
||||
void deleteLabelTemplate(Long id);
|
||||
|
||||
/**
|
||||
* 获得标签模板
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 标签模板
|
||||
*/
|
||||
LabelTemplateRespVO getLabelTemplate(Long id);
|
||||
|
||||
/**
|
||||
* 获得标签模板分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 标签模板分页
|
||||
*/
|
||||
PageResult<LabelTemplateDO> getLabelTemplatePage(LabelTemplatePageReqVO pageReqVO);
|
||||
|
||||
// ==================== 子表(标签元素模板) ====================
|
||||
|
||||
|
||||
|
||||
-14
@@ -11,7 +11,6 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import com.cf.imes.module.system.controller.admin.labeltemplate.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.labeltemplate.LabelTemplateDO;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.system.dal.mysql.labeltemplate.LabelTemplateMapper;
|
||||
import javax.annotation.Resource;
|
||||
@@ -74,19 +73,6 @@ public class LabelTemplateServiceImpl implements LabelTemplateService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public LabelTemplateRespVO getLabelTemplate(Long id) {
|
||||
LabelTemplateDO labelTemplateDO = labelTemplateMapper.selectById(id);
|
||||
labelTemplateDO.setTemplate(JsonUtils.unzipString(labelTemplateDO.getTemplate()));
|
||||
LabelTemplateRespVO labelTemplateRespVO = BeanUtils.toBean(labelTemplateDO, LabelTemplateRespVO.class);
|
||||
return labelTemplateRespVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<LabelTemplateDO> getLabelTemplatePage(LabelTemplatePageReqVO pageReqVO) {
|
||||
return labelTemplateMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, List<LabelTemplateRespVO>> getGroupList() {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.validation.system.common;
|
||||
package com.cf.imes.module.system.validation.common;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.validation.system.common;
|
||||
package com.cf.imes.module.system.validation.common;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.validation.system.dict;
|
||||
package com.cf.imes.module.system.validation.dict;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.validation.system.dict;
|
||||
package com.cf.imes.module.system.validation.dict;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.cf.imes.module.system.validation.label;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 标签模版类型校验注解
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/15 10:42
|
||||
*/
|
||||
@Target({
|
||||
ElementType.FIELD,
|
||||
ElementType.PARAMETER
|
||||
})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Constraint(
|
||||
validatedBy = {LabelTemplateTypeValidator.class}
|
||||
)
|
||||
public @interface LabelTemplateTypeValid {
|
||||
String message() default "标签模板类型不合法";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.cf.imes.module.system.validation.label;
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.module.system.enums.label.LabelTemplateType;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
/**
|
||||
* 标签模版类型校验器
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/15 10:43
|
||||
*/
|
||||
public class LabelTemplateTypeValidator implements ConstraintValidator<LabelTemplateTypeValid, String> {
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||
// 非空使用@NotBlank等进行校验
|
||||
if (CharSequenceUtil.isEmpty(value)) {
|
||||
return true;
|
||||
}
|
||||
for (LabelTemplateType type : LabelTemplateType.values()) {
|
||||
if (ObjectUtil.equal(type.getType(), value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.cf.imes.module.system.validation.sms;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 短信接收状态校验注解
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/15 13:46
|
||||
*/
|
||||
@Target({
|
||||
ElementType.FIELD,
|
||||
})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Constraint(
|
||||
validatedBy = {SmsReceiveStatusValidator.class}
|
||||
)
|
||||
public @interface SmsReceiveStatusValid {
|
||||
String message() default "短信接收状态不合法";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.cf.imes.module.system.validation.sms;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.module.system.enums.sms.SmsReceiveStatusEnum;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
/**
|
||||
* 短信接收状态校验器
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/15 13:47
|
||||
*/
|
||||
public class SmsReceiveStatusValidator implements ConstraintValidator<SmsReceiveStatusValid, Integer> {
|
||||
@Override
|
||||
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
||||
if (ObjectUtil.isNull(value)) {
|
||||
return true;
|
||||
}
|
||||
for (SmsReceiveStatusEnum statusEnum : SmsReceiveStatusEnum.values()) {
|
||||
if (ObjectUtil.equal(statusEnum.getStatus(), value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.cf.imes.module.system.validation.sms;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 短信发送状态校验注解
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/15 13:46
|
||||
*/
|
||||
@Target({
|
||||
ElementType.FIELD,
|
||||
})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Constraint(
|
||||
validatedBy = {SmsSendStatusValidator.class}
|
||||
)
|
||||
public @interface SmsSendStatusValid {
|
||||
String message() default "短信发送状态不合法";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.cf.imes.module.system.validation.sms;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.module.system.enums.sms.SmsSendStatusEnum;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
/**
|
||||
* 短信发送状态校验器
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/15 13:47
|
||||
*/
|
||||
public class SmsSendStatusValidator implements ConstraintValidator<SmsSendStatusValid, Integer> {
|
||||
@Override
|
||||
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
||||
if (ObjectUtil.isNull(value)) {
|
||||
return true;
|
||||
}
|
||||
for (SmsSendStatusEnum statusEnum : SmsSendStatusEnum.values()) {
|
||||
if (ObjectUtil.equal(statusEnum.getStatus(), value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.cf.imes.module.system.validation.sms;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 短信模版校验注解
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/15 13:46
|
||||
*/
|
||||
@Target({
|
||||
ElementType.FIELD,
|
||||
})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Constraint(
|
||||
validatedBy = {SmsTemplateTypeValidator.class}
|
||||
)
|
||||
public @interface SmsTemplateTypeValid {
|
||||
String message() default "短信模板类型不合法";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.cf.imes.module.system.validation.sms;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.module.system.enums.sms.SmsTemplateTypeEnum;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
/**
|
||||
* 短信模版校验器
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/15 13:47
|
||||
*/
|
||||
public class SmsTemplateTypeValidator implements ConstraintValidator<SmsTemplateTypeValid, Integer> {
|
||||
@Override
|
||||
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
||||
if (ObjectUtil.isNull(value)) {
|
||||
return true;
|
||||
}
|
||||
for (SmsTemplateTypeEnum templateTypeEnum : SmsTemplateTypeEnum.values()) {
|
||||
if (ObjectUtil.equal(templateTypeEnum.getType(), value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.validation.system.user;
|
||||
package com.cf.imes.module.system.validation.user;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
@@ -22,7 +22,7 @@ import java.lang.annotation.Target;
|
||||
@Constraint(
|
||||
validatedBy = {SexValidator.class}
|
||||
)
|
||||
public @interface Sex {
|
||||
public @interface SexValid {
|
||||
String message() default "性别不合法,1:男、2:女";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.validation.system.user;
|
||||
package com.cf.imes.module.system.validation.user;
|
||||
|
||||
import com.cf.imes.module.system.enums.common.SexEnum;
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.Objects;
|
||||
* @author Gqr
|
||||
* @since 2024/10/12 9:50
|
||||
*/
|
||||
public class SexValidator implements ConstraintValidator<Sex, Integer> {
|
||||
public class SexValidator implements ConstraintValidator<SexValid, Integer> {
|
||||
|
||||
@Override
|
||||
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
||||
-1
@@ -217,7 +217,6 @@ public class SmsTemplateServiceImplTest extends BaseDbUnitTest {
|
||||
reqVO.setType(SmsTemplateTypeEnum.PROMOTION.getType());
|
||||
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
reqVO.setCode("tu");
|
||||
reqVO.setContent("晨丰");
|
||||
reqVO.setApiTemplateId("yu");
|
||||
reqVO.setCreateTime(buildBetweenTime(2021, 11, 1, 2021, 12, 1));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user