zxl
2025-04-02 419104df560d427e9cfb610bb6549dcfe695822d
business/src/main/java/com/ycl/service/impl/CodingRulerServiceImpl.java
@@ -17,6 +17,7 @@
import com.ycl.framework.utils.PageUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.stream.Collectors;
@@ -150,4 +151,30 @@
        baseMapper.updateById(codingRuler);
        return Result.ok(msg);
    }
    /**
     * 获得启动的赋码规则
     * @return 存放的字段 yellowRuler启用的黄码规则,redRuler启用的红码规则
     */
    @Override
    public Result getStartRuler() {
        Result result = new Result();
        //获得启用的赋码规则
        List<CodingRulerVO> codingRulerVOS = codingRulerMapper.getStartRuler();
        if (CollectionUtils.isEmpty(codingRulerVOS)){
            log.error("未启用赋码规则");
            return result;
        }
        CodingRulerVO yellowRuler = null;
        CodingRulerVO redRuler = null;
        for (CodingRulerVO codingRulerVO : codingRulerVOS){
            if (CodingRulerCodeTypeEnum.YELLOW.getValue().equals(codingRulerVO.getProjectCodeType())){
                yellowRuler = codingRulerVO;
            }else if (CodingRulerCodeTypeEnum.RED.getValue().equals(codingRulerVO.getProjectCodeType())){
                redRuler = codingRulerVO;
            }
        }
        result.put("yellowRuler",yellowRuler);
        result.put("redRuler",redRuler);
        return result;
    }
}