Commit 623fc9f8 by sdif

修改统计条件

parent dc777019
...@@ -25,6 +25,11 @@ public class TableDataInfo<T> implements Serializable { ...@@ -25,6 +25,11 @@ public class TableDataInfo<T> implements Serializable {
private long total; private long total;
/** /**
* 总页码
*/
private long totalNumber;
/**
* 列表数据 * 列表数据
*/ */
private List<T> rows; private List<T> rows;
...@@ -56,6 +61,7 @@ public class TableDataInfo<T> implements Serializable { ...@@ -56,6 +61,7 @@ public class TableDataInfo<T> implements Serializable {
rspData.setMsg("查询成功"); rspData.setMsg("查询成功");
rspData.setRows(page.getRecords()); rspData.setRows(page.getRecords());
rspData.setTotal(page.getTotal()); rspData.setTotal(page.getTotal());
rspData.setTotalNumber((int)Math.ceil((double) page.getTotal() / page.getSize()));
return rspData; return rspData;
} }
......
...@@ -92,48 +92,51 @@ public class DepartmentServiceImpl implements IDepartmentService { ...@@ -92,48 +92,51 @@ public class DepartmentServiceImpl implements IDepartmentService {
@Override @Override
public List<DepartmentVo> departmentByHospitalId(Integer hospitalId) { public List<DepartmentVo> departmentByHospitalId(Integer hospitalId) {
Hospital hospital = hospitalMapper.selectById(hospitalId); Hospital hospital = hospitalMapper.selectById(hospitalId);
// 移除字符串中的方括号和双引号 List<DepartmentVo> departments = new ArrayList<>();
String trimmedString = hospital.getDepartments().substring(1, hospital.getDepartments().length() - 1).replace("\"", ""); if(StringUtils.isNotEmpty(hospital.getDepartments())){
// 移除字符串中的方括号和双引号
// 拆分字符串为数组 String trimmedString = hospital.getDepartments().substring(1, hospital.getDepartments().length() - 1).replace("\"", "");
String[] numberStrings = trimmedString.split(",");
// 拆分字符串为数组
// 将字符串数组转为整数列表 String[] numberStrings = trimmedString.split(",");
List<Integer> integerList = new ArrayList<>();
for (String numberString : numberStrings) { // 将字符串数组转为整数列表
integerList.add(Integer.parseInt(numberString)); List<Integer> integerList = new ArrayList<>();
} for (String numberString : numberStrings) {
List<DepartmentVo> departments = baseMapper.selectVoList(new LambdaQueryWrapper<Department>().in(Department::getId, integerList)); integerList.add(Integer.parseInt(numberString));
if (CollectionUtils.isNotEmpty(departments)) {
//查询所有菜单
List<DepartmentVo> allMenu = departments;
// 对父菜单进行排序
Collections.sort(allMenu, new Comparator<DepartmentVo>() {
@Override
public int compare(DepartmentVo o1, DepartmentVo o2) {
// 根据需要进行排序比较,可以根据实际情况修改
return Integer.compare(o1.getSortord(), o2.getSortord());
}
});
//根节点集合
List<DepartmentVo> rootMenu = new ArrayList<>();
for (DepartmentVo entity : allMenu) {
entity.setLabel(entity.getTitle());
entity.setValue(entity.getId());
entity.setText(entity.getTitle());
if (entity.getParentId() == 0) { //父节点是0的,为根节点。
rootMenu.add(entity);
}
} }
departments = baseMapper.selectVoList(new LambdaQueryWrapper<Department>().in(Department::getId, integerList));
if (CollectionUtils.isNotEmpty(departments)) {
//查询所有菜单
List<DepartmentVo> allMenu = departments;
// 对父菜单进行排序
Collections.sort(allMenu, new Comparator<DepartmentVo>() {
@Override
public int compare(DepartmentVo o1, DepartmentVo o2) {
// 根据需要进行排序比较,可以根据实际情况修改
return Integer.compare(o1.getSortord(), o2.getSortord());
}
});
//根节点集合
List<DepartmentVo> rootMenu = new ArrayList<>();
for (DepartmentVo entity : allMenu) {
entity.setLabel(entity.getTitle());
entity.setValue(entity.getId());
entity.setText(entity.getTitle());
if (entity.getParentId() == 0) { //父节点是0的,为根节点。
rootMenu.add(entity);
}
}
for (DepartmentVo entity : rootMenu) { for (DepartmentVo entity : rootMenu) {
entity.setLabel(entity.getTitle()); entity.setLabel(entity.getTitle());
//查询主科室下面所有的子科室 //查询主科室下面所有的子科室
entity.setChildren(baseMapper.selectDepartmentChildren(entity.getValue())); entity.setChildren(baseMapper.selectDepartmentChildren(entity.getValue()));
}
return rootMenu;
} }
return rootMenu;
} }
return departments; return departments;
} }
......
...@@ -98,13 +98,10 @@ public class SysUserServiceImpl implements ISysUserService, UserService { ...@@ -98,13 +98,10 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
private Wrapper<SysUser> buildQueryWrapper(SysUser user) { private Wrapper<SysUser> buildQueryWrapper(SysUser user) {
Map<String, Object> params = user.getParams(); Map<String, Object> params = user.getParams();
QueryWrapper<SysUser> wrapper = Wrappers.query(); QueryWrapper<SysUser> wrapper = Wrappers.query();
List<Integer> u = new ArrayList<>();
u.add(1);
u.add(2);
wrapper.eq("u.del_flag", UserConstants.USER_NORMAL) wrapper.eq("u.del_flag", UserConstants.USER_NORMAL)
.eq(StringUtils.isNotBlank(user.getUserType()), "u.user_type", user.getUserType()) .eq(StringUtils.isNotBlank(user.getUserType()), "u.user_type", user.getUserType())
.eq(ObjectUtil.isNotNull(user.getUserId()), "u.user_id", user.getUserId()) .eq(ObjectUtil.isNotNull(user.getUserId()), "u.user_id", user.getUserId())
.notIn("u.user_id", u) .in("u.user_type", "xcx_user")
.like(StringUtils.isNotBlank(user.getUserName()), "u.user_name", user.getUserName()) .like(StringUtils.isNotBlank(user.getUserName()), "u.user_name", user.getUserName())
.eq(StringUtils.isNotBlank(user.getStatus()), "u.status", user.getStatus()) .eq(StringUtils.isNotBlank(user.getStatus()), "u.status", user.getStatus())
.like(StringUtils.isNotBlank(user.getPhonenumber()), "u.phonenumber", user.getPhonenumber()) .like(StringUtils.isNotBlank(user.getPhonenumber()), "u.phonenumber", user.getPhonenumber())
...@@ -506,27 +503,28 @@ public class SysUserServiceImpl implements ISysUserService, UserService { ...@@ -506,27 +503,28 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
SysUser sysUser = baseMapper.selectById(userId); SysUser sysUser = baseMapper.selectById(userId);
return Optional.ofNullable(sysUser) return Optional.ofNullable(sysUser)
.map(user -> { .map(user -> {
//普通用户 //陪诊员用户
if (user.getUserType().equals(UserType.XCX_USER.getUserType()) || user.getUserType().equals(UserType.SYS_USER.getUserType())) { EmployeesVo employeesVo = employeesMapper.selectVoOne(Wrappers.<Employees>lambdaQuery().eq(Employees::getUid, userId));
// TODO: 2023/9/19 user.getUserType().equals(UserType.SYS_USER.getUserType()用于目前测试,测试结束清数据时再修改 if (employeesVo != null) {
userIdentityVo.setUserType(1); userIdentityVo.setUserType(2);
userIdentityVo.setEmCmId(employeesVo.getId());
userIdentityVo.setEmCmStatus(employeesVo.getStatus());
} else { } else {
//陪诊员用户 //商家用户
EmployeesVo employeesVo = employeesMapper.selectVoOne(Wrappers.<Employees>lambdaQuery().eq(Employees::getUid, userId)); CompanyVo companyVo = companyMapper.selectVoOne(Wrappers.<Company>lambdaQuery().eq(Company::getUid, userId));
if (employeesVo != null) { if (companyVo != null) {
userIdentityVo.setUserType(2); userIdentityVo.setUserType(3);
userIdentityVo.setEmCmId(employeesVo.getId()); userIdentityVo.setEmCmId(companyVo.getId());
userIdentityVo.setEmCmStatus(employeesVo.getStatus()); userIdentityVo.setEmCmStatus(companyVo.getStatus());
} else { }else {
//商家用户 userIdentityVo.setUserType(1);
CompanyVo companyVo = companyMapper.selectVoOne(Wrappers.<Company>lambdaQuery().eq(Company::getUid, userId));
if (companyVo != null) {
userIdentityVo.setUserType(3);
userIdentityVo.setEmCmId(companyVo.getId());
userIdentityVo.setEmCmStatus(companyVo.getStatus());
}
} }
} }
//普通用户
/*if (user.getUserType().equals(UserType.XCX_USER.getUserType()) || user.getUserType().equals(UserType.SYS_USER.getUserType())) {
// TODO: 2023/9/19 user.getUserType().equals(UserType.SYS_USER.getUserType()用于目前测试,测试结束清数据时再修改
userIdentityVo.setUserType(1);
} */
return userIdentityVo; return userIdentityVo;
}) })
.orElseGet(() -> userIdentityVo); .orElseGet(() -> userIdentityVo);
......
...@@ -146,7 +146,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -146,7 +146,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT count(employees.id) as dataSum SELECT count(employees.id) as dataSum
FROM employees FROM employees
left join company on company.id = employees.company_id left join company on company.id = employees.company_id
WHERE employees.`status` = 1 or employees.`status` = 2 WHERE (employees.`status` = 1 or employees.`status` = 2)
<if test="dataViewBo.userId != null"> <if test="dataViewBo.userId != null">
and company.uid = #{dataViewBo.userId} and company.uid = #{dataViewBo.userId}
</if> </if>
......
...@@ -105,13 +105,13 @@ ...@@ -105,13 +105,13 @@
and company.uid = #{dataViewBo.userId} and company.uid = #{dataViewBo.userId}
</if> </if>
<if test="dataViewBo.condition == 2"> <if test="dataViewBo.condition == 2">
and total_order.finish_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) -- 近7天 and total_order.create_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) -- 近7天
</if> </if>
<if test="dataViewBo.condition == 3"> <if test="dataViewBo.condition == 3">
and total_order.finish_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) -- 近30天 and total_order.create_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) -- 近30天
</if> </if>
<if test="dataViewBo.condition == 1"> <if test="dataViewBo.condition == 1">
and DATE(total_order.finish_time) = CURDATE() and DATE(total_order.create_time) = CURDATE()
</if> </if>
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment