Browse Source

2.3第二条完成

邓凯 2 years ago
parent
commit
9f03c9142b

+ 3 - 0
common/src/main/resources/mapper/base/FeedbackOpinion.xml

@@ -183,6 +183,9 @@
 				and a.create_time < #{searchParams.reportDateEnd}
 				]]>
 			</if>
+			<if test="searchParams.year != null">
+				and a.sort_ like #{searchParams.year}
+			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">
 	        ${sort.name} ${sort.order}

+ 3 - 3
web/src/main/java/com/jpsoft/excellent/modules/open/FeedbackOpinionApiController.java

@@ -99,13 +99,13 @@ public class FeedbackOpinionApiController {
         MessageResult<FeedbackOpinion> msgResult = new MessageResult<>();
 
         try {
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
             String lastSort = feedbackOpinionService.getLastSort(sdf.format(new Date()) + "%");
             if(lastSort == null){
-                lastSort = sdf.format(new Date()) + "0001";
+                lastSort = sdf.format(new Date()) + "000001";
             }
             else{
-                lastSort = sdf.format(new Date()) + String.format("%04d",Integer.parseInt(lastSort.substring(8)) + 1);
+                lastSort = sdf.format(new Date()) + String.format("%06d",Integer.parseInt(lastSort.substring(4)) + 1);
             }
 
             FeedbackOpinion feedbackOpinion = new FeedbackOpinion();

+ 39 - 0
web/src/main/java/com/jpsoft/excellent/modules/textController.java

@@ -1,9 +1,11 @@
 package com.jpsoft.excellent.modules;
 
+import com.github.pagehelper.Page;
 import com.jpsoft.excellent.config.OSSConfig;
 import com.jpsoft.excellent.modules.base.entity.*;
 import com.jpsoft.excellent.modules.base.service.*;
 import com.jpsoft.excellent.modules.common.dto.MessageResult;
+import com.jpsoft.excellent.modules.common.dto.Sort;
 import com.jpsoft.excellent.modules.common.utils.DES3;
 import com.jpsoft.excellent.modules.common.utils.OSSUtil;
 import com.jpsoft.excellent.modules.common.utils.POIUtils;
@@ -57,6 +59,8 @@ public class textController {
     private AreaService areaService;
     @Autowired
     private WorkStationService workStationService;
+    @Autowired
+    private FeedbackOpinionService feedbackOpinionService;
 
     @ApiOperation(value="短信发送")
     @RequestMapping(value = "sendSMS",method = RequestMethod.POST)
@@ -363,4 +367,39 @@ public class textController {
 
         return msgResult;
     }
+
+    @ApiOperation(value="更新序号")
+    @RequestMapping(value = "updataSortNum",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="year", value="年份", required=true, paramType="query"),
+    })
+    public MessageResult updataSortNum(String year){
+        MessageResult msgResult = new MessageResult();
+
+        try {
+            Map<String,Object> searchParams = new HashMap<>();
+            if (StringUtils.isNotEmpty(year)) {
+                searchParams.put("year", year + "%");
+            }
+
+            List<Sort> sortList = new ArrayList<>();
+            sortList.add(new Sort("sort_","asc"));
+
+            Page<FeedbackOpinion> page = feedbackOpinionService.pageSearch(searchParams,1,1000000,false,sortList);
+            for(int i=0; i<page.size(); i++){
+                FeedbackOpinion feedbackOpinion = page.get(i);
+                feedbackOpinion.setSort(year + String.format("%06d",i+1));
+                feedbackOpinionService.update(feedbackOpinion);
+            }
+
+            msgResult.setResult(true);
+            msgResult.setData(page.getResult());
+        }
+        catch(Exception ex){
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
 }