فهرست منبع

Merge remote-tracking branch 'origin/dev' into dev

wangliang 4 سال پیش
والد
کامیت
e1272892a2

+ 0 - 52
distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/OrgCenterTypeEnum.java

@@ -1,52 +0,0 @@
-package com.qmth.distributed.print.business.enums;
-
-import com.qmth.distributed.print.business.enums.result.EnumResult;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @Description: 机构用户中心机构类别
- * @Author: CaoZixuan
- * @Date: 2021-03-27
- */
-public enum OrgCenterTypeEnum {
-    NETWORK("NETWORK","高校网院"),
-    COLLEGE("COLLEGE","高校教务处"),
-    UNDERGRADUATE("UNDERGRADUATE","本科招办"),
-    POSTGRADUATE("COLLEGE","研究生招办"),
-    MINISTRY("MINISTRY","考试院"),
-    AOPENG("AOPENG","奥鹏"),
-    PARTNER("PARTNER","合作机构"),
-    OTHER("OTHER","其他"),
-    ;
-
-    OrgCenterTypeEnum(String typeCode, String typeName) {
-        this.typeCode = typeCode;
-        this.typeName = typeName;
-    }
-
-    private final String typeCode;
-    private final String typeName;
-
-    public String getTypeCode() {
-        return typeCode;
-    }
-
-    public String getTypeName() {
-        return typeName;
-    }
-    public static List<EnumResult> listTypes() {
-        List<EnumResult> list = new ArrayList<EnumResult>();
-        for (OrgCenterTypeEnum value : OrgCenterTypeEnum.values()) {
-            EnumResult result = new EnumResult();
-            result.setName(value.name());
-            result.setOrdinal(value.ordinal());
-            result.setCode(value.getTypeCode());
-            result.setDesc(value.getTypeName());
-            list.add(result);
-        }
-        return list;
-    }
-
-}

+ 15 - 27
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/OrgCenterDataDisposeServiceImpl.java

@@ -1,22 +1,18 @@
 package com.qmth.distributed.print.business.service.impl;
 
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.qmth.distributed.print.business.entity.BasicSchool;
-import com.qmth.distributed.print.business.enums.OrgCenterTypeEnum;
 import com.qmth.distributed.print.business.service.BasicSchoolService;
 import com.qmth.distributed.print.business.service.CallApiOrgCenterService;
 import com.qmth.distributed.print.business.service.OrgCenterDataDisposeService;
 import com.qmth.distributed.print.common.contant.SystemConstant;
-import com.qmth.distributed.print.common.enums.ExceptionResultEnum;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -44,17 +40,17 @@ public class OrgCenterDataDisposeServiceImpl implements OrgCenterDataDisposeServ
         List<Long> needDisable = new ArrayList<>();
         List<Long> needDelete = new ArrayList<>();
         for (Long aLong : oldIdList) {
-            if (!newIdList.contains(aLong)){
+            if (!newIdList.contains(aLong)) {
                 needDisable.add(aLong);
-            }else {
+            } else {
                 needDelete.add(aLong);
             }
         }
-        if (needDisable.size() > 0){
-            basicSchoolService.update(new UpdateWrapper<BasicSchool>().lambda().set(BasicSchool::getEnable,false).in(BasicSchool::getId,needDisable));
+        if (needDisable.size() > 0) {
+            basicSchoolService.update(new UpdateWrapper<BasicSchool>().lambda().set(BasicSchool::getEnable, false).in(BasicSchool::getId, needDisable));
         }
-        if (needDelete.size() > 0){
-            basicSchoolService.remove(new QueryWrapper<BasicSchool>().lambda().in(BasicSchool::getId,needDelete));
+        if (needDelete.size() > 0) {
+            basicSchoolService.remove(new QueryWrapper<BasicSchool>().lambda().in(BasicSchool::getId, needDelete));
         }
 
         for (Map map : result) {
@@ -64,23 +60,15 @@ public class OrgCenterDataDisposeServiceImpl implements OrgCenterDataDisposeServ
             String logo = String.valueOf(map.get("logo"));
             String accessKey = String.valueOf(map.get("accessKey"));
             String accessSecret = String.valueOf(map.get("accessSecret"));
-            Map typeMap = JSONObject.parseObject(String.valueOf(map.get("type")));
-            String typeCode = String.valueOf(typeMap.get("code"));
-            String typeName = String.valueOf(typeMap.get("name"));
-            if (!Arrays.stream(OrgCenterTypeEnum.values()).map(OrgCenterTypeEnum::getTypeCode).collect(Collectors.toList()).contains(typeCode)){
-                throw ExceptionResultEnum.ERROR.exception("机构类型在枚举中不存在 + typeCode = " + typeCode);
-            }
-            if (!OrgCenterTypeEnum.PARTNER.getTypeCode().equals(typeCode)){
-                BasicSchool school = new BasicSchool();
-                school.setId(id);
-                school.setCode(code);
-                school.setName(name);
-                school.setEnable(true);
-                school.setAccessKey(accessKey);
-                school.setAccessSecret(accessSecret);
-                school.setLogo(logo);
-                basicSchoolService.save(school);
-            }
+            BasicSchool school = new BasicSchool();
+            school.setId(id);
+            school.setCode(code);
+            school.setName(name);
+            school.setEnable(true);
+            school.setAccessKey(accessKey);
+            school.setAccessSecret(accessSecret);
+            school.setLogo(logo);
+            basicSchoolService.save(school);
         }
     }
 }

+ 4 - 7
distributed-print/src/main/java/com/qmth/distributed/print/api/EnumsController.java

@@ -85,19 +85,16 @@ public class EnumsController {
         } else if (type.equals(EnumType.CARD_REQUIRED_FIELDS.name())) {
             //题卡必选字段
             list = CardRequiredFieldsEnum.listTypes();
-        } else if (type.equals(EnumType.ORG_CENTER_TYPE_ENUM.name())){
-            //机构用户中心类型
-            list = OrgCenterTypeEnum.listTypes();
-        } else if (type.equals(EnumType.PRINT_PLAN_STATUS_ENUM.name())){
+        } else if (type.equals(EnumType.PRINT_PLAN_STATUS_ENUM.name())) {
             //印刷计划状态
             list = PrintPlanStatusEnum.listTypes();
-        } else if (type.equals(EnumType.MAKE_METHOD.name())){
+        } else if (type.equals(EnumType.MAKE_METHOD.name())) {
             // 题卡制作方式
             list = MakeMethodEnum.listTypes();
-        } else if (type.equals(EnumType.CARD_TYPE.name())){
+        } else if (type.equals(EnumType.CARD_TYPE.name())) {
             // 题卡类型
             list = CardTypeEnum.listTypes();
-        } else if (type.equals(EnumType.EXAM_DETAIL_STATUS_ENUM.name())){
+        } else if (type.equals(EnumType.EXAM_DETAIL_STATUS_ENUM.name())) {
             // 考场状态
             list = ExamDetailStatusEnum.listTypes();
         }