系统配置
This commit is contained in:
parent
72b01a7382
commit
5f31feb5c8
|
|
@ -0,0 +1,41 @@
|
|||
package com.bonus.digitalSignage.backstage.controller;
|
||||
|
||||
import com.bonus.digitalSignage.annotation.DecryptAndVerify;
|
||||
import com.bonus.digitalSignage.annotation.LogAnnotation;
|
||||
import com.bonus.digitalSignage.backstage.entity.dto.QueryParamDto;
|
||||
import com.bonus.digitalSignage.backstage.service.ProProgressService;
|
||||
import com.bonus.digitalSignage.system.vo.EncryptedReq;
|
||||
import com.bonus.digitalSignage.utils.ServerResponse;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @className:ProProgressController
|
||||
* @author:cwchen
|
||||
* @date:2025-04-21-17:33
|
||||
* @version:1.0
|
||||
* @description:工程进度更新-controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/backstage/proProgress/")
|
||||
@Slf4j
|
||||
public class ProProgressController {
|
||||
|
||||
@Resource(name = "ProProgressService")
|
||||
private ProProgressService service;
|
||||
|
||||
@ApiOperation("工程进度更新-查询列表")
|
||||
@PostMapping(value = "getList")
|
||||
@DecryptAndVerify(decryptedClass = QueryParamDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "综合查询-工程进度更新", operation = "查询列表", operDesc = "系统级事件",operType="查询")
|
||||
public ServerResponse getList(EncryptedReq<QueryParamDto> dto) {
|
||||
PageHelper.startPage(dto.getData().getPageNum(), dto.getData().getPageSize());
|
||||
return service.getList(dto.getData());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.bonus.digitalSignage.backstage.dao;
|
||||
|
||||
import com.bonus.digitalSignage.backstage.entity.dto.QueryParamDto;
|
||||
import com.bonus.digitalSignage.backstage.entity.vo.ProProgressVo;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:ProProgressMapper
|
||||
* @author:cwchen
|
||||
* @date:2025-04-21-17:35
|
||||
* @version:1.0
|
||||
* @description:工程进度更新-数据层
|
||||
*/
|
||||
@Repository(value = "ProProgressDao")
|
||||
public interface ProProgressDao {
|
||||
/**
|
||||
* 工程进度更新-查询列表
|
||||
* @param dto
|
||||
* @return List<ProProgressVo>
|
||||
* @author cwchen
|
||||
* @date 2025/4/21 17:46
|
||||
*/
|
||||
List<ProProgressVo> getList(QueryParamDto dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.bonus.digitalSignage.backstage.entity.dto;
|
||||
|
||||
import com.bonus.digitalSignage.utils.UserUtil;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:QueryParamDto
|
||||
* @author:cwchen
|
||||
* @date:2025-03-31-15:46
|
||||
* @version:1.0
|
||||
* @description:前端参数
|
||||
*/
|
||||
@Data
|
||||
public class QueryParamDto {
|
||||
|
||||
private Long id;
|
||||
private String keyWord;
|
||||
/**权限层级*/
|
||||
private String level = UserUtil.getAuthLevel();
|
||||
/**工程权限*/
|
||||
private List<Long> proIds = UserUtil.getAuthProIds();
|
||||
private int pageNum = 1;
|
||||
private int pageSize = 10;
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.bonus.digitalSignage.backstage.entity.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @className:ProProgressVo
|
||||
* @author:cwchen
|
||||
* @date:2025-04-21-17:24
|
||||
* @version:1.0
|
||||
* @description:工程进度更新-VO
|
||||
*/
|
||||
@Data
|
||||
public class ProProgressVo {
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String keyWord;
|
||||
|
||||
private Long id;
|
||||
/**工程名称*/
|
||||
private String proName;
|
||||
/**电压等级*/
|
||||
private String voltageLevel;
|
||||
/**项目进度*/
|
||||
private double proProgress;
|
||||
/**更新时间*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTime;
|
||||
/**更新人*/
|
||||
private String updateUserName;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.bonus.digitalSignage.backstage.service;
|
||||
|
||||
import com.bonus.digitalSignage.backstage.entity.dto.QueryParamDto;
|
||||
import com.bonus.digitalSignage.utils.ServerResponse;
|
||||
|
||||
/**
|
||||
* @className:ProProgress
|
||||
* @author:cwchen
|
||||
* @date:2025-04-21-17:33
|
||||
* @version:1.0
|
||||
* @description:工程进度更新
|
||||
*/
|
||||
public interface ProProgressService {
|
||||
/**
|
||||
* 工程进度更新-查询列表
|
||||
* @param data
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
* @date 2025/4/21 17:41
|
||||
*/
|
||||
ServerResponse getList(QueryParamDto data);
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.bonus.digitalSignage.backstage.service.impl;
|
||||
|
||||
import com.bonus.digitalSignage.backstage.dao.ProProgressDao;
|
||||
import com.bonus.digitalSignage.backstage.entity.dto.QueryParamDto;
|
||||
import com.bonus.digitalSignage.backstage.entity.vo.ProProgressVo;
|
||||
import com.bonus.digitalSignage.backstage.service.ProProgressService;
|
||||
import com.bonus.digitalSignage.utils.ServerResponse;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @className:ProProgressServiceImpl
|
||||
* @author:cwchen
|
||||
* @date:2025-04-21-17:34
|
||||
* @version:1.0
|
||||
* @description:工程进度更新-业务逻辑层
|
||||
*/
|
||||
@Service(value = "ProProgressService")
|
||||
@Slf4j
|
||||
public class ProProgressServiceImpl implements ProProgressService {
|
||||
|
||||
@Resource(name = "ProProgressDao")
|
||||
private ProProgressDao dao;
|
||||
|
||||
@Override
|
||||
public ServerResponse getList(QueryParamDto dto) {
|
||||
List<ProProgressVo> list = null;
|
||||
try {
|
||||
list = Optional.ofNullable(dao.getList(dto)).orElseGet(ArrayList::new);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
PageInfo<ProProgressVo> pageInfo = new PageInfo<>(list);
|
||||
return ServerResponse.createSuccessPage(pageInfo, dto.getPageNum(), dto.getPageSize());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,18 @@
|
|||
package com.bonus.digitalSignage.utils;
|
||||
|
||||
import com.bonus.digitalSignage.system.vo.LoginUser;
|
||||
import com.bonus.digitalSignage.webResult.Constants;
|
||||
import org.springframework.security.authentication.AnonymousAuthenticationToken;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class UserUtil {
|
||||
|
||||
public static LoginUser getLoginUser() {
|
||||
|
|
@ -23,4 +30,46 @@ public class UserUtil {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取权限等级 1.全部 2.分公司 3.项目
|
||||
* @return String
|
||||
* @author cwchen
|
||||
* @date 2025/4/21 18:02
|
||||
*/
|
||||
public static String getAuthLevel() {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
if(loginUser == null){
|
||||
return null;
|
||||
}else {
|
||||
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());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所属工程权限
|
||||
* @return List<Long>
|
||||
* @author cwchen
|
||||
* @date 2025/4/21 18:02
|
||||
*/
|
||||
public static List<Long> getAuthProIds() {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
if(loginUser == null){
|
||||
return null;
|
||||
}else {
|
||||
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());
|
||||
return proList;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,8 +182,8 @@ public class Constants
|
|||
public static final Integer TYPE4 = 4;
|
||||
public static final Integer TRY_COUNT_NUM = 10;
|
||||
|
||||
/**角色级别 项目部级*/
|
||||
public static final String ROLE_LEVEL = "0";
|
||||
/**角色级别 全部*/
|
||||
public static final String ROLE_LEVEL = "1";
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.digitalSignage.backstage.dao.ProProgressDao">
|
||||
|
||||
<!--工程进度更新-查询列表-->
|
||||
<select id="getList" resultType="com.bonus.digitalSignage.backstage.entity.vo.ProProgressVo">
|
||||
SELECT tp.id,
|
||||
tp.pro_name AS proName,
|
||||
A.dict_name AS voltageLevel,
|
||||
tp.pro_progress,
|
||||
tp.update_time AS updateTime,
|
||||
su.user_name AS updateUserName
|
||||
FROM tb_project tp
|
||||
LEFT JOIN sys_user su ON tp.update_user_id = su.id
|
||||
LEFT JOIN (
|
||||
SELECT sd.dict_value,sd.dict_name
|
||||
FROM sys_distinct sd
|
||||
LEFT JOIN sys_distinct sd2 ON sd.p_id = sd2.id
|
||||
WHERE sd2.dict_code = 'voltage_level' AND sd.del_flag = 0
|
||||
) A ON A.dict_value = tp.voltage_level
|
||||
<where>
|
||||
<if test="level != '1' and proIds != null and proIds.size() > 0">
|
||||
AND tp.pro_id IN
|
||||
<foreach collection="proIds" item="proId" open="(" separator="," close=")">
|
||||
#{proId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="keyWord!=null and keyWord!=''">
|
||||
AND INSTR(tp.pro_name,#{keyWord}) > 0
|
||||
</if>
|
||||
AND tp.is_active = '1'
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue