Compare commits

...

2 Commits

Author SHA1 Message Date
wzz f11c42defc 处理冲突 3 months ago
wzz e114c2bd87 合并new 3 months ago
  1. 8
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminDmsUserController.java
  2. 1
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java
  3. 1
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ScreeningController.java
  4. 422
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/TaskController.java
  5. 2
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/WxQrCodeController.java
  6. 4
      acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java
  7. 1
      acupuncture-common/src/main/java/com/acupuncture/common/core/domain/entity/SysUser.java
  8. 38
      acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java
  9. 5
      acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantUserDto.java
  10. 2
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminTenantUserServiceImpl.java

8
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminDmsUserController.java

@ -2,10 +2,10 @@ package com.acupuncture.web.controller.web;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.acupuncture.common.annotation.DataSource;
import com.acupuncture.common.annotation.Log;
import com.acupuncture.common.core.domain.AjaxResult;
import com.acupuncture.common.core.domain.BaseDto;
import com.acupuncture.common.core.domain.JsonResponse;
import com.acupuncture.common.core.domain.entity.SysUser;
@ -89,6 +89,7 @@ public class AdminDmsUserController {
} else if (StringUtils.isNotEmpty(dto.getPhonenumber()) && !dmsLoginService.checkPhoneUnique(dto)) {
return JsonResponse.ok().fail("新增用户'" + dto.getUserName() + "'失败,手机号码已存在");
}
dto.setId(IdUtil.getSnowflakeNextId());
dto.setPassword(SecurityUtils.encryptPassword(dto.getPassword()));
adminTenantUserService.insert(dto);
@ -104,6 +105,7 @@ public class AdminDmsUserController {
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
return JsonResponse.ok().fail("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setUserId(dto.getId());
user.setTenantId(dto.getTenantId());
user.setCreateBy(SecurityUtils.getUsername());
user.setPhonenumber(dto.getContactPhone());
@ -196,8 +198,4 @@ public class AdminDmsUserController {
//只修改主库密码,修改从库密码没有任何意义。
return JsonResponse.ok(adminTenantUserService.resetPwd(dto));
}
private static void removeDataSource() {
DynamicDataSourceContextHolder.clearDataSourceType();
}
}

1
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/AdminPmsTreatmentController.java

@ -75,7 +75,6 @@ public class AdminPmsTreatmentController {
// }
//
// @ApiOperation("导出诊疗档案评估报告")
// @PostMapping("/exportTreatmentPg")
// public JsonResponse<String> exportTreatmentPg(HttpServletResponse response, @RequestBody @Validated PmsTreatmentDto.ExportVO dto){

1
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ScreeningController.java

@ -87,7 +87,6 @@ public class ScreeningController {
return JsonResponse.ok(detailInfo);
}
@ApiOperation(value = "提交筛查", notes = "")
@RequestMapping(value = "/submit", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse submitQuestionnaire(@ApiParam @Validated @RequestBody BaseDto<ScreeningDto.SubmitScreeningQuestionnaire> params) throws Exception {

422
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/TaskController.java

@ -1,211 +1,211 @@
package com.acupuncture.web.controller.web;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.acupuncture.common.annotation.Anonymous;
import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder;
import com.acupuncture.system.domain.po.FmsFollowupTask;
import com.acupuncture.system.domain.po.FmsPatientQueueRelation;
import com.acupuncture.system.domain.vo.FmsFollowupVo;
import com.acupuncture.system.domain.vo.UmsDataSourceVo;
import com.acupuncture.system.persist.dao.FmsFollowupDao;
import com.acupuncture.system.persist.dao.UmsDataSourceDao;
import com.acupuncture.system.persist.mapper.FmsFollowupTaskMapper;
import com.acupuncture.system.persist.mapper.FmsPatientQueueRelationMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.quartz.TriggerUtils;
import org.quartz.impl.triggers.CronTriggerImpl;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* @Author zzc
* @Package com.acupuncture.web.controller.web
* @Date 2025/2/13 8:50
* @description:
*/
@Slf4j
@Api(tags = "定时任务相关")
@RestController
@RequestMapping("/task")
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class TaskController {
@Resource
private FmsFollowupDao fmsFollowupDao;
@Resource
private FmsFollowupTaskMapper fmsFollowupTaskMapper;
@Resource
private UmsDataSourceDao umsDataSourceDao;
@Resource
private FmsPatientQueueRelationMapper fmsPatientQueueRelationMapper;
@ApiOperation("定时任务添加随访工单")
@PostMapping("/task")
// @Scheduled(fixedRate = 10000)
@Anonymous
public void task() {
// TODO 生成工单第一次生成之后2周的,往后只生成之后一周。第一次随访时间: ( 患者的出院时间 - 7 + 轮次时间) 到 (患者的出院时间 + 7 + 轮次时间 )
//查询租户,根据租户循环切换数据源,定时处理所有医院的随访工单
// UmsDataSourceVo.Result result1 = new UmsDataSourceVo.Result();
// result1.setDataSourceKey("MASTER");
// changeDataSource(result1);
List<UmsDataSourceVo.Result> query = umsDataSourceDao.query(null);
if (CollectionUtil.isEmpty(query)) {
return;
}
//查询公共队列
List<FmsFollowupVo.FollowupQueueVO> queueResults = fmsFollowupDao.queryCommonQueue(null);
//切换数据源
for (UmsDataSourceVo.Result result : query) {
if ("MASTER".equals(result.getDataSourceKey())) {
continue;
}
changeDataSource(result);
{
//获取随访患者列表,根据患者出院日时间和队列添加工单
//1. 查询队列
List<FmsFollowupVo.FollowupQueueVO> queueList = fmsFollowupDao.selectQueueList(null, null, null, result.getTenantId());
if (CollectionUtil.isEmpty(queueList)) {
queueList = queueResults;
} else {
queueList.addAll(queueResults);
}
for (FmsFollowupVo.FollowupQueueVO followupQueueVO : queueList) {
//2. 查询队列随访患者列表
List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupDao.queryPatient(followupQueueVO.getId(), (byte) 0, null, followupQueueVO.getTenantId());
if (CollectionUtil.isEmpty(patientList)) {
continue;
}
//随访总月数
Integer followupMonth = followupQueueVO.getFollowupMonth();
for (FmsFollowupVo.FollowupPatient followupPatient : patientList) {
//获取随访到期时间 出院时间+随访总月数 = 到期时间
Calendar calendar = Calendar.getInstance();
calendar.setTime(followupPatient.getDischargeTime());
calendar.set(Calendar.MONTH, followupMonth);
Date time = calendar.getTime();
//获取队列信息
String frequency = followupQueueVO.getFrequency();
List<Date> dateList = new ArrayList<>();
try {
CronTriggerImpl cronTrigger = new CronTriggerImpl();
cronTrigger.setCronExpression(frequency);
//TriggerUtils.computeFireTimesBetween(要计算触发时间的触发器对象, 用于计算触发时间的日历对象, 计算触发时间的起始时间点, 计算触发时间的结束时间点);
dateList = TriggerUtils.computeFireTimesBetween(cronTrigger, null, followupPatient.getDischargeTime(), time);
if (CollectionUtil.isEmpty(dateList)) {
continue;
}
} catch (Exception e) {
e.printStackTrace();
}
//3. 判断随访类型
if (followupQueueVO.getFollowupType() == 0) {
//单次
FmsFollowupTask fmsFollowupTask = new FmsFollowupTask();
BeanUtil.copyProperties(followupQueueVO, fmsFollowupTask);
fmsFollowupTask.setId(IdUtil.getSnowflakeNextId());
fmsFollowupTask.setName(followupPatient.getName());
fmsFollowupTask.setPinyinFull(followupPatient.getPinyinFull());
fmsFollowupTask.setPinyinSimple(followupPatient.getPinyinSimple());
fmsFollowupTask.setGender(followupPatient.getGender());
if (followupPatient.getBirthDate() != null) {
fmsFollowupTask.setAge(DateUtil.age(followupPatient.getBirthDate(), new Date()));
}
fmsFollowupTask.setEthnicity(followupPatient.getEthnicity());
fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
fmsFollowupTask.setPhone(followupPatient.getPhone());
fmsFollowupTask.setTenantId(followupPatient.getTenantId());
fmsFollowupTask.setIdCardType(followupPatient.getIdCardType());
fmsFollowupTask.setIdCard(followupPatient.getIdCard());
fmsFollowupTask.setTimes(1);
fmsFollowupTask.setQueueId(followupQueueVO.getId());
fmsFollowupTask.setPatientId(followupPatient.getId());
fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
fmsFollowupTask.setDelFlag((byte) 0);
fmsFollowupTask.setCreateTime(new Date());
fmsFollowupTask.setStatus((byte) 0);
fmsFollowupTask.setStartTime(dateList.get(0));
fmsFollowupTask.setEndTime(dateList.get(0));
fmsFollowupTask.setFollowuper(followupQueueVO.getPersonInCharge());
fmsFollowupTask.setFollowupTime(dateList.get(0));
changeDataSource(result);
fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
} else {
//周期
//4. 根据频次和总月数添加
int i = 0;
for (Date date : dateList) {
i+=1;
//单次
FmsFollowupTask fmsFollowupTask = new FmsFollowupTask();
BeanUtil.copyProperties(followupQueueVO, fmsFollowupTask);
fmsFollowupTask.setId(IdUtil.getSnowflakeNextId());
fmsFollowupTask.setName(followupPatient.getName());
fmsFollowupTask.setPinyinFull(followupPatient.getPinyinFull());
fmsFollowupTask.setPinyinSimple(followupPatient.getPinyinSimple());
fmsFollowupTask.setGender(followupPatient.getGender());
if (followupPatient.getBirthDate() != null) {
fmsFollowupTask.setAge(DateUtil.age(followupPatient.getBirthDate(), new Date()));
}
fmsFollowupTask.setEthnicity(followupPatient.getEthnicity());
fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
fmsFollowupTask.setTimes(i);
fmsFollowupTask.setPhone(followupPatient.getPhone());
fmsFollowupTask.setTenantId(followupPatient.getTenantId());
fmsFollowupTask.setIdCardType(followupPatient.getIdCardType());
fmsFollowupTask.setIdCard(followupPatient.getIdCard());
fmsFollowupTask.setId(IdUtil.getSnowflakeNextId());
fmsFollowupTask.setQueueId(followupQueueVO.getId());
fmsFollowupTask.setDelFlag((byte) 0);
fmsFollowupTask.setCreateTime(new Date());
fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
fmsFollowupTask.setStatus((byte) 0);
fmsFollowupTask.setStartTime(date);
fmsFollowupTask.setEndTime(date);
fmsFollowupTask.setFollowuper(followupQueueVO.getPersonInCharge());
fmsFollowupTask.setFollowupTime(date);
changeDataSource(result);
fmsFollowupTask.setPatientId(followupPatient.getId());
fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
}
}
changeDataSource(result);
//将患者设置为已生成工单
FmsPatientQueueRelation fmsPatientQueueRelation = BeanUtil.copyProperties(followupPatient, FmsPatientQueueRelation.class);
fmsPatientQueueRelation.setTaskFlag((byte) 1);
fmsPatientQueueRelation.setPatientId(followupPatient.getId());
fmsPatientQueueRelationMapper.updateByPrimaryKeySelective(fmsPatientQueueRelation);
}
}
}
}
}
private static void changeDataSource(UmsDataSourceVo.Result result) {
try {
DynamicDataSourceContextHolder.setDataSourceType(result.getDataSourceKey());
}finally {
DynamicDataSourceContextHolder.clearDataSourceType();
}
}
}
//package com.acupuncture.web.controller.web;
//
//import cn.hutool.core.bean.BeanUtil;
//import cn.hutool.core.collection.CollectionUtil;
//import cn.hutool.core.date.DateUtil;
//import cn.hutool.core.util.IdUtil;
//import com.acupuncture.common.annotation.Anonymous;
//import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder;
//import com.acupuncture.system.domain.po.FmsFollowupTask;
//import com.acupuncture.system.domain.po.FmsPatientQueueRelation;
//import com.acupuncture.system.domain.vo.FmsFollowupVo;
//import com.acupuncture.system.domain.vo.UmsDataSourceVo;
//import com.acupuncture.system.persist.dao.FmsFollowupDao;
//import com.acupuncture.system.persist.dao.UmsDataSourceDao;
//import com.acupuncture.system.persist.mapper.FmsFollowupTaskMapper;
//import com.acupuncture.system.persist.mapper.FmsPatientQueueRelationMapper;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.quartz.TriggerUtils;
//import org.quartz.impl.triggers.CronTriggerImpl;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.transaction.annotation.Propagation;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//import java.util.ArrayList;
//import java.util.Calendar;
//import java.util.Date;
//import java.util.List;
//
///**
// * @Author zzc
// * @Package com.acupuncture.web.controller.web
// * @Date 2025/2/13 8:50
// * @description:
// */
//@Slf4j
//@Api(tags = "定时任务相关")
//@RestController
//@RequestMapping("/task")
//@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
//public class TaskController {
//
// @Resource
// private FmsFollowupDao fmsFollowupDao;
// @Resource
// private FmsFollowupTaskMapper fmsFollowupTaskMapper;
// @Resource
// private UmsDataSourceDao umsDataSourceDao;
// @Resource
// private FmsPatientQueueRelationMapper fmsPatientQueueRelationMapper;
//
// @ApiOperation("定时任务添加随访工单")
// @PostMapping("/task")
//// @Scheduled(fixedRate = 10000)
// @Anonymous
// public void task() {
// // TODO 生成工单第一次生成之后2周的,往后只生成之后一周。第一次随访时间: ( 患者的出院时间 - 7 + 轮次时间) 到 (患者的出院时间 + 7 + 轮次时间 )
//
// //查询租户,根据租户循环切换数据源,定时处理所有医院的随访工单
//// UmsDataSourceVo.Result result1 = new UmsDataSourceVo.Result();
//// result1.setDataSourceKey("MASTER");
//// changeDataSource(result1);
// List<UmsDataSourceVo.Result> query = umsDataSourceDao.query(null);
// if (CollectionUtil.isEmpty(query)) {
// return;
// }
// //查询公共队列
// List<FmsFollowupVo.FollowupQueueVO> queueResults = fmsFollowupDao.queryCommonQueue(null);
// //切换数据源
// for (UmsDataSourceVo.Result result : query) {
// if ("MASTER".equals(result.getDataSourceKey())) {
// continue;
// }
// changeDataSource(result);
// {
// //获取随访患者列表,根据患者出院日时间和队列添加工单
// //1. 查询队列
// List<FmsFollowupVo.FollowupQueueVO> queueList = fmsFollowupDao.selectQueueList(null, null, null, result.getTenantId());
//
// if (CollectionUtil.isEmpty(queueList)) {
// queueList = queueResults;
// } else {
// queueList.addAll(queueResults);
// }
// for (FmsFollowupVo.FollowupQueueVO followupQueueVO : queueList) {
// //2. 查询队列随访患者列表
// List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupDao.queryPatient(followupQueueVO.getId(), (byte) 0, null, followupQueueVO.getTenantId());
// if (CollectionUtil.isEmpty(patientList)) {
// continue;
// }
// //随访总月数
// Integer followupMonth = followupQueueVO.getFollowupMonth();
// for (FmsFollowupVo.FollowupPatient followupPatient : patientList) {
// //获取随访到期时间 出院时间+随访总月数 = 到期时间
// Calendar calendar = Calendar.getInstance();
// calendar.setTime(followupPatient.getDischargeTime());
// calendar.set(Calendar.MONTH, followupMonth);
// Date time = calendar.getTime();
//
// //获取队列信息
// String frequency = followupQueueVO.getFrequency();
// List<Date> dateList = new ArrayList<>();
// try {
// CronTriggerImpl cronTrigger = new CronTriggerImpl();
// cronTrigger.setCronExpression(frequency);
// //TriggerUtils.computeFireTimesBetween(要计算触发时间的触发器对象, 用于计算触发时间的日历对象, 计算触发时间的起始时间点, 计算触发时间的结束时间点);
// dateList = TriggerUtils.computeFireTimesBetween(cronTrigger, null, followupPatient.getDischargeTime(), time);
// if (CollectionUtil.isEmpty(dateList)) {
// continue;
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// //3. 判断随访类型
// if (followupQueueVO.getFollowupType() == 0) {
// //单次
// FmsFollowupTask fmsFollowupTask = new FmsFollowupTask();
// BeanUtil.copyProperties(followupQueueVO, fmsFollowupTask);
// fmsFollowupTask.setId(IdUtil.getSnowflakeNextId());
// fmsFollowupTask.setName(followupPatient.getName());
// fmsFollowupTask.setPinyinFull(followupPatient.getPinyinFull());
// fmsFollowupTask.setPinyinSimple(followupPatient.getPinyinSimple());
// fmsFollowupTask.setGender(followupPatient.getGender());
// if (followupPatient.getBirthDate() != null) {
// fmsFollowupTask.setAge(DateUtil.age(followupPatient.getBirthDate(), new Date()));
// }
// fmsFollowupTask.setEthnicity(followupPatient.getEthnicity());
// fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
// fmsFollowupTask.setPhone(followupPatient.getPhone());
// fmsFollowupTask.setTenantId(followupPatient.getTenantId());
// fmsFollowupTask.setIdCardType(followupPatient.getIdCardType());
// fmsFollowupTask.setIdCard(followupPatient.getIdCard());
// fmsFollowupTask.setTimes(1);
// fmsFollowupTask.setQueueId(followupQueueVO.getId());
// fmsFollowupTask.setPatientId(followupPatient.getId());
// fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
// fmsFollowupTask.setDelFlag((byte) 0);
// fmsFollowupTask.setCreateTime(new Date());
// fmsFollowupTask.setStatus((byte) 0);
// fmsFollowupTask.setStartTime(dateList.get(0));
// fmsFollowupTask.setEndTime(dateList.get(0));
// fmsFollowupTask.setFollowuper(followupQueueVO.getPersonInCharge());
// fmsFollowupTask.setFollowupTime(dateList.get(0));
// changeDataSource(result);
// fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
//
// } else {
// //周期
// //4. 根据频次和总月数添加
// int i = 0;
// for (Date date : dateList) {
// i+=1;
// //单次
// FmsFollowupTask fmsFollowupTask = new FmsFollowupTask();
// BeanUtil.copyProperties(followupQueueVO, fmsFollowupTask);
// fmsFollowupTask.setId(IdUtil.getSnowflakeNextId());
// fmsFollowupTask.setName(followupPatient.getName());
// fmsFollowupTask.setPinyinFull(followupPatient.getPinyinFull());
// fmsFollowupTask.setPinyinSimple(followupPatient.getPinyinSimple());
// fmsFollowupTask.setGender(followupPatient.getGender());
// if (followupPatient.getBirthDate() != null) {
// fmsFollowupTask.setAge(DateUtil.age(followupPatient.getBirthDate(), new Date()));
// }
// fmsFollowupTask.setEthnicity(followupPatient.getEthnicity());
// fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
// fmsFollowupTask.setTimes(i);
// fmsFollowupTask.setPhone(followupPatient.getPhone());
// fmsFollowupTask.setTenantId(followupPatient.getTenantId());
// fmsFollowupTask.setIdCardType(followupPatient.getIdCardType());
// fmsFollowupTask.setIdCard(followupPatient.getIdCard());
// fmsFollowupTask.setId(IdUtil.getSnowflakeNextId());
// fmsFollowupTask.setQueueId(followupQueueVO.getId());
// fmsFollowupTask.setDelFlag((byte) 0);
// fmsFollowupTask.setCreateTime(new Date());
// fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
// fmsFollowupTask.setStatus((byte) 0);
// fmsFollowupTask.setStartTime(date);
// fmsFollowupTask.setEndTime(date);
// fmsFollowupTask.setFollowuper(followupQueueVO.getPersonInCharge());
// fmsFollowupTask.setFollowupTime(date);
// changeDataSource(result);
// fmsFollowupTask.setPatientId(followupPatient.getId());
// fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
// }
// }
// changeDataSource(result);
// //将患者设置为已生成工单
// FmsPatientQueueRelation fmsPatientQueueRelation = BeanUtil.copyProperties(followupPatient, FmsPatientQueueRelation.class);
// fmsPatientQueueRelation.setTaskFlag((byte) 1);
// fmsPatientQueueRelation.setPatientId(followupPatient.getId());
// fmsPatientQueueRelationMapper.updateByPrimaryKeySelective(fmsPatientQueueRelation);
// }
// }
//
// }
// }
// }
//
// private static void changeDataSource(UmsDataSourceVo.Result result) {
// try {
// DynamicDataSourceContextHolder.setDataSourceType(result.getDataSourceKey());
// }finally {
// DynamicDataSourceContextHolder.clearDataSourceType();
// }
// }
//}

2
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/WxQrCodeController.java

@ -1,7 +1,5 @@
package com.acupuncture.web.controller.web;
import cn.hutool.core.bean.BeanUtil;
import com.acupuncture.common.annotation.Anonymous;
import com.acupuncture.common.core.domain.BaseDto;
import com.acupuncture.common.core.domain.JsonResponse;
import com.acupuncture.system.domain.dto.AmsWxQrCodeDto;

4
acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java

@ -293,10 +293,6 @@ public class TaskController {
}
private static void changeDataSource(UmsDataSourceVo.Result result) {
DynamicDataSourceContextHolder.setDataSourceType(result.getDataSourceKey());
}
/**
* 法用于计算在指定时间范围内触发器的触发时间点具体步骤如下
* 初始化一个空列表 lst 存储触发时间点

1
acupuncture-common/src/main/java/com/acupuncture/common/core/domain/entity/SysUser.java

@ -100,6 +100,7 @@ public class SysUser extends BaseEntity
@ApiModelProperty("是否具有审核权限(0不具有; 1具有)")
private Byte slaverAdmin;
public SysUser()
{

38
acupuncture-framework/src/main/java/com/acupuncture/framework/aspectj/AdminGlobalDataSourceAspect.java

@ -37,8 +37,6 @@ import javax.servlet.http.HttpServletRequest;
public class AdminGlobalDataSourceAspect {
protected Logger logger = LoggerFactory.getLogger(getClass());
// @Autowired
// private UmsDataSourceMapper umsDataSourceMapper;
@Resource
private DmsLoginService dmsLoginService;
@ -51,10 +49,16 @@ public class AdminGlobalDataSourceAspect {
@Around("dsPointCut()")
public Object around(ProceedingJoinPoint point) throws Throwable {
String dataSourceKey = getDataSource(point);
if (StringUtils.isNotNull(dataSourceKey)) {
DataSourceManager.setDataSourceKey(dataSourceKey);
//获取datasource
try {
String dataSourceKey = getDataSource(point);
if (StringUtils.isNotEmpty(dataSourceKey)) {
DataSourceManager.setDataSourceKey(dataSourceKey);
} else {
DataSourceManager.setDataSourceKey(null);
}
}catch (Exception e){
throw new BaseException(StrUtil.format("获取数据源错误:{}", e));
}
try {
@ -72,25 +76,23 @@ public class AdminGlobalDataSourceAspect {
// 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest();
Long tenantId;
Long tenantId = null;
String header = request.getHeader(UserConstants.DEPT);
if(StrUtil.isNotEmpty(header)){
tenantId = Long.parseLong(header);
}else {
String authHeader = request.getHeader(UserConstants.HEADER_KEY_TOKEN);
if (StrUtil.isEmpty(authHeader)) {
return null;
}
tenantId = SecurityUtils.getTenantId();
if (tenantId == null) {
return null;
if (StrUtil.isNotEmpty(request.getHeader(UserConstants.HEADER_KEY_TOKEN))) {
tenantId = SecurityUtils.getTenantId();
}
}
//根据组织ID查询数据源
UmsDataSource dataSource = dmsLoginService.getDataSourceByTenantId(tenantId);
if (dataSource == null) {
throw new BaseException(DATASOURCE_NOT_FOUND);
if(tenantId !=null) {
UmsDataSource dataSource = dmsLoginService.getDataSourceByTenantId(tenantId);
if (dataSource == null) {
throw new BaseException(DATASOURCE_NOT_FOUND);
}
return dataSource.getDataSourceKey();
}
return dataSource.getDataSourceKey();
return null;
}
}

5
acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/AdminTenantUserDto.java

@ -64,11 +64,16 @@ public class AdminTenantUserDto {
private String status;
private String contactPhone;
@ApiModelProperty("是否具有审核权限(0不具有; 1具有)")
private Byte slaverAdmin;
}
@Data
public static class DeleteDto {
private List<Long> idList;
}
@Data
public static class Query {
private Long tenantId;

2
acupuncture-system/src/main/java/com/acupuncture/system/service/impl/AdminTenantUserServiceImpl.java

@ -35,7 +35,7 @@ public class AdminTenantUserServiceImpl implements AdminTenantUserService {
@Override
public int insert(AdminTenantUserDto.AddDto dto) {
DmsUser dmsUser = BeanUtil.copyProperties(dto, DmsUser.class);
dmsUser.setId(IdUtil.getSnowflakeNextId());
dmsUser.setId(dto.getId());
dmsUser.setCreateBy(SecurityUtils.getUsername());
dmsUser.setCreateTime(new Date());
return dmsUserMapper.insertSelective(dmsUser);

Loading…
Cancel
Save