Merge branch 'fix_foton_20231031' into 'dev_20230829_change'

Fix foton 20231031

See merge request laws-foton-slrs/foton-slrs-system-rest!132
This commit is contained in:
高嵩
2023-11-13 04:33:49 +00:00
6 changed files with 61 additions and 26 deletions
@@ -121,6 +121,7 @@ public class SendBussMQService {
}else{
saveMap.put("put_time_data",-1000000000000000000L);
}
saveMap.put("warehousingTime",sdf.format(infoEO.getCreationTime())); // 入库时间
//查询字典表,形成Hash映射提升速度
List<DicTypeEO> dicInfo = dicTypeEODao.getDicInfo("dic_id","dic_type_code", "dic_type_name","show_index");
@@ -243,7 +243,9 @@ public class SendLawsMQService {
// 动态存储属性字段
for (String field : fieldInfoList) {
saveMap.put(field,attrInfoMap.getOrDefault(field,""));
Object fieldValueObj = attrInfoMap.getOrDefault(field,"");
saveMap.put(field,fieldValueObj);
String fieldValue = "";
String fieldFilter = field.toLowerCase();
if(infoMap.get(fieldFilter) != null && StringUtils.isNotBlank(infoMap.get(fieldFilter).toString())){
@@ -259,7 +261,12 @@ public class SendLawsMQService {
fieldValue = fieldValue.replace("null","");
}
}
saveMap.put(field+"Name",fieldValue);
if("SSRQ".equals(field)){
saveMap.put(field+"Name",fieldValue.replace(" ","").replace("-",""));
}else{
saveMap.put(field+"Name",fieldValue);
}
}
if(infoEOMapItems != null && !infoEOMapItems.isEmpty()){
@@ -194,6 +194,8 @@ public class SendStandMQService {
saveMap.put("validFlag","0");
saveMap.put("content",infoEO.getFileIds());
saveMap.put("CHJL",infoEO.getCHJL());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
saveMap.put("warehousingTime",sdf.format(infoEO.getCreationTime())); // 入库时间
String fieldInfo = InitStandAttrUtil.queryField;
List<String> fieldInfoList = Arrays.asList(fieldInfo .split(",")).stream().map(s -> (s.trim())).collect(Collectors.toList());
@@ -23,7 +23,9 @@ import com.adc.da.sys.constant.ValidFlagEnum;
import com.adc.da.sys.entity.UserOrgEO;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.log4j.Log4j;
@@ -496,6 +498,7 @@ public class DataSyncServiceImpl implements IDataSyncService {
}
List<TsUser> addUserList = new ArrayList<>();
List<TsUser> upUserList = new ArrayList<>();
Set<String> syncUserIdSet = new HashSet<>();
for (String s : res) {
JSONObject userData = JSONObject.parseObject(s);
if(userData.containsKey("results")){
@@ -503,6 +506,7 @@ public class DataSyncServiceImpl implements IDataSyncService {
jsonArray.forEach(object -> {
JSONObject jsonObject = JSONObject.parseObject(object.toString());
String userid = jsonObject.getString("userid");
syncUserIdSet.add(userid);
TsUser userEO = tsUserService.getById(userid);
String userState = "";
if(userEO != null){
@@ -566,6 +570,23 @@ public class DataSyncServiceImpl implements IDataSyncService {
logger.debug("本次更新的用户为:"+JSONObject.toJSONString(upUserList));
tsUserService.updateBatchById(upUserList);
}
LambdaQueryWrapper<TsUser> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TsUser::getState,"1");
wrapper.eq(TsUser::getValidFlag,"0");
wrapper.eq(TsUser::getDisableFlag,"0");
wrapper.select(TsUser::getUserId);
Set<String> userIdDbList = tsUserService.list(wrapper).stream().map(TsUser::getUserId).collect(Collectors.toSet());
userIdDbList.removeAll(syncUserIdSet);
logger.info("本次同步删除掉的用户有:"+userIdDbList);
if(!userIdDbList.isEmpty()){
//删除数据库中不存在的用户
LambdaUpdateWrapper<TsUser> wrapper1 = new LambdaUpdateWrapper<>();
wrapper1.in(TsUser::getUserId,userIdDbList);
wrapper1.set(TsUser::getState,"0");
wrapper1.set(TsUser::getValidFlag,"1");
wrapper1.set(TsUser::getDisableFlag,"1");
tsUserService.update(wrapper1);
}
}else{
logger.info("本次获取用户的数据为空,原因有2种:1、没有同步数据 2、请求接口报错");
}
@@ -47,8 +47,9 @@
<select id="selectPreviousInstitution" resultMap="TsUser">
select * from ts_user
<where>
STATE = '1' and VALID_FLAG = '0' and DISABLE_FLAG = '0'
<if test="userName != null and userName != '' ">
( ts_user.ACCOUNT like concat(concat('%',#{userName}),'%') or ts_user.UNAME like concat(concat('%',#{userName}),'%') )
and ( ts_user.ACCOUNT like concat(concat('%',#{userName}),'%') or ts_user.UNAME like concat(concat('%',#{userName}),'%') )
</if>
</where>
</select>
@@ -96,7 +97,8 @@
from ts_user
left join ts_institution ON ts_institution.id = (SELECT parent_id from ts_institution WHERE id = ts_user.INSTITUTION_ID)
left join ts_institution t2 on t2.id=ts_user.INSTITUTION_ID
WHERE institution_id=#{institutionId}
WHERE ts_user.STATE = '1' and ts_user.VALID_FLAG = '0' and ts_user.DISABLE_FLAG = '0'
and institution_id=#{institutionId}
<if test="userName != null and userName != '' ">
and ( ts_user.ACCOUNT like concat(concat('%',#{userName}),'%') or ts_user.UNAME like concat(concat('%',#{userName}),'%') )
</if>