Merge remote-tracking branch 'origin/fix_foton_20231031' into fix_foton_20231031

This commit is contained in:
wxyclub
2023-11-20 11:01:31 +08:00
68 changed files with 2119 additions and 312 deletions
@@ -29,17 +29,16 @@ public class ActSarLawsInformationEOService {
SarLawsInformation sarLawsInformation = JSONObject.parseObject(lawsInformationInfo, SarLawsInformation.class);
JSONObject jsonObject = JSONObject.parseObject(lawsInformationInfo);
String applyUserId = jsonObject.getString("applyUserId");
String applyUserName = jsonObject.getString("applyUserName");
// String applyUserName = jsonObject.getString("applyUserName");
String approverId = jsonObject.getString("approverId");
String approverName = jsonObject.getString("approverName");
// String approverName = jsonObject.getString("approverName");
String createAndApproveBy = "";
// 判断发起人和审批人是否相同
if (approverId.equals(applyUserId)) {
createAndApproveBy = applyUserName + "(" + applyUserId + ")";
createAndApproveBy = applyUserId;
}else {
createAndApproveBy = applyUserName + "(" + applyUserId + ")," + approverName + "(" + approverId + ")";
createAndApproveBy = applyUserId + "," + approverId;
}
sarLawsInformation.setCreateAndApproveBy(createAndApproveBy);
sarLawsInformation.setDownloadableBy(createAndApproveBy);
sarLawsInformation.setViewableBy(createAndApproveBy);
logger.info("政策法规资料入库:" + sarLawsInformation);
@@ -142,10 +142,10 @@ public class LoginRestController {
if(userEO.getDisableFlag()==1){
return Result.error("r0011", "帐号已禁用");
}
String position = userService.selectPositionByUserId(account);
if(StringUtils.isBlank(position)){
return Result.error("r0011", "无配置岗位");
}
// String position = userService.selectPositionByUserId(account);
// if(StringUtils.isBlank(position)){
// return Result.error("r0011", "无配置岗位");
// }
String token = jwtUtils.generateToken(userEO.getUsid());
userEO.setToken(token);
// 加密重要信息
@@ -212,10 +212,10 @@ public class LoginRestController {
if(userEO.getDisableFlag()==1){
return Result.error("r0011", "帐号已禁用");
}
String position = userService.selectPositionByUserId(account);
if(StringUtils.isBlank(position)){
return Result.error("r0011", "无配置岗位");
}
// String position = userService.selectPositionByUserId(account);
// if(StringUtils.isBlank(position)){
// return Result.error("r0011", "无配置岗位");
// }
String token = jwtUtils.generateToken(userEO.getUsid());
userEO.setToken(token);
// 加密重要信息
@@ -197,12 +197,25 @@ public class WebMvcConfig implements WebMvcConfigurer {
// 政策课题导出接口
addInterceptor.excludePathPatterns("/api/lawss/sarLawsTopic/exportLawsTopicInfo");
// 政策资料导出接口
addInterceptor.excludePathPatterns("/api/lawss/sarLawsInformation/exportLawsInformationInfo");
// 获取onlyOffice历史文件接口
addInterceptor.excludePathPatterns("/api/lawss/activiti/getAllOnlyOfficeHisFileById");
// // 添加自定义拦截器,并拦截对应 url
// 内外部会议模板下载
addInterceptor.excludePathPatterns("/api/lawss/insideOutsideMeeting/exportTemplateFile");
// 政策课题模板下载
addInterceptor.excludePathPatterns("/api/lawss/sarLawsTopic/exportTemplateFile");
// 政策资料模板下载
addInterceptor.excludePathPatterns("/api/lawss/sarLawsInformation/exportTemplateFile");
// 标准体系列表导出
addInterceptor.excludePathPatterns("/api/lawss/sarMenuStandardLimit/standardSystemListExport");
// 添加自定义拦截器,并拦截对应 url
addInterceptor.addPathPatterns("/**");
}
}
@@ -16,7 +16,7 @@ import java.util.List;
@Mapper
public interface InsideOutsideMeetingDao extends BaseMapper<InsideOutsideMeeting> {
Integer queryByPageCount(InsideOutsideMeetingVO page);
List<Integer> queryByPageCount(InsideOutsideMeetingVO page);
List<InsideOutsideMeetingVO> queryByPage(InsideOutsideMeetingVO page);
@@ -86,7 +86,9 @@ public class InsideOutsideMeetingVO extends BasePage {
private String sortMode = "asc";
private String meetingTimeOperator = "=";
// 会议时间查询字段
private String meetingTimeBegin;
private String meetingTimeEnd;
// 导出使用字段
// 被前端选中的记录的ids
@@ -12,6 +12,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* @author tjzdw
* @description
@@ -55,4 +57,12 @@ public class MeetingTopic extends BaseEntity {
@TableField("AGENDA_CONTENT")
@Excel(name = "议题主要内容")
private String agendaContent;
@ApiModelProperty(value = "创建时间")
@TableField("CREATE_TIME")
private Date createTime;
@ApiModelProperty(value = "修改时间")
@TableField("MODIFY_TIME")
private Date modifyTime;
}
@@ -81,6 +81,7 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
// 获取会议课题列表
LambdaQueryWrapper<MeetingTopic> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MeetingTopic::getMeetingId, meetingId);
wrapper.orderByAsc(MeetingTopic::getCreateTime);
List<MeetingTopic> meetingTopicList = meetingTopicService.list(wrapper);
insideOutsideMeeting.setMeetingTopicList(meetingTopicList);
}
@@ -108,7 +109,7 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
if (StringUtils.isBlank(insideOutsideMeeting.getId())) {
return false;
}
InsideOutsideMeeting insideOutsideMeetingDB = this.baseMapper.selectById(insideOutsideMeeting.getId());
InsideOutsideMeeting insideOutsideMeetingDB = getMeetingInfo(insideOutsideMeeting.getId());
List<String> diffList = compareInsideOutsideMeeting(insideOutsideMeetingDB, insideOutsideMeeting);
if (diffList.size() > 0) {
insideOutsideMeeting.setModifyTime(new Date());
@@ -187,7 +188,7 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
page.setSortField("ID");
page.setSortMode("asc");
}
Integer rowCount = this.baseMapper.queryByPageCount(page);
int rowCount = this.baseMapper.queryByPageCount(page).size();
page.getPager().setRowCount(rowCount);
List<InsideOutsideMeetingVO> insideOutsideMeetingVOList = this.baseMapper.queryByPage(page);
for (InsideOutsideMeetingVO insideOutsideMeeting : insideOutsideMeetingVOList) {
@@ -427,7 +428,7 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
public List<String> compareInsideOutsideMeeting(InsideOutsideMeeting oldMeeting, InsideOutsideMeeting newMeeting) {
List<String> changes = new ArrayList<>();
// 不需要比较的字段
String[] ignoreFields = {"id","validFlag","createTime","modifyTime", "firstMeetingTypeName", "secondMeetingTypeName"};
String[] ignoreFields = {"id","validFlag","createTime","modifyTime","meetingMinutesList", "firstMeetingTypeName", "secondMeetingTypeName"};
List<String> ignoreFieldList = Arrays.asList(ignoreFields);
// 获取SarLawsInformation类的所有字段
Field[] fields = InsideOutsideMeeting.class.getDeclaredFields();
@@ -8,8 +8,7 @@ import com.adc.da.http.PageInfo;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.esRevisePlan.service.IEsRevisePlanService;
import com.adc.da.slrs.sarEnterpriseStandardEvaluation.dao.QualityEvaluationDao;
import com.adc.da.slrs.sarEnterpriseStandardEvaluation.entity.QualityEvaluation;
import com.adc.da.slrs.sarEnterpriseStandardEvaluation.service.IQualityEvaluationService;
import com.adc.da.utils.util.EsRevisePlanExportUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiOperation;
@@ -29,10 +28,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
* <p>
@@ -52,7 +48,7 @@ public class EsRevisePlanController extends BaseController<EsRevisePlan> {
@Autowired
IEsRevisePlanService iEsRevisePlanService;
@Autowired
private QualityEvaluationDao qualityEvaluationDao;
private IQualityEvaluationService qualityEvaluationService;
@ApiOperation(value = "获取所有企标计划")
@GetMapping("getAllPlans")
@@ -106,38 +102,41 @@ public class EsRevisePlanController extends BaseController<EsRevisePlan> {
revisePlan.setArea(area);
//查评分
if (ObjectUtils.isNotEmpty(revisePlan.getStandId())) {
List<Double> last = new ArrayList<>();
List<QualityEvaluation> evaluations = qualityEvaluationDao.getEvaluationForm(new QueryWrapper<QualityEvaluation>().eq("law_id", revisePlan.getStandId()).eq("evaluation_type", "quality"));
for (QualityEvaluation evaluation : evaluations) {
Double score;
String value;
if (evaluation.getProcessNode()==null){
value="";
}else {
value=evaluation.getProcessNode();
}
String evaluationScore = ObjectUtils.isEmpty(evaluation.getScore()) ? "0" : evaluation.getScore();
switch (value){
case "征求意见":
score=Double.valueOf(evaluationScore) * 0.3;
break;
case "技术委员会评审、评审意见修改":
score=Double.valueOf(evaluationScore) * 0.4;
break;
case "重新技术委员会评审、评审意见修改":
score=Double.valueOf(evaluationScore) * 0.4;
break;
case "标准化复审":
score=Double.valueOf(evaluationScore) * 0.15;
break;
case "标准法规部高级经理审核":
score=Double.valueOf(evaluationScore) * 0.15;
break;
default: score=Double.valueOf(evaluationScore);
}
last.add(score);
}
revisePlan.setScore(last.stream().mapToDouble(Double::doubleValue).sum());
Map<String, Double> score = qualityEvaluationService.getScore(revisePlan.getStandId());
revisePlan.setScore(score.get("finalScore"));
// List<Double> last = new ArrayList<>();
// List<QualityEvaluation> evaluations = qualityEvaluationDao.getEvaluationForm(new QueryWrapper<QualityEvaluation>().eq("law_id", revisePlan.getStandId()).eq("evaluation_type", "quality"));
// for (QualityEvaluation evaluation : evaluations) {
// Double score;
// String value;
// if (evaluation.getProcessNode()==null){
// value="";
// }else {
// value=evaluation.getProcessNode();
// }
// String evaluationScore = ObjectUtils.isEmpty(evaluation.getScore()) ? "0" : evaluation.getScore();
// switch (value){
// case "征求意见":
// score=Double.valueOf(evaluationScore) * 0.3;
// break;
// case "技术委员会评审、评审意见修改":
// score=Double.valueOf(evaluationScore) * 0.4;
// break;
// case "重新技术委员会评审、评审意见修改":
// score=Double.valueOf(evaluationScore) * 0.4;
// break;
// case "标准化复审":
// score=Double.valueOf(evaluationScore) * 0.15;
// break;
// case "标准法规部高级经理审核":
// score=Double.valueOf(evaluationScore) * 0.15;
// break;
// default: score=Double.valueOf(evaluationScore);
// }
// last.add(score);
// }
// revisePlan.setScore(last.stream().mapToDouble(Double::doubleValue).sum());
}
}
workbook = EsRevisePlanExportUtil.exportDatas(datas);
@@ -5,12 +5,12 @@ import com.adc.da.slrs.fileMaterialCenter.entity.FileMaterial;
import com.adc.da.slrs.fileMaterialCenter.dao.FileMaterialDao;
import com.adc.da.slrs.fileMaterialCenter.entity.FileMaterialPage;
import com.adc.da.slrs.fileMaterialCenter.service.IFileMaterialService;
import com.adc.da.slrs.sarPosition.service.ITsPositionService;
import com.adc.da.slrs.sarUser.dao.TsUserDao;
import com.adc.da.slrs.sarUser.service.ITsUserService;
import com.adc.da.slrs.tsRoleMeunData.entity.TsRoleMenuData;
import com.adc.da.slrs.tsRoleMeunData.service.ITsRoleMenuDataService;
import com.adc.da.slrs.zlTree.service.IZlTreeService;
import com.adc.da.sys.service.IUserRoleEOService;
import com.adc.da.util.LoginUserUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -22,6 +22,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.management.Query;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -44,12 +45,11 @@ public class FileMaterialServiceImpl extends ServiceImpl<FileMaterialDao, FileMa
@Autowired
private TsUserDao tsUserDao;
@Autowired
private ITsPositionService tsPositionService;
@Autowired
private ITsRoleMenuDataService iTsRoleMenuDataService;
@Autowired
private IZlTreeService zlTreeService;
@Resource
private IUserRoleEOService userRoleEOService;
@Override
public IPage<FileMaterial> getFileMaterial(FileMaterialPage queryPage) {
@@ -63,8 +63,9 @@ public class FileMaterialServiceImpl extends ServiceImpl<FileMaterialDao, FileMa
// 获取当前登录人
String loginUserId = LoginUserUtil.getUserId();
List<String> positionIds = tsUserDao.selectPositionIds(loginUserId);
List<String> roleIds = tsPositionService.getRoleIdsByPositionIds(positionIds);
// List<String> positionIds = tsUserDao.selectPositionIds(loginUserId);
// List<String> roleIds = tsPositionService.getRoleIdsByPositionIds(positionIds);
List<String> roleIds = userRoleEOService.getRoleIdsByUserId(loginUserId);
QueryWrapper<TsRoleMenuData> wrapper = new QueryWrapper<>();
wrapper.in("ROLE_ID", roleIds);
List<TsRoleMenuData> tsRoleMenuData = iTsRoleMenuDataService.list(wrapper);
@@ -105,8 +106,9 @@ public class FileMaterialServiceImpl extends ServiceImpl<FileMaterialDao, FileMa
userId = LoginUserUtil.getUserId();
}
List<String> positionIds = tsUserDao.selectPositionIds(userId);
List<String> roleIds = tsPositionService.getRoleIdsByPositionIds(positionIds);
// List<String> positionIds = tsUserDao.selectPositionIds(userId);
// List<String> roleIds = tsPositionService.getRoleIdsByPositionIds(positionIds);
List<String> roleIds = userRoleEOService.getRoleIdsByUserId(userId);
QueryWrapper<TsRoleMenuData> wrapper = new QueryWrapper<>();
wrapper.in("ROLE_ID", roleIds);
List<TsRoleMenuData> tsRoleMenuData = iTsRoleMenuDataService.list(wrapper);
@@ -0,0 +1,34 @@
package com.adc.da.slrs.roleReplacePosition.controller;
import com.adc.da.slrs.roleReplacePosition.service.UserPositionService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @author: Mzaxd
* @Date: 2023/11/14 13:46
*/
@RestController
@Api(tags = "福田标准法规--角色替换岗位")
@RequestMapping("/api/roleReplacePosition")
public class RoleReplacePositionController {
@Resource
private UserPositionService userPositionService;
/**
* 角色替换岗位
*
* @return
*/
@GetMapping("/start")
public void roleReplacePosition() {
userPositionService.roleReplacePosition();
}
}
@@ -0,0 +1,20 @@
package com.adc.da.slrs.roleReplacePosition.dao;
import com.adc.da.slrs.roleReplacePosition.domain.PositionRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* @author ThinkBook
* @description 针对表【ts_position_role】的数据库操作Mapper
* @createDate 2023-11-14 13:53:47
* @Entity com.adc.da.slrs.roleReplacePosition.domain.PositionRole
*/
@Repository
public interface PositionRoleMapper extends BaseMapper<PositionRole> {
}
@@ -0,0 +1,20 @@
package com.adc.da.slrs.roleReplacePosition.dao;
import com.adc.da.slrs.roleReplacePosition.domain.UserPosition;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* @author ThinkBook
* @description 针对表【ts_user_position】的数据库操作Mapper
* @createDate 2023-11-14 13:49:37
* @Entity com.adc.da.slrs.roleReplacePosition.domain.UserPosition
*/
@Repository
public interface UserPositionMapper extends BaseMapper<UserPosition> {
}
@@ -0,0 +1,95 @@
package com.adc.da.slrs.roleReplacePosition.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
/**
*
* @TableName ts_position_role
*/
@TableName(value ="ts_position_role")
public class PositionRole implements Serializable {
/**
* 角色ID
*/
@TableId
private String roleId;
/**
* 岗位ID
*/
@TableId
private String positionId;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/**
* 角色ID
*/
public String getRoleId() {
return roleId;
}
/**
* 角色ID
*/
public void setRoleId(String roleId) {
this.roleId = roleId;
}
/**
* 岗位ID
*/
public String getPositionId() {
return positionId;
}
/**
* 岗位ID
*/
public void setPositionId(String positionId) {
this.positionId = positionId;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
PositionRole other = (PositionRole) that;
return (this.getRoleId() == null ? other.getRoleId() == null : this.getRoleId().equals(other.getRoleId()))
&& (this.getPositionId() == null ? other.getPositionId() == null : this.getPositionId().equals(other.getPositionId()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getRoleId() == null) ? 0 : getRoleId().hashCode());
result = prime * result + ((getPositionId() == null) ? 0 : getPositionId().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", roleId=").append(roleId);
sb.append(", positionId=").append(positionId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
@@ -0,0 +1,93 @@
package com.adc.da.slrs.roleReplacePosition.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
/**
*
* @TableName ts_user_position
*/
@TableName(value ="ts_user_position")
public class UserPosition implements Serializable {
/**
* 用户ID
*/
private String userId;
/**
* 岗位ID
*/
private String positionId;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/**
* 用户ID
*/
public String getUserId() {
return userId;
}
/**
* 用户ID
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* 岗位ID
*/
public String getPositionId() {
return positionId;
}
/**
* 岗位ID
*/
public void setPositionId(String positionId) {
this.positionId = positionId;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
UserPosition other = (UserPosition) that;
return (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getPositionId() == null ? other.getPositionId() == null : this.getPositionId().equals(other.getPositionId()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getPositionId() == null) ? 0 : getPositionId().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", userId=").append(userId);
sb.append(", positionId=").append(positionId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
@@ -0,0 +1,13 @@
package com.adc.da.slrs.roleReplacePosition.service;
import com.adc.da.slrs.roleReplacePosition.domain.PositionRole;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author ThinkBook
* @description 针对表【ts_position_role】的数据库操作Service
* @createDate 2023-11-14 13:53:47
*/
public interface PositionRoleService extends IService<PositionRole> {
}
@@ -0,0 +1,14 @@
package com.adc.da.slrs.roleReplacePosition.service;
import com.adc.da.slrs.roleReplacePosition.domain.UserPosition;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author ThinkBook
* @description 针对表【ts_user_position】的数据库操作Service
* @createDate 2023-11-14 13:49:37
*/
public interface UserPositionService extends IService<UserPosition> {
void roleReplacePosition();
}
@@ -0,0 +1,22 @@
package com.adc.da.slrs.roleReplacePosition.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.adc.da.slrs.roleReplacePosition.domain.PositionRole;
import com.adc.da.slrs.roleReplacePosition.service.PositionRoleService;
import com.adc.da.slrs.roleReplacePosition.dao.PositionRoleMapper;
import org.springframework.stereotype.Service;
/**
* @author ThinkBook
* @description 针对表【ts_position_role】的数据库操作Service实现
* @createDate 2023-11-14 13:53:47
*/
@Service
public class PositionRoleServiceImpl extends ServiceImpl<PositionRoleMapper, PositionRole>
implements PositionRoleService{
}
@@ -0,0 +1,68 @@
package com.adc.da.slrs.roleReplacePosition.service.impl;
import com.adc.da.slrs.roleReplacePosition.domain.PositionRole;
import com.adc.da.slrs.roleReplacePosition.service.PositionRoleService;
import com.adc.da.sys.entity.UserRoleEO;
import com.adc.da.sys.service.IUserRoleEOService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.adc.da.slrs.roleReplacePosition.domain.UserPosition;
import com.adc.da.slrs.roleReplacePosition.service.UserPositionService;
import com.adc.da.slrs.roleReplacePosition.dao.UserPositionMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author ThinkBook
* @description 针对表【ts_user_position】的数据库操作Service实现
* @createDate 2023-11-14 13:49:37
*/
@Service
public class UserPositionServiceImpl extends ServiceImpl<UserPositionMapper, UserPosition>
implements UserPositionService{
@Resource
private PositionRoleService positionRoleService;
@Resource
private IUserRoleEOService userRoleEOService;
@Override
public void roleReplacePosition() {
// 找到所有对应关系
List<UserPosition> userPositions = this.list();
// 转换对应关系
Map<String, List<PositionRole>> positionRoleMap = positionRoleService.list().stream()
.collect(Collectors.groupingBy(PositionRole::getPositionId));
Set<UserRoleEO> userRoleEOSet = new HashSet<>();
for (UserPosition userPosition : userPositions) {
// 去除空指针异常
if (positionRoleMap.get(userPosition.getPositionId()) == null) {
continue;
}
List<String> roleIds = positionRoleMap.get(userPosition.getPositionId()).stream()
.map(PositionRole::getRoleId).collect(Collectors.toList());
for (String roleId : roleIds) {
UserRoleEO userRoleEO = new UserRoleEO();
userRoleEO.setUserId(userPosition.getUserId());
userRoleEO.setRoleId(roleId);
userRoleEOSet.add(userRoleEO);
}
}
// 保存对应关系
// 先找出所有用户角色,然后和构建好的用户角色去重后再进行添加,避免出现多条重复数据
List<UserRoleEO> userRoleEOList = userRoleEOService.list();
userRoleEOList.forEach(userRoleEOSet::remove);
userRoleEOService.saveBatch(userRoleEOSet, userRoleEOSet.size());
}
}
@@ -37,4 +37,5 @@ public interface SarBussStandMenuDao extends BaseMapper<SarBussStandMenu> {
int updateMenuidByMenuid (@Param("oldMenuid") String oldMenuid ,@Param("newMenuid") String newMenuid);
List<SarBussStandMenu> getESStandMenu();
}
@@ -3,6 +3,7 @@ package com.adc.da.slrs.sarBussionessStand.dao;
import com.adc.da.slrs.sarBussionessStand.entity.OldSystem;
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStandExport;
import com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO;
import com.adc.da.slrs.sarStandardsInfo.entity.RecommendVO;
import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
@@ -138,5 +139,7 @@ public interface SarBussionessStandDao extends BaseMapper<SarBussionessStand> {
List<SarBussionessStand> selectAllStandStatus();
String selectMaxStandSn(String standSort);
List<StandSystemDTO> getESSystemData(@Param("param") StandSystemDTO standSystemDTO);
}
@@ -69,6 +69,9 @@ public class SarLawsInformationController extends BaseController<SarLawsInformat
@GetMapping("/page")
public ResponseMessage<PageInfo<SarLawsInformation>> page(SarLawsInformation sarLawsInformation) {
List<SarLawsInformation> rows = informationService.queryByPage(sarLawsInformation);
if (rows == null) {
return Result.error("查询失败!");
}
return Result.success(getPageInfo(sarLawsInformation.getPager(), rows));
}
@@ -0,0 +1,14 @@
package com.adc.da.slrs.sarLawsInformation.dao;
import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformationAuth;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author tjzdw
* @description
* @date 2023/11/10
*/
@Mapper
public interface SarLawsInformationAuthDao extends BaseMapper<SarLawsInformationAuth> {
}
@@ -37,7 +37,7 @@ public class SarLawsInformation extends BasePage implements Serializable {
/**
* 一级资料类别
*/
@ApiModelProperty("级资料类")
@ApiModelProperty("1级资料")
@TableField(value = "FIRST_TYPE")
private String firstType;
@@ -45,8 +45,8 @@ public class SarLawsInformation extends BasePage implements Serializable {
* 一级资料类别名称
*/
@ApiModelProperty(value = "一级资料类别名称")
@TableField(exist = false)
@Excel(name = "级资料类", orderNum = "0")
// @TableField(exist = false)
@Excel(name = "1级资料", orderNum = "0")
private String firstTypeName;
/**
@@ -60,8 +60,8 @@ public class SarLawsInformation extends BasePage implements Serializable {
* 二级资料类别名称
*/
@ApiModelProperty(value = "二级资料类别名称")
@TableField(exist = false)
@Excel(name = "级资料类", orderNum = "1")
// @TableField(exist = false)
@Excel(name = "2级资料", orderNum = "1")
private String secondTypeName;
/**
@@ -75,8 +75,8 @@ public class SarLawsInformation extends BasePage implements Serializable {
* 三级资料类别名称
*/
@ApiModelProperty(value = "三级资料类别名称")
@TableField(exist = false)
@Excel(name = "级资料类", orderNum = "2")
// @TableField(exist = false)
@Excel(name = "3级资料", orderNum = "2")
private String thirdTypeName;
/**
@@ -90,8 +90,8 @@ public class SarLawsInformation extends BasePage implements Serializable {
* 四级资料类别名称
*/
@ApiModelProperty(value = "四级资料类别名称")
@TableField(exist = false)
@Excel(name = "级资料类", orderNum = "3")
// @TableField(exist = false)
@Excel(name = "4级资料", orderNum = "3")
private String fourthTypeName;
/**
@@ -154,21 +154,21 @@ public class SarLawsInformation extends BasePage implements Serializable {
* 可查看者,若设置为空则所有用户均可查看,若设置人员后,仅有可查看者可以查看文件信息。
*/
@ApiModelProperty(value = "可查看者")
@TableField(value = "VIEWABLE_BY")
@TableField(exist = false)
private String viewableBy;
/**
* 可下载者,若设置为空则仅有上传人和审批人可以查看,若设置人员后,仅有可下载者可下载文件信息。
*/
@ApiModelProperty(value = "可下载者")
@TableField(value = "DOWNLOADABLE_BY")
@TableField(exist = false)
private String downloadableBy;
/**
* 创建人和审批人
*/
@ApiModelProperty(value = "创建人和审批人")
@TableField
@TableField(exist = false)
private String createAndApproveBy;
/**
@@ -242,4 +242,20 @@ public class SarLawsInformation extends BasePage implements Serializable {
@TableField(exist = false)
private static final long serialVersionUID = 1L;
// 上传时间查询字段
@TableField(exist = false)
private String uploadTimeBegin;
@TableField(exist = false)
private String uploadTimeEnd;
// 查询使用 所有子节点列表
@TableField(exist = false)
private List<String> treeNodeIdList;
@TableField(exist = false)
private List<String> informationIdList;
// 是否可下载
@TableField(exist = false)
private Boolean downloadable;
}
@@ -0,0 +1,41 @@
package com.adc.da.slrs.sarLawsInformation.entity;
import com.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @author tjzdw
* @description
* @date 2023/11/10
*/
@TableName(value ="sar_laws_information_auth")
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@Data
public class SarLawsInformationAuth extends BaseEntity implements Serializable {
@ApiModelProperty(value = "主键")
@TableId(value = "ID", type = IdType.ID_WORKER_STR)
private String id;
@ApiModelProperty(value = "权限类型")
@TableField(value = "AUTH_TYPE")
private String authType;
@ApiModelProperty(value = "政策资料ID")
@TableField(value = "LAWS_INFORMATION_ID")
private String lawsInformationId;
@ApiModelProperty(value = "用户ID")
@TableField(value = "USER_ID")
private String userId;
}
@@ -0,0 +1,12 @@
package com.adc.da.slrs.sarLawsInformation.service;
import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformationAuth;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author tjzdw
* @description
* @date 2023/11/10
*/
public interface SarLawsInformationAuthService extends IService<SarLawsInformationAuth> {
}
@@ -18,7 +18,7 @@ public interface SarLawsInformationService extends IService<SarLawsInformation>
List<SarLawsInformation> queryByPage(SarLawsInformation sarLawsInformation);
Integer addLawsInformation(SarLawsInformation sarLawsInformation);
Boolean addLawsInformation(SarLawsInformation sarLawsInformation);
Boolean deleteInformation(String id);
@@ -0,0 +1,18 @@
package com.adc.da.slrs.sarLawsInformation.service.impl;
import com.adc.da.slrs.sarLawsInformation.dao.SarLawsInformationAuthDao;
import com.adc.da.slrs.sarLawsInformation.dao.SarLawsInformationDao;
import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformationAuth;
import com.adc.da.slrs.sarLawsInformation.service.SarLawsInformationAuthService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author tjzdw
* @description
* @date 2023/11/10
*/
@Service
public class SarLawsInformationAuthServiceImpl extends ServiceImpl<SarLawsInformationAuthDao, SarLawsInformationAuth>
implements SarLawsInformationAuthService {
}
@@ -1,6 +1,5 @@
package com.adc.da.slrs.sarLawsInformation.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import com.adc.da.att.entity.AttFileEO;
@@ -10,11 +9,12 @@ import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.person.entity.TsPersonCollect;
import com.adc.da.person.service.IPersonCollectEOService;
import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformationAuth;
import com.adc.da.slrs.sarLawsInformation.service.SarLawsInformationAuthService;
import com.adc.da.slrs.sarLawsInformationCenterTree.entity.SarLawsInformationCenterTree;
import com.adc.da.slrs.sarLawsInformationCenterTree.service.SarLawsInformationCenterTreeService;
import com.adc.da.slrs.sarUpdLog.entity.SarUpdLog;
import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
import com.adc.da.slrs.sarUser.entity.TsUser;
import com.adc.da.slrs.sarUser.service.ITsUserService;
import com.adc.da.slrs.tsDictionaryType.entity.TsDicType;
import com.adc.da.slrs.tsDictionaryType.service.ITsDicTypeService;
@@ -22,7 +22,6 @@ import com.adc.da.util.LoginUserUtil;
import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.util.FieldConvertUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation;
@@ -47,6 +46,8 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
@@ -61,6 +62,8 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
@Resource
private SarLawsInformationCenterTreeService treeService;
@Resource
private SarLawsInformationAuthService authService;
@Resource
private IAttFileEOService attFileEOService;
@Resource
private ITsDicTypeService dicTypeService;
@@ -77,7 +80,7 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
public SarLawsInformation getLawsInformationInfo(String id) {
SarLawsInformation sarLawsInformation = this.baseMapper.selectById(id);
// 将字典编号变更为字典值
convertCodeToName(sarLawsInformation);
// convertCodeToName(sarLawsInformation);
// 查询资料文件信息
if (StringUtils.isNotBlank(sarLawsInformation.getInformationFile())) {
String[] split = sarLawsInformation.getInformationFile().split(",");
@@ -100,12 +103,74 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
if (list.size() > 0) {
sarLawsInformation.setCollectId(list.get(0).getId());
}
// 查询可查看用户和可下载用户
String userId = LoginUserUtil.getUserId();
LambdaQueryWrapper<SarLawsInformationAuth> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(SarLawsInformationAuth::getLawsInformationId, sarLawsInformation.getId());
wrapper1.eq(SarLawsInformationAuth::getAuthType, "viewableBy");
wrapper1.select(SarLawsInformationAuth::getUserId);
List<SarLawsInformationAuth> list1 = authService.list(wrapper1);
if (list1.size() > 0) {
List<String> viewableBy = new ArrayList<>();
list1.forEach(item -> {
String userName = userService.userIdByName(item.getUserId());
viewableBy.add(userName + "(" + item.getUserId() + ")");
});
sarLawsInformation.setViewableBy(String.join(",", viewableBy));
}
sarLawsInformation.setDownloadable(false);
LambdaQueryWrapper<SarLawsInformationAuth> wrapper2 = new LambdaQueryWrapper<>();
wrapper2.eq(SarLawsInformationAuth::getLawsInformationId, sarLawsInformation.getId());
wrapper2.eq(SarLawsInformationAuth::getAuthType, "downloadableBy");
wrapper2.select(SarLawsInformationAuth::getUserId);
List<SarLawsInformationAuth> list2 = authService.list(wrapper2);
if (list2.size() > 0) {
List<String> downloadableBy = new ArrayList<>();
list2.forEach(item -> {
String userName = userService.userIdByName(item.getUserId());
downloadableBy.add(userName + "(" + item.getUserId() + ")");
// 判断是否可下载
if (item.getUserId().equals(userId)) {
sarLawsInformation.setDownloadable(true);
}
});
sarLawsInformation.setDownloadableBy(String.join(",", downloadableBy));
} else {
sarLawsInformation.setDownloadable(true);
}
LambdaQueryWrapper<SarLawsInformationAuth> wrapper3 = new LambdaQueryWrapper<>();
wrapper3.eq(SarLawsInformationAuth::getLawsInformationId, sarLawsInformation.getId());
wrapper3.eq(SarLawsInformationAuth::getAuthType, "createAndApproveBy");
wrapper3.eq(SarLawsInformationAuth::getUserId, userId);
int count = authService.count(wrapper3);
if (count > 0) {
sarLawsInformation.setDownloadable(true);
}
return sarLawsInformation;
}
@Override
public List<SarLawsInformation> queryByPage(SarLawsInformation page) {
String userId = LoginUserUtil.getUserId();
if (StringUtils.isBlank(userId)) {
return null;
}
// 查询有权限的资料ID
LambdaQueryWrapper<SarLawsInformationAuth> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SarLawsInformationAuth::getUserId, userId);
wrapper.eq(SarLawsInformationAuth::getAuthType, "viewableBy");
wrapper.or().eq(SarLawsInformationAuth::getAuthType, "createAndApproveBy");
wrapper.select(SarLawsInformationAuth::getLawsInformationId);
List<SarLawsInformationAuth> informationAuthList = authService.list(wrapper);
if (informationAuthList.size() > 0) {
List<String> informationIdList = informationAuthList.stream().map(SarLawsInformationAuth::getLawsInformationId).collect(Collectors.toList());
page.setInformationIdList(informationIdList);
}
// 设置排序字段
// if("name".equals(page.getSortField()) || "uploadTime".equals(page.getSortField())) {
// String sortField = StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(page.getSortField()),"_").toUpperCase();
// page.setSortField(sortField);
// }
if (StringUtils.isNotBlank(page.getSortField())) {
String sortField = StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(page.getSortField()),"_").toUpperCase();
page.setSortField(sortField);
@@ -113,9 +178,17 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
page.setSortField("ID");
page.setSortMode("asc");
}
// 查询树节点及其子节点
if (StringUtils.isNotBlank(page.getTreeNodeId())) {
List<String> treeNodeIdList = new ArrayList<>();
treeService.querySubordinateTreeNode(treeNodeIdList, page.getTreeNodeId());
page.setTreeNodeIdList(treeNodeIdList);
}
Integer rowCount = this.baseMapper.queryByPageCount(page);
page.getPager().setRowCount(rowCount);
List<SarLawsInformation> sarLawsInformationList = this.baseMapper.queryByPage(page);
// 对一级类别或二级类别做排序
// if (page.getSortField().contains("_"))
for (SarLawsInformation sarLawsInformation : sarLawsInformationList) {
// 将字典编号变更为字典值
convertCodeToName(sarLawsInformation);
@@ -134,7 +207,7 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
}
@Override
public Integer addLawsInformation(SarLawsInformation sarLawsInformation) {
public Boolean addLawsInformation(SarLawsInformation sarLawsInformation) {
sarLawsInformation.setCreateTime(new Date());
sarLawsInformation.setModifyTime(new Date());
if (sarLawsInformation.getUploadTime() == null) {
@@ -142,9 +215,6 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
}
sarLawsInformation.setValidFlag(0);
String userId = LoginUserUtil.getUserId();
TsUser tsUser = userService.getById(userId);
sarLawsInformation.setViewableBy(tsUser.getUname() + "(" + userId + ")");
sarLawsInformation.setDownloadableBy(tsUser.getUname() + "(" + userId + ")");
// 若体系类别不存在,则默认属于根节点
if (StringUtils.isBlank(sarLawsInformation.getTreeNodeId())) {
LambdaQueryWrapper<SarLawsInformationCenterTree> wrapper = new LambdaQueryWrapper<>();
@@ -152,7 +222,56 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
SarLawsInformationCenterTree one = treeService.getOne(wrapper);
sarLawsInformation.setTreeNodeId(one.getId());
}
return this.baseMapper.insert(sarLawsInformation);
convertCodeToName(sarLawsInformation);
int insert = this.baseMapper.insert(sarLawsInformation);
if (insert <= 0) {
return false;
}
// 设置可见人和下载人
if (StringUtils.isNotBlank(sarLawsInformation.getViewableBy())) {
List<String> viewableByList = extractContentInParentheses(sarLawsInformation.getViewableBy());
if (!viewableByList.contains(userId)) {
viewableByList.add(userId);
}
viewableByList.forEach(viewableBy -> {
SarLawsInformationAuth auth = new SarLawsInformationAuth();
auth.setLawsInformationId(sarLawsInformation.getId());
auth.setAuthType("viewableBy");
auth.setUserId(viewableBy);
authService.save(auth);
});
}
if (StringUtils.isNotBlank(sarLawsInformation.getDownloadableBy())) {
List<String> downloadableByList = extractContentInParentheses(sarLawsInformation.getDownloadableBy());
if (!downloadableByList.contains(userId)) {
downloadableByList.add(userId);
}
downloadableByList.forEach(viewableBy -> {
SarLawsInformationAuth auth = new SarLawsInformationAuth();
auth.setLawsInformationId(sarLawsInformation.getId());
auth.setAuthType("downloadableBy");
auth.setUserId(viewableBy);
authService.save(auth);
});
}
// 流程入库审批人和创建人入库
if (sarLawsInformation.getCreateAndApproveBy() != null) {
for (String userIdBy : sarLawsInformation.getCreateAndApproveBy().split(",")) {
SarLawsInformationAuth auth = new SarLawsInformationAuth();
auth.setLawsInformationId(sarLawsInformation.getId());
auth.setAuthType("createAndApproveBy");
auth.setUserId(userIdBy);
authService.save(auth);
}
} else {
// 配置初始人员权限
SarLawsInformationAuth auth = new SarLawsInformationAuth();
auth.setLawsInformationId(sarLawsInformation.getId());
auth.setAuthType("createAndApproveBy");
auth.setUserId(userId);
authService.save(auth);
}
return true;
}
@Override
@@ -161,7 +280,13 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
wrapper.eq(SarLawsInformation::getId, id);
wrapper.set(SarLawsInformation::getValidFlag,1);
wrapper.set(SarLawsInformation::getModifyTime,new Date());
return update(wrapper);
boolean update = update(wrapper);
if (update) {
LambdaQueryWrapper<SarLawsInformationAuth> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(SarLawsInformationAuth::getLawsInformationId, id);
authService.remove(wrapper1);
}
return false;
}
@Override
@@ -175,6 +300,36 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
List<String> compareResult = compareSarLawsInformation(oldLawsInformation, lawsInformation);
if (compareResult.size() > 0) {
int update = this.baseMapper.updateById(lawsInformation);
for (String compareItem : compareResult) {
if (compareItem.contains("可查看者")) {
LambdaQueryWrapper<SarLawsInformationAuth> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SarLawsInformationAuth::getLawsInformationId, lawsInformation.getId());
wrapper.eq(SarLawsInformationAuth::getAuthType, "viewableBy");
authService.remove(wrapper);
List<String> viewableByList = extractContentInParentheses(lawsInformation.getViewableBy());
viewableByList.forEach(viewableBy -> {
SarLawsInformationAuth auth = new SarLawsInformationAuth();
auth.setLawsInformationId(lawsInformation.getId());
auth.setAuthType("viewableBy");
auth.setUserId(viewableBy);
authService.save(auth);
});
}
if (compareItem.contains("可下载者")) {
LambdaQueryWrapper<SarLawsInformationAuth> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SarLawsInformationAuth::getLawsInformationId, lawsInformation.getId());
wrapper.eq(SarLawsInformationAuth::getAuthType, "downloadableBy");
authService.remove(wrapper);
List<String> downloadableByList = extractContentInParentheses(lawsInformation.getDownloadableBy());
downloadableByList.forEach(downloadableBy -> {
SarLawsInformationAuth auth = new SarLawsInformationAuth();
auth.setLawsInformationId(lawsInformation.getId());
auth.setAuthType("downloadableBy");
auth.setUserId(downloadableBy);
authService.save(auth);
});
}
}
// 添加修改记录
SarUpdLog sarUpdLogEO = new SarUpdLog();
sarUpdLogEO.setId(UUIDUtils.randomUUID20());
@@ -193,19 +348,31 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
LambdaQueryWrapper<SarLawsInformation> wrapper = new LambdaQueryWrapper<>();
wrapper.in(SarLawsInformation::getId, idList);
List<SarLawsInformation> sarLawsInformationList = this.baseMapper.selectList(wrapper);
for (SarLawsInformation sarLawsInformation : sarLawsInformationList) {
// 将字典编号变更为字典值
convertCodeToName(sarLawsInformation);
}
// for (SarLawsInformation sarLawsInformation : sarLawsInformationList) {
// // 将字典编号变更为字典值
// convertCodeToName(sarLawsInformation);
// }
return sarLawsInformationList;
}
@Override
public List<SarLawsInformation> getAllLawsInformation(SarLawsInformation sarLawsInformation) {
String userId = LoginUserUtil.getUserId();
// 查询有权限的资料ID
LambdaQueryWrapper<SarLawsInformationAuth> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SarLawsInformationAuth::getUserId, userId);
wrapper.eq(SarLawsInformationAuth::getAuthType, "viewableBy");
wrapper.or().eq(SarLawsInformationAuth::getAuthType, "createAndApproveBy");
wrapper.select(SarLawsInformationAuth::getLawsInformationId);
List<SarLawsInformationAuth> informationAuthList = authService.list(wrapper);
if (informationAuthList.size() > 0) {
List<String> informationIdList = informationAuthList.stream().map(SarLawsInformationAuth::getLawsInformationId).collect(Collectors.toList());
sarLawsInformation.setInformationIdList(informationIdList);
}
List<SarLawsInformation> sarLawsInformationList = this.baseMapper.getAllLawsInformation(sarLawsInformation);
for (SarLawsInformation lawsInformation : sarLawsInformationList) {
// 将字典编号变更为字典值
convertCodeToName(lawsInformation);
// convertCodeToName(lawsInformation);
// 查询文件信息
if (StringUtils.isNotBlank(lawsInformation.getInformationFile())) {
String[] split = lawsInformation.getInformationFile().split(",");
@@ -425,63 +592,70 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
*/
public List<String> compareSarLawsInformation(SarLawsInformation oldInfo, SarLawsInformation newInfo) {
List<String> changes = new ArrayList<>();
// 需要比较的字段
String[] ignoreFields = {"id","firstTypeName","secondTypeName","thirdTypeName","fourthTypeName","uploadTime",
"informationFileList","createAndApproveBy","treeNodeId","treeNodeName","validFlag","createTime",
"modifyTime","sortField","sortMode","collectId","serialVersionUID"};
List<String> ignoreFieldList = Arrays.asList(ignoreFields);
// 需要比较的字段
String[] fieldArr = {"firstType","secondType","thirdType","fourthType","name",
"department","author","description","informationFile","treeNodeId","viewableBy","downloadableBy"};
List<String> fieldList = Arrays.asList(fieldArr);
// 获取SarLawsInformation类的所有字段
Field[] fields = SarLawsInformation.class.getDeclaredFields();
for (Field field : fields) {
if (!ignoreFieldList.contains(field.getName())) {
if (fieldList.contains(field.getName())) {
try {
field.setAccessible(true);
String oldValue = String.valueOf(field.get(oldInfo));
String newValue = String.valueOf(field.get(newInfo));
if (!Objects.equals(oldValue, newValue)) {
if ("firstType".equals(field.getName()) || "secondType".equals(field.getName()) || "thirdType".equals(field.getName()) ||
"fourthType".equals(field.getName())) {
List<String> typeNameList = new ArrayList<>();
if (StringUtils.isNotBlank(newValue)) {
for (String type : newValue.split(",")) {
if (StringUtils.isNotBlank(type)) {
typeNameList.add(dicTypeService.getDicTypeNameByDicCode(type));
switch (field.getName()) {
// case "firstType":
// case "secondType":
// case "thirdType":
// case "fourthType": {
// List<String> typeNameList = new ArrayList<>();
// if (StringUtils.isNotBlank(newValue)) {
// for (String type : newValue.split(",")) {
// if (StringUtils.isNotBlank(type)) {
// typeNameList.add(dicTypeService.getDicTypeNameByDicCode(type));
// }
// }
// }
// // 获取资料类型名称
// String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1);
// Method method = SarLawsInformation.class.getMethod("get" + fieldName + "Name");
// Object oldTypeName = method.invoke(oldInfo);
// ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
// changes.add(annotationsByType.value() + "由\"" + oldTypeName + "\"改为\"" + String.join(",", typeNameList) + "\"");
// break;
// }
case "informationFile": {
List<String> fileNameList = new ArrayList<>();
if (StringUtils.isNotBlank(newValue)) {
String[] split = newValue.split(",");
for (String attId : split) {
AttFileEO fileInfo = attFileEOService.getFileInfo(attId);
fileNameList.add(fileInfo.getOldFileName());
}
}
}
// 获取资料类型名称
String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1);
Method method = SarLawsInformation.class.getMethod("get" + fieldName + "Name");
Object oldTypeName = method.invoke(oldInfo);
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "\"" + oldTypeName + "\"改为\"" + String.join(",",typeNameList) + "\"");
} else if ("informationFile".equals(field.getName())) {
List<String> fileNameList = new ArrayList<>();
if (StringUtils.isNotBlank(newValue)) {
String[] split = newValue.split(",");
for (String attId : split) {
AttFileEO fileInfo = attFileEOService.getFileInfo(attId);
fileNameList.add(fileInfo.getOldFileName());
// 获取资料类型名称
String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1);
Method method = SarLawsInformation.class.getMethod("get" + fieldName + "List");
List<?> oldFileList = (List) method.invoke(oldInfo);
List<String> oldFileNameList = new ArrayList<>();
if (oldFileList != null && oldFileList.size() > 0) {
for (Object oldFile : oldFileList) {
AttFileEO oldFile1 = (AttFileEO) oldFile;
oldFileNameList.add(oldFile1.getOldFileName());
}
}
// 获取字段名称
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "\"" + String.join(",", oldFileNameList) + "\"改为\"" + String.join(",", fileNameList) + "\"");
break;
}
// 获取资料类型名称
String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1);
Method method = SarLawsInformation.class.getMethod("get" + fieldName + "Name");
List<?> oldFileList = (List)method.invoke(oldInfo);
List<String> oldFileNameList = new ArrayList<>();
if (oldFileList != null && oldFileList.size() > 0) {
for (Object oldFile : oldFileList) {
AttFileEO oldFile1 = (AttFileEO) oldFile;
oldFileNameList.add(oldFile1.getOldFileName());
}
default: {
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "\"" + oldValue + "\"改为\"" + newValue + "\"");
break;
}
// 获取字段名称
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "\"" + String.join(",",oldFileNameList) + "\"改为\"" + String.join(",",fileNameList) + "\"");
}
else {
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "\"" + oldValue + "\"改为\"" + newValue + "\"");
}
}
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
@@ -509,6 +683,21 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
}
return resultlist;
}
/**
* 获取括号内的内容转换成列表
* @param input 类似于 张兰英(zhanglanying),管理员(admin) 的字符串
* @return 括号内内容的List
*/
private static List<String> extractContentInParentheses(String input) {
List<String> results = new ArrayList<>();
Pattern pattern = Pattern.compile("\\(([^)]+)\\)");
Matcher matcher = pattern.matcher(input);
while (matcher.find()) {
results.add(matcher.group(1));
}
return results;
}
}
@@ -22,4 +22,6 @@ public interface SarLawsInformationCenterTreeService extends IService<SarLawsInf
List<SarLawsInformationCenterTreeData> getTree();
boolean updateTreeNode(SarLawsInformationCenterTree informationCenterTree);
void querySubordinateTreeNode(List<String> treeNodeIdList, String treeNodeId);
}
@@ -101,6 +101,20 @@ public class SarLawsInformationCenterTreeServiceImpl extends ServiceImpl<SarLaws
return updated > 0;
}
// 递归查询所有子节点
@Override
public void querySubordinateTreeNode(List<String> treeNodeIdList, String treeNodeId) {
treeNodeIdList.add(treeNodeId);
LambdaQueryWrapper<SarLawsInformationCenterTree> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SarLawsInformationCenterTree::getParentId, treeNodeId);
List<SarLawsInformationCenterTree> list = list(wrapper);
if (list.size()>0) {
for (SarLawsInformationCenterTree sarLawsInformationCenterTree : list) {
querySubordinateTreeNode(treeNodeIdList,sarLawsInformationCenterTree.getId());
}
}
}
@Transactional
@Override
public void setResource(SarLawsInformationCenterTree informationCenterTree) {
@@ -76,24 +76,24 @@ public class SarLawsTopicController extends BaseController<SarLawsTopicVO> {
@ApiOperation(value = "新增政策课题")
@PostMapping(value = "/addLawsTopic", consumes = "application/json;charset=UTF-8")
public ResponseMessage<?> create(@RequestBody SarLawsTopic lawsTopic) throws Exception {
public ResponseMessage<?> addLawsTopic(@RequestBody SarLawsTopic lawsTopic) throws Exception {
lawsTopicService.addLawsTopicInfo(lawsTopic);
return Result.success();
}
@ApiOperation("根据会议ID删除会议")
@ApiOperation("根据政策课题id删除课题")
@DeleteMapping("/deleteLawsTopicById")
public ResponseMessage<?> deleteMeeting(String lawsTopicId) {
if (StringUtils.isBlank(lawsTopicId)) {
public ResponseMessage<?> deleteLawsTopicById(String id) {
if (StringUtils.isBlank(id)) {
return Result.error("删除失败,政策课题ID为空");
}
lawsTopicService.deleteLawsTopicInfo(lawsTopicId);
lawsTopicService.deleteLawsTopicInfo(id);
return Result.success();
}
@ApiOperation("根据会议ID修改会议信息")
@ApiOperation("根据政策课题ID修改课题信息")
@PutMapping("/updateLawsTopicInfo")
public ResponseMessage<?> updateMeetingInfo(@RequestBody SarLawsTopic lawsTopic) {
public ResponseMessage<?> updateLawsTopicInfo(@RequestBody SarLawsTopic lawsTopic) {
if (ObjectUtils.isEmpty(lawsTopic)) {
return Result.error("更新失败,政策课题信息不存在");
}
@@ -178,7 +178,7 @@ public class SarLawsTopicController extends BaseController<SarLawsTopicVO> {
HSSFCellStyle cellStyle1 = workbook.createCellStyle();
cellStyle1.setAlignment(HorizontalAlignment.CENTER);
cellStyle1.setVerticalAlignment(VerticalAlignment.CENTER);
String exportFieldName = "课题名称,课题承办单位,课题指导单位,课题参与单位,开始时间,结题时间,课题费用(万元)";
String exportFieldName = "课题名称,课题承办单位,课题指导单位,课题参与单位,启动时间,结题时间,课题费用(万元)";
String[] headerArr = exportFieldName.split(",");
for (int i=0;i < headerArr.length; i++) {
Cell cell = rowHeader.createCell(i);
@@ -17,7 +17,7 @@ import java.util.List;
@Mapper
public interface SarLawsTopicMapper extends BaseMapper<SarLawsTopic> {
Integer queryByPageCount(SarLawsTopicVO page);
List<Integer> queryByPageCount(SarLawsTopicVO page);
List<SarLawsTopicVO> queryByPage(SarLawsTopicVO page);
@@ -58,7 +58,7 @@ public class SarLawsTopic implements Serializable {
/**
* 开始时间
*/
@ApiModelProperty(value = "开始时间")
@ApiModelProperty(value = "启动时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@TableField(value = "START_TIME")
private Date startTime;
@@ -56,7 +56,7 @@ public class SarLawsTopicVO extends BasePage {
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", orderNum = "4", exportFormat = "yyyy-MM-dd", needMerge = true)
@Excel(name = "启动时间", orderNum = "4", exportFormat = "yyyy-MM-dd", needMerge = true)
private Date startTime;
/**
@@ -238,8 +238,9 @@ public class SarLawsTopicVO extends BasePage {
private String sortMode = "asc";
private String startTimeOperator = "=";
private String closeTimeOperator = "=";
// 排序字段
private String startTimeBegin;
private String startTimeEnd;
// 导出使用的属性
// 导出文件名
@@ -217,7 +217,7 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
page.setSortField("ID");
page.setSortMode("asc");
}
Integer rowCount = this.baseMapper.queryByPageCount(page);
int rowCount = this.baseMapper.queryByPageCount(page).size();
page.getPager().setRowCount(rowCount);
List<SarLawsTopicVO> sarLawsTopicVOList = this.baseMapper.queryByPage(page);
for (SarLawsTopicVO lawsTopicVO : sarLawsTopicVOList) {
@@ -414,14 +414,16 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
if (!ignoreFieldList.contains(field.getName())) {
try {
field.setAccessible(true);
String oldValue = String.valueOf(field.get(oldLawsTopic));
String newValue = String.valueOf(field.get(newLawsTopic));
Object oldValue = field.get(oldLawsTopic);
Object newValue = field.get(newLawsTopic);
if (!Objects.equals(oldValue, newValue)) {
// 对比文件字段
if (fileAttIdFieldList.contains(field.getName())) {
String oldValueStr = String.valueOf(oldValue);
String newValueStr = String.valueOf(newValue);
List<String> fileNameList = new ArrayList<>();
if (StringUtils.isNotBlank(newValue)) {
String[] split = newValue.split(",");
if (StringUtils.isNotBlank(newValueStr)) {
String[] split = newValueStr.split(",");
for (String attId : split) {
AttFileEO fileInfo = attFileEOService.getFileInfo(attId);
fileNameList.add(fileInfo.getOldFileName());
@@ -447,7 +449,21 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
|| "insideContactInformationList".equals(field.getName())) {
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "被变更");
} else {
} else if ("startTime".equals(field.getName()) || "closeTime".equals(field.getName())) {
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String oldDateStr = null;
String newDateStr = null;
if (oldValue != null) {
Date oldDate = (Date) oldValue;
oldDateStr = sdf.format(oldDate);
}
if (newValue!= null) {
Date newDate = (Date) newValue;
newDateStr = sdf.format(newDate);
}
changes.add(annotationsByType.value() + "\"" + oldDateStr + "\"改为\"" + newDateStr + "\"");
}else {
// 对比其他字段
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "\"" + oldValue + "\"改为\"" + newValue + "\"");
@@ -1,34 +1,38 @@
package com.adc.da.slrs.sarMenuStandard.controller;
import com.adc.da.base.web.BaseController;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarMenuStandard.entity.SarMenuStandardNew;
import com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO;
import com.adc.da.slrs.sarMenuStandard.service.ISarMenuStandardNewService;
import com.adc.da.slrs.sarUser.service.ITsUserService;
import com.adc.da.sys.sarMenuStandard.entity.SarMenuStandard;
import com.adc.da.util.LoginUserUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author super_liu
* @since 2021-07-07
*/
* <p>
* 前端控制器
* </p>
*
* @author super_liu
* @since 2021-07-07
*/
@RestController
@Api(tags = "福田标准法规--标准法规库-菜单标准体系")
@RequestMapping("/${restPath}/lawss/sarMenuStandardLimit")
@Slf4j
public class SarMenuStandardNewController extends BaseController<SarMenuStandardNew> {
@Autowired
@@ -39,16 +43,16 @@ public class SarMenuStandardNewController extends BaseController<SarMenuStandard
@ApiOperation("查询当前节点所有关联上级")
@GetMapping("/getTopMenu")
public ResponseMessage<String> getTopMenu(SarMenuStandardNew sarMenuStandardNew){
String tsResources= iSarMenuStandardNewService.getTopMenu(sarMenuStandardNew);
public ResponseMessage<String> getTopMenu(SarMenuStandardNew sarMenuStandardNew) {
String tsResources = iSarMenuStandardNewService.getTopMenu(sarMenuStandardNew);
return Result.success(tsResources);
}
@ApiOperation("查询有权限资源")
@GetMapping("/getListStandLimit")
public ResponseMessage<List<SarMenuStandard>> getListStandLimit(SarMenuStandardNew sarMenuStandardNew){
public ResponseMessage<List<SarMenuStandard>> getListStandLimit(SarMenuStandardNew sarMenuStandardNew) {
List<String> access = tsUserService.getResourceUserId(LoginUserUtil.getUserId());
List<SarMenuStandard> tsResources= iSarMenuStandardNewService.getListStandLimit(sarMenuStandardNew,access);
List<SarMenuStandard> tsResources = iSarMenuStandardNewService.getListStandLimit(sarMenuStandardNew, access);
return Result.success(tsResources);
}
@@ -64,7 +68,7 @@ public class SarMenuStandardNewController extends BaseController<SarMenuStandard
@ApiOperation("根据菜单ID查询菜单")
@GetMapping("/getMenuStandardById")
public ResponseMessage<SarMenuStandard> getMenuStandardById(@RequestParam String menuId){
public ResponseMessage<SarMenuStandard> getMenuStandardById(@RequestParam String menuId) {
if (StringUtils.isBlank(menuId)) {
return Result.error("获取失败,菜单ID为空");
}
@@ -86,6 +90,27 @@ public class SarMenuStandardNewController extends BaseController<SarMenuStandard
if (StringUtils.isBlank(menuId)) {
return Result.error("删除失败,菜单ID为空");
}
return Result.success(iSarMenuStandardNewService.deleteMenuStandard(menuId));
iSarMenuStandardNewService.deleteMenuStandard(menuId);
return Result.success();
}
@ApiOperation("体系搜索三层树")
@GetMapping("/standardSystemTree")
public ResponseMessage<?> standardSystemTree() {
return Result.success(iSarMenuStandardNewService.standardSystemTree());
}
@ApiOperation("法规弹窗列表")
@PostMapping("/standardSystemList")
public ResponseMessage<?> standardSystemList(@RequestBody StandSystemDTO standSystemDTO) {
return Result.success(iSarMenuStandardNewService.standardSystemList(standSystemDTO));
}
@ApiOperation("法规列表弹窗Excel导出")
@GetMapping("/standardSystemListExport")
public ResponseMessage<?> standardSystemListExport(StandSystemDTO standSystemDTO,
HttpServletResponse response, HttpServletRequest request) {
iSarMenuStandardNewService.standardSystemListExport(standSystemDTO, response, request);
return Result.success();
}
}
@@ -0,0 +1,85 @@
package com.adc.da.slrs.sarMenuStandard.entity;
import com.adc.da.exception.AdcDaBaseException;
/**
* @author: Mzaxd
* @Date: 2023/11/15 17:36
*/
public enum StandCategoryEnum {
// INLAND 类型的枚举实例
INLAND_GB("INLAND", "GB", 0),
INLAND_GBT("INLAND", "GB/T", 1),
INLAND_QCT("INLAND", "QC/T", 2),
INLAND_JT("INLAND", "JT", 3),
INLAND_JB("INLAND", "JB", 4),
INLAND_GA("INLAND", "GA", 5),
INLAND_GJB("INLAND", "GJB", 6),
INLAND_HJ("INLAND", "HJ", 7),
// FOREIGN 类型的枚举实例
FOREIGN_ECE("FOREIGN", "ECE", 0),
FOREIGN_EU("FOREIGN", "EU", 1),
FOREIGN_EC("FOREIGN", "EC", 2),
FOREIGN_EEC("FOREIGN", "EEC", 3),
FOREIGN_ISO("FOREIGN", "ISO", 4),
FOREIGN_IEC("FOREIGN", "IEC", 5),
FOREIGN_GTR("FOREIGN", "GTR", 6),
FOREIGN_CFR("FOREIGN", "CFR", 7),
FOREIGN_JASO("FOREIGN", "JASO", 8),
FOREIGN_JIS("FOREIGN", "JIS", 9),
FOREIGN_GSO("FOREIGN", "GSO", 10),
FOREIGN_GOST("FOREIGN", "GOST", 11),
FOREIGN_ΓOCT("FOREIGN", "ΓOCT", 12),
FOREIGN_TP("FOREIGN", "TP", 13),
FOREIGN_SASO("FOREIGN", "SASO", 14),
FOREIGN_UAE("FOREIGN", "UAE", 15),
FOREIGN_CONTRAN("FOREIGN", "CONTRAN", 16),
FOREIGN_DENATRAN("FOREIGN", "DENATRAN", 17),
FOREIGN_ABNT_NBR("FOREIGN", "ABNT NBR", 18),
FOREIGN_NBR("FOREIGN", "NBR", 19),
FOREIGN_INMETRO("FOREIGN", "INMETRO", 20),
FOREIGN_CONAMA("FOREIGN", "CONAMA", 21),
FOREIGN_Normative_Instruction("FOREIGN", "Normative Instruction", 22),
FOREIGN_ADR("FOREIGN", "ADR", 23),
;
private final String standType;
private final String standSort;
private final int sortValue;
StandCategoryEnum(String standType, String standSort, int sortValue) {
this.standType = standType;
this.standSort = standSort;
this.sortValue = sortValue;
}
// 根据 standSort 返回 value 的静态方法
public static int getSortByStandType(String standType, String standSort) {
for (StandCategoryEnum category : StandCategoryEnum.values()) {
if (category.getStandType().equals(standType) && category.getStandSort().equals(standSort)) {
return category.getSortValue();
}
// 给国标 外标默认值
if (category.getStandType().equals("INLAND")) {
return 8;
} else if (category.getStandType().equals("FOREIGN")) {
return 24;
}
}
throw new AdcDaBaseException("标准类型错误");
}
// Getter 方法
public String getStandType() {
return standType;
}
public String getStandSort() {
return standSort;
}
public int getSortValue() {
return sortValue;
}
}
@@ -0,0 +1,159 @@
package com.adc.da.slrs.sarMenuStandard.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @author: Mzaxd
* @Date: 2023/11/14 17:20
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class StandSystemDTO {
@ApiModelProperty(value = "节点Id")
private String menuId;
@Excel(name = "体系结构", width = 40, orderNum = "1")
@ApiModelProperty(value = "体系结构")
private String standSystem;
@ApiModelProperty(value = "标准Id")
private String standId;
@Excel(name = "标准编号", width = 25, orderNum = "2")
@ApiModelProperty(value = "标准编号")
private String standNo;
@Excel(name = "标准名称", width = 25, orderNum = "3")
@ApiModelProperty(value = "标准名称")
private String standName;
@ApiModelProperty(value = "标准状态")
private String standState;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "开始发布日期")
private Date startReleaseDate;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "开始发布日期字符串")
private String startReleaseDateString;
@Excel(name = "发布日期", width = 25, orderNum = "4", exportFormat = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "发布日期")
private Date releaseDate;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "结束发布日期")
private Date endReleaseDate;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "结束发布日期字符串")
private String endReleaseDateString;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "开始实施日期")
private Date startImplementDate;
@Excel(name = "实施日期", width = 25, orderNum = "5", exportFormat = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "实施日期")
private Date implementDate;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "结束实施日期")
private Date endImplementDate;
@Excel(name = "代替标准", width = 25, orderNum = "5")
@ApiModelProperty(value = "代替标准")
private String replaceStandardNo;
@Excel(name = "编制单位", width = 25, orderNum = "5")
@ApiModelProperty(value = "编制单位")
private String dept;
@Excel(name = "起草人", width = 25, orderNum = "5")
@ApiModelProperty(value = "起草人")
private String draftUserName;
@Excel(name = "数据来源", width = 25, orderNum = "5")
@ApiModelProperty(value = "数据来源")
private String dataSource;
@ApiModelProperty(value = "排序字段")
private String sortField;
@ApiModelProperty(value = "排序规则")
private String sortMode;
@ApiModelProperty(value = "标准类型(数据排序用)")
private String standSort;
private String selectIds;
private List<String> selectIdList;
@ApiModelProperty(value = "页码")
private int page;
@ApiModelProperty(value = "每页数量")
private int pageSize;
@ApiModelProperty(value = "体系排序顺序号")
private int systemSort;
@ApiModelProperty(value = "国标外表企标排序号")
private int standTypeSort;
@ApiModelProperty(value = "标准类别排序号")
private int standCategorySort;
@ApiModelProperty(value = "相关联的节点ID列表(数据库查询用)")
private List<String> menuIdList;
@ApiModelProperty(value = "导出文件名称")
private String exportName;
public void setSelectIds(String selectIds) {
this.selectIds = selectIds;
this.selectIdList = java.util.Arrays.asList(selectIds.split(","));
}
public void setStartReleaseDate(Date startReleaseDate) {
this.startReleaseDate = startReleaseDate;
if (startReleaseDate != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.startReleaseDateString = sdf.format(startReleaseDate);
}
}
public void setEndReleaseDate(Date endReleaseDate) {
this.endReleaseDate = endReleaseDate;
if (endReleaseDate != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.endReleaseDateString = sdf.format(endReleaseDate);
}
}
}
@@ -1,9 +1,13 @@
package com.adc.da.slrs.sarMenuStandard.service;
import com.adc.da.slrs.sarMenuStandard.entity.SarMenuStandardNew;
import com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO;
import com.adc.da.sys.sarMenuStandard.entity.SarMenuStandard;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@@ -26,7 +30,13 @@ public interface ISarMenuStandardNewService extends IService<SarMenuStandardNew>
Integer updateMenuStandard(SarMenuStandardNew sarMenuStandardNew);
Integer deleteMenuStandard(String menuId);
void deleteMenuStandard(String menuId);
SarMenuStandard getMenuStandardById(String menuId);
List<SarMenuStandard> standardSystemTree();
IPage<StandSystemDTO> standardSystemList(StandSystemDTO standSystemDTO);
void standardSystemListExport(StandSystemDTO standSystemDTO, HttpServletResponse response, HttpServletRequest request);
}
@@ -1,22 +1,54 @@
package com.adc.da.slrs.sarMenuStandard.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.hutool.core.util.StrUtil;
import com.adc.da.common.ReadExcel;
import com.adc.da.exception.AdcDaBaseException;
import com.adc.da.scheduled.dao.SarStandardInfoDao;
import com.adc.da.slrs.sarBussStandMenu.dao.SarBussStandMenuDao;
import com.adc.da.slrs.sarBussStandMenu.entity.SarBussStandMenu;
import com.adc.da.slrs.sarBussStandMenu.service.ISarBussStandMenuService;
import com.adc.da.slrs.sarBussionessStand.dao.SarBussionessStandDao;
import com.adc.da.slrs.sarLawsTopic.entity.SarLawsTopicVO;
import com.adc.da.slrs.sarMenuStandard.dao.SarMenuStandardNewDao;
import com.adc.da.slrs.sarMenuStandard.entity.SarMenuStandardNew;
import com.adc.da.slrs.sarMenuStandard.entity.StandCategoryEnum;
import com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO;
import com.adc.da.slrs.sarMenuStandard.service.ISarMenuStandardNewService;
import com.adc.da.slrs.sarResource.dao.TsResourceDao;
import com.adc.da.slrs.sarRole.dao.TsRoleDao;
import com.adc.da.slrs.sarStandMenu.dao.SarStandMenuDao;
import com.adc.da.slrs.sarStandMenu.entity.SarStandMenu;
import com.adc.da.slrs.sarStandMenu.service.ISarStandMenuService;
import com.adc.da.slrs.tsDictionaryType.entity.TsDicType;
import com.adc.da.slrs.tsDictionaryType.service.ITsDicTypeService;
import com.adc.da.sys.sarMenuStandard.dao.SarMenuStandardDao;
import com.adc.da.sys.sarMenuStandard.entity.SarMenuStandard;
import com.adc.da.sys.sarMenuStandard.entity.StandMenuRelation;
import com.adc.da.sys.util.BeanCopyUtils;
import com.adc.da.util.LoginUserUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.util.IOUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.*;
import java.util.stream.Collectors;
@@ -28,6 +60,7 @@ import java.util.stream.Collectors;
* @author super_liu
* @since 2021-07-07
*/
@Slf4j
@Service
public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandardNewDao, SarMenuStandardNew> implements ISarMenuStandardNewService {
@@ -37,7 +70,22 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
private TsRoleDao tsRoleDao;
@Resource
private TsResourceDao resourceDao;
@Resource
private ISarStandMenuService sarStandMenuService;
@Resource
private ISarBussStandMenuService sarBussStandMenuService;
@Resource
private SarStandMenuDao sarStandMenuDao;
@Resource
private SarStandardInfoDao sarStandardInfoDao;
@Resource
private SarBussionessStandDao sarBussionessStandDao;
@Resource
private ITsDicTypeService dicItemService;
@Resource
private SarBussStandMenuDao sarBussStandMenuDao;
@Override
public String getTopMenu(SarMenuStandardNew sarMenuStandardNew){
@@ -112,6 +160,211 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
return sarMenuStandard;
}
@Override
public List<SarMenuStandard> standardSystemTree() {
// 构造树
List<SarMenuStandard> TsResources;
QueryWrapper<SarMenuStandard> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("DIC_ID", "9m4qqqaansxmox5e82zm");
queryWrapper.eq("VALID_FLAG", 0);
queryWrapper.isNull("PARENT_ID");
queryWrapper.orderByAsc("DISPLAY_SEQ");
TsResources = dao.selectList(queryWrapper);
for (SarMenuStandard resource : TsResources) {
resource.setTreeType("sarMs");
QueryWrapper<SarMenuStandard> TsResourceQueryWrapper = new QueryWrapper<>();
TsResourceQueryWrapper.like("PARENT_IDS", resource.getId());
TsResourceQueryWrapper.eq("VALID_FLAG", 0);
TsResourceQueryWrapper.orderByAsc("DISPLAY_SEQ");
List<SarMenuStandard> children = dao.selectList(TsResourceQueryWrapper);
resource.setChildren(recursionGetListChildrenStand((resource), (children)));
}
// 把所有关联表中的数据拉出来
// 国标
List<SarStandMenu> gbStandMenu = sarStandMenuDao.getGBStandMenu().stream().filter(item -> item.getStandId() != null).collect(Collectors.toList());
List<StandMenuRelation> gbRelations = BeanCopyUtils.copyBeanList(gbStandMenu, StandMenuRelation.class);
// 外标
List<SarStandMenu> fbStandMenu = sarStandMenuDao.getFBStandMenu().stream().filter(item -> item.getStandId() != null).collect(Collectors.toList());;
List<StandMenuRelation> fbRelations = BeanCopyUtils.copyBeanList(fbStandMenu, StandMenuRelation.class);
// 企标
List<SarBussStandMenu> esStandMenu = sarBussStandMenuDao.getESStandMenu().stream().filter(item -> item.getBussStandId() != null).collect(Collectors.toList());
List<StandMenuRelation> esRelations = new ArrayList<>();
for (SarBussStandMenu s : esStandMenu) {
StandMenuRelation standMenuRelation = new StandMenuRelation(s.getBussStandId(), s.getMenuId());
esRelations.add(standMenuRelation);
}
// 计算每个节点的数值
TsResources.get(0).calculateAndSetCounts(gbRelations, fbRelations, esRelations, 0);
// 拼接返回
return TsResources;
}
@Override
public IPage<StandSystemDTO> standardSystemList(StandSystemDTO standSystemDTO) {
boolean select = standSystemDTO.getSelectIdList() != null;
String menuId = standSystemDTO.getMenuId();
// 校验menuId不能为空
if (StringUtils.isBlank(menuId)) {
throw new AdcDaBaseException("menuId不能为空");
}
// 体系树
SarMenuStandard sarMenuStandard = this.standardSystemTree().get(0);
// 找到menuId对应的节点
SarMenuStandard targetNode = SarMenuStandard.findNodeById(sarMenuStandard, menuId);
// 收集目标节点及其所有子节点的ID
List<String> childIds = new ArrayList<>();
targetNode.collectChildIds(childIds);
standSystemDTO.setMenuIdList(childIds);
if (!select) {
standSystemDTO.setSelectIdList(targetNode.getGbStandIdList());
}
// 查国标
Set<StandSystemDTO> gbList = new HashSet<>(sarStandMenuDao.getStandInfoSystemData(standSystemDTO, "INLAND"));
if (!select) {
standSystemDTO.setSelectIdList(targetNode.getFbStandIdList());
}
// 查外标
Set<StandSystemDTO> fbList = new HashSet<>(sarStandMenuDao.getStandInfoSystemData(standSystemDTO, "FOREIGN"));
if (!select) {
standSystemDTO.setSelectIdList(targetNode.getEsStandIdList());
}
// 查企标
Set<StandSystemDTO> esList = new HashSet<>(sarBussionessStandDao.getESSystemData(standSystemDTO));
// 数据转换后整合
List<StandSystemDTO> resultList = new ArrayList<>();
resultList.addAll(gbList);
resultList.addAll(fbList);
resultList.addAll(esList);
// 构造体系路径映射
Map<String, String> pathMap = new HashMap<>();
sarMenuStandard.buildPathMap(pathMap, "");
// 为树设置systemSort
SarMenuStandard.setSystemSort(sarMenuStandard, "");
// 国标外标标准状态字典
List<TsDicType> gbStateDictList = dicItemService.selectAllDicTypeNameByDicCode("STANDSTATE");
// 企标标准状态字典
List<TsDicType> esStateDictList = dicItemService.selectAllDicTypeNameByDicCode("TEXTSTATUSBUSS");
// 构造体系路径 && 设置标准内部类别排序号 && 翻译
for (StandSystemDTO dto : resultList) {
String fullPath = pathMap.get(dto.getMenuId());
dto.setStandSystem(fullPath);
dto.setStandCategorySort(StandCategoryEnum.getSortByStandType(dto.getDataSource(), dto.getStandSort()));
// 设置体系排序号
SarMenuStandard node = SarMenuStandard.findNodeById(targetNode, dto.getMenuId());
dto.setSystemSort(node.getSystemSort());
// 翻译
this.translateStandardSystemDTO(dto, gbStateDictList, esStateDictList);
}
// 根据排序字段对 resultList 进行排序
// 按照标准体系排序
// 体系内部按照国内/海外/企业排序
// 每个类别的标准内部按照类别排序
resultList.sort(Comparator.comparingInt(StandSystemDTO::getSystemSort)
.thenComparingInt(StandSystemDTO::getStandTypeSort)
.thenComparingInt(StandSystemDTO::getStandCategorySort));
// 两个时间排序
String sortField = standSystemDTO.getSortField();
if (StringUtils.isNotBlank(sortField)) {
String sortMode = standSystemDTO.getSortMode();
if (sortField.equals("releaseDate") && sortMode.equals("desc")) {
resultList.sort(Comparator.comparing(StandSystemDTO::getStartImplementDate));
} else {
resultList.sort(Comparator.comparing(StandSystemDTO::getStartImplementDate).reversed());
}
if (sortField.equals("implementDate") && sortMode.equals("desc")) {
resultList.sort(Comparator.comparing(StandSystemDTO::getStartImplementDate));
} else {
resultList.sort(Comparator.comparing(StandSystemDTO::getStartImplementDate).reversed());
}
}
// 手动分页
int pageNum = standSystemDTO.getPage();
int pageSize = standSystemDTO.getPageSize();
// 计算总页数
int total = resultList.size();
int totalPages = (total + pageSize - 1) / pageSize;
// 计算当前页应该显示的数据的起始和结束索引
int start = (pageNum - 1) * pageSize;
int end = Math.min(start + pageSize, total);
// 获取当前页面的数据
List<StandSystemDTO> pageList = resultList.subList(start, end);
// 使用MyBatis Plus的Page类来构造分页对象
Page<StandSystemDTO> page = new Page<>(pageNum, pageSize, total);
page.setRecords(pageList); // 设置当前页面的记录
page.setTotal(total); // 设置总记录数
page.setPages(totalPages); // 设置总页数
return page;
}
private void translateStandardSystemDTO(StandSystemDTO dto, List<TsDicType> gbStateDictList, List<TsDicType> esStateDictList) {
// 翻译数据来源、标准状态
switch (dto.getDataSource()) {
case "INLAND":
dto.setDataSource("国内标准库");
dto.setStandState(gbStateDictList.stream()
.filter(dict -> dict.getDicTypeCode().equals(dto.getStandState()))
.findFirst().orElse(new TsDicType()).getDicTypeName());
break;
case "FOREIGN":
dto.setDataSource("海外标准库");
dto.setStandState(gbStateDictList.stream()
.filter(dict -> dict.getDicTypeCode().equals(dto.getStandState()))
.findFirst().orElse(new TsDicType()).getDicTypeName());
break;
case "ENTERPRISE":
dto.setDataSource("企业标准库");
dto.setStandState(esStateDictList.stream()
.filter(dict -> dict.getDicTypeCode().equals(dto.getStandState()))
.findFirst().orElse(new TsDicType()).getDicTypeName());
break;
}
}
@Override
public void standardSystemListExport(StandSystemDTO standSystemDTO, HttpServletResponse response, HttpServletRequest request) {
OutputStream os = null;
Workbook workbook;
List<StandSystemDTO> dataList;
standSystemDTO.setPage(1);
standSystemDTO.setPageSize(Integer.MAX_VALUE);
try {
response.setHeader("Content-Disposition",
"attachment; filename=" + ReadExcel.encodeFileName(standSystemDTO.getExportName()+".xlsx",
request));
// 导出数据,若指定了值则使用ids字段条件导出,否则根据条件导出
IPage<StandSystemDTO> page = this.standardSystemList(standSystemDTO);
dataList = page.getRecords();
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
exportParams.setSheetName(standSystemDTO.getExportName());
workbook = ExcelExportUtil.exportExcel(exportParams, StandSystemDTO.class, dataList);
os = response.getOutputStream();
workbook.write(os);
os.flush();
} catch (IOException e) {
log.error(e.getMessage(), e);
throw new AdcDaBaseException("下载文件失败,请重试");
} finally {
IOUtils.closeQuietly(os);
}
}
@Override
public Integer updateMenuStandard(SarMenuStandardNew sarMenuStandardNew) {
SarMenuStandard menuStandarddb = dao.selectById(sarMenuStandardNew.getId());
@@ -122,12 +375,25 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
return dao.updateById(menuStandarddb);
}
@Transactional(rollbackFor = Exception.class)
@Override
public Integer deleteMenuStandard(String menuId) {
SarMenuStandard menuStandard = new SarMenuStandard();
menuStandard.setId(menuId);
menuStandard.setValidFlag(1);
return dao.updateById(menuStandard);
public void deleteMenuStandard(String menuId) {
// 删除主表中的节点
LambdaUpdateWrapper<SarMenuStandard> menuUpdateWrapper = new LambdaUpdateWrapper<>();
menuUpdateWrapper.eq(SarMenuStandard::getId, menuId);
this.dao.delete(menuUpdateWrapper);
log.info("删除主表中的节点成功");
// 删除国标外标体系关联关系
LambdaUpdateWrapper<SarStandMenu> gbWrapper = new LambdaUpdateWrapper<>();
gbWrapper.eq(SarStandMenu::getMenuId, menuId);
sarStandMenuService.remove(gbWrapper);
log.info("删除国标外标主表中的相应字段成功");
// 删除企标体系关联关系
LambdaUpdateWrapper<SarBussStandMenu> esWrapper = new LambdaUpdateWrapper<>();
esWrapper.eq(SarBussStandMenu::getMenuId, menuId);
sarBussStandMenuService.remove(esWrapper);
log.info("删除企标主表中的相应字段成功");
// TODO 理论上这里应该删除国标外标企标主表中的中文字段
}
/**
@@ -72,20 +72,20 @@ public interface TsPositionDao extends BaseMapper<TsPosition> {
Integer countPositionAndRole(TsPosition tsPosition);
/**
* 通过岗位列表查询绑定的角色列表
* @param positionIds:岗位列表
* @return List<String>
*/
List<String> getRoleIdsByPositionIds(List<String> positionIds);
// /**
// * 通过岗位列表查询绑定的角色列表
// * @param positionIds:岗位列表
// * @return List<String>
// */
// List<String> getRoleIdsByPositionIds(List<String> positionIds);
long pageTotal();
/**
* 通过roleId查询岗位ID列表
* @param roleId:角色ID
* @return List<String>
*/
@Select("select position_id from ts_position_role where role_id=#{roleId}")
List<String> getPositionIdsByRoleId(String roleId);
// /**
// * 通过roleId查询岗位ID列表
// * @param roleId:角色ID
// * @return List<String>
// */
// @Select("select position_id from ts_position_role where role_id=#{roleId}")
// List<String> getPositionIdsByRoleId(String roleId);
}
@@ -67,17 +67,17 @@ public interface ITsPositionService extends IService<TsPosition> {
*/
ResponseMessage<Object> deletePosition(String positionId);
/**
* 通过岗位列表查询绑定的角色列表
* @param positionIds:岗位列表
* @return List<String>
*/
List<String> getRoleIdsByPositionIds(List<String> positionIds);
/**
* 通过roleId查询岗位ID列表
* @param roleId:角色ID
* @return List<String>
*/
List<String> getPositionIdsByRoleId(String roleId);
// /**
// * 通过岗位列表查询绑定的角色列表
// * @param positionIds:岗位列表
// * @return List<String>
// */
// List<String> getRoleIdsByPositionIds(List<String> positionIds);
//
// /**
// * 通过roleId查询岗位ID列表
// * @param roleId:角色ID
// * @return List<String>
// */
// List<String> getPositionIdsByRoleId(String roleId);
}
@@ -195,26 +195,26 @@ public class TsPositionServiceImpl extends ServiceImpl<TsPositionDao, TsPosition
return Result.success();
}
/**
* 通过岗位列表查询绑定的角色列表
* @param positionIds:岗位列表
* @return List<String>
*/
@Override
public List<String> getRoleIdsByPositionIds(List<String> positionIds) {
if(positionIds!=null&&positionIds.size()>0){
return tsPositionDao.getRoleIdsByPositionIds(positionIds);
}
return null;
}
// /**
// * 通过岗位列表查询绑定的角色列表
// * @param positionIds:岗位列表
// * @return List<String>
// */
// @Override
// public List<String> getRoleIdsByPositionIds(List<String> positionIds) {
// if(positionIds!=null&&positionIds.size()>0){
// return tsPositionDao.getRoleIdsByPositionIds(positionIds);
// }
// return null;
// }
/**
* 通过roleId查询岗位ID列表
* @param roleId:角色ID
* @return List<String>
*/
@Override
public List<String> getPositionIdsByRoleId(String roleId) {
return tsPositionDao.getPositionIdsByRoleId(roleId);
}
// /**
// * 通过roleId查询岗位ID列表
// * @param roleId:角色ID
// * @return List<String>
// */
// @Override
// public List<String> getPositionIdsByRoleId(String roleId) {
// return tsPositionDao.getPositionIdsByRoleId(roleId);
// }
}
@@ -163,10 +163,10 @@ public class TsRoleServiceImpl extends ServiceImpl<TsRoleDao, TsRole> implements
if(childrenRole!=null&&childrenRole.size()>0){
return Result.error("该角色有下属角色,无法删除");
}
List<String> positionIds=tsRoleDao.getPositionIds(roleId);
if(positionIds!=null&&positionIds.size()>0){
return Result.error("该角色已绑定岗位,无法删除");
}
// List<String> positionIds=tsRoleDao.getPositionIds(roleId);
// if(positionIds!=null&&positionIds.size()>0){
// return Result.error("该角色已绑定岗位,无法删除");
// }
tsRoleDao.deleteById(roleId);
return Result.success();
}
@@ -1,7 +1,9 @@
package com.adc.da.slrs.sarStandMenu.dao;
import com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO;
import com.adc.da.slrs.sarStandMenu.entity.SarStandMenu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import javax.annotation.Resource;
import java.util.List;
@@ -31,4 +33,9 @@ public interface SarStandMenuDao extends BaseMapper<SarStandMenu> {
List<SarStandMenu> getMenuByStandId(SarStandMenu sarStandMenu);
List<SarStandMenu> getGBStandMenu();
List<SarStandMenu> getFBStandMenu();
List<StandSystemDTO> getStandInfoSystemData(@Param("param") StandSystemDTO standSystemDTO, @Param("dataSource") String dataSource);
}
@@ -19,4 +19,7 @@ public interface ISarStandMenuService extends IService<SarStandMenu> {
List<SarStandMenu> selectAllMenuByStandId(SarStandMenu sarStandMenuEO);
void deleteStandSystemByStandId(String id);
void addStandSystemRelation(String standSystem, String id);
}
@@ -5,6 +5,8 @@ import com.adc.da.slrs.sarResource.service.ITsResourceService;
import com.adc.da.slrs.sarStandMenu.entity.SarStandMenu;
import com.adc.da.slrs.sarStandMenu.dao.SarStandMenuDao;
import com.adc.da.slrs.sarStandMenu.service.ISarStandMenuService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -40,4 +42,20 @@ public class SarStandMenuServiceImpl extends ServiceImpl<SarStandMenuDao, SarSta
return dao.selectAllMenuByStandId(sarStandMenuEO);
}
@Override
public void deleteStandSystemByStandId(String id) {
LambdaUpdateWrapper<SarStandMenu> sarStandMenuWrapper = new LambdaUpdateWrapper<>();
sarStandMenuWrapper.eq(SarStandMenu::getStandId, id);
remove(sarStandMenuWrapper);
}
@Override
public void addStandSystemRelation(String standSystem, String id) {
SarStandMenu sarStandMenu = new SarStandMenu();
// 生成不带横杠的UUID
sarStandMenu.setId(java.util.UUID.randomUUID().toString().replaceAll("-", ""));
sarStandMenu.setStandId(id).setMenuId(standSystem).setValidFlag(0);
save(sarStandMenu);
}
}
@@ -243,6 +243,8 @@ public class SarStandardsInfo extends BaseEntity {
@TableField(exist = false)
private String standSystemName;
@TableField(exist = false)
private String standSystemId;
public static long getSerialVersionUID() {
return serialVersionUID;
@@ -17,7 +17,7 @@ import com.adc.da.slrs.sarBussionessStand.entity.OldSystem;
import com.adc.da.slrs.sarLawsAttrDetailedList.dao.SarLawsAttrDetailedListDao;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarFindDto;
import com.adc.da.slrs.sarPosition.entity.TsPosition;
import com.adc.da.slrs.sarPosition.service.ITsPositionService;
//import com.adc.da.slrs.sarPosition.service.ITsPositionService;
import com.adc.da.slrs.sarStandFile.service.ISarStandFileService;
import com.adc.da.slrs.sarStandWarning.entity.WarningDate;
import com.adc.da.slrs.sarStandWarning.service.Impl.WarningDateServiceImpl;
@@ -114,6 +114,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -150,8 +151,8 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
@Autowired
WarningDateServiceImpl warningDateService;
@Autowired
private ITsPositionService iTsPositionService;
// @Autowired
// private ITsPositionService iTsPositionService;
@Autowired
private SarStandardsInfoDao dao;
@@ -1027,15 +1028,15 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
value = String.join(",", stringList.isEmpty() ? valArr : stringList);
break;
}
//通过id绑定责任部门师名称
case "ZRBM": {
QueryWrapper<TsPosition> tsPositionQW = new QueryWrapper<>();
tsPositionQW.select("name")
.in("id", valArr);
List<String> stringList = iTsPositionService.listObjs(tsPositionQW, o -> o.toString());
value = String.join(",", stringList.isEmpty() ? valArr : stringList);
break;
}
// //通过id绑定责任部门师名称
// case "ZRBM": {
// QueryWrapper<TsPosition> tsPositionQW = new QueryWrapper<>();
// tsPositionQW.select("name")
// .in("id", valArr);
// List<String> stringList = iTsPositionService.listObjs(tsPositionQW, o -> o.toString());
// value = String.join(",", stringList.isEmpty() ? valArr : stringList);
// break;
// }
default:
value = dicTypeEODao.getDicNamesByCodes(valArr, "");
}
@@ -1996,6 +1997,11 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
* @Return: com.adc.da.util.http.ResponseMessage<com.adc.da.lawss.entity.SarStandardsInfoEO>
*/
public int updateSarStandardsInfo(SarStandardsInfo sarStandardsInfoEO) throws Exception {
// 标准体系
sarStandMenuService.deleteStandSystemByStandId(sarStandardsInfoEO.getId());
if (StringUtils.isNotEmpty(sarStandardsInfoEO.getStandSystemId())) {
sarStandMenuService.addStandSystemRelation(sarStandardsInfoEO.getStandSystemId(), sarStandardsInfoEO.getId());
}
/**
* 加入对应"国家/地区"的清单列表
@@ -7,9 +7,9 @@ import com.adc.da.slrs.sarInstitution.entity.TsInstitution;
import com.adc.da.slrs.sarInstitution.service.ITsInstitutionService;
import com.adc.da.slrs.sarMenu.entity.SarMenu;
import com.adc.da.slrs.sarMenu.service.ISarMenuService;
import com.adc.da.slrs.sarPosition.dao.TsPositionDao;
//import com.adc.da.slrs.sarPosition.dao.TsPositionDao;
import com.adc.da.slrs.sarPosition.entity.TsPosition;
import com.adc.da.slrs.sarPosition.service.ITsPositionService;
//import com.adc.da.slrs.sarPosition.service.ITsPositionService;
import com.adc.da.slrs.sarResource.entity.TsResource;
import com.adc.da.slrs.sarResource.service.ITsResourceService;
import com.adc.da.slrs.sarRole.service.ITsRoleService;
@@ -20,10 +20,13 @@ import com.adc.da.slrs.tsRoleMeunData.entity.TsRoleMenuData;
import com.adc.da.slrs.tsRoleMeunData.service.ITsRoleMenuDataService;
import com.adc.da.sync.service.SyncUserService;
import com.adc.da.sys.entity.UserEO;
import com.adc.da.sys.entity.UserRoleEO;
import com.adc.da.sys.service.IUserRoleEOService;
import com.adc.da.utils.util.ListUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -34,6 +37,7 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -54,8 +58,8 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
private TsUserDao tsUserDao;
@Autowired
private ITsUserService tsUserService;
@Autowired
private ITsPositionService tsPositionService;
// @Autowired
// private ITsPositionService tsPositionService;
@Autowired
@Lazy
private ITsRoleService tsRoleService;
@@ -65,12 +69,15 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
private ITsResourceService tsResourceService;
@Autowired
private SyncUserService syncUserService;
@Autowired
private TsPositionDao tsPositionDao;
// @Autowired
// private TsPositionDao tsPositionDao;
@Autowired
private ITsInstitutionService tsInstitutionService;
@Autowired
ITsRoleMenuDataService iTsRoleMenuDataService;
@Resource
private IUserRoleEOService userRoleEOService;
public void deleteUser(){
@@ -289,16 +296,17 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
public List<SarMenu> getMenu() {
UserEO userEO=UserUtils.getUser();
String userId= userEO.getUsid();
List<String> positionIds=tsUserDao.selectPositionIds(userId);
// List<String> positionIds=tsUserDao.selectPositionIds(userId);
/**
* 当用户没有所属岗位,默认给一个other岗位,适用于特定权限外的其他用户
* 用户同步时需要将用户配置的系统内的岗位保留
*/
if(positionIds == null || positionIds.isEmpty()){
positionIds = Arrays.asList(new String[]{"other"});
}
List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
// if(positionIds == null || positionIds.isEmpty()){
// positionIds = Arrays.asList(new String[]{"other"});
// }
// List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
List<String> roleIds = userRoleEOService.getRoleIdsByUserId(userId);
List<String> menuIds=tsRoleService.getMenuIdsByRoleIds(roleIds);
return sarMenuService.getMenuByIds(menuIds);
}
@@ -313,8 +321,9 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
UserEO userEO=UserUtils.getUser();
String userId= userEO.getUsid();
System.out.println(userId);
List<String> positionIds=tsUserDao.selectPositionIds(userId);
List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
// List<String> positionIds=tsUserDao.selectPositionIds(userId);
// List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
List<String> roleIds = userRoleEOService.getRoleIdsByUserId(userId);
List<String> resourceIds=tsRoleService.getResourceIdsByRoleIds(roleIds);
return tsResourceService.getResourceByIds(resourceIds,tsResource.getSorDivide());
}
@@ -326,8 +335,16 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
*/
@Override
public List<String> getUserIdsByRoleId(String roleId) {
List<String> positionIds=tsPositionService.getPositionIdsByRoleId(roleId);
return tsUserDao.getUserIdsByPositionIds(positionIds);
LambdaQueryWrapper<UserRoleEO> userRoleEOLambdaQueryWrapper = new LambdaQueryWrapper<>();
userRoleEOLambdaQueryWrapper.eq(UserRoleEO::getRoleId,roleId);
// 根据角色ID查询用户ID
List<UserRoleEO> list = userRoleEOService.list(userRoleEOLambdaQueryWrapper);
// 判空
if (list == null || list.isEmpty()) {
return null;
}
// 获取用户ID
return list.stream().map(UserRoleEO::getUserId).collect(Collectors.toList());
}
/**
@@ -337,8 +354,9 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
*/
@Override
public List<SarMenu> getMenusByUserId(String userId){
List<String> positionIds=tsUserDao.selectPositionIds(userId);
List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
// List<String> positionIds=tsUserDao.selectPositionIds(userId);
// List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
List<String> roleIds = userRoleEOService.getRoleIdsByUserId(userId);
List<String> menuIds=tsRoleService.getMenuIdsByRoleIds(roleIds);
return sarMenuService.getMenuByIds(menuIds);
}
@@ -353,8 +371,9 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
UserEO userEO=UserUtils.getUser();
String userId= userEO.getUsid();
System.out.println(userId);
List<String> positionIds=tsUserDao.selectPositionIds(userId);
List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
// List<String> positionIds=tsUserDao.selectPositionIds(userId);
// List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
List<String> roleIds = userRoleEOService.getRoleIdsByUserId(userId);
return tsRoleService.getResourceIdsByRoleIds(roleIds);
}
@@ -365,8 +384,9 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
*/
@Override
public List<String> getResourceUserId(String userId) {
List<String> positionIds=tsUserDao.selectPositionIds(userId);
List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
// List<String> positionIds=tsUserDao.selectPositionIds(userId);
// List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
List<String> roleIds = userRoleEOService.getRoleIdsByUserId(userId);
return tsRoleService.getResourceIdsByRoleIds(roleIds);
}
@@ -376,8 +396,9 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
*/
@Override
public List<String> getResourceDataUserId(String userId) {
List<String> positionIds=tsUserDao.selectPositionIds(userId);
List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
// List<String> positionIds=tsUserDao.selectPositionIds(userId);
// List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
List<String> roleIds = userRoleEOService.getRoleIdsByUserId(userId);
QueryWrapper<TsRoleMenuData> wrapper=new QueryWrapper<>();
wrapper.select("MENU_ID");
wrapper.in("ROLE_ID",roleIds);
@@ -420,15 +441,15 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
for(SyncUser syncUser:syncUsers){
QueryWrapper<TsPosition> positionQueryWrapper=new QueryWrapper<>();
positionQueryWrapper.eq("name",syncUser.getTitle());
TsPosition tsPosition=tsPositionDao.selectOne(positionQueryWrapper);
if(tsPosition==null){
tsPosition=new TsPosition();
tsPosition.setName(syncUser.getTitle());
tsPosition.setType("1");
tsPositionDao.insert(tsPosition);
}
// TsPosition tsPosition=tsPositionDao.selectOne(positionQueryWrapper);
// if(tsPosition==null){
// tsPosition=new TsPosition();
// tsPosition.setName(syncUser.getTitle());
// tsPosition.setType("1");
// tsPositionDao.insert(tsPosition);
// }
TsUser tsUser=SyncUser.toUser(syncUser);
tsUser.setPositionId(tsPosition.getId());
// tsUser.setPositionId(tsPosition.getId());
tsUserDao.insert(tsUser);
}
@@ -436,8 +457,9 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
@Override
public List<SarMenu> getSecondMenusByUserId(String userId) {
List<String> positionIds=tsUserDao.selectPositionIds(userId);
List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
// List<String> positionIds=tsUserDao.selectPositionIds(userId);
// List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
List<String> roleIds = userRoleEOService.getRoleIdsByUserId(userId);
List<String> menuIds=tsRoleService.getMenuIdsByRoleIds(roleIds);
return sarMenuService.getSecondMenuByIds(menuIds);
}
@@ -506,12 +528,12 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
}
ids.removeIf(s -> null==s);
List<TsUser> tsUsers = tsUserDao.userUnderInstitution((tsUser.getCurrent() - 1) * tsUser.getSize(), tsUser.getSize(), tsUser, ids);
if(tsUsers!=null && !tsUsers.isEmpty()){
for (TsUser user:tsUsers) {
List<TsPosition> positionList = tsPositionService.getPositionDataByUserId(user.getUserId());
user.setPositions(positionList);
}
}
// if(tsUsers!=null && !tsUsers.isEmpty()){
// for (TsUser user:tsUsers) {
// List<TsPosition> positionList = tsPositionService.getPositionDataByUserId(user.getUserId());
// user.setPositions(positionList);
// }
// }
Page<TsUser> tsUserPage = new Page<>();
tsUserPage.setCurrent(tsUser.getCurrent());
@@ -33,8 +33,11 @@ public class BussStandExportUtil {
Map<String,String> attrInfoMap = new HashMap<>();
for (SarStandAttrDetails detailsEO : detailsEOList) {
if (!InitStandAttrUtil.fileFieldListBuss.contains(detailsEO.getAttrField())) {
attrBud.append(detailsEO.getAttrName() + ",");
attrInfoMap.put(detailsEO.getAttrName(),detailsEO.getAttrField());
if ("关联流程".equals(detailsEO.getAttrName())) {
continue;
}
attrBud.append(detailsEO.getAttrName() + ",");
}
}
String header = FieldConvertUtil.exportBaseFieldNamesBuss + "," + attrBud.toString();
@@ -33,9 +33,15 @@ public class FieldConvertUtil {
public static String exportBaseFieldNames = "标准体系,是否纳入认证清单,标准性质,标准类别,标准编号,标准年份,中文名称,英文名称," +
"文本状态,发布日期"; // 导出基础表字段 //删除 实施日期 2021-05-28
public static String exportBaseFieldNewNames = "标准编号,中文名称,英文名称,标准体系," +
"文本状态,发布日期,标准性质"; // 导出基础表字段 // 删除是否纳入认证清单,删除 标准类别 标准编号 标准年份 ,统一为标准编号 2023-11-13
public static String exportBaseFieldNamesForeign = "标准类别,标准编号,标准年份,中文名称,英文名称," +
"文本状态,发布日期,是否纳入认证清单,标准体系,适用认证,能源类型";// 导出基础表字段
public static String exportBaseFieldNamesNewForeign = "标准编号,中文名称,英文名称," +
"文本状态,发布日期,是否纳入认证清单,标准体系,适用认证,能源类型";// 导出基础表字段 //删除 标准类别 标准编号 标准年份 ,统一为标准编号 2023-11-13
public static String exportAttrFieldNamesInland = "归口管理部门,发布机构,工作组信息,我司参与深度,适用车辆类型,要求类型," +
"标签,发布稿(必读),增补件(必读),报批稿,送审稿,征求意见稿,草案,相关资料,新车型实施日期(文本),在产车实施日期(文本)," +
"EOP实施日期(文本),责任部门,相关部门,SVPPS,FO,项目评估角色,法规维护人,代替标准编号," +
@@ -64,7 +70,7 @@ public class FieldConvertUtil {
public static String exportFieldNamesMeetingTopic = "议题名称,汇报人,汇报单位,议题主要内容";
// 政策法规资料 表头
public static String exportFieldLawsInformation = "级资料类别,二级资料类别,三级资料类别,四级资料类,资料名称,资料归属部门,作者,资料说明";
public static String exportFieldLawsInformation = "1级资料分类,2级资料分类,3级资料分类,4级资料类,资料名称,资料归属部门,作者,资料说明";
// 政策课题 表头
public static String exportFieldLawsTopic = "课题名称,课题承办单位,课题指导单位,课题参与单位,开始时间,结题时间,课题费用(万元),课题组会议列表,课题组联系方式,内部联系方式";
@@ -39,17 +39,21 @@ public class StandExportUtil {
}
for (SarStandAttrDetails detailsEO : detailsEOList) {
if (!InitStandAttrUtil.fileFieldList.contains(detailsEO.getAttrField())) {
attrBud.append(detailsEO.getAttrName() + ",");
attrInfoMap.put(detailsEO.getAttrName(),detailsEO.getAttrField());
// 去掉 参会记录 和 相关流程 两个导出字段 2023-11-13
if("参会记录".equals(detailsEO.getAttrName()) || "相关流程".equals(detailsEO.getAttrName())) {
continue;
}
attrBud.append(detailsEO.getAttrName() + ",");
}
}
String header = FieldConvertUtil.exportBaseFieldNames + "," + attrBud.toString();
String header = FieldConvertUtil.exportBaseFieldNewNames + "," + attrBud.toString();
//国内导出去掉体系类别
if (SarTypeEnum.INLAND_STAND.getValue().equals(standType)) {
header = header.replace(",体系类别","");
}
if (SarTypeEnum.FOREIGN_STAND.getValue().equals(standType)) {
header = FieldConvertUtil.exportBaseFieldNamesForeign + "," + attrBud.toString();
header = FieldConvertUtil.exportBaseFieldNamesNewForeign + "," + attrBud.toString();
}
//创建工作表对象
Sheet sheet = workbook.createSheet();
@@ -125,9 +129,9 @@ public class StandExportUtil {
case "适用区域":
value = verifyBean(sarStandardsInfoEO.getCountryShow());
break;
case "标准类别":
value = verifyBean(sarStandardsInfoEO.getStandSortShow());
break;
// case "标准类别":
// value = verifyBean(sarStandardsInfoEO.getStandSortShow());
// break;
case "重要度":
if (StringUtils.isNotBlank(sarStandardsInfoEO.getIsRelateAccess())) {
if ("1".equals(sarStandardsInfoEO.getIsRelateAccess())) {
@@ -138,11 +142,14 @@ public class StandExportUtil {
}
value = sarStandardsInfoEO.getIsRelateAccess();
break;
// case "标准编号":
// value = verifyBean(sarStandardsInfoEO.getStandNumber());
// break;
// case "标准年份":
// value = verifyBean(sarStandardsInfoEO.getStandYear());
// break;
case "标准编号":
value = verifyBean(sarStandardsInfoEO.getStandNumber());
break;
case "标准年份":
value = verifyBean(sarStandardsInfoEO.getStandYear());
value = sarStandardsInfoEO.getStandCode();
break;
case "中文名称":
value = verifyBean(sarStandardsInfoEO.getStandName());
@@ -26,6 +26,8 @@
<result column="REPORTER" property="reporter" />
<result column="REPORTING_UNIT" property="reportingUnit" />
<result column="AGENDA_CONTENT" property="agendaContent" />
<result column="CREATE_TIME" property="createTime" />
<result column="MODIFY_TIME" property="modifyTime" />
</collection>
</resultMap>
<sql id="Base_Column_List">
@@ -50,8 +52,8 @@
<if test="meetingOrganizer != null and meetingOrganizer != ''" >
and MEETING_ORGANIZER like concat('%',#{meetingOrganizer},'%')
</if>
<if test="meetingTime != null and meetingTime !=''">
and MEETING_TIME ${meetingTimeOperator} #{meetingTime}
<if test="meetingTimeBegin != null and meetingTimeEnd != null">
and MEETING_TIME between DATE_FORMAT(#{meetingTimeBegin}, '%Y-%m-%d') and DATE_FORMAT(#{meetingTimeEnd}, '%Y-%m-%d')
</if>
<if test="meetingAddress != null and meetingAddress != ''" >
and MEETING_ADDRESS like concat('%',#{meetingAddress},'%')
@@ -88,10 +90,11 @@
</if>
</sql>
<select id="queryByPageCount" resultType="java.lang.Integer">
select count(1) from inside_outside_meeting iom join meeting_topic mt on iom.ID = mt.MEETING_ID
select count(iom.ID) from inside_outside_meeting iom join meeting_topic mt on iom.ID = mt.MEETING_ID
where iom.VALID_FLAG = 0
<include refid="Base_Where_Clause"/>
<include refid="MeetingTopic_where" />
group by iom.ID
</select>
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.slrs.InsideOntSideMeeting.entity.InsideOutsideMeetingVO">
select <include refid="Base_Column_Join_MeetingTopic_List" />
@@ -102,10 +105,12 @@
order by
<choose>
<when test="sortField == 'AGENDA_NAME'">
mt.${sortField} ${sortMode}
mt.${sortField} ${sortMode},
mt.AGENDA_NAME asc
</when>
<otherwise>
iom.${sortField} ${sortMode}
iom.${sortField} ${sortMode},
mt.AGENDA_NAME asc
</otherwise>
</choose>
limit ${pager.startIndex-1},${pageSize}
@@ -144,5 +144,118 @@
</select>
<select id="getGBStandMenu" resultType="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu">
select
DISTINCT
sms.ID AS menuId,
stand.ID as standId
from SAR_STAND_MENU AS sm
LEFT JOIN sar_standards_info AS stand ON sm.STAND_ID = stand.ID AND stand.VALID_FLAG = '0'
LEFT JOIN sar_menu_standard sms on sm.MENU_ID = sms.ID
where stand.STAND_TYPE = 'INLAND'
AND sms.MENU_NAME IS NOT NULL
AND LENGTH(sm.MENU_ID) > 30
AND sm.VALID_FLAG = '0'
AND sms.id in (select id from sar_menu_standard where valid_flag = 0)
group by stand.ID
</select>
<select id="getFBStandMenu" resultType="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu">
select
DISTINCT
sms.ID AS menuId,
stand.ID as standId
from SAR_STAND_MENU AS sm
LEFT JOIN sar_standards_info AS stand ON sm.STAND_ID = stand.ID AND stand.VALID_FLAG = '0'
LEFT JOIN sar_menu_standard sms on sm.MENU_ID = sms.ID
where stand.STAND_TYPE = 'FOREIGN'
AND sms.MENU_NAME IS NOT NULL
AND LENGTH(sm.MENU_ID) > 30
AND sm.VALID_FLAG = '0'
AND sms.id in (select id from sar_menu_standard where valid_flag = 0)
group by stand.ID
</select>
<select id="getStandInfoSystemData" resultType="com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO">
SELECT
gb.ID AS standId,
CONCAT(gb.STAND_SORT, ' ', gb.STAND_NUMBER) AS standNo,
gb.STAND_NAME AS standName,
gb.STAND_STATE AS standState,
gb.ISSUE_TIME AS releaseDate,
gb.PUT_TIME AS implementDate,
gb.REPLACE_STAND_NUM AS replaceStandardNo,
gba.QCDW AS dept,
gba.WSSMR AS draftUserName,
gb.STAND_TYPE AS dataSource,
gb.STAND_SORT AS standSort,
CASE
WHEN gb.STAND_TYPE = 'INLAND' THEN 1
WHEN gb.STAND_TYPE = 'FOREIGN' THEN 2
END AS standTypeSort,
sms.ID AS menuId
FROM
`sar_standards_info` AS gb
LEFT JOIN `sar_stand_attr_info` AS gba ON gb.ID = gba.STAND_ID
LEFT JOIN `sar_stand_menu` AS m ON gb.ID = m.STAND_ID AND LENGTH(m.MENU_ID) > 30
LEFT JOIN sar_menu_standard sms on m.MENU_ID = sms.ID
WHERE gb.VALID_FLAG = '0'
AND sms.id in (select id from sar_menu_standard where valid_flag = 0)
<!--国标/外标-->
<if test="param.standNo != null and param.standNo != ''">
AND gb.STAND_TYPE = #{dataSource}
</if>
<!--关联的节点IDList-->
<if test="param.menuIdList != null and param.menuIdList.size() > 0">
AND m.MENU_ID IN
<foreach item="item" index="index" collection="param.menuIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<!--标准编号-->
<if test="param.standNo != null and param.standNo != ''">
AND gb.STAND_NUMBER LIKE CONCAT('%',#{param.standNo},'%')
</if>
<!--标准名称-->
<if test="param.standName != null and param.standName != ''">
AND gb.STAND_NAME LIKE CONCAT('%',#{param.standName},'%')
</if>
<!--发布时间-->
<if test="param.startReleaseDateString != null and param.startReleaseDateString != '' and
param.endReleaseDateString != null and param.endReleaseDateString != ''">
AND gb.ISSUE_TIME BETWEEN #{param.startReleaseDateString} AND #{param.endReleaseDateString}
</if>
<!--实施日期-->
<if test="param.startImplementDate != null and param.endImplementDate != ''">
AND gb.PUT_TIME BETWEEN #{param.startImplementDate} AND #{param.endImplementDate}
</if>
<!--代替标准-->
<if test="param.replaceStandardNo != null and param.replaceStandardNo != ''">
AND gb.REPLACE_STAND_NUM LIKE CONCAT('%',#{param.replaceStandardNo},'%')
</if>
<!--编制单位-->
<if test="param.dept != null and param.dept != ''">
AND gba.QCDW LIKE CONCAT('%',#{param.dept},'%')
</if>
<!--起草人-->
<if test="param.draftUserName != null and param.draftUserName != ''">
AND gba.WSSMR LIKE CONCAT('%',#{param.draftUserName},'%')
</if>
<!--搜索条件数据来源-->
<if test="param.dataSource != null and param.dataSource != ''">
AND gb.STAND_TYPE = #{param.dataSource}
</if>
<!--SQL复用数据来源-->
<if test="dataSource != null and dataSource != ''">
AND gb.STAND_TYPE = #{dataSource}
</if>
<if test="param.selectIdList != null and param.selectIdList.size() > 0">
AND gb.ID IN
<foreach item="item" index="index" collection="param.selectIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by gb.ID
</select>
</mapper>
@@ -0,0 +1,15 @@
<?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.adc.da.slrs.roleReplacePosition.mapper.PositionRoleMapper">
<resultMap id="BaseResultMap" type="com.adc.da.slrs.roleReplacePosition.domain.PositionRole">
<id property="roleId" column="role_id" jdbcType="VARCHAR"/>
<id property="positionId" column="position_id" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
role_id,position_id
</sql>
</mapper>
@@ -203,6 +203,24 @@
where buss_stand_id = #{bussStandId} and valid_flag=0
</select>
<select id="getESStandMenu" resultType="com.adc.da.slrs.sarBussStandMenu.entity.SarBussStandMenu">
select
DISTINCT
sms.ID AS menuId,
stand.ID AS bussStandId
from sar_buss_stand_menu AS sm
LEFT JOIN sar_bussioness_stand AS stand
ON sm.BUSS_STAND_ID = stand.ID AND
stand.VALID_FLAG = 0
LEFT JOIN sar_menu_standard sms on sm.MENU_ID = sms.ID
where LENGTH(sm.MENU_ID) > 30
AND sms.MENU_NAME IS NOT NULL
AND sm.VALID_FLAG = 0
AND sm.TREE_TYPE is null
AND sms.id in (select id from sar_menu_standard where valid_flag = 0)
group by stand.ID
</select>
<delete id="deleteByStandIdAndMenuId" parameterType="com.adc.da.slrs.sarBussStandMenu.entity.SarBussStandMenu">
delete from SAR_BUSS_STAND_MENU
where buss_stand_id = #{bussStandId, jdbcType=VARCHAR} and MENU_ID = #{menuId, jdbcType=VARCHAR}
@@ -1267,4 +1267,96 @@
where id = #{attfId}
</update>
<select id="getESSystemData" resultType="com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO">
SELECT
DISTINCT
es.ID AS standId,
es.STAND_CODE AS standNo,
es.STAND_NAME AS standName,
es.TEXT_STATUS_BUSS AS standState,
es.ISSUE_TIME AS releaseDate,
es.PUT_TIME AS implementDate,
es.REPLACE_STAND_NUM AS replaceStandardNo,
esa.QCDW AS dept,
esa.QCRBUSS AS draftUserName,
'ENTERPRISE' AS dataSource,
sms.ID AS menuId,
3 AS standTypeSort,
CASE
when es.stand_code like concat('%', 'Q/FT A', '%') THEN 0
when es.stand_code like concat('%', 'Q/FT B', '%') THEN 1
when es.stand_code like concat('%', 'Q/FT E', '%') THEN 2
when es.stand_code like concat('%', 'Q/FT F', '%') THEN 3
when es.stand_code like concat('%', 'Q/FT G', '%') THEN 4
when es.stand_code like concat('%', 'Q/FT M', '%') THEN 5
when es.stand_code like concat('%', 'Q/FT Q', '%') THEN 6
when es.stand_code like concat('%', 'Q/FT R', '%') THEN 7
when es.stand_code like concat('%', 'Q/FT S', '%') THEN 8
when es.stand_code like concat('%', 'Q/FT T', '%') THEN 9
when es.stand_code like concat('%', 'Q/FT V', '%') THEN 10
when es.stand_code like concat('%', 'Q/FT X', '%') THEN 11
when es.stand_code like concat('%', 'Q/FT Y', '%') THEN 12
when es.stand_code like concat('%', 'Q/FT Z', '%') THEN 13
when es.stand_code like concat('%', 'Q/QCBFC', '%') THEN 14
when es.stand_code like concat('%', '雷萨企标Q/FL', '%') THEN 15
when es.stand_code like concat('%', 'Q/QCFLC', '%') THEN 16
ELSE 17
END AS standCategorySort
FROM
`sar_bussioness_stand` AS es
LEFT JOIN `sar_buss_stand_attr_info` AS esa ON es.ID = esa.STAND_ID
LEFT JOIN `sar_buss_stand_menu` AS m ON es.ID = m.BUSS_STAND_ID
AND LENGTH(m.MENU_ID) > 30
AND m.TREE_TYPE is null
AND m.VALID_FLAG = 0
LEFT JOIN sar_menu_standard sms on m.MENU_ID = sms.ID
WHERE 1 = 1
AND sms.id in (select id from sar_menu_standard where valid_flag = 0)
<!--标准编号-->
<if test="param.standNo != null and param.standNo != ''">
AND es.STAND_CODE LIKE CONCAT('%',#{param.standNo},'%')
</if>
<!--关联的节点IDList-->
<if test="param.menuIdList != null and param.menuIdList.size() > 0">
AND m.MENU_ID IN
<foreach item="item" index="index" collection="param.menuIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<!--标准名称-->
<if test="param.standName != null and param.standName != ''">
AND es.STAND_NAME LIKE CONCAT('%',#{param.standName},'%')
</if>
<!--发布时间-->
<if test="param.startReleaseDate != null and param.endReleaseDate != null">
AND es.ISSUE_TIME BETWEEN #{param.startReleaseDate} AND #{param.endReleaseDate}
</if>
<!--实施日期-->
<if test="param.startImplementDate != null and param.endImplementDate != null">
AND es.PUT_TIME BETWEEN #{param.startImplementDate} AND #{param.endImplementDate}
</if>
<!--代替标准-->
<if test="param.replaceStandardNo != null and param.replaceStandardNo != ''">
AND es.REPLACE_STAND_NUM LIKE CONCAT('%',#{param.replaceStandardNo},'%')
</if>
<!--编制单位-->
<if test="param.dept != null and param.dept != ''">
AND esa.QCDW LIKE CONCAT('%',#{param.dept},'%')
</if>
<!--起草人-->
<if test="param.draftUserName != null and param.draftUserName != ''">
AND esa.QCRBUSS LIKE CONCAT('%',#{param.draftUserName},'%')
</if>
<!--数据来源-->
<if test="param.dataSource != null and param.dataSource != ''">
AND 'ENTERPRISE' = #{param.dataSource}
</if>
<if test="param.selectIdList != null and param.selectIdList.size() > 0">
AND es.ID IN
<foreach item="item" index="index" collection="param.selectIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by es.ID
</select>
</mapper>
@@ -20,10 +20,8 @@
<result property="uploadTime" column="UPLOAD_TIME" jdbcType="TIMESTAMP"/>
<result property="description" column="DESCRIPTION" jdbcType="VARCHAR"/>
<result property="informationFile" column="INFORMATION_FILE" jdbcType="VARCHAR"/>
<result property="viewableBy" column="VIEWABLE_BY" jdbcType="VARCHAR"/>
<result property="downloadableBy" column="DOWNLOADABLE_BY" jdbcType="VARCHAR"/>
<result property="treeNodeId" column="TREE_NODE_ID" jdbcType="VARCHAR"/>
<result property="viewableBy" column="VALID_FLAG" jdbcType="TINYINT"/>
<result property="validFlag" column="VALID_FLAG" jdbcType="TINYINT"/>
<result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
<result property="modifyTime" column="MODIFY_TIME" jdbcType="TIMESTAMP"/>
</resultMap>
@@ -35,9 +33,13 @@
THIRD_TYPE,
FOURTH_TYPE,
`NAME`,
DEPARTMENT,AUTHOR,UPLOAD_TIME,
`DESCRIPTION`,INFORMATION_FILE,VIEWABLE_BY,
DOWNLOADABLE_BY,VALID_FLAG,CREATE_TIME,
DEPARTMENT,
AUTHOR,
UPLOAD_TIME,
`DESCRIPTION`,
INFORMATION_FILE,
VALID_FLAG,
CREATE_TIME,
MODIFY_TIME
</sql>
<sql id="Base_Where_Clause">
@@ -50,11 +52,20 @@
<if test="name != null and name != ''">
and `NAME` like concat('%',#{name},'%')
</if>
<if test="uploadTime != null">
and UPLOAD_TIME = #{uploadTime}
<if test="uploadTimeBegin != null and uploadTimeEnd != null">
and UPLOAD_TIME between DATE_FORMAT(#{uploadTimeBegin}, '%Y-%m-%d') and DATE_FORMAT(#{uploadTimeEnd}, '%Y-%m-%d')
</if>
<if test="treeNodeId != null and treeNodeId != ''">
and TREE_NODE_ID = #{treeNodeId}
<if test="treeNodeIdList != null and treeNodeIdList.size() &gt; 0">
and TREE_NODE_ID in
<foreach collection="treeNodeIdList" item="treeNodeId" index="index" separator="," open="(" close=")">
#{treeNodeId}
</foreach>
</if>
<if test="informationIdList != null and informationIdList.size() &gt; 0">
and ID in
<foreach collection="informationIdList" item="informationId" index="index" separator="," open="(" close=")">
#{informationId}
</foreach>
</if>
</sql>
<select id="queryByPageCount" resultType="java.lang.Integer">
@@ -114,11 +114,8 @@
<if test="participatingUnit != null and participatingUnit != ''" >
and PARTICIPATING_UNIT like concat('%',#{participatingUnit},'%')
</if>
<if test="startTime != null">
and START_TIME ${startTimeOperator} #{startTime}
</if>
<if test="closeTime != null">
and CLOSE_TIME ${startTimeOperator} #{closeTime}
<if test="startTimeBegin != null and startTimeEnd != null">
and START_TIME between DATE_FORMAT(#{startTimeBegin}, '%Y-%m-%d') and DATE_FORMAT(#{startTimeEnd}, '%Y-%m-%d')
</if>
<if test="topicStatus != null and topicStatus != ''" >
and TOPIC_STATUS = #{topicStatus}
@@ -185,13 +182,14 @@
</sql>
<select id="queryByPageCount" resultType="java.lang.Integer">
select count(1) from sar_laws_topic slt left join sar_laws_topic_meeting sltm on slt.ID = sltm.LAWS_TOPIC_ID
select count(slt.ID) from sar_laws_topic slt left join sar_laws_topic_meeting sltm on slt.ID = sltm.LAWS_TOPIC_ID
left join sar_laws_contact_information slci1 on slt.ID = slci1.LAWS_TOPIC_ID and slci1.GROUP_TYPE = 'topicGroup'
left join sar_laws_contact_information slci2 on slt.ID = slci2.LAWS_TOPIC_ID and slci2.GROUP_TYPE = 'inside'
where slt.VALID_FLAG = 0
<include refid="Base_Where_Clause"/>
<include refid="TopicMeeting_where" />
<include refid="ContactInformation_where" />
group by slt.ID
</select>
<select id="queryByPage" resultMap="BaseResultMap">
select <include refid="Base_Join_Column_List" />
@@ -44,6 +44,7 @@
<result column="stand_name" property="standName"/>
<result column="stand_year" property="standYear"/>
<result column="stand_number" property="standNumber"/>
<result property="standCode" column="standCode" />
<result column="id" property="id"/>
</resultMap>
@@ -115,6 +116,7 @@
SAR_STANDARDS_INFO.stand_sort,
SAR_STANDARDS_INFO.stand_number,
SAR_STANDARDS_INFO.stand_year,
concat(COALESCE(SAR_STANDARDS_INFO.stand_sort, ''), ' ', COALESCE(SAR_STANDARDS_INFO.stand_number, ''), '-' , COALESCE(SAR_STANDARDS_INFO.stand_year, '')) as standCode,
SAR_STANDARDS_INFO.stand_name,
SAR_STANDARDS_INFO.stand_en_name,
SAR_STANDARDS_INFO.stand_state,
@@ -0,0 +1,15 @@
<?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.adc.da.slrs.roleReplacePosition.mapper.UserPositionMapper">
<resultMap id="BaseResultMap" type="com.adc.da.slrs.roleReplacePosition.domain.UserPosition">
<result property="userId" column="user_id" jdbcType="VARCHAR"/>
<result property="positionId" column="position_id" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
user_id,position_id
</sql>
</mapper>
@@ -1,6 +1,7 @@
package com.adc.da.sys.entity;
import com.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
/**
@@ -9,6 +10,7 @@ import com.adc.da.base.entity.BaseEntity;
* <b>日期</b> 2018-09-03 <br>
* <b>版权所有<b>版权归北京卡达克数据技术中心所有<br>
*/
@TableName("TS_USER_ROLE")
public class UserRoleEO extends BaseEntity {
private String roleId;
@@ -15,8 +15,10 @@ import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -64,6 +66,10 @@ public class SarMenuStandard extends BaseEntity {
@TableField("DISPLAY_SEQ")
private Integer displaySeq;
@ApiModelProperty(value = "排序")
@TableField(exist = false)
private Integer systemSort;
@ApiModelProperty(value = "路径")
@TableField("HREF")
private String href;
@@ -107,4 +113,109 @@ public class SarMenuStandard extends BaseEntity {
@TableField(exist = false)
private String treeType;
@ApiModelProperty(value = "树层级")
@TableField(exist = false)
private Integer level;
@TableField(exist = false)
private Integer gbStandCount;
@TableField(exist = false)
private Integer fbStandCount;
@TableField(exist = false)
private Integer esStandCount;
@TableField(exist = false)
private List<String> gbStandIdList;
@TableField(exist = false)
private List<String> fbStandIdList;
@TableField(exist = false)
private List<String> esStandIdList;
// 添加用于计算和设置关联关系数量的方法
// 添加用于计算和设置关联关系数量的方法
public void calculateAndSetCounts(List<StandMenuRelation> gbStandMenu, List<StandMenuRelation> fbStandMenu, List<StandMenuRelation> esStandMenu, Integer curLevel) {
this.gbStandIdList = new ArrayList<>();
this.fbStandIdList = new ArrayList<>();
this.esStandIdList = new ArrayList<>();
this.level = curLevel;
this.gbStandCount = countMatches(gbStandMenu, this.id, gbStandIdList);
this.fbStandCount = countMatches(fbStandMenu, this.id, fbStandIdList);
this.esStandCount = countMatches(esStandMenu, this.id, esStandIdList);
for (SarMenuStandard child : children) {
child.calculateAndSetCounts(gbStandMenu, fbStandMenu, esStandMenu, curLevel + 1);
this.gbStandCount += child.gbStandCount;
this.gbStandIdList.addAll(child.gbStandIdList);
this.fbStandCount += child.fbStandCount;
this.fbStandIdList.addAll(child.fbStandIdList);
this.esStandCount += child.esStandCount;
this.esStandIdList.addAll(child.esStandIdList);
}
}
private int countMatches(List<StandMenuRelation> standMenuList, String menuId, List<String> standIdList) {
int count = 0;
// 计算与menuId匹配的项的数量
for (StandMenuRelation standMenu : standMenuList) {
if (standMenu.getMenuId().equals(menuId)) {
count++;
standIdList.add(standMenu.getStandId());
}
}
return count;
}
// 添加用于构建映射的方法
public void buildPathMap(Map<String, String> pathMap, String parentPath) {
String currentPath = parentPath.isEmpty() ? this.menuName : parentPath + "/" + this.menuName;
pathMap.put(this.id, currentPath);
for (SarMenuStandard child : children) {
child.buildPathMap(pathMap, currentPath);
}
}
// 添加用于收集子节点ID的方法
public void collectChildIds(List<String> childIds) {
childIds.add(this.id);
for (SarMenuStandard child : children) {
child.collectChildIds(childIds);
}
}
public static SarMenuStandard findNodeById(SarMenuStandard node, String menuId) {
if (node == null) {
return null;
}
// 检查当前节点的ID是否匹配
if (menuId.equals(node.getId())) {
return node;
}
// 在子节点中递归搜索
for (SarMenuStandard child : node.getChildren()) {
SarMenuStandard found = findNodeById(child, menuId);
if (found != null) {
return found;
}
}
// 如果在当前节点及其子节点中都没有找到返回null
return null;
}
// 递归方法来设置每个节点的 systemSort
public static void setSystemSort(SarMenuStandard node, String parentSort) {
// 计算当前节点的 systemSort
String currentSort = parentSort.isEmpty() ? String.valueOf(node.getDisplaySeq()) : parentSort + node.getDisplaySeq();
// 设置当前节点的 systemSort
node.setSystemSort(Integer.parseInt(currentSort));
// 递归设置子节点的 systemSort
for (SarMenuStandard child : node.getChildren()) {
setSystemSort(child, currentSort);
}
}
}
@@ -0,0 +1,20 @@
package com.adc.da.sys.sarMenuStandard.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author: Mzaxd
* @Date: 2023/11/14 16:31
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class StandMenuRelation {
private String standId;
private String menuId;
}
@@ -3,5 +3,9 @@ package com.adc.da.sys.service;
import com.adc.da.sys.entity.UserRoleEO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
public interface IUserRoleEOService extends IService<UserRoleEO> {
List<String> getRoleIdsByUserId(String userId);
}
@@ -3,11 +3,16 @@ package com.adc.da.sys.service.impl;
import com.adc.da.sys.dao.UserRoleEODao;
import com.adc.da.sys.entity.UserRoleEO;
import com.adc.da.sys.service.IUserRoleEOService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
*
@@ -21,4 +26,10 @@ import org.springframework.transaction.annotation.Transactional;
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
public class UserRoleEOServiceImpl extends ServiceImpl<UserRoleEODao, UserRoleEO> implements IUserRoleEOService {
@Override
public List<String> getRoleIdsByUserId(String userId) {
return this.list(new LambdaQueryWrapper<UserRoleEO>()
.eq(UserRoleEO::getUserId, userId))
.stream().map(UserRoleEO::getRoleId).distinct().collect(Collectors.toList());
}
}
@@ -0,0 +1,36 @@
package com.adc.da.sys.util;
import org.springframework.beans.BeanUtils;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author Mzaxd
* @since 2022-11-22 15:36
*/
public class BeanCopyUtils {
private BeanCopyUtils() {
}
public static <V> V copyBean(Object source, Class<V> clazz){
V result = null;
//创建目标对象
try {
result = clazz.newInstance();
//实现属性copy
BeanUtils.copyProperties(source, result);
} catch (Exception e) {
e.printStackTrace();
}
//返回结果
return result;
}
public static <O,V> List<V> copyBeanList(List<O> list, Class<V> clazz) {
return list.stream()
.map(o -> copyBean(o, clazz))
.collect(Collectors.toList());
}
}