Explorar o código

物品申购规则引擎生成编号

大数据与最优化研究所 hai 1 ano
pai
achega
bd9ade285d

+ 7 - 7
src/main/java/com/xjrsoft/module/ledger/service/impl/WfSubscriptionServiceImpl.java

@@ -19,6 +19,8 @@ import com.xjrsoft.module.ledger.vo.WfSubscriptionListInfoVo;
 import com.xjrsoft.module.ledger.vo.WfSubscriptionListVo;
 import com.xjrsoft.module.ledger.vo.WfSubscriptionPageVo;
 import com.xjrsoft.module.ledger.vo.WorkflowRecordVo;
+import com.xjrsoft.module.student.entity.BaseStudentAssessmentItem;
+import com.xjrsoft.module.student.vo.BaseStudentAssessmentItemPageVo;
 import com.xjrsoft.module.system.entity.File;
 import com.xjrsoft.module.system.service.IFileService;
 import com.xjrsoft.module.textbook.entity.WfTextbookRecede;
@@ -207,18 +209,16 @@ public class WfSubscriptionServiceImpl extends MPJBaseServiceImpl<WfSubscription
             //获取当前内存中的最大编号
             LambdaQueryWrapper<WfSubscription> wfSubscriptionLambdaQueryWrapper = new LambdaQueryWrapper<>();
             wfSubscriptionLambdaQueryWrapper
-                    .select(WfSubscription::getNumber)
+                    .select(WfSubscription.class, x -> VoToColumnUtil.fieldsToColumns(WfSubscription.class).contains(x.getProperty()))
                     .orderByDesc(WfSubscription::getNumber)
                     .last("limit 1");
             WfSubscription wfSubscriptionMax = this.getOne(wfSubscriptionLambdaQueryWrapper);
             if(wfSubscriptionMax != null){
                 String number = wfSubscriptionMax.getNumber();
                 String ysarStr = "";
-                String lastThreeChars = "";
                 if(number != null && number.length() >= 3) {
                     number = number.trim();
                     ysarStr = number.substring(0, number.length() - 3);
-                    lastThreeChars = number.substring(number.length() - 3);
                 }
 
                 Date shenQingRiQi = wfSubscription.getShenQingRiQi4752();
@@ -229,11 +229,11 @@ public class WfSubscriptionServiceImpl extends MPJBaseServiceImpl<WfSubscription
                 WfSubscription wfSubscriptionNew = new WfSubscription();
 
                 if(year.equals(ysarStr)){
-                    int num = Integer.parseInt(lastThreeChars);
+                    int num = Integer.parseInt(number);
                     num = num + 1;
-                    wfSubscriptionNew.setNumber(ysarStr+num);
+                    wfSubscriptionNew.setNumber(String.valueOf(num));
                 }else {
-                    wfSubscriptionNew.setNumber(ysarStr+"001");
+                    wfSubscriptionNew.setNumber(year+"001");
                 }
                 wfSubscriptionNew.setId(wfSubscription.getId());
                 wfSubscriptionNew.setStatus(1);
@@ -245,7 +245,7 @@ public class WfSubscriptionServiceImpl extends MPJBaseServiceImpl<WfSubscription
 
                 String year = String.valueOf(localDate.getYear());
                 WfSubscription wfSubscriptionNew = new WfSubscription();
-                wfSubscriptionNew.setNumber(year+"001");
+                wfSubscriptionNew.setNumber(year + "001");
                 wfSubscriptionNew.setId(wfSubscription.getId());
                 wfSubscriptionNew.setStatus(1);
 

+ 1 - 1
src/test/java/com/xjrsoft/module/ledger/service/impl/WfSubscriptionServiceImplTest.java

@@ -12,6 +12,6 @@ class WfSubscriptionServiceImplTest {
     private IWfSubscriptionService wfSubscriptionService;
     @Test
     void dataHandle() {
-        wfSubscriptionService.dataHandle(1732758742634655744L);
+        wfSubscriptionService.dataHandle(1764944082720788480L);
     }
 }