|
@@ -1,22 +1,18 @@
|
|
package com.qmth.distributed.print.business.service.impl;
|
|
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.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.qmth.distributed.print.business.entity.BasicSchool;
|
|
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.BasicSchoolService;
|
|
import com.qmth.distributed.print.business.service.CallApiOrgCenterService;
|
|
import com.qmth.distributed.print.business.service.CallApiOrgCenterService;
|
|
import com.qmth.distributed.print.business.service.OrgCenterDataDisposeService;
|
|
import com.qmth.distributed.print.business.service.OrgCenterDataDisposeService;
|
|
import com.qmth.distributed.print.common.contant.SystemConstant;
|
|
import com.qmth.distributed.print.common.contant.SystemConstant;
|
|
-import com.qmth.distributed.print.common.enums.ExceptionResultEnum;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
-import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -44,17 +40,17 @@ public class OrgCenterDataDisposeServiceImpl implements OrgCenterDataDisposeServ
|
|
List<Long> needDisable = new ArrayList<>();
|
|
List<Long> needDisable = new ArrayList<>();
|
|
List<Long> needDelete = new ArrayList<>();
|
|
List<Long> needDelete = new ArrayList<>();
|
|
for (Long aLong : oldIdList) {
|
|
for (Long aLong : oldIdList) {
|
|
- if (!newIdList.contains(aLong)){
|
|
|
|
|
|
+ if (!newIdList.contains(aLong)) {
|
|
needDisable.add(aLong);
|
|
needDisable.add(aLong);
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
needDelete.add(aLong);
|
|
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) {
|
|
for (Map map : result) {
|
|
@@ -64,23 +60,15 @@ public class OrgCenterDataDisposeServiceImpl implements OrgCenterDataDisposeServ
|
|
String logo = String.valueOf(map.get("logo"));
|
|
String logo = String.valueOf(map.get("logo"));
|
|
String accessKey = String.valueOf(map.get("accessKey"));
|
|
String accessKey = String.valueOf(map.get("accessKey"));
|
|
String accessSecret = String.valueOf(map.get("accessSecret"));
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|