소스 검색

feat: 修复维修费统计接口错误

weijianghai 10 달 전
부모
커밋
f895a4e445
1개의 변경된 파일15개의 추가작업 그리고 5개의 파일을 삭제
  1. 15 5
      src/main/java/com/example/service/impl/WzHouseMaintenaCostServiceImpl.java

+ 15 - 5
src/main/java/com/example/service/impl/WzHouseMaintenaCostServiceImpl.java

@@ -10,9 +10,12 @@ import com.example.entity.vo.HighFrequencyVo;
 import com.example.service.WzHouseMaintenaCostService;
 import com.example.service.WzOtnAreaService;
 import com.example.utils.Query;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -209,16 +212,23 @@ public class WzHouseMaintenaCostServiceImpl implements WzHouseMaintenaCostServic
         if(map.get("county")!=null&&map.get("county").toString().equals("")){
             map.remove("county");
         }
-        if(map.get("statisticalMonth")!=null&&!map.get("statisticalMonth").toString().equals("")&&!map.get("statisticalMonth").toString().equals("账期")){
-            map.put("statisticalMonth",Integer.valueOf(map.get("statisticalMonth").toString()));
-        }else{
-            map.remove("statisticalMonth");
-        }
         if(map.get("statisticalMonth1")!=null&&!map.get("statisticalMonth1").toString().equals("")){
+            String statisticalMonth1 = (String) map.get("statisticalMonth1");
+            if (map.get("statisticalMonth") == null || StringUtils.isBlank((String) map.get("statisticalMonth"))) {
+                String statisticalMonth =
+                        LocalDate.parse(statisticalMonth1 + "01", DateTimeFormatter.ofPattern("yyyyMMdd"))
+                                .withDayOfYear(1).format(DateTimeFormatter.ofPattern("yyyyMM"));
+                map.put("statisticalMonth", statisticalMonth);
+            }
             map.put("statisticalMonth1",Integer.valueOf(map.get("statisticalMonth1").toString()));
         }else{
             map.remove("statisticalMonth1");
         }
+        if(map.get("statisticalMonth")!=null&&!map.get("statisticalMonth").toString().equals("")&&!map.get("statisticalMonth").toString().equals("账期")){
+            map.put("statisticalMonth",Integer.valueOf(map.get("statisticalMonth").toString()));
+        }else{
+            map.remove("statisticalMonth");
+        }
     }