给所有多数据源切换 加上try finally处理
This commit is contained in:
parent
bcbcf55ea0
commit
a068975b98
|
|
@ -15,6 +15,7 @@ import com.nu.modules.elder.api.IElderInfoApi;
|
||||||
import com.nu.modules.nubaseelder.api.INuBaseElderApi;
|
import com.nu.modules.nubaseelder.api.INuBaseElderApi;
|
||||||
import com.nu.modules.orgapplyinfo.api.IOrgApplyInfoApi;
|
import com.nu.modules.orgapplyinfo.api.IOrgApplyInfoApi;
|
||||||
import com.nu.modules.orgapplyinfo.entity.OrgAllInfoApiEntity;
|
import com.nu.modules.orgapplyinfo.entity.OrgAllInfoApiEntity;
|
||||||
|
import com.nu.utils.NuRedisUtils;
|
||||||
import com.nu.utils.RabbitMQUtil;
|
import com.nu.utils.RabbitMQUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
@ -131,16 +132,19 @@ public class ElderApi {
|
||||||
|
|
||||||
//切换数据源整理好数据放到返回结果中
|
//切换数据源整理好数据放到返回结果中
|
||||||
DynamicDataSourceContextHolder.push(orgCode);
|
DynamicDataSourceContextHolder.push(orgCode);
|
||||||
ElderInfoMQDto mqdto = new ElderInfoMQDto();
|
try {
|
||||||
mqdto.setGuardianId(nuBizAdvisoryInfo.getId());//家属(用户)id
|
ElderInfoMQDto mqdto = new ElderInfoMQDto();
|
||||||
mqdto.setGuardianOpenId(nuBizAdvisoryInfo.getOpenId());//联系人openId
|
mqdto.setGuardianId(nuBizAdvisoryInfo.getId());//家属(用户)id
|
||||||
mqdto.setGuardianName(nuBizAdvisoryInfo.getName());//联系人姓名
|
mqdto.setGuardianOpenId(nuBizAdvisoryInfo.getOpenId());//联系人openId
|
||||||
mqdto.setGuardianPhone(nuBizAdvisoryInfo.getTel());//联系人电话
|
mqdto.setGuardianName(nuBizAdvisoryInfo.getName());//联系人姓名
|
||||||
mqdto.setGuardianIdCard(nuBizAdvisoryInfo.getIdCard());//联系人身份证号
|
mqdto.setGuardianPhone(nuBizAdvisoryInfo.getTel());//联系人电话
|
||||||
mqdto.setGuardianHomeAddress(nuBizAdvisoryInfo.getHomeAddress());//联系人家庭住址
|
mqdto.setGuardianIdCard(nuBizAdvisoryInfo.getIdCard());//联系人身份证号
|
||||||
mqdto.setGuardianWorkUnit(nuBizAdvisoryInfo.getWorkUnit());//联系人工作单位
|
mqdto.setGuardianHomeAddress(nuBizAdvisoryInfo.getHomeAddress());//联系人家庭住址
|
||||||
rabbitMQUtil.sendToExchange("hldy.elder", orgCode + ".elder.updateguardianinfo", mqdto);
|
mqdto.setGuardianWorkUnit(nuBizAdvisoryInfo.getWorkUnit());//联系人工作单位
|
||||||
DynamicDataSourceContextHolder.clear();
|
rabbitMQUtil.sendToExchange("hldy.elder", orgCode + ".elder.updateguardianinfo", mqdto);
|
||||||
|
} finally {
|
||||||
|
DynamicDataSourceContextHolder.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -247,9 +251,13 @@ public class ElderApi {
|
||||||
// for (Map.Entry<String, String> entry : orgCodeToNuIdMap.entrySet()) {
|
// for (Map.Entry<String, String> entry : orgCodeToNuIdMap.entrySet()) {
|
||||||
//切换数据源整理好数据放到返回结果中
|
//切换数据源整理好数据放到返回结果中
|
||||||
DynamicDataSourceContextHolder.push(orgCode);
|
DynamicDataSourceContextHolder.push(orgCode);
|
||||||
List<ElderInfoEntity> list = elderInfoApi.queryElders(openId, elderId);
|
List<ElderInfoEntity> list = Lists.newArrayList();
|
||||||
|
try {
|
||||||
|
list = elderInfoApi.queryElders(openId, elderId);
|
||||||
|
} finally {
|
||||||
|
DynamicDataSourceContextHolder.clear();
|
||||||
|
}
|
||||||
result.addAll(list);
|
result.addAll(list);
|
||||||
DynamicDataSourceContextHolder.clear();
|
|
||||||
// }
|
// }
|
||||||
result.stream().forEach(d -> {
|
result.stream().forEach(d -> {
|
||||||
d.setOrgCode(orgCode);
|
d.setOrgCode(orgCode);
|
||||||
|
|
@ -265,7 +273,10 @@ public class ElderApi {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/addElder")
|
@PostMapping("/addElder")
|
||||||
public Result<?> save(@RequestBody ElderInfoEntity elderInfoEntity) {
|
public Result<?> save(@RequestParam("ukey") String ukey, @RequestBody ElderInfoEntity elderInfoEntity) {
|
||||||
|
if (NuRedisUtils.existKey(ukey)) {
|
||||||
|
return Result.ok("重复提交");
|
||||||
|
}
|
||||||
//长者id
|
//长者id
|
||||||
String id = elderInfoEntity.getSysOrgCode() + IdUtil.simpleUUID();
|
String id = elderInfoEntity.getSysOrgCode() + IdUtil.simpleUUID();
|
||||||
|
|
||||||
|
|
@ -273,20 +284,23 @@ public class ElderApi {
|
||||||
{
|
{
|
||||||
//切换数据源
|
//切换数据源
|
||||||
DynamicDataSourceContextHolder.push(elderInfoEntity.getSysOrgCode());
|
DynamicDataSourceContextHolder.push(elderInfoEntity.getSysOrgCode());
|
||||||
NuBaseInfoEntity judgeResult = nuBaseInfoApi.queryByElderIdNum(elderInfoEntity.getIdCard());
|
try {
|
||||||
if (judgeResult != null) {
|
NuBaseInfoEntity judgeResult = nuBaseInfoApi.queryByElderIdNum(elderInfoEntity.getIdCard());
|
||||||
//这个是老人id跟护理单元还绑定中(认为是还在住)
|
if (judgeResult != null) {
|
||||||
if (StringUtils.isNotBlank(judgeResult.getElderId())) {
|
//这个是老人id跟护理单元还绑定中(认为是还在住)
|
||||||
return Result.error("老人已入住机构,不可重复添加");
|
if (StringUtils.isNotBlank(judgeResult.getElderId())) {
|
||||||
}
|
return Result.error("老人已入住机构,不可重复添加");
|
||||||
//这个是入住任何护理单元 但是有盖老人信息 在业务端会更新长者信息
|
}
|
||||||
if (StringUtils.isBlank(judgeResult.getElderId()) && StringUtils.isNotBlank(judgeResult.getElderTableId())) {
|
//这个是入住任何护理单元 但是有盖老人信息 在业务端会更新长者信息
|
||||||
//老人之前在机构入住过
|
if (StringUtils.isBlank(judgeResult.getElderId()) && StringUtils.isNotBlank(judgeResult.getElderTableId())) {
|
||||||
id = judgeResult.getElderTableId();
|
//老人之前在机构入住过
|
||||||
|
id = judgeResult.getElderTableId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
//清理数据源
|
||||||
|
DynamicDataSourceContextHolder.clear();
|
||||||
}
|
}
|
||||||
//清理数据源
|
|
||||||
DynamicDataSourceContextHolder.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -299,7 +313,7 @@ public class ElderApi {
|
||||||
|
|
||||||
//处理管理端老人信息
|
//处理管理端老人信息
|
||||||
ElderInfoEntity elderInfoEn = new ElderInfoEntity();
|
ElderInfoEntity elderInfoEn = new ElderInfoEntity();
|
||||||
BeanUtils.copyProperties(mqdto,elderInfoEn);
|
BeanUtils.copyProperties(mqdto, elderInfoEn);
|
||||||
elderInfoApi.addElder(elderInfoEn);
|
elderInfoApi.addElder(elderInfoEn);
|
||||||
|
|
||||||
return Result.ok(id);
|
return Result.ok(id);
|
||||||
|
|
@ -327,7 +341,10 @@ public class ElderApi {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/updateElderInfo")
|
@PostMapping("/updateElderInfo")
|
||||||
public Result<?> updateElderInfo(@RequestBody ElderInfoEntity elderInfoEntity) {
|
public Result<?> updateElderInfo(@RequestParam("ukey") String ukey, @RequestBody ElderInfoEntity elderInfoEntity) {
|
||||||
|
if (NuRedisUtils.existKey(ukey)) {
|
||||||
|
return Result.ok("重复提交");
|
||||||
|
}
|
||||||
elderInfoEntity.setOrgCode(elderInfoEntity.getSysOrgCode());
|
elderInfoEntity.setOrgCode(elderInfoEntity.getSysOrgCode());
|
||||||
ElderInfoMQDto mqdto = new ElderInfoMQDto();
|
ElderInfoMQDto mqdto = new ElderInfoMQDto();
|
||||||
BeanUtils.copyProperties(elderInfoEntity, mqdto);
|
BeanUtils.copyProperties(elderInfoEntity, mqdto);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
package com.nu.modules.wechat.employess.api;
|
package com.nu.modules.wechat.employess.api;
|
||||||
|
|
||||||
import com.nu.modules.EmployessInfo.api.IEmployessAdvisioryInfoApi;
|
|
||||||
import com.nu.entity.EmployeesAdvisoryInfoEntity;
|
import com.nu.entity.EmployeesAdvisoryInfoEntity;
|
||||||
|
import com.nu.modules.EmployessInfo.api.IEmployessAdvisioryInfoApi;
|
||||||
|
import com.nu.utils.NuRedisUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
|
@ -17,15 +18,20 @@ public class EmployessInfoApi {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IEmployessAdvisioryInfoApi employessAdvisioryInfoApi;
|
private IEmployessAdvisioryInfoApi employessAdvisioryInfoApi;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增/编辑员工入驻申请信息
|
* 新增/编辑员工入驻申请信息
|
||||||
*
|
*
|
||||||
|
* @param ukey 幂等性
|
||||||
* @param EmployeesAdvisoryInfoEntity
|
* @param EmployeesAdvisoryInfoEntity
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@AutoLog(value = "员工咨询信息-新增或修改")
|
@AutoLog(value = "员工咨询信息-新增或修改")
|
||||||
@PostMapping("/saveApiEmployess")
|
@PostMapping("/saveApiEmployess")
|
||||||
public Result<Object> saveApiEmployess(@RequestBody EmployeesAdvisoryInfoEntity EmployeesAdvisoryInfoEntity) {
|
public Result<Object> saveApiEmployess(@RequestParam("ukey") String ukey, @RequestBody EmployeesAdvisoryInfoEntity EmployeesAdvisoryInfoEntity) {
|
||||||
|
if(NuRedisUtils.existKey(ukey)){
|
||||||
|
return Result.ok("重复提交");
|
||||||
|
}
|
||||||
//新增员工信息
|
//新增员工信息
|
||||||
// if (StringUtils.isNotBlank(EmployeesAdvisoryInfoEntity.getOpenId())) {
|
// if (StringUtils.isNotBlank(EmployeesAdvisoryInfoEntity.getOpenId())) {
|
||||||
// EmployeesAdvisoryInfoEntity employeesAdvisoryInfoEntity = new EmployeesAdvisoryInfoEntity();
|
// EmployeesAdvisoryInfoEntity employeesAdvisoryInfoEntity = new EmployeesAdvisoryInfoEntity();
|
||||||
|
|
@ -39,7 +45,8 @@ public class EmployessInfoApi {
|
||||||
employessAdvisioryInfoApi.updateById(EmployeesAdvisoryInfoEntity);
|
employessAdvisioryInfoApi.updateById(EmployeesAdvisoryInfoEntity);
|
||||||
return Result.ok("保存成功!");
|
return Result.ok("保存成功!");
|
||||||
} else {
|
} else {
|
||||||
return Result.ok(employessAdvisioryInfoApi.insert(EmployeesAdvisoryInfoEntity));
|
Result.ok(employessAdvisioryInfoApi.insert(EmployeesAdvisoryInfoEntity));
|
||||||
|
return Result.ok("添加成功!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,14 +91,15 @@ public class NuBaseInfoApi {
|
||||||
|
|
||||||
//切换数据源整理好数据放到返回结果中
|
//切换数据源整理好数据放到返回结果中
|
||||||
DynamicDataSourceContextHolder.push(orgCode);
|
DynamicDataSourceContextHolder.push(orgCode);
|
||||||
NuBillEntity params = new NuBillEntity();
|
List<NuBillEntity> list;
|
||||||
params.setOpenId(openId);
|
try {
|
||||||
params.setNuId(nuId);
|
NuBillEntity params = new NuBillEntity();
|
||||||
List<NuBillEntity> list = nuBillApi.queryByOpenId(params);
|
params.setOpenId(openId);
|
||||||
// if (list == null || list.size() == 0) {
|
params.setNuId(nuId);
|
||||||
// continue;
|
list = nuBillApi.queryByOpenId(params);
|
||||||
// }
|
} finally {
|
||||||
DynamicDataSourceContextHolder.clear();
|
DynamicDataSourceContextHolder.clear();
|
||||||
|
}
|
||||||
result.addAll(list);
|
result.addAll(list);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
@ -150,55 +151,59 @@ public class NuBaseInfoApi {
|
||||||
|
|
||||||
//切换数据源整理好数据放到返回结果中
|
//切换数据源整理好数据放到返回结果中
|
||||||
DynamicDataSourceContextHolder.push(orgCode);
|
DynamicDataSourceContextHolder.push(orgCode);
|
||||||
List<NuBaseInfoEntity> baseList = nuBaseInfoApi.queryByOpenId(openId);
|
List<NuBaseInfoEntity> baseList;
|
||||||
if (baseList == null || baseList.size() == 0) {
|
try {
|
||||||
continue;
|
baseList = nuBaseInfoApi.queryByOpenId(openId);
|
||||||
}
|
if (baseList == null || baseList.size() == 0) {
|
||||||
Map<String, Integer> nuIndex = Maps.newHashMap();//护理单元所在索引位置
|
continue;
|
||||||
Map<String, Integer> elderIndex = Maps.newHashMap();//长者所在索引位置
|
}
|
||||||
String nuIds = "";//护理单元ids
|
Map<String, Integer> nuIndex = Maps.newHashMap();//护理单元所在索引位置
|
||||||
String elderIds = "";//长者ids
|
Map<String, Integer> elderIndex = Maps.newHashMap();//长者所在索引位置
|
||||||
|
String nuIds = "";//护理单元ids
|
||||||
|
String elderIds = "";//长者ids
|
||||||
|
|
||||||
for (int i = 0; i < baseList.size(); i++) {
|
for (int i = 0; i < baseList.size(); i++) {
|
||||||
String nuId = baseList.get(i).getNuId();//护理单元nuID
|
String nuId = baseList.get(i).getNuId();//护理单元nuID
|
||||||
String elderId = baseList.get(i).getElderId();//长者id
|
String elderId = baseList.get(i).getElderId();//长者id
|
||||||
nuIds += "," + nuId;
|
nuIds += "," + nuId;
|
||||||
nuIndex.put(nuId, i);
|
nuIndex.put(nuId, i);
|
||||||
if (StringUtils.isNotBlank(elderId)) {
|
if (StringUtils.isNotBlank(elderId)) {
|
||||||
elderIds += "," + elderId;
|
elderIds += "," + elderId;
|
||||||
elderIndex.put(elderId, i);
|
elderIndex.put(elderId, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
//老人信息
|
||||||
//老人信息
|
if (StringUtils.isNotBlank(elderIds)) {
|
||||||
if (StringUtils.isNotBlank(elderIds)) {
|
List<ElderInfoEntity> elderList = elderInfoApi.queryByElderIds(elderIds.substring(1).split(","));
|
||||||
List<ElderInfoEntity> elderList = elderInfoApi.queryByElderIds(elderIds.substring(1).split(","));
|
if (elderList != null && elderList.size() > 0) {
|
||||||
if (elderList != null && elderList.size() > 0) {
|
elderList.stream().forEach(el -> {
|
||||||
elderList.stream().forEach(el -> {
|
Integer index = elderIndex.get(el.getId());
|
||||||
Integer index = elderIndex.get(el.getId());
|
if (index != null) {
|
||||||
if (index != null) {
|
baseList.get(index).setElderInfo(el);
|
||||||
baseList.get(index).setElderInfo(el);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//温湿度
|
|
||||||
if (StringUtils.isNotBlank(nuIds)) {
|
|
||||||
List<HumidDeviceEntity> huList = humidAlarmApi.queryByNuIds(nuIds.substring(1));
|
|
||||||
if (huList != null && huList.size() > 0) {
|
|
||||||
huList.stream().forEach(h -> {
|
|
||||||
Integer index = nuIndex.get(h.getNuId());
|
|
||||||
if (index != null) {
|
|
||||||
List<HumidDeviceEntity> humidDeviceList = baseList.get(index).getHumidDeviceList();
|
|
||||||
if (humidDeviceList == null) {
|
|
||||||
humidDeviceList = Lists.newArrayList();
|
|
||||||
}
|
}
|
||||||
humidDeviceList.add(h);
|
});
|
||||||
baseList.get(index).setHumidDeviceList(humidDeviceList);
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
//温湿度
|
||||||
|
if (StringUtils.isNotBlank(nuIds)) {
|
||||||
|
List<HumidDeviceEntity> huList = humidAlarmApi.queryByNuIds(nuIds.substring(1));
|
||||||
|
if (huList != null && huList.size() > 0) {
|
||||||
|
huList.stream().forEach(h -> {
|
||||||
|
Integer index = nuIndex.get(h.getNuId());
|
||||||
|
if (index != null) {
|
||||||
|
List<HumidDeviceEntity> humidDeviceList = baseList.get(index).getHumidDeviceList();
|
||||||
|
if (humidDeviceList == null) {
|
||||||
|
humidDeviceList = Lists.newArrayList();
|
||||||
|
}
|
||||||
|
humidDeviceList.add(h);
|
||||||
|
baseList.get(index).setHumidDeviceList(humidDeviceList);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
DynamicDataSourceContextHolder.clear();
|
||||||
}
|
}
|
||||||
DynamicDataSourceContextHolder.clear();
|
|
||||||
result.addAll(baseList);
|
result.addAll(baseList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.nu.modules.EmployessInfo.api.IEmployessAdvisioryInfoApi;
|
||||||
import com.nu.entity.EmployeesAdvisoryInfoEntity;
|
import com.nu.entity.EmployeesAdvisoryInfoEntity;
|
||||||
import com.nu.modules.orgapplyinfo.api.IOrgApplyInfoApi;
|
import com.nu.modules.orgapplyinfo.api.IOrgApplyInfoApi;
|
||||||
import com.nu.modules.orgapplyinfo.entity.OrgApplyInfoApiEntity;
|
import com.nu.modules.orgapplyinfo.entity.OrgApplyInfoApiEntity;
|
||||||
|
import com.nu.utils.NuRedisUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
|
@ -30,7 +31,10 @@ public class OrgApplyInfoApi {
|
||||||
*/
|
*/
|
||||||
@AutoLog(value = "新增/编辑机构加盟申请信息")
|
@AutoLog(value = "新增/编辑机构加盟申请信息")
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public Result<Object> save(@RequestBody OrgApplyInfoApiEntity orgApplyInfoApiEntity) {
|
public Result<Object> save(@RequestParam("ukey") String ukey,@RequestBody OrgApplyInfoApiEntity orgApplyInfoApiEntity) {
|
||||||
|
if(NuRedisUtils.existKey(ukey)){
|
||||||
|
return Result.ok("重复提交");
|
||||||
|
}
|
||||||
System.out.println("-----------新增/编辑机构加盟申请信息--------tel------------" + orgApplyInfoApiEntity.getTel());
|
System.out.println("-----------新增/编辑机构加盟申请信息--------tel------------" + orgApplyInfoApiEntity.getTel());
|
||||||
if (StringUtils.isNotBlank(orgApplyInfoApiEntity.getTel())) {
|
if (StringUtils.isNotBlank(orgApplyInfoApiEntity.getTel())) {
|
||||||
EmployeesAdvisoryInfoEntity employeesAdvisoryInfoEntity = new EmployeesAdvisoryInfoEntity();
|
EmployeesAdvisoryInfoEntity employeesAdvisoryInfoEntity = new EmployeesAdvisoryInfoEntity();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.nu.dto;
|
package com.nu.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -42,4 +43,12 @@ public class CategoryMQDto implements Serializable {
|
||||||
* 是否删除 0未删除 1删除
|
* 是否删除 0未删除 1删除
|
||||||
*/
|
*/
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
/**
|
||||||
|
* 网络标记,0为用pad本地静态图片,1为用网络图
|
||||||
|
*/
|
||||||
|
private java.lang.String netFlag;
|
||||||
|
/**
|
||||||
|
* 动画图片
|
||||||
|
*/
|
||||||
|
private java.lang.String animationPath;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,4 +58,12 @@ public class DirectiveTypeMQDto implements Serializable {
|
||||||
* 是否删除 0未删除 1删除
|
* 是否删除 0未删除 1删除
|
||||||
*/
|
*/
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
/**
|
||||||
|
* 网络标记,0为用pad本地静态图片,1为用网络图
|
||||||
|
*/
|
||||||
|
private java.lang.String netFlag;
|
||||||
|
/**
|
||||||
|
* 动画图片
|
||||||
|
*/
|
||||||
|
private java.lang.String animationPath;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,43 +9,79 @@ import java.util.Date;
|
||||||
/**
|
/**
|
||||||
* @Description: 长者标签
|
* @Description: 长者标签
|
||||||
* @Author: zmy
|
* @Author: zmy
|
||||||
* @Date: 2025-08-13
|
* @Date: 2025-08-13
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class ElderTagAsyncMQDto implements Serializable {
|
public class ElderTagAsyncMQDto implements Serializable {
|
||||||
|
|
||||||
/**id*/
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
private String id;
|
private String id;
|
||||||
/**标签类型*/
|
/**
|
||||||
|
* 标签类型
|
||||||
|
*/
|
||||||
private String type;
|
private String type;
|
||||||
/**标签名称*/
|
/**
|
||||||
|
* 标签名称
|
||||||
|
*/
|
||||||
private String tagName;
|
private String tagName;
|
||||||
/**说明*/
|
/**
|
||||||
|
* 说明
|
||||||
|
*/
|
||||||
private java.lang.String describ;
|
private java.lang.String describ;
|
||||||
/**价格*/
|
/**
|
||||||
|
* 价格
|
||||||
|
*/
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
/**图标*/
|
/**
|
||||||
|
* 图标
|
||||||
|
*/
|
||||||
private String pic;
|
private String pic;
|
||||||
/**图标md5值*/
|
/**
|
||||||
|
* 图标md5值
|
||||||
|
*/
|
||||||
private String picMd5;
|
private String picMd5;
|
||||||
/**排序*/
|
/**
|
||||||
|
* 焦点图标
|
||||||
|
*/
|
||||||
|
private java.lang.String picFocus;
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
/**是否启用*/
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
private String izEnabled;
|
private String izEnabled;
|
||||||
/**是否删除*/
|
/**
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
/**创建人*/
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
private String createBy;
|
private String createBy;
|
||||||
/**创建日期*/
|
/**
|
||||||
|
* 创建日期
|
||||||
|
*/
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
/**更新人*/
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
private String updateBy;
|
private String updateBy;
|
||||||
/**更新日期*/
|
/**
|
||||||
|
* 更新日期
|
||||||
|
*/
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
/**所属机构*/
|
/**
|
||||||
|
* 所属机构
|
||||||
|
*/
|
||||||
private String sysOrgCode;
|
private String sysOrgCode;
|
||||||
/**资源请求接口域名+项目上下文路径 */
|
/**
|
||||||
|
* 资源请求接口域名+项目上下文路径
|
||||||
|
*/
|
||||||
private String api;
|
private String api;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.nu.utils;
|
||||||
|
|
||||||
|
import org.jeecg.common.util.RedisUtil;
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationContextAware;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class NuRedisUtils implements ApplicationContextAware {
|
||||||
|
|
||||||
|
private static RedisUtil redisUtil;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||||
|
// 从 Spring 容器中获取 RedisUtil(确保 RedisUtil 是 Spring 管理的 Bean)
|
||||||
|
redisUtil = applicationContext.getBean(RedisUtil.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断 key 是否存在,如果不存在则设置(30秒过期),并返回 false;
|
||||||
|
* 如果已存在,返回 true。
|
||||||
|
*/
|
||||||
|
public static boolean existKey(String key) {
|
||||||
|
if (redisUtil == null) {
|
||||||
|
throw new IllegalStateException("RedisUtil 尚未初始化,请确保 Spring 容器已启动");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!redisUtil.hasKey(key)) {
|
||||||
|
redisUtil.set(key, key, 15); // 过期时间
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -123,4 +123,5 @@ public class SafetyUtil {
|
||||||
// 计算 MD5 并返回
|
// 计算 MD5 并返回
|
||||||
return calculateMD5(mixedKey);
|
return calculateMD5(mixedKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ public class ServiceElderBkJob implements Job {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备份各机构长者标签
|
* 备份各机构长者标签
|
||||||
|
*
|
||||||
* @param jobExecutionContext
|
* @param jobExecutionContext
|
||||||
* @throws JobExecutionException
|
* @throws JobExecutionException
|
||||||
*/
|
*/
|
||||||
|
|
@ -51,9 +52,13 @@ public class ServiceElderBkJob implements Job {
|
||||||
currentOrgCode = codes.get(i);
|
currentOrgCode = codes.get(i);
|
||||||
try {
|
try {
|
||||||
DynamicDataSourceContextHolder.push(codes.get(i));
|
DynamicDataSourceContextHolder.push(codes.get(i));
|
||||||
List<ElderTag> list = elderTagService.lambdaQuery().list();
|
List<ElderTag> list;
|
||||||
DynamicDataSourceContextHolder.clear();
|
try {
|
||||||
if(list!=null && list.size()>0){
|
list = elderTagService.lambdaQuery().list();
|
||||||
|
} finally {
|
||||||
|
DynamicDataSourceContextHolder.clear();
|
||||||
|
}
|
||||||
|
if (list != null && list.size() > 0) {
|
||||||
//增加长者标签主备份记录
|
//增加长者标签主备份记录
|
||||||
ElderBkMain elderBkMain = new ElderBkMain();
|
ElderBkMain elderBkMain = new ElderBkMain();
|
||||||
elderBkMain.setOrgCode(codes.get(i));
|
elderBkMain.setOrgCode(codes.get(i));
|
||||||
|
|
@ -68,7 +73,7 @@ public class ServiceElderBkJob implements Job {
|
||||||
bkItemService.saveBatch(needAddList);
|
bkItemService.saveBatch(needAddList);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.info("备份机构【{}】的长者标签时报错",currentOrgCode,e);
|
log.info("备份机构【{}】的长者标签时报错", currentOrgCode, e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,13 @@ public class ElderTag implements Serializable {
|
||||||
/**图标md5值*/
|
/**图标md5值*/
|
||||||
@ApiModelProperty(value = "图标md5值")
|
@ApiModelProperty(value = "图标md5值")
|
||||||
private java.lang.String picMd5;
|
private java.lang.String picMd5;
|
||||||
|
/**焦点图标*/
|
||||||
|
@Excel(name = "焦点图标", width = 15)
|
||||||
|
@ApiModelProperty(value = "焦点图标")
|
||||||
|
private java.lang.String picFocus;
|
||||||
|
/**图标md5值*/
|
||||||
|
@ApiModelProperty(value = "图标md5值")
|
||||||
|
private java.lang.String picFocusMd5;
|
||||||
/**排序*/
|
/**排序*/
|
||||||
@Excel(name = "排序", width = 15)
|
@Excel(name = "排序", width = 15)
|
||||||
@ApiModelProperty(value = "排序")
|
@ApiModelProperty(value = "排序")
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ public class ServiceDirectiveBkJob implements Job {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备份各机构服务指令
|
* 备份各机构服务指令
|
||||||
|
*
|
||||||
* @param jobExecutionContext
|
* @param jobExecutionContext
|
||||||
* @throws JobExecutionException
|
* @throws JobExecutionException
|
||||||
*/
|
*/
|
||||||
|
|
@ -50,10 +51,15 @@ public class ServiceDirectiveBkJob implements Job {
|
||||||
for (int i = 0; i < codes.size(); i++) {
|
for (int i = 0; i < codes.size(); i++) {
|
||||||
currentOrgCode = codes.get(i);
|
currentOrgCode = codes.get(i);
|
||||||
try {
|
try {
|
||||||
|
//定时任务 无法通过获取本身或注入方式使用@DS注解切换
|
||||||
DynamicDataSourceContextHolder.push(codes.get(i));
|
DynamicDataSourceContextHolder.push(codes.get(i));
|
||||||
List<ConfigServiceDirective> directives = directiveService.queryAndTranslate(null);
|
List<ConfigServiceDirective> directives;
|
||||||
DynamicDataSourceContextHolder.clear();
|
try {
|
||||||
if(directives!=null && directives.size()>0){
|
directives = directiveService.queryAndTranslate(null);
|
||||||
|
} finally {
|
||||||
|
DynamicDataSourceContextHolder.clear();
|
||||||
|
}
|
||||||
|
if (directives != null && directives.size() > 0) {
|
||||||
//增加服务指令主备份记录
|
//增加服务指令主备份记录
|
||||||
DirectiveBkMain directiveBkMain = new DirectiveBkMain();
|
DirectiveBkMain directiveBkMain = new DirectiveBkMain();
|
||||||
directiveBkMain.setOrgCode(codes.get(i));
|
directiveBkMain.setOrgCode(codes.get(i));
|
||||||
|
|
@ -68,7 +74,7 @@ public class ServiceDirectiveBkJob implements Job {
|
||||||
bkItemService.saveBatch(needAddList);
|
bkItemService.saveBatch(needAddList);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.info("备份机构【{}】的服务指令时报错",currentOrgCode,e);
|
log.info("备份机构【{}】的服务指令时报错", currentOrgCode, e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,4 +81,10 @@ public class ConfigServiceCategory implements Serializable {
|
||||||
/**所属部门*/
|
/**所属部门*/
|
||||||
@ApiModelProperty(value = "所属部门")
|
@ApiModelProperty(value = "所属部门")
|
||||||
private java.lang.String sysOrgCode;
|
private java.lang.String sysOrgCode;
|
||||||
|
/**网络标记,0为用pad本地静态图片,1为用网络图*/
|
||||||
|
@ApiModelProperty(value = "网络标记")
|
||||||
|
private java.lang.String netFlag;
|
||||||
|
/**动画图片*/
|
||||||
|
@ApiModelProperty(value = "动画图片")
|
||||||
|
private java.lang.String animationPath;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,4 +86,10 @@ public class ConfigServiceType implements Serializable {
|
||||||
/**所属部门*/
|
/**所属部门*/
|
||||||
@ApiModelProperty(value = "所属部门")
|
@ApiModelProperty(value = "所属部门")
|
||||||
private java.lang.String sysOrgCode;
|
private java.lang.String sysOrgCode;
|
||||||
|
/**网络标记,0为用pad本地静态图片,1为用网络图*/
|
||||||
|
@ApiModelProperty(value = "网络标记")
|
||||||
|
private java.lang.String netFlag;
|
||||||
|
/**动画图片*/
|
||||||
|
@ApiModelProperty(value = "动画图片")
|
||||||
|
private java.lang.String animationPath;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue