liusheng
2023-12-19 78ee837585bf67ca1b462db6adbdb8135de05fb8
ruoyi-project/src/main/java/com/ruoyi/project/service/impl/BaseOnlyvalueServiceImpl.java
@@ -49,7 +49,7 @@
    @Override
    public String getOnlyCode(String businessType) {
    public BaseOnlyvalue getOnlyCode(String businessType) {
        LocalDate currentDate = LocalDate.now();
        int year = currentDate.getYear();
        int month = currentDate.getMonthValue();
@@ -58,7 +58,7 @@
        String data = String.valueOf(year) + String.valueOf(month);
        BaseOnlyvalue baseOnlyvalue = new BaseOnlyvalue();
        baseOnlyvalue.setAppentvalue(data);
        baseOnlyvalue.setBusinesstype(businessType);
        List<BaseOnlyvalue> baseOnlyvalues = queryList(baseOnlyvalue);
        if (CollectionUtils.isEmpty(baseOnlyvalues)) {
@@ -68,7 +68,8 @@
            baseOnlyvalue.setBusinesstype(businessType);
            save(baseOnlyvalue);
            return "OPO-" + data + "1";
//            return "OPO-" + data + "1";
            return  baseOnlyvalue;
        } else {
            //则将currentValue+1,重新赋值
            BaseOnlyvalue baseOnlyvalue1 = baseOnlyvalues.get(0);
@@ -76,7 +77,7 @@
            baseOnlyvalue1.setCurrentvalue(newCurrentvalue);
            updateById(baseOnlyvalue1);
            return "OPO-" + data + "" + newCurrentvalue;
            return baseOnlyvalue1;
        }
    }