Compare commits

..

No commits in common. "e44b29a33cb5d17efddbaa66df77b2847ba57b10" and "c6f6509d74d8ee5d8c4e02e9c73ca16af7aefa55" have entirely different histories.

4 changed files with 27 additions and 23 deletions

View File

@ -89,11 +89,12 @@ public class HttpUtil {
Map<String, Object> input = new HashMap<>();
input.put("ver", version_name);
String infno = String.valueOf(type);
System.out.println("上个版本号:" + version_name);
JSONObject result = null;
try {
result = call(infno, "data", input);
result = callBackMsgId(infno, "data", input);
} catch (Exception e) {
return new ArrayList<>();
return null;
}
String filename = result.getString("filename");

View File

@ -4,8 +4,11 @@ import com.syjiaer.clinic.server.common.util.DictoryUtil;
import com.syjiaer.clinic.server.common.vo.Page;
import com.syjiaer.clinic.server.common.vo.Result;
import com.syjiaer.clinic.server.controller.BaseController;
import com.syjiaer.clinic.server.entity.social.SocialDiagnose;
import com.syjiaer.clinic.server.entity.social.SocialDirectory;
import com.syjiaer.clinic.server.entity.social.SocialItem;
import com.syjiaer.clinic.server.entity.social.vo.SocialDirectoryView;
import com.syjiaer.clinic.server.service.social.SocialDiagnoseService;
import com.syjiaer.clinic.server.service.social.SocialDirectoryService;
import com.syjiaer.clinic.server.service.social.SocialItemService;
import org.springframework.beans.factory.annotation.Autowired;
@ -33,6 +36,8 @@ public class SocialDirectoryController extends BaseController {
@Autowired
private SocialItemService socialItemService;
@Autowired
private SocialDiagnoseService socialDiagnoseService;
@Autowired
private DictoryUtil dictoryUtil;
@RequestMapping("search")
@ -60,14 +65,18 @@ public class SocialDirectoryController extends BaseController {
// 处理参数为空的情况这里假设返回一个错误结果
return error("参数 ver 不能为空");
}
String version_name= null;
Map<String, Object> result= null;
if(type==1301||type==1302||type==1306){
version_name =socialDirectoryService.download(ver, type);
return success(version_name);
result =socialDirectoryService.download(ver, type);
return success(result);
}
if(type==1305){
version_name =socialItemService.download(ver);
return success(version_name);
if (type ==1307){
result =socialDiagnoseService.download(ver);
return success(result);
}
if (type == 1305 || type == 1321){
result =socialItemService.download(ver);
return success(result);
}
return error("参数 type 不正确");

View File

@ -53,7 +53,7 @@ public class SocialDirectoryService extends BaseService {
* @param type 类型
*/
@Transactional(rollbackFor = Exception.class)
public String download(String version_name, int type) {
public Map<String, Object> download(String version_name, int type) {
Integer[] type_list = {1301, 1302, 1306};
//判断type在数组中
if (!Arrays.asList(type_list).contains(type)) {
@ -73,16 +73,18 @@ public class SocialDirectoryService extends BaseService {
queryWrapper.in("code", code_list);
socialDirectoryMapper.delete(queryWrapper);
}
return insertSocialDirectorys(version_name, type, tab_list);
String current_version_name = insertSocialDirectorys(version_name, type, tab_list);
Map<String, Object> hashMap = new HashMap<>();
hashMap.put("current_version_name", current_version_name);
hashMap.put("pre_version_name", version_name);
return hashMap;
}
private String insertSocialDirectorys(String version_name, int type, List<String[]> tab_list) {
Map<String, String> title_map = dictoryUtil.getTitleMap(String.valueOf(type));
List<SocialDirectory> list = new ArrayList<>();
HashMap<String, SocialDirectory> tmp_map = new HashMap<>();
String next_version_name="";
for (int i=0;i<tab_list.size();i++) {
String[] line_array=tab_list.get(i);
for (String[] line_array : tab_list) {
SocialDirectory socialDirectory = new SocialDirectory();
socialDirectory.setType(type);
String code = line_array[0];
@ -123,22 +125,14 @@ public class SocialDirectoryService extends BaseService {
socialDirectory.setKeyword(line_array[4]);
}
SocialDirectory tmp_socialDirectory = tmp_map.get(code);
if(i==0){
next_version_name=list.get(0).getVersionName();
}
if (tmp_socialDirectory == null && flag.equals("1")) {
list.add(socialDirectory);
tmp_map.put(code, socialDirectory);
}
}
if(list.isEmpty()){
return null;
}
socialDirectoryMapper.insert(list, 100);
socialDirectoryVersionService.setSocialDirectoryVersion(type, version_name, list.get(0).getVersionName(), list.size());
return next_version_name;
return list.get(0).getVersionName();
}
/*

View File

@ -32,7 +32,7 @@ public class SocialItemService {
@Autowired
private SocialDirectoryVersionService socialDirectoryVersionService;
public String download( String version_name) {
public Map<String, Object> download( String version_name) {
List<String[]> tab_list = httpUtil.download(version_name, 1305);
List<SocialItem> list = new ArrayList<>();
String value = String.valueOf(1305);