|
|
|
@ -1,10 +1,14 @@
|
|
|
|
|
package com.tz.platform.system.feign;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.json.JSONArray;
|
|
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import com.tz.platform.common.core.tools.BeanUtils;
|
|
|
|
|
import com.tz.platform.entity.School;
|
|
|
|
|
import com.tz.platform.feign.IFeignSchool;
|
|
|
|
|
import com.tz.platform.feign.vo.SchoolVo;
|
|
|
|
|
import com.tz.platform.repository.SchoolDao;
|
|
|
|
|
import com.tz.platform.system.pc.biz.SchoolBiz;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
@ -16,6 +20,9 @@ public class FeignSchoolController implements IFeignSchool {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private SchoolDao schoolDao ;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private SchoolBiz schoolBiz;
|
|
|
|
|
@Override
|
|
|
|
|
public SchoolVo getByOuterId(Integer outerId) {
|
|
|
|
|
School school = schoolDao.getByOuterId(outerId);
|
|
|
|
@ -29,4 +36,23 @@ public class FeignSchoolController implements IFeignSchool {
|
|
|
|
|
List<SchoolVo> vo = BeanUtils.copyProperties(schoolList,SchoolVo.class);
|
|
|
|
|
return vo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void addSchool(String json) {
|
|
|
|
|
JSONObject content = JSONUtil.parseObj(json);
|
|
|
|
|
int code = content.getInt("code");
|
|
|
|
|
if(code == 200){
|
|
|
|
|
JSONArray jsonArray = content.getJSONArray("data");
|
|
|
|
|
jsonArray.forEach(object -> {
|
|
|
|
|
JSONObject schoolInfo = (JSONObject) object;
|
|
|
|
|
int id = schoolInfo.getInt("id");
|
|
|
|
|
String name = schoolInfo.getStr("name");
|
|
|
|
|
int level = schoolInfo.getInt("level");
|
|
|
|
|
if(name.isEmpty() ==false){
|
|
|
|
|
schoolBiz.save(id,name,level);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|