소스 검색

履职任务NFC标签获取未过滤

jiawuxian 2 년 전
부모
커밋
96dc6ed7d5

+ 4 - 4
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/TaskCreatingServiceImplBase.java

@@ -134,7 +134,7 @@ public abstract class TaskCreatingServiceImplBase<M extends BaseMapper<T>, T> ex
      * @param appPlan
      * @return
      */
-    protected List<Long> getPlanOrgIds(AppPlan appPlan, List<Long> restrictOrgIds) {
+    protected List<SysOrg> getPlanOrgIds(AppPlan appPlan, List<Long> restrictOrgIds) {
         List<Long> orgIds = null;
 //        if (appPlan.getExecType()!=null&&appPlan.getExecType() == 0) {//0机构类型需要安类型去机构里查询所以的机构
         OrgListByTypesConditionEto cond = new OrgListByTypesConditionEto();
@@ -144,7 +144,7 @@ public abstract class TaskCreatingServiceImplBase<M extends BaseMapper<T>, T> ex
         if (ObjectUtil.isNull(r) || ObjectUtil.isEmpty(r.getData())) {
             return new ArrayList<>();
         }
-        orgIds = r.getData().stream().map(i -> i.getId()).collect(Collectors.toList());
+        List<SysOrg> orgs = r.getData();
 //        }
 //        else {
 //            List<SysOrg> sysOrgs = orgService.selectByOrgType(appPlan.getExecOrgType(), SecurityConstants.INNER);
@@ -152,10 +152,10 @@ public abstract class TaskCreatingServiceImplBase<M extends BaseMapper<T>, T> ex
 ////            orgIds = appPlanService.findExecOrgByPlan(appPlan.getId());
 //        }
         if (CollectionUtil.isNotEmpty(restrictOrgIds)) {
-            return orgIds.stream().filter(id -> restrictOrgIds.contains(id)).collect(Collectors.toList());
+            return orgs.stream().filter(org -> restrictOrgIds.contains(org.getId())).collect(Collectors.toList());
         }
 
-        return orgIds;
+        return orgs;
     }
 
 //    protected List<SysOrg> getPlanOrgs(AppPlan appPlan) {

+ 18 - 16
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/gx/service/ResumptionServiceImpl.java

@@ -264,28 +264,29 @@ public class ResumptionServiceImpl implements ResumptionService {
 //            }
         }
 
-        List<ResumptionNFCVo> orgNFCs = resumptionMapper.selectNFCOfOrg(resumption.getId(), resumption.getOrgId());
+        List<ResumptionNFCVo> orgAllNFCs = resumptionMapper.selectNFCOfOrg(resumption.getId(), resumption.getOrgId());
+        final Set<Long> usedNFCID = new HashSet<>();
         if (!isExist) {
             //未保存过时,根据NFC-点位-区域的关系,将绑定到点位的履职内容拆解到各个区域。
             List<ResumptionPlanVo> supplementItems = new ArrayList<>();
 
             for (ResumptionPlanVo resumptionPlanVo : resumptionPlanVos) {
-
                 if (ObjectUtil.isNotNull(resumptionPlanVo.getCheckId()) && ObjectUtil.isNull(resumptionPlanVo.getAreaId())) {
 
-                    /*Map<Long, List<ResumptionNFCVo>> areaGroup = orgNFCs.stream()
+                    /*Map<Long, List<ResumptionNFCVo>> areaGroup = orgAllNFCs.stream()
                             .filter(n -> ObjectUtil.equal(n.getCheckId(), resumptionPlanVo.getCheckId()))
                             .collect(Collectors.groupingBy(n -> n.getAreaId()));
                     */
-                    Map<Long,List<ResumptionNFCVo>> areaGroup = new HashMap<>();
+                    Map<Long, List<ResumptionNFCVo>> areaGroup = new HashMap<>();
                     List<ResumptionNFCVo> vos = new ArrayList<>();
-                    for (ResumptionNFCVo nfcVo : orgNFCs) {
-                        if(nfcVo.getCheckId().equals(resumptionPlanVo.getCheckId())){
+                    for (ResumptionNFCVo nfcVo : orgAllNFCs) {
+                        if (nfcVo.getCheckId().equals(resumptionPlanVo.getCheckId())) {
                             nfcVo.setPointScan(resumptionPlanVo.getPointScan());
                             vos.add(nfcVo);
+                            usedNFCID.add(nfcVo.getNfcId());
                         }
                     }
-                    areaGroup= vos.stream().collect(Collectors.groupingBy(n -> n.getAreaId()));
+                    areaGroup = vos.stream().collect(Collectors.groupingBy(n -> n.getAreaId()));
 
 
                     if (CollectionUtils.isEmpty(areaGroup)) {
@@ -303,9 +304,10 @@ public class ResumptionServiceImpl implements ResumptionService {
                         });
                     }
                 } else {
-                    for (ResumptionNFCVo nfcVo : orgNFCs) {
-                        if(nfcVo.getAreaId().equals(resumptionPlanVo.getAreaId())){
+                    for (ResumptionNFCVo nfcVo : orgAllNFCs) {
+                        if (nfcVo.getAreaId().equals(resumptionPlanVo.getAreaId())) {
                             nfcVo.setPointScan(resumptionPlanVo.getPointScan());
+                            usedNFCID.add(nfcVo.getNfcId());
                         }
                     }
                     //如果是绑定到区域的,直接使用
@@ -314,14 +316,14 @@ public class ResumptionServiceImpl implements ResumptionService {
             }
 
             resumptionPlanVos = supplementItems;
-        }else{
+        } else {
             //反馈给前端,只需要保存后的数据
-            if(resumption.getStatus() == 3){
+            if (resumption.getStatus() == 3) {
                 //如果已经提交
-                orgNFCs = orgNFCs.stream().filter(n -> n.getStatus() == 1).collect(Collectors.toList());
+                usedNFCID.addAll(orgAllNFCs.stream().filter(n -> n.getStatus() == 1).map(n -> n.getNfcId()).collect(Collectors.toSet()));
             }
-
         }
+        orgAllNFCs = orgAllNFCs.stream().filter(n -> usedNFCID.contains(n.getNfcId())).collect(Collectors.toList());
 
         Integer yesPointNum = 0;
         Integer noPointNum = 0;
@@ -349,7 +351,7 @@ public class ResumptionServiceImpl implements ResumptionService {
             if (ObjectUtil.isNull(areaVo)) {
                 areaVo = new AreaResumptionVo();
                 areaVo.setAreaId(vo.getAreaId());
-                areaVo.setAreaName(ObjectUtil.isNull(vo.getAreaName())?"其它":vo.getAreaName());
+                areaVo.setAreaName(ObjectUtil.isNull(vo.getAreaName()) ? "其它" : vo.getAreaName());
                 map.put(areaVo.getAreaId(), areaVo);
             }
 
@@ -383,7 +385,7 @@ public class ResumptionServiceImpl implements ResumptionService {
             if (itCom == null) {
                 itCom = new HashMap<>();
                 itCom.put("total", 1);
-                if (pointVo.getDataStatus() == 1 ) {
+                if (pointVo.getDataStatus() == 1) {
                     itCom.put("yes", 0);
                 } else {
                     itCom.put("yes", 1);
@@ -424,7 +426,7 @@ public class ResumptionServiceImpl implements ResumptionService {
             AreaResumptionVo vo = entry.getValue();
             Long areaId = entry.getKey();
             //获取每个区域下的nfc
-            List<ResumptionNFCVo> resumptionNFCVos = orgNFCs.stream().filter(n -> ObjectUtil.equal(n.getAreaId(), areaId)).collect(Collectors.toList());
+            List<ResumptionNFCVo> resumptionNFCVos = orgAllNFCs.stream().filter(n -> ObjectUtil.equal(n.getAreaId(), areaId)).collect(Collectors.toList());
             /*resumptionMapper.selectResumptionNFC(resumption.getId(), areaId, resumption.getOrgId());*/
 
             for (ResumptionNFCVo resumptionNFCVo : resumptionNFCVos) {