代码优化
This commit is contained in:
parent
99bac03ea0
commit
ed4bf502ff
|
|
@ -2,6 +2,8 @@ package com.bonus.imgTool.imageUpload.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CoordinatePhotoReqVo {
|
public class CoordinatePhotoReqVo {
|
||||||
|
|
||||||
|
|
@ -30,6 +32,16 @@ public class CoordinatePhotoReqVo {
|
||||||
*/
|
*/
|
||||||
private String keyWord;
|
private String keyWord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色级别 0.项目部 1.分公司
|
||||||
|
*/
|
||||||
|
private String roleLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户管理的工程
|
||||||
|
*/
|
||||||
|
private List<Long> proIds;
|
||||||
|
|
||||||
private int page;
|
private int page;
|
||||||
private int limit;
|
private int limit;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package com.bonus.imgTool.imageUpload.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ImportantMatterReqVo {
|
public class ImportantMatterReqVo {
|
||||||
|
|
||||||
|
|
@ -31,6 +33,16 @@ public class ImportantMatterReqVo {
|
||||||
*/
|
*/
|
||||||
private String keyWord;
|
private String keyWord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色级别 0.项目部 1.分公司
|
||||||
|
*/
|
||||||
|
private String roleLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户管理的工程
|
||||||
|
*/
|
||||||
|
private List<Long> proIds;
|
||||||
|
|
||||||
private int page;
|
private int page;
|
||||||
private int limit;
|
private int limit;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.bonus.imgTool.imageUpload.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class SafetyMeasuresReqVo {
|
public class SafetyMeasuresReqVo {
|
||||||
|
|
||||||
|
|
@ -30,6 +32,16 @@ public class SafetyMeasuresReqVo {
|
||||||
*/
|
*/
|
||||||
private String keyWord;
|
private String keyWord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色级别 0.项目部 1.分公司
|
||||||
|
*/
|
||||||
|
private String roleLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户管理的工程
|
||||||
|
*/
|
||||||
|
private List<Long> proIds;
|
||||||
|
|
||||||
private int page;
|
private int page;
|
||||||
private int limit;
|
private int limit;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,11 @@ import com.bonus.imgTool.imageUpload.dto.CoordinatePhotoVo;
|
||||||
import com.bonus.imgTool.imageUpload.mapper.CoordinatePhotoMapper;
|
import com.bonus.imgTool.imageUpload.mapper.CoordinatePhotoMapper;
|
||||||
import com.bonus.imgTool.imageUpload.service.CoordinatePhotoService;
|
import com.bonus.imgTool.imageUpload.service.CoordinatePhotoService;
|
||||||
import com.bonus.imgTool.system.service.SysFileResourceService;
|
import com.bonus.imgTool.system.service.SysFileResourceService;
|
||||||
|
import com.bonus.imgTool.system.vo.LoginUser;
|
||||||
import com.bonus.imgTool.system.vo.SysFileResourceVo;
|
import com.bonus.imgTool.system.vo.SysFileResourceVo;
|
||||||
import com.bonus.imgTool.utils.ServerResponse;
|
import com.bonus.imgTool.utils.ServerResponse;
|
||||||
import com.bonus.imgTool.utils.UserUtil;
|
import com.bonus.imgTool.utils.UserUtil;
|
||||||
|
import com.bonus.imgTool.webResult.Constants;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -20,8 +22,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
@ -46,6 +48,13 @@ public class CoordinatePhotoServiceImpl implements CoordinatePhotoService {
|
||||||
public ServerResponse getCoordinatePhotoList(CoordinatePhotoReqVo data) {
|
public ServerResponse getCoordinatePhotoList(CoordinatePhotoReqVo data) {
|
||||||
PageHelper.startPage(data.getPage(), data.getLimit());
|
PageHelper.startPage(data.getPage(), data.getLimit());
|
||||||
try {
|
try {
|
||||||
|
String roleLevel = Optional.ofNullable(UserUtil.getLoginUser()).map(LoginUser::getRoleLevel).orElse("0");
|
||||||
|
String proIds = Optional.ofNullable(UserUtil.getLoginUser()).map(LoginUser::getProIds).orElse("-1");
|
||||||
|
if(Objects.equals(roleLevel, Constants.ROLE_LEVEL)){ // 项目部级
|
||||||
|
List<Long> proList = Arrays.stream(proIds.split(",")).map(String::trim).filter(s -> !s.isEmpty()).map(Long::valueOf).collect(Collectors.toList());
|
||||||
|
data.setProIds(proList);
|
||||||
|
}
|
||||||
|
data.setRoleLevel(roleLevel);
|
||||||
List<CoordinatePhotoVo> list = coordinatePhotoMapper.getCoordinatePhotoList(data);
|
List<CoordinatePhotoVo> list = coordinatePhotoMapper.getCoordinatePhotoList(data);
|
||||||
//获取图片信息
|
//获取图片信息
|
||||||
for (CoordinatePhotoVo coordinatePhotoVo : list) {
|
for (CoordinatePhotoVo coordinatePhotoVo : list) {
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,11 @@ import com.bonus.imgTool.imageUpload.dto.ImportantMatterVo;
|
||||||
import com.bonus.imgTool.imageUpload.mapper.ImportantMatterMapper;
|
import com.bonus.imgTool.imageUpload.mapper.ImportantMatterMapper;
|
||||||
import com.bonus.imgTool.imageUpload.service.ImportantMatterService;
|
import com.bonus.imgTool.imageUpload.service.ImportantMatterService;
|
||||||
import com.bonus.imgTool.system.service.SysFileResourceService;
|
import com.bonus.imgTool.system.service.SysFileResourceService;
|
||||||
|
import com.bonus.imgTool.system.vo.LoginUser;
|
||||||
import com.bonus.imgTool.system.vo.SysFileResourceVo;
|
import com.bonus.imgTool.system.vo.SysFileResourceVo;
|
||||||
import com.bonus.imgTool.utils.ServerResponse;
|
import com.bonus.imgTool.utils.ServerResponse;
|
||||||
import com.bonus.imgTool.utils.UserUtil;
|
import com.bonus.imgTool.utils.UserUtil;
|
||||||
|
import com.bonus.imgTool.webResult.Constants;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -21,8 +23,8 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
@ -46,6 +48,13 @@ public class ImportantMatterServiceImpl implements ImportantMatterService {
|
||||||
public ServerResponse getImportantMatterList(ImportantMatterReqVo data) {
|
public ServerResponse getImportantMatterList(ImportantMatterReqVo data) {
|
||||||
PageHelper.startPage(data.getPage(), data.getLimit());
|
PageHelper.startPage(data.getPage(), data.getLimit());
|
||||||
try {
|
try {
|
||||||
|
String roleLevel = Optional.ofNullable(UserUtil.getLoginUser()).map(LoginUser::getRoleLevel).orElse("0");
|
||||||
|
String proIds = Optional.ofNullable(UserUtil.getLoginUser()).map(LoginUser::getProIds).orElse("-1");
|
||||||
|
if(Objects.equals(roleLevel, Constants.ROLE_LEVEL)){ // 项目部级
|
||||||
|
List<Long> proList = Arrays.stream(proIds.split(",")).map(String::trim).filter(s -> !s.isEmpty()).map(Long::valueOf).collect(Collectors.toList());
|
||||||
|
data.setProIds(proList);
|
||||||
|
}
|
||||||
|
data.setRoleLevel(roleLevel);
|
||||||
List<ImportantMatterVo> list = importantMatterMapper.getImportantMatterList(data);
|
List<ImportantMatterVo> list = importantMatterMapper.getImportantMatterList(data);
|
||||||
//获取图片信息
|
//获取图片信息
|
||||||
for (ImportantMatterVo importantMatterVo : list) {
|
for (ImportantMatterVo importantMatterVo : list) {
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,11 @@ import com.bonus.imgTool.imageUpload.dto.SafetyMeasuresVo;
|
||||||
import com.bonus.imgTool.imageUpload.mapper.SafetyMeasuresMapper;
|
import com.bonus.imgTool.imageUpload.mapper.SafetyMeasuresMapper;
|
||||||
import com.bonus.imgTool.imageUpload.service.SafetyMeasuresService;
|
import com.bonus.imgTool.imageUpload.service.SafetyMeasuresService;
|
||||||
import com.bonus.imgTool.system.service.SysFileResourceService;
|
import com.bonus.imgTool.system.service.SysFileResourceService;
|
||||||
|
import com.bonus.imgTool.system.vo.LoginUser;
|
||||||
import com.bonus.imgTool.system.vo.SysFileResourceVo;
|
import com.bonus.imgTool.system.vo.SysFileResourceVo;
|
||||||
import com.bonus.imgTool.utils.ServerResponse;
|
import com.bonus.imgTool.utils.ServerResponse;
|
||||||
import com.bonus.imgTool.utils.UserUtil;
|
import com.bonus.imgTool.utils.UserUtil;
|
||||||
|
import com.bonus.imgTool.webResult.Constants;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -21,8 +23,8 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
|
|
@ -46,6 +48,13 @@ public class SafetyMeasuresServiceImpl implements SafetyMeasuresService {
|
||||||
public ServerResponse getSafetyMeasuresList(SafetyMeasuresReqVo data) {
|
public ServerResponse getSafetyMeasuresList(SafetyMeasuresReqVo data) {
|
||||||
PageHelper.startPage(data.getPage(), data.getLimit());
|
PageHelper.startPage(data.getPage(), data.getLimit());
|
||||||
try {
|
try {
|
||||||
|
String roleLevel = Optional.ofNullable(UserUtil.getLoginUser()).map(LoginUser::getRoleLevel).orElse("0");
|
||||||
|
String proIds = Optional.ofNullable(UserUtil.getLoginUser()).map(LoginUser::getProIds).orElse("-1");
|
||||||
|
if(Objects.equals(roleLevel, Constants.ROLE_LEVEL)){ // 项目部级
|
||||||
|
List<Long> proList = Arrays.stream(proIds.split(",")).map(String::trim).filter(s -> !s.isEmpty()).map(Long::valueOf).collect(Collectors.toList());
|
||||||
|
data.setProIds(proList);
|
||||||
|
}
|
||||||
|
data.setRoleLevel(roleLevel);
|
||||||
List<SafetyMeasuresVo> list = safetyMeasuresMapper.getSafetyMeasuresList(data);
|
List<SafetyMeasuresVo> list = safetyMeasuresMapper.getSafetyMeasuresList(data);
|
||||||
//获取图片信息
|
//获取图片信息
|
||||||
for (SafetyMeasuresVo safetyMeasuresVo : list) {
|
for (SafetyMeasuresVo safetyMeasuresVo : list) {
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,12 @@
|
||||||
create_time as createTime, create_user_name as createUserName from tb_coordinate_photo
|
create_time as createTime, create_user_name as createUserName from tb_coordinate_photo
|
||||||
where is_active = '1'
|
where is_active = '1'
|
||||||
<if test="proId != '' and proId != null"> and pro_id = #{proId}</if>
|
<if test="proId != '' and proId != null"> and pro_id = #{proId}</if>
|
||||||
|
<if test="roleLevel = '0' and proIds != null and proIds.size() > 0">
|
||||||
|
AND pro_id IN
|
||||||
|
<foreach collection="proIds" item="proId" open="(" separator="," close=")">
|
||||||
|
#{proId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="majorId != '' and majorId != null"> and major_id = #{majorId}</if>
|
<if test="majorId != '' and majorId != null"> and major_id = #{majorId}</if>
|
||||||
<if test="gxId != '' and gxId != null"> and gx_id = #{gxId}</if>
|
<if test="gxId != '' and gxId != null"> and gx_id = #{gxId}</if>
|
||||||
<if test="keyWord != null and keyWord != ''">
|
<if test="keyWord != null and keyWord != ''">
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,12 @@
|
||||||
from tb_main_matter_publicize_photo
|
from tb_main_matter_publicize_photo
|
||||||
where is_active = '1'
|
where is_active = '1'
|
||||||
<if test="proId != '' and proId != null"> and pro_id = #{proId}</if>
|
<if test="proId != '' and proId != null"> and pro_id = #{proId}</if>
|
||||||
|
<if test="roleLevel = '0' and proIds != null and proIds.size() > 0">
|
||||||
|
AND pro_id IN
|
||||||
|
<foreach collection="proIds" item="proId" open="(" separator="," close=")">
|
||||||
|
#{proId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="majorId != '' and majorId != null"> and major_id = #{majorId}</if>
|
<if test="majorId != '' and majorId != null"> and major_id = #{majorId}</if>
|
||||||
<if test="gxId != '' and gxId != null"> and gx_id = #{gxId}</if>
|
<if test="gxId != '' and gxId != null"> and gx_id = #{gxId}</if>
|
||||||
<if test="keyWord != null and keyWord != ''">
|
<if test="keyWord != null and keyWord != ''">
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,12 @@
|
||||||
create_time as createTime, create_user_name as createUserName from tb_safety_measure
|
create_time as createTime, create_user_name as createUserName from tb_safety_measure
|
||||||
where is_active = '1'
|
where is_active = '1'
|
||||||
<if test="proId != '' and proId != null"> and pro_id = #{proId}</if>
|
<if test="proId != '' and proId != null"> and pro_id = #{proId}</if>
|
||||||
|
<if test="roleLevel = '0' and proIds != null and proIds.size() > 0">
|
||||||
|
AND pro_id IN
|
||||||
|
<foreach collection="proIds" item="proId" open="(" separator="," close=")">
|
||||||
|
#{proId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="majorId != '' and majorId != null"> and major_id = #{majorId}</if>
|
<if test="majorId != '' and majorId != null"> and major_id = #{majorId}</if>
|
||||||
<if test="gxId != '' and gxId != null"> and gx_id = #{gxId}</if>
|
<if test="gxId != '' and gxId != null"> and gx_id = #{gxId}</if>
|
||||||
<if test="keyWord != null and keyWord != ''">
|
<if test="keyWord != null and keyWord != ''">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue