app37版本问题修复

master
gongzhenkun 2 years ago
parent af8d2a9919
commit 48783ba096

@ -49,39 +49,6 @@ import java.util.stream.Collectors;
@RequestMapping("/api/app")
public class AppController extends BaseController
{
/**
* 01.06barbase64
*/
private static final List<String> BAR_PROPERTY = new ArrayList<String>(){{
add("sz_pangshou");
add("st_houbo");
add("st_funi");
add("st_runzao");
add("st_cao");
}};
/**
*
*/
private static final List<String> jsonKeyList = new ArrayList<String>(){{
add("st_avg_yellow");
add("img_sz");
add("img_sz_yudian");
add("img_sz_yuban");
add("img_sz_liewen");
add("img_st");
add("img_sx");
add("img_sx_vein");
add("sz_avg_red");
add("sz_avg_purple");
add("sx_vein_avg_purple");
add("sz_pangshou");
add("st_houbo");
add("st_funi");
add("st_runzao");
add("st_cao");
}};
@Autowired
private ITRecordService tRecordService;
@ -725,6 +692,19 @@ public class AppController extends BaseController
public JSONObject removeBase64Image(JSONObject jsonObject,Long recordId)
{
List<String> jsonKeyList = new ArrayList<String>(){{
add("st_avg_yellow");
add("img_sz");
add("img_sz_yudian");
add("img_sz_yuban");
add("img_sz_liewen");
add("img_st");
add("img_sx");
add("img_sx_vein");
add("sz_avg_red");
add("sz_avg_purple");
add("sx_vein_avg_purple");
}};
try {
doRemoveBase64Image(jsonObject.getJSONObject("data"), "data", jsonKeyList, recordId);
}
@ -763,7 +743,7 @@ public class AppController extends BaseController
String imageKey = null;
if (entry.getValue() instanceof JSONObject) {
logger.info("entry key is {}", entry.getKey());
if (entry.getKey().contains("avg") || BAR_PROPERTY.contains(entry.getKey())) {
if (entry.getKey().contains("avg")) {
imageStr = ((JSONObject) entry.getValue()).getString("bar");
imageKey = "bar";
} else {

@ -2,8 +2,8 @@
not.null=* 必须填写
user.jcaptcha.error=验证码错误
user.jcaptcha.expire=验证码已失效
user.not.exists=用户不存在/密码错误
user.password.not.match=用户不存在/密码错误
user.not.exists=用户不存在
user.password.not.match=密码错误
user.password.retry.limit.count=密码输入错误{0}次
user.password.retry.limit.exceed=密码输入错误{0}次帐户锁定10分钟
user.password.delete=对不起,您的账号已被删除

@ -5,6 +5,7 @@ import javax.annotation.Resource;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUserEX;
import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.file.FileUploadUtils;
@ -14,6 +15,7 @@ import com.ruoyi.system.mapper.TDoctorMapper;
import com.ruoyi.system.service.impl.UserTokenService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
@ -130,7 +132,7 @@ public class SysLoginService
if (!SecurityUtils.matchesPassword(password, sysUser.getPassword())) {
log.info("登录用户:{} 密码不正确.", username);
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
return AjaxResult.success(MessageUtils.message("user.password.not.match"));
return AjaxResult.error(MessageUtils.message("user.password.not.match"));
}
LoginUser loginUser = new LoginUser();
sysUser.setDoctorId(tDoctor.getId());
@ -153,15 +155,20 @@ public class SysLoginService
log.info("login for app fill info req :{}", req);
// 查询sys_user数据
SysUser sysUser = userService.selectUserByPhone(req.getPhone());
// 查询医生表数据
TDoctor tDoctor = tDoctorMapper.selectTDoctorByPhone(req.getPhone());
if (Objects.nonNull(sysUser)) {
if ("2".equals(sysUser.getDelFlag())) {
if ("2".equals(tDoctor.getDelFlag())) {
// 医生账号被删除 重新注册
sysUser.setDelFlag("0");
sysUser.setPassword(SecurityUtils.encryptPassword("123456"));
sysUser.setUserName(req.getPhone());
sysUser.setNickName(req.getName());
sysUser.setStatus("0");
userService.updateUser(sysUser);
// 向下转型
SysUserEX sysUserEX = new SysUserEX();
BeanUtils.copyProperties(sysUser, sysUserEX);
userService.updateUser(sysUserEX);
} else {
// delFlag = 0 : 医生账号已存在
return AjaxResult.error("当前手机号已经注册!");
@ -180,7 +187,7 @@ public class SysLoginService
userService.insertUser(sysUser);
}
// 查询医生表数据
TDoctor tDoctor = tDoctorMapper.selectTDoctorByPhone(req.getPhone());
// TDoctor tDoctor = tDoctorMapper.selectTDoctorByPhone(req.getPhone());
if (Objects.nonNull(tDoctor)) {
if ("2".equals(tDoctor.getDelFlag())) {
// 重新注册

@ -37,6 +37,8 @@ public class TRecordServiceImpl implements ITRecordService
private static Map<String, JSONObject> jsonKeyMap = new HashMap<>();
private static int index = 0;
private static Map<String, String> newJsonKeyMap = new HashMap<String, String>(){{
put("sx_vein_color", "sx_vein_color2");
put("sz_color", "sz_color2");
@ -67,24 +69,13 @@ public class TRecordServiceImpl implements ITRecordService
}};
/**
* key
* key
*/
private static final List<String> getQuantificationKeys = new ArrayList<String>(){{
add("sx_vein_width");
add("sx_vein_length");
}};
/**
* keys
*/
private static final List<String> addQuantificationKeys = new ArrayList<String>(){{
add("sz_pangshou");
add("st_houbo");
add("st_funi");
add("st_runzao");
add("st_cao");
}};
@Autowired
private TRecordMapper tRecordMapper;
@ -203,6 +194,7 @@ public class TRecordServiceImpl implements ITRecordService
return "";
}
// 将老数据结构对应的数据读出来
jsonKeyMap.clear();
JSONObject jsonObject = JSONObject.parseObject(jsonString);
readJsonToMap(jsonObject.getJSONObject("data"));
logger.info("jsonKeyMap is {}", jsonKeyMap);
@ -295,11 +287,11 @@ public class TRecordServiceImpl implements ITRecordService
{
logger.info("get history list param is : {} ", tRecord);
List<TRecord> tRecords = tRecordMapper.selectTRecordList(tRecord);
tRecords.removeIf(o->"0".equals(o.getStatus()));
if (CollectionUtils.isEmpty(tRecords)){
List<TRecord> collect = tRecords.stream().filter(tRecord1 -> "1".equals(tRecord1.getStatus())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(collect)){
return AjaxResult.success();
}
List<TRecord> records = tRecords.stream().sorted(Comparator.comparing(TRecord::getCreateTime)).collect(Collectors.toList());
List<TRecord> records = collect.stream().sorted(Comparator.comparing(TRecord::getCreateTime)).collect(Collectors.toList());
RecordHistoryDataResp recordHistoryDataRespMap = getDataList(records);
return AjaxResult.success(recordHistoryDataRespMap);
}
@ -328,17 +320,20 @@ public class TRecordServiceImpl implements ITRecordService
}).filter(Objects::nonNull).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(result)){
HashMap<String, ArrayList<Object>> map = new HashMap<>();
result.forEach(jsonObject -> {
getJsonData(jsonObject.getJSONObject("data"), "data", map, ignoreKeys);
logger.info("history map is {} ", map);
for (int i = 0; i < result.size(); i++) {
index = i + 1;
getJsonData(result.get(i).getJSONObject("data"), "data", map, ignoreKeys);
map.forEach((key, value) -> {
if (value.size() < result.indexOf(jsonObject) + 1) {
// 向后插入
if (value.size() < index) {
value.add("-1");
}
});
});
logger.info("index is '{}', history map is '{}' ", index, map);
}
recordHistoryDataResp.setHistoryDataMap(map);
}
index = 0;
return recordHistoryDataResp;
}
@ -358,7 +353,7 @@ public class TRecordServiceImpl implements ITRecordService
// 这两种情况应该添加默认值
if (nullValKeys.contains(listName) && null == ((JSONObject) obj).get("v")) {
// 加默认值
doSetHistoryData(historyDataMap, listName, "0");
doSetHistoryData(historyDataMap, listName, "-1");
}
for (Map.Entry<String, Object> entry : ((JSONObject) obj).entrySet()) {
// 忽略带图片字段
@ -378,11 +373,6 @@ public class TRecordServiceImpl implements ITRecordService
if (!getQuantificationKeys.contains(listName) && "v".equals(entry.getKey())) {
doSetHistoryData(historyDataMap, listName, entry.getValue());
}
// 追加量化值数据
if (addQuantificationKeys.contains(listName) && "quantification".equals(entry.getKey())) {
String newListName = listName + "_q";
doSetHistoryData(historyDataMap, newListName, entry.getValue());
}
}
}
}
@ -402,6 +392,12 @@ public class TRecordServiceImpl implements ITRecordService
} else {
list = historyDataMap.get(listName);
}
// 判断是否需要向前补数据
if ((list.size() + 1) < index) {
for (int i = 0; i < index - list.size(); i++) {
list.add(0, "-1");
}
}
list.add(StringUtils.isNull(val) || StringUtils.isEmpty(val.toString()) ? "-1" : val);
historyDataMap.put(listName, list);
}

Loading…
Cancel
Save