Merge branch 'master' of ssh://git.jizhiweb.cn:2222/clinic-v2/server
# Conflicts: # src/main/java/com/syjiaer/clinic/server/common/config/ControllerAspect.java
This commit is contained in:
commit
2bb5b01136
|
|
@ -12,6 +12,7 @@ import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.net.http.HttpResponse;
|
import java.net.http.HttpResponse;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Component // 将当前类交给spring管理
|
@Component // 将当前类交给spring管理
|
||||||
@Aspect // 声明这是一个AOP类
|
@Aspect // 声明这是一个AOP类
|
||||||
public class ControllerAspect {
|
public class ControllerAspect {
|
||||||
|
|
@ -41,7 +42,7 @@ public class ControllerAspect {
|
||||||
result.setMessage("系统异常");
|
result.setMessage("系统异常");
|
||||||
result.setData(null);
|
result.setData(null);
|
||||||
result.setCode(101);
|
result.setCode(101);
|
||||||
|
log.error(e.getMessage());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,26 +47,33 @@ public class FileController extends BaseController {
|
||||||
@RequestMapping("/getImage/{fileName}")
|
@RequestMapping("/getImage/{fileName}")
|
||||||
@NoAuthCheck
|
@NoAuthCheck
|
||||||
public ResponseEntity<Resource> getImage(@PathVariable String fileName) {
|
public ResponseEntity<Resource> getImage(@PathVariable String fileName) {
|
||||||
return fileService.getImage(fileName);
|
try {
|
||||||
|
return fileService.getImage(fileName);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResponseEntity.notFound().build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/download/{token}")
|
@RequestMapping("/download/{token}")
|
||||||
@NoAuthCheck
|
@NoAuthCheck
|
||||||
public ResponseEntity<Resource> download(@PathVariable String token){
|
public ResponseEntity<Resource> download(@PathVariable String token){
|
||||||
JSONObject jsonObject =cacheUtil.get(token);
|
|
||||||
String filename=jsonObject.getString("path");
|
|
||||||
Path path = Paths.get(filename);
|
|
||||||
Resource resource= null;
|
|
||||||
try {
|
try {
|
||||||
|
JSONObject jsonObject =cacheUtil.get(token);
|
||||||
|
String filename=jsonObject.getString("path");
|
||||||
|
Path path = Paths.get(filename);
|
||||||
|
Resource resource= null;
|
||||||
resource = new UrlResource(path.toUri());
|
resource = new UrlResource(path.toUri());
|
||||||
} catch (MalformedURLException e) {
|
return ResponseEntity.ok()
|
||||||
throw new MessageException("创建下载失败");
|
.contentType(MediaType.parseMediaType("application/octet-stream"))
|
||||||
|
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + resource.getFilename() + "\"")
|
||||||
|
.body(resource);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResponseEntity.notFound().build();
|
||||||
}
|
}
|
||||||
return ResponseEntity.ok()
|
|
||||||
.contentType(MediaType.parseMediaType("application/octet-stream"))
|
|
||||||
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + resource.getFilename() + "\"")
|
|
||||||
.body(resource);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.syjiaer.clinic.server.controller.social;
|
||||||
|
|
||||||
|
import com.syjiaer.clinic.server.common.vo.Result;
|
||||||
|
import com.syjiaer.clinic.server.controller.BaseController;
|
||||||
|
import com.syjiaer.clinic.server.service.social.SocialDirectoryLimitService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 更新信息 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author NiuZiYuan
|
||||||
|
* @since 2025-02-20
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/social/directory_limit")
|
||||||
|
public class SocialDirectoryLimitController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private SocialDirectoryLimitService socialDirectoryLimitService;
|
||||||
|
|
||||||
|
@RequestMapping("get_page")
|
||||||
|
public Result get_page() {
|
||||||
|
Map<String, Object> parms = getParms();
|
||||||
|
String updt_time = (String) parms.get("updt_time");
|
||||||
|
int page = (Integer) parms.getOrDefault("page", 1);
|
||||||
|
if (updt_time == null || updt_time.trim().isEmpty()) {
|
||||||
|
// 处理参数为空的情况,这里假设返回一个错误结果
|
||||||
|
return error("参数 updt_time 不能为空");
|
||||||
|
}
|
||||||
|
Map<String, Object> result = socialDirectoryLimitService.getPage(updt_time, page);
|
||||||
|
return success(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.syjiaer.clinic.server.controller.social;
|
||||||
|
|
||||||
|
import com.syjiaer.clinic.server.common.vo.Result;
|
||||||
|
import com.syjiaer.clinic.server.controller.BaseController;
|
||||||
|
import com.syjiaer.clinic.server.service.social.SocialDirectorySelfService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 更新信息 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author NiuZiYuan
|
||||||
|
* @since 2025-02-20
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/social/directory_self")
|
||||||
|
public class SocialDirectorySelfController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private SocialDirectorySelfService socialDirectorySelfService;
|
||||||
|
|
||||||
|
@RequestMapping("get_page")
|
||||||
|
public Result get_page() {
|
||||||
|
Map<String, Object> parms = getParms();
|
||||||
|
String updt_time = (String) parms.get("updt_time");
|
||||||
|
int page = (Integer) parms.getOrDefault("page", 1);
|
||||||
|
if (updt_time == null || updt_time.trim().isEmpty()) {
|
||||||
|
// 处理参数为空的情况,这里假设返回一个错误结果
|
||||||
|
return error("参数 updt_time 不能为空");
|
||||||
|
}
|
||||||
|
Map<String, Object> result = socialDirectorySelfService.getPage(updt_time, page);
|
||||||
|
return success(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,72 +1,124 @@
|
||||||
package com.syjiaer.clinic.server.service.social;
|
package com.syjiaer.clinic.server.service.social;
|
||||||
|
|
||||||
import com.syjiaer.clinic.server.common.api.input.IM1318;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.syjiaer.clinic.server.common.api.output.OM1318;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.syjiaer.clinic.server.common.api.request.SocialRequest;
|
import com.syjiaer.clinic.server.common.api.request.SocialRequest;
|
||||||
import com.syjiaer.clinic.server.common.exception.MessageException;
|
import com.syjiaer.clinic.server.common.util.HttpUtil;
|
||||||
import com.syjiaer.clinic.server.entity.social.SocialDirectoryLimit;
|
import com.syjiaer.clinic.server.entity.social.SocialDirectoryLimit;
|
||||||
import com.syjiaer.clinic.server.mapper.social.SocialDirectoryLimitMapper;
|
import com.syjiaer.clinic.server.mapper.social.SocialDirectoryLimitMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.util.ArrayList;
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.logging.Logger;
|
||||||
/*
|
/*
|
||||||
* 医保限价
|
* 目录有效期
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class SocialDirectoryLimitService {
|
public class SocialDirectoryLimitService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SocialRequest socialRequest;
|
private SocialRequest socialRequest;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SocialDirectoryLimitMapper socialDirectoryLimitMapper;
|
private SocialDirectoryLimitMapper socialDirectoryLimitMapper;
|
||||||
|
@Autowired
|
||||||
|
private HttpUtil httpUtil;
|
||||||
|
|
||||||
|
private Logger logger = Logger.getLogger(this.getClass().getName());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 更新医保限价信息
|
* 更新医保有效期
|
||||||
* @param updtTime 更新时间
|
* @param updtTime 更新时间
|
||||||
* @param pageNum 页码
|
* @param pageNum 页码
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public Map<String, Object> update(String updtTime, int pageNum) {
|
public Map<String, Object> getPage(String updtTime, int pageNum) {
|
||||||
if (updtTime == null || updtTime.trim().isEmpty()) {
|
JSONObject result = call(updtTime, pageNum);
|
||||||
// 处理参数为空的情况,这里假设返回一个错误结果
|
System.out.println(result);
|
||||||
throw new MessageException("参数 updt_time 不能为空");
|
int recordCounts = result.getInteger("recordCounts");
|
||||||
|
int pages = result.getInteger("pages");
|
||||||
|
JSONArray json_list = result.getJSONArray("data");
|
||||||
|
int number = saveJsonList(json_list);
|
||||||
|
Map<String, Object> result_map = new HashMap<>();
|
||||||
|
result_map.put("recordCounts", recordCounts);
|
||||||
|
result_map.put("pages", pages);
|
||||||
|
result_map.put("number", number);
|
||||||
|
return result_map;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private int saveJsonList(JSONArray json_list) {
|
||||||
|
List<SocialDirectoryLimit> list = new ArrayList<>();
|
||||||
|
for (int i = 0; i < json_list.size(); i++) {
|
||||||
|
JSONObject jsonObject = json_list.getJSONObject(i);
|
||||||
|
JSONObject new_jsonObject = new JSONObject();
|
||||||
|
for (String key : jsonObject.keySet()) {
|
||||||
|
new_jsonObject.put(toCamelCase(key), jsonObject.get(key));
|
||||||
|
}
|
||||||
|
new_jsonObject.put("code", jsonObject.getString("hilist_code"));
|
||||||
|
SocialDirectoryLimit socialDirectoryLimit = new_jsonObject.toJavaObject(SocialDirectoryLimit.class);
|
||||||
|
list.add(socialDirectoryLimit);
|
||||||
}
|
}
|
||||||
IM1318 im1318 = new IM1318();
|
int number = 0;
|
||||||
System.out.println("正在处理第" + pageNum + "页");
|
for (int i = 0; i < list.size(); i++) {
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
SocialDirectoryLimit socialDirectoryLimit = list.get(i);
|
||||||
im1318.setUpdtTime(LocalDateTime.parse(updtTime, formatter));
|
|
||||||
im1318.setValiFlag("1");
|
|
||||||
im1318.setPageNum(pageNum);
|
|
||||||
im1318.setPageSize(1000);
|
|
||||||
OM1318 om1318 = socialRequest.call1318(im1318);
|
|
||||||
System.out.println(1 + "/" + om1318.getPages());
|
|
||||||
List<Map<String, Object>> data = om1318.getData();
|
|
||||||
for (Map<String, Object> datum : data) {
|
|
||||||
SocialDirectoryLimit socialDirectoryLimit = new SocialDirectoryLimit();
|
|
||||||
socialDirectoryLimit.setRid(new BigInteger(datum.get("rid").toString()));
|
|
||||||
socialDirectoryLimit.setCode(datum.get("hilist_code").toString());
|
|
||||||
socialDirectoryLimit.setHilistLmtpricType(datum.get("hilist_lmtpric_type").toString());
|
|
||||||
socialDirectoryLimit.setHilistPricUplmtAmt(new BigDecimal(datum.get("hilist_pric_uplmt_amt").toString()));
|
|
||||||
String code = socialDirectoryLimit.getCode();
|
String code = socialDirectoryLimit.getCode();
|
||||||
SocialDirectoryLimit directoryLimit = socialDirectoryLimitMapper.selectById(code);
|
SocialDirectoryLimit pre_socialDirectoryLimit = socialDirectoryLimitMapper.selectById(code);
|
||||||
if (directoryLimit == null) {
|
|
||||||
|
if (pre_socialDirectoryLimit == null) {
|
||||||
|
|
||||||
socialDirectoryLimitMapper.insert(socialDirectoryLimit);
|
socialDirectoryLimitMapper.insert(socialDirectoryLimit);
|
||||||
|
number++;
|
||||||
} else {
|
} else {
|
||||||
BigInteger newRid = socialDirectoryLimit.getRid();
|
QueryWrapper<SocialDirectoryLimit> upqw = new QueryWrapper<>();
|
||||||
BigInteger oldRid = directoryLimit.getRid();
|
upqw.eq("code", code);
|
||||||
if (newRid.compareTo(oldRid) > 0) {
|
socialDirectoryLimitMapper.delete(upqw);
|
||||||
socialDirectoryLimitMapper.updateById(socialDirectoryLimit);
|
socialDirectoryLimitMapper.insert(socialDirectoryLimit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
|
||||||
|
private JSONObject call(String updt_time, int page_num) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("updt_time", updt_time);
|
||||||
|
map.put("page_num", page_num);
|
||||||
|
map.put("page_size", 1000);
|
||||||
|
map.put("vali_flag", "1");
|
||||||
|
JSONObject result = httpUtil.call("1312", "data", map);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将下划线命名法转换为驼峰命名法
|
||||||
|
private String toCamelCase(String snakeStr) {
|
||||||
|
// 创建一个StringBuilder对象,用于存储转换后的字符串
|
||||||
|
StringBuilder camelCaseStr = new StringBuilder();
|
||||||
|
// 定义一个布尔变量,用于标记下一个字符是否需要大写
|
||||||
|
boolean nextUpperCase = false;
|
||||||
|
|
||||||
|
// 遍历输入字符串的每一个字符
|
||||||
|
for (char c : snakeStr.toCharArray()) {
|
||||||
|
// 如果字符是下划线,则将nextUpperCase设置为true
|
||||||
|
if (c == '_') {
|
||||||
|
nextUpperCase = true;
|
||||||
|
} else {
|
||||||
|
// 如果nextUpperCase为true,则将字符转换为大写,并添加到StringBuilder中
|
||||||
|
if (nextUpperCase) {
|
||||||
|
camelCaseStr.append(Character.toUpperCase(c));
|
||||||
|
// 将nextUpperCase设置为false
|
||||||
|
nextUpperCase = false;
|
||||||
|
} else {
|
||||||
|
// 如果nextUpperCase为false,则将字符转换为小写,并添加到StringBuilder中
|
||||||
|
camelCaseStr.append(Character.toLowerCase(c));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Map<String, Object> map = new HashMap<>();
|
|
||||||
map.put("pages", om1318.getPages());
|
// 返回转换后的字符串
|
||||||
return map;
|
return camelCaseStr.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,71 +1,124 @@
|
||||||
package com.syjiaer.clinic.server.service.social;
|
package com.syjiaer.clinic.server.service.social;
|
||||||
|
|
||||||
import com.syjiaer.clinic.server.common.api.input.IM1319;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.syjiaer.clinic.server.common.api.output.OM1319;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.syjiaer.clinic.server.common.api.request.SocialRequest;
|
import com.syjiaer.clinic.server.common.api.request.SocialRequest;
|
||||||
import com.syjiaer.clinic.server.common.exception.MessageException;
|
import com.syjiaer.clinic.server.common.util.HttpUtil;
|
||||||
import com.syjiaer.clinic.server.entity.social.SocialDirectorySelf;
|
import com.syjiaer.clinic.server.entity.social.SocialDirectorySelf;
|
||||||
import com.syjiaer.clinic.server.mapper.social.SocialDirectorySelfMapper;
|
import com.syjiaer.clinic.server.mapper.social.SocialDirectorySelfMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.util.ArrayList;
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.logging.Logger;
|
||||||
/*
|
/*
|
||||||
* 自付比例
|
* 目录有效期
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class SocialDirectorySelfService {
|
public class SocialDirectorySelfService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SocialRequest socialRequest;
|
private SocialRequest socialRequest;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SocialDirectorySelfMapper socialDirectorySelfMapper;
|
private SocialDirectorySelfMapper socialDirectorySelfMapper;
|
||||||
|
@Autowired
|
||||||
|
private HttpUtil httpUtil;
|
||||||
|
|
||||||
|
private Logger logger = Logger.getLogger(this.getClass().getName());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 更新医保自付比例
|
* 更新医保有效期
|
||||||
* @param updtTime 更新时间
|
* @param updtTime 更新时间
|
||||||
* @param pageNum 页码
|
* @param pageNum 页码
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public Map<String, Object> updateSocial(String updtTime, int pageNum) {
|
public Map<String, Object> getPage(String updtTime, int pageNum) {
|
||||||
if (updtTime == null) {
|
JSONObject result = call(updtTime, pageNum);
|
||||||
throw new MessageException("updtTime不能为空");
|
System.out.println(result);
|
||||||
|
int recordCounts = result.getInteger("recordCounts");
|
||||||
|
int pages = result.getInteger("pages");
|
||||||
|
JSONArray json_list = result.getJSONArray("data");
|
||||||
|
int number = saveJsonList(json_list);
|
||||||
|
Map<String, Object> result_map = new HashMap<>();
|
||||||
|
result_map.put("recordCounts", recordCounts);
|
||||||
|
result_map.put("pages", pages);
|
||||||
|
result_map.put("number", number);
|
||||||
|
return result_map;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private int saveJsonList(JSONArray json_list) {
|
||||||
|
List<SocialDirectorySelf> list = new ArrayList<>();
|
||||||
|
for (int i = 0; i < json_list.size(); i++) {
|
||||||
|
JSONObject jsonObject = json_list.getJSONObject(i);
|
||||||
|
JSONObject new_jsonObject = new JSONObject();
|
||||||
|
for (String key : jsonObject.keySet()) {
|
||||||
|
new_jsonObject.put(toCamelCase(key), jsonObject.get(key));
|
||||||
|
}
|
||||||
|
new_jsonObject.put("code", jsonObject.getString("hilist_code"));
|
||||||
|
SocialDirectorySelf socialDirectorySelf = new_jsonObject.toJavaObject(SocialDirectorySelf.class);
|
||||||
|
list.add(socialDirectorySelf);
|
||||||
}
|
}
|
||||||
IM1319 im1319 = new IM1319();
|
int number = 0;
|
||||||
System.out.println("正在处理第" + pageNum + "页");
|
for (int i = 0; i < list.size(); i++) {
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
SocialDirectorySelf socialDirectorySelf = list.get(i);
|
||||||
im1319.setUpdtTime(LocalDateTime.parse(updtTime, formatter));
|
|
||||||
im1319.setSelfpayPropPsnType("310");
|
|
||||||
im1319.setValiFlag("1");
|
|
||||||
im1319.setPageNum(pageNum);
|
|
||||||
im1319.setPageSize(1000);
|
|
||||||
OM1319 om1319 = socialRequest.call1319(im1319);
|
|
||||||
System.out.println(pageNum + "/" + om1319.getPages());
|
|
||||||
for (int i = 0; i < om1319.getData().size(); i++){
|
|
||||||
SocialDirectorySelf socialDirectorySelf = new SocialDirectorySelf();
|
|
||||||
Map<String, Object> map = om1319.getData().get(i);
|
|
||||||
socialDirectorySelf.setRid(new BigInteger(map.get("rid").toString()));
|
|
||||||
socialDirectorySelf.setCode(map.get("hilist_code").toString());
|
|
||||||
socialDirectorySelf.setSelfpayPropType(map.get("selfpay_prop_type").toString());
|
|
||||||
socialDirectorySelf.setSelfpayProp(new BigDecimal(map.get("selpay_prop").toString()));
|
|
||||||
String code = socialDirectorySelf.getCode();
|
String code = socialDirectorySelf.getCode();
|
||||||
SocialDirectorySelf existingSelf = socialDirectorySelfMapper.selectById(code);
|
SocialDirectorySelf pre_socialDirectorySelf = socialDirectorySelfMapper.selectById(code);
|
||||||
if (existingSelf == null) {
|
|
||||||
|
if (pre_socialDirectorySelf == null) {
|
||||||
|
|
||||||
socialDirectorySelfMapper.insert(socialDirectorySelf);
|
socialDirectorySelfMapper.insert(socialDirectorySelf);
|
||||||
|
number++;
|
||||||
} else {
|
} else {
|
||||||
BigInteger newRid = socialDirectorySelf.getRid();
|
QueryWrapper<SocialDirectorySelf> upqw = new QueryWrapper<>();
|
||||||
BigInteger oldRid = existingSelf.getRid();
|
upqw.eq("code", code);
|
||||||
if (newRid.compareTo(oldRid) > 0) {
|
socialDirectorySelfMapper.delete(upqw);
|
||||||
socialDirectorySelfMapper.updateById(socialDirectorySelf);
|
socialDirectorySelfMapper.insert(socialDirectorySelf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
|
||||||
|
private JSONObject call(String updt_time, int page_num) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("updt_time", updt_time);
|
||||||
|
map.put("page_num", page_num);
|
||||||
|
map.put("page_size", 1000);
|
||||||
|
map.put("vali_flag", "1");
|
||||||
|
JSONObject result = httpUtil.call("1312", "data", map);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将下划线命名法转换为驼峰命名法
|
||||||
|
private String toCamelCase(String snakeStr) {
|
||||||
|
// 创建一个StringBuilder对象,用于存储转换后的字符串
|
||||||
|
StringBuilder camelCaseStr = new StringBuilder();
|
||||||
|
// 定义一个布尔变量,用于标记下一个字符是否需要大写
|
||||||
|
boolean nextUpperCase = false;
|
||||||
|
|
||||||
|
// 遍历输入字符串的每一个字符
|
||||||
|
for (char c : snakeStr.toCharArray()) {
|
||||||
|
// 如果字符是下划线,则将nextUpperCase设置为true
|
||||||
|
if (c == '_') {
|
||||||
|
nextUpperCase = true;
|
||||||
|
} else {
|
||||||
|
// 如果nextUpperCase为true,则将字符转换为大写,并添加到StringBuilder中
|
||||||
|
if (nextUpperCase) {
|
||||||
|
camelCaseStr.append(Character.toUpperCase(c));
|
||||||
|
// 将nextUpperCase设置为false
|
||||||
|
nextUpperCase = false;
|
||||||
|
} else {
|
||||||
|
// 如果nextUpperCase为false,则将字符转换为小写,并添加到StringBuilder中
|
||||||
|
camelCaseStr.append(Character.toLowerCase(c));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Map<String, Object> map = new HashMap<>();
|
|
||||||
map.put("pages", om1319.getPages());
|
// 返回转换后的字符串
|
||||||
return map;
|
return camelCaseStr.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue