Browse Source

Merge branch 'server-165' of uskycloud/usky-modules into master

gez 1 year ago
parent
commit
b684401302

+ 33 - 5
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionRecordServiceImpl.java

@@ -103,9 +103,15 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
         List<PatrolInspectionRecordPicture> patrolInspectionRecordPictureList = patrolInspectionRecordPictureService.list(queryWrapperOne);
 
         //内容选中项查询
+        List<Integer> contentOptionIdList = new ArrayList<>();
         LambdaQueryWrapper<PatrolInspectionRecordOption> queryWrapperTwo = Wrappers.lambdaQuery();
         queryWrapperTwo.eq(PatrolInspectionRecordOption::getRecordId, id);
         List<PatrolInspectionRecordOption> patrolInspectionRecordOptionList = patrolInspectionRecordOptionService.list(queryWrapperTwo);
+        for (int i = 0; i < patrolInspectionRecordOptionList.size(); i++) {
+            if (patrolInspectionRecordOptionList.get(i).getContentOptionId() != null) {
+                contentOptionIdList.add(patrolInspectionRecordOptionList.get(i).getContentOptionId());
+            }
+        }
 
         //地点内容ID查询
         LambdaQueryWrapper<PatrolInspectionSiteContent> queryWrapperThree = Wrappers.lambdaQuery();
@@ -164,13 +170,35 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
             patrolInspectionContentVo.setEnable(patrolInspectionContentList.get(i).getEnable());
             patrolInspectionContentVo.setCompanyId(patrolInspectionContentList.get(i).getCompanyId());
             List<ContentOptionVo> contentOptionVoListOne = new ArrayList<>();
-            for (int j = 0; j < contentOptionVoList.size(); j++) {
-                if (patrolInspectionContentList.get(i).getId() == contentOptionVoList.get(j).getContentId()) {
-                    patrolInspectionContentVo.setRemarks(contentOptionVoList.get(j).getRemarks());
-                    contentOptionVoListOne.add(contentOptionVoList.get(j));
+
+            if (patrolInspectionContentList.get(i).getSubmissionMethod() == 3) {
+                for (int j = 0; j < patrolInspectionRecordOptionList.size(); j++) {
+                    if (patrolInspectionRecordOptionList.get(j).getContentOptionId() == null || patrolInspectionRecordOptionList.get(j).getContentOptionId() == 0) {
+                        int id11 = patrolInspectionContentList.get(i).getId();
+                        int id22 = patrolInspectionRecordOptionList.get(j).getContentId();
+                        if (id11 == id22) {
+                            if (patrolInspectionRecordOptionList.get(j).getRemarks() != null && !"".equals(patrolInspectionRecordOptionList.get(j).getRemarks())) {
+                                patrolInspectionContentVo.setRemarks(patrolInspectionRecordOptionList.get(j).getRemarks());
+                            }
+                            patrolInspectionContentVo.setContent(patrolInspectionRecordOptionList.get(j).getContent());
+                        }
+                    }
+                }
+            } else {
+                for (int j = 0; j < contentOptionVoList.size(); j++) {
+                    int id1 = patrolInspectionContentList.get(i).getId();
+                    int id2 = contentOptionVoList.get(j).getContentId();
+                    if (id1 == id2) {
+                        if (contentOptionVoList.get(j).getRemarks() != null && !"".equals(contentOptionVoList.get(j).getRemarks())) {
+                            patrolInspectionContentVo.setRemarks(contentOptionVoList.get(j).getRemarks());
+                        }
+                        contentOptionVoListOne.add(contentOptionVoList.get(j));
+                        patrolInspectionContentVo.setContentOptionVoList(contentOptionVoListOne);
+                    }
                 }
             }
-            patrolInspectionContentVo.setContentOptionVoList(contentOptionVoListOne);
+
+            patrolInspectionContentVo.setContentOptionValue(contentOptionIdList);
             patrolInspectionContentVoList.add(patrolInspectionContentVo);
         }
 

+ 44 - 25
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/DmpProductInfoServiceImpl.java

@@ -288,17 +288,51 @@ public class DmpProductInfoServiceImpl extends AbstractCrudService<DmpProductInf
     @Override
     public List<Object> deviceStatusStatistic(Integer deptId,String productCode) {
         List<Object> list2 = new ArrayList<>();
-        QueryWrapper<DmpDeviceStatus> query = Wrappers.query();
-        query.select("count(*) as count","COUNT(device_status=1 or null) as " +
-                "onCount","COUNT(device_status=2 or null) as offCount")
-                .eq(StringUtils.isNotBlank(productCode),"product_code",productCode);
-        List<Map<String, Object>> list = dmpDeviceStatusService.listMaps(query);
-        QueryWrapper<DmpDeviceInfo> query1 = Wrappers.query();
-        query1.select("count(*) as count","COUNT(service_status=1 or null) as notActiveCount")
-                .eq(StringUtils.isNotBlank(productCode),"product_code",productCode);
-        List<Map<String, Object>> list1 = dmpDeviceInfoService.listMaps(query1);
         Map<String, Object> map = new HashMap<>();
-        if (Integer.valueOf(list.get(0).get("offCount").toString()).equals(0)){
+        LambdaQueryWrapper<DmpDeviceInfo> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(DmpDeviceInfo::getTenantId,SecurityUtils.getTenantId());
+        List<DmpDeviceInfo> deviceList = dmpDeviceInfoService.list(queryWrapper);
+        List<String> deviceIds = new ArrayList<>();
+        if(CollectionUtils.isNotEmpty(deviceList)){
+            for(int i=0;i<deviceList.size();i++){
+                deviceIds.add(deviceList.get(i).getDeviceId());
+            }
+            QueryWrapper<DmpDeviceStatus> query = Wrappers.query();
+            query.select("count(*) as count","COUNT(device_status=1 or null) as " +
+                    "onCount","COUNT(device_status=2 or null) as offCount")
+                    .eq(StringUtils.isNotBlank(productCode),"product_code",productCode)
+                    .in("device_id",deviceIds);
+            List<Map<String, Object>> list = dmpDeviceStatusService.listMaps(query);
+            QueryWrapper<DmpDeviceInfo> query1 = Wrappers.query();
+            query1.select("count(*) as count","COUNT(service_status=1 or null) as notActiveCount")
+                    .eq(StringUtils.isNotBlank(productCode),"product_code",productCode)
+                    .eq("tenant_id",SecurityUtils.getTenantId());
+            List<Map<String, Object>> list1 = dmpDeviceInfoService.listMaps(query1);
+            if (Integer.valueOf(list.get(0).get("offCount").toString()).equals(0)){
+                map.put("count", 0);
+                map.put("onCount", 0);
+                map.put("offCount", 0);
+                map.put("notActiveCount", 0);
+                map.put("onCountBig", 0);
+                map.put("offCountBig", 0);
+                map.put("notActiveCountBig", 0);
+            }else {
+                BigDecimal onCountBig = new BigDecimal(Integer.valueOf(list.get(0).get("onCount").toString()));
+                BigDecimal temp = new BigDecimal(Integer.valueOf(list.get(0).get("count").toString()));
+                onCountBig = onCountBig.divide(temp,2,RoundingMode.HALF_UP);
+                BigDecimal offCountBig = new BigDecimal(Integer.valueOf(list.get(0).get("offCount").toString()));
+                offCountBig = offCountBig.divide(temp,2,RoundingMode.HALF_UP);
+                BigDecimal notActiveCountBig = new BigDecimal(Integer.valueOf(list1.get(0).get("notActiveCount").toString()));
+                notActiveCountBig = notActiveCountBig.divide(temp,2,RoundingMode.HALF_UP);
+                map.put("count", Integer.valueOf(list.get(0).get("count").toString()));
+                map.put("onCount", Integer.valueOf(list.get(0).get("onCount").toString()));
+                map.put("offCount", Integer.valueOf(list.get(0).get("offCount").toString()));
+                map.put("notActiveCount", Integer.valueOf(list1.get(0).get("notActiveCount").toString()));
+                map.put("onCountBig", onCountBig);
+                map.put("offCountBig", offCountBig);
+                map.put("notActiveCountBig", notActiveCountBig);
+            }
+        }else {
             map.put("count", 0);
             map.put("onCount", 0);
             map.put("offCount", 0);
@@ -306,21 +340,6 @@ public class DmpProductInfoServiceImpl extends AbstractCrudService<DmpProductInf
             map.put("onCountBig", 0);
             map.put("offCountBig", 0);
             map.put("notActiveCountBig", 0);
-        }else {
-            BigDecimal onCountBig = new BigDecimal(Integer.valueOf(list.get(0).get("onCount").toString()));
-            BigDecimal temp = new BigDecimal(Integer.valueOf(list.get(0).get("count").toString()));
-            onCountBig = onCountBig.divide(temp,2,RoundingMode.HALF_UP);
-            BigDecimal offCountBig = new BigDecimal(Integer.valueOf(list.get(0).get("offCount").toString()));
-            offCountBig = offCountBig.divide(temp,2,RoundingMode.HALF_UP);
-            BigDecimal notActiveCountBig = new BigDecimal(Integer.valueOf(list1.get(0).get("notActiveCount").toString()));
-            notActiveCountBig = notActiveCountBig.divide(temp,2,RoundingMode.HALF_UP);
-            map.put("count", Integer.valueOf(list.get(0).get("count").toString()));
-            map.put("onCount", Integer.valueOf(list.get(0).get("onCount").toString()));
-            map.put("offCount", Integer.valueOf(list.get(0).get("offCount").toString()));
-            map.put("notActiveCount", Integer.valueOf(list1.get(0).get("notActiveCount").toString()));
-            map.put("onCountBig", onCountBig);
-            map.put("offCountBig", offCountBig);
-            map.put("notActiveCountBig", notActiveCountBig);
         }
         list2.add(map);
         return list2;

+ 1 - 0
service-issue/service-issue-biz/src/main/java/com/usky/issue/controller/web/SpHj2017Controller.java

@@ -18,6 +18,7 @@ import java.util.*;
  * @author fu
  * @since 2023-12-13
  */
+@CrossOrigin
 @RestController
 @RequestMapping("/spHj2017")
 public class SpHj2017Controller {

+ 1 - 0
service-issue/service-issue-biz/src/main/java/com/usky/issue/controller/web/YtDeviceStatusController.java

@@ -21,6 +21,7 @@ import java.util.Map;
  * @author fu
  * @since 2023-11-23
  */
+@CrossOrigin
 @RestController
 @RequestMapping("/ytDeviceStatus")
 public class YtDeviceStatusController {

+ 1 - 1
service-website/service-website-biz/src/main/java/com/usky/website/service/impl/SiteArticleServiceImpl.java

@@ -67,7 +67,7 @@ public class SiteArticleServiceImpl extends AbstractCrudService<SiteArticleMappe
 
         for (int i = 0; i < page.getRecords().size(); i++) {
             for (int j = 0; j < list.size(); j++) {
-                if (page.getRecords().get(i).getCategoryid() == list.get(j).getId()) {
+                if (page.getRecords().get(i).getCategoryid().equals(list.get(j).getId())) {
                     page.getRecords().get(i).setCategoryName(list.get(j).getCategoryName());
                 }
             }