Merge remote-tracking branch 'origin/develop_master' into develop_3

This commit is contained in:
zhaokaiyao@91isoft.com
2022-01-22 19:24:03 +08:00
24 changed files with 495 additions and 32 deletions
@@ -18,7 +18,7 @@ public class ActDefineStartMap {
map.put("2","standardSurveyWorkFlow");
map.put("3","StandAskForOpinion");
map.put("4","standardregulatoryinventory");
map.put("5","projectEvaluationProcess");
map.put("5","projectEvaluationNewProcess");
map.put("6","Projectcomplianceassessment");
@@ -1,5 +1,6 @@
package com.adc.da.common;
import com.adc.da.utils.removeHtml.RemoveHtml;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.ss.usermodel.*;
@@ -93,6 +94,10 @@ public class TableToExcel {
if (!"commentText".equals(key)) {
try {
Object val = BeanUtils.getProperty(t, key);
val= RemoveHtml.getResultsFromHtml(String.valueOf(val));
if ("null".equals(val)){
val="";
}
if (val instanceof Long) {
dataRow.createCell(v++).setCellValue((Long) val);
} else if (val instanceof Double) {
@@ -11,9 +11,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/${restPath}/lawss/actSarItemsBuss")
@@ -35,4 +33,10 @@ public class ActSarItemsBussEOController extends BaseController<ActSarItemsEO> {
return Result.error("传入数据json不能为空");
}
}
@ApiOperation(value = "手动更新")
@GetMapping("/autoUpdIndex")
public void autoUpdIndex(@RequestParam("pid") String pid,@RequestParam("bussId") String bussId) {
actSarItemsEOService.autoUpdIndex(pid,bussId);
}
}
@@ -29,6 +29,7 @@ import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.util.InitStandAttrUtil;
import com.adc.da.utils.util.Utils;
import com.adc.da.workFlow.dao.ActSarItemsEODao;
import com.adc.da.workFlow.entity.BusProcessEvaluationHis;
import com.alibaba.fastjson.JSON;
@@ -44,8 +45,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@Service("actSarItemsBussEOService")
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
@@ -78,6 +81,49 @@ public class ActSarItemsBussEOService {
@Value("${elas.flag}")
private boolean elasflag;
public void autoUpdIndex(String pid,String bussId){
List<BusProcessEvaluationHis> evaluationHisFilter = workFlowFeignClient.evaluationHisList(pid);
List<BusProcessEvaluationHis> evaluationHis = new ArrayList<>();
Map<String, List<BusProcessEvaluationHis>> listMap = new TreeMap<>();
// 按 相同数据分组
listMap = evaluationHisFilter.stream().collect(
Collectors.groupingBy(a -> Utils.format("{0}#{1}", a.getPId(),a.getTaskInfo())));
List<QualityEvaluation> evaluations = new ArrayList<>();
if(!listMap.isEmpty()){
SimpleDateFormat sdf=new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
listMap.forEach((key, value) -> {
if(!value.isEmpty()){
evaluationHis.add(value.get(0));
}
});
String finalBussId = bussId;
Date date = new Date();
evaluationHis.forEach(busProcessEvaluationHis -> {
List<JSONObject> valueArr = JSONArray.parseArray(busProcessEvaluationHis.getMesg(),JSONObject.class);
if(!valueArr.isEmpty()){
valueArr.forEach(object -> {
QualityEvaluation evaluation = new QualityEvaluation();
evaluation.setId(UUIDUtils.randomUUID20());
evaluation.setLawId(finalBussId);
evaluation.setUserId(object.getString("userId"));
evaluation.setScore(object.getString("score"));
evaluation.setReason(object.getString("reason"));
evaluation.setEvaluationIndex(object.getString("code"));
evaluation.setProcessNode(object.getString("processNode"));
evaluation.setEvaluationType(object.getString("indexType"));
evaluation.setCreateTime(date);
evaluation.setModifyTime(date);
evaluations.add(evaluation);
});
}
});
qualityEvaluationService.saveBatch(evaluations);
}
}
/***
* @Description: 国内外标准流程入库"
* @Date: 2020/12/7 13:48
@@ -238,10 +284,24 @@ public class ActSarItemsBussEOService {
// saveCompStatusInfo(sarStandardsInfoEO,breakVal,allItems,prcNum);
// }
List<BusProcessEvaluationHis> evaluationHis = workFlowFeignClient.evaluationHisList(pid);
List<BusProcessEvaluationHis> evaluationHisFilter = workFlowFeignClient.evaluationHisList(pid);
List<BusProcessEvaluationHis> evaluationHis = new ArrayList<>();
Map<String, List<BusProcessEvaluationHis>> listMap = new TreeMap<>();
// 按 相同数据分组
listMap = evaluationHisFilter.stream().collect(
Collectors.groupingBy(a -> Utils.format("{0}#{1}", a.getPId(),a.getTaskInfo())));
List<QualityEvaluation> evaluations = new ArrayList<>();
if(!evaluationHis.isEmpty()){
if(!listMap.isEmpty()){
SimpleDateFormat sdf=new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
listMap.forEach((key, value) -> {
if(!value.isEmpty()){
evaluationHis.add(value.get(0));
}
});
String finalBussId = bussId;
Date date = new Date();
evaluationHis.forEach(busProcessEvaluationHis -> {
List<JSONObject> valueArr = JSONArray.parseArray(busProcessEvaluationHis.getMesg(),JSONObject.class);
if(!valueArr.isEmpty()){
@@ -255,15 +315,15 @@ public class ActSarItemsBussEOService {
evaluation.setEvaluationIndex(object.getString("code"));
evaluation.setProcessNode(object.getString("processNode"));
evaluation.setEvaluationType(object.getString("indexType"));
evaluation.setCreateTime(new Date());
evaluation.setModifyTime(new Date());
evaluation.setCreateTime(date);
evaluation.setModifyTime(date);
evaluations.add(evaluation);
});
}
});
qualityEvaluationService.saveBatch(evaluations);
}
qualityEvaluationService.saveBatch(evaluations);
}
@@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List;
@Validated
@@ -96,6 +97,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 token = jwtUtils.generateToken(userEO.getUsid());
userEO.setToken(token);
// 加密重要信息
@@ -3,6 +3,7 @@ package com.adc.da.slrs.sarEnterpriseStandardEvaluation.entity;
import com.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -77,10 +78,12 @@ public class QualityEvaluation extends BaseEntity {
@ApiModelProperty(value = "创建时间")
@TableField(fill = FieldFill.INSERT)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@ApiModelProperty(value = "更新时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date modifyTime;
@@ -73,6 +73,17 @@ public class TsInstitutionController extends BaseController<TsInstitution> {
return Result.success(tsUserIPage);
}
/**
* 查询机构下所有的机构人员
* @return ResponseMessage<List<TsUser>>
*/
@ApiOperation("查询机构的人员")
@PostMapping("/userUnderInstitution")
public ResponseMessage<IPage<TsUser>> userUnderInstitution(TsUser tsUser){
return Result.success(tsUserService.getAllUsers(tsUser));
}
@ApiOperation("导入机构数据")
@PostMapping("/import")
public ResponseMessage<Object> importInstitution() throws Exception {
@@ -6,6 +6,7 @@ import com.adc.da.http.Result;
import com.adc.da.slrs.sarStandIdea.dao.SarPublicIdeaAllDao;
import com.adc.da.slrs.sarStandIdea.entity.*;
import com.adc.da.slrs.sarStandIdea.service.Impl.SarPublicIdeaAllServiceImpl;
import com.adc.da.utils.removeHtml.RemoveHtml;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -140,8 +141,8 @@ public class SarPublicIdeaAllController extends BaseController<SarPublicIdeaAll>
if ("1".equals(type)) {
GetExcelDto2 getExcelDto = GetExcelDto2.builder()
.partCode(sarPublicIdeaAll.getPartCode())
.oldText(sarPublicIdeaAll.getOldText())
.newText(sarPublicIdeaAll.getNewText())
.oldText(RemoveHtml.getResultsFromHtml(sarPublicIdeaAll.getOldText()))
.newText(RemoveHtml.getResultsFromHtml(sarPublicIdeaAll.getNewText()))
.reason(sarPublicIdeaAll.getReason())
.userName(sarPublicIdeaAll.getUserName())
.deptName(sarPublicIdeaAll.getDeptName())
@@ -152,8 +153,8 @@ public class SarPublicIdeaAllController extends BaseController<SarPublicIdeaAll>
}else {
GetExcelDto getExcelDto = GetExcelDto.builder()
.partCode(sarPublicIdeaAll.getPartCode())
.oldText(sarPublicIdeaAll.getOldText())
.newText(sarPublicIdeaAll.getNewText())
.oldText(RemoveHtml.getResultsFromHtml(sarPublicIdeaAll.getOldText()))
.newText(RemoveHtml.getResultsFromHtml(sarPublicIdeaAll.getNewText()))
.reason(sarPublicIdeaAll.getReason())
.userName(sarPublicIdeaAll.getUserName())
.deptName(sarPublicIdeaAll.getDeptName())
@@ -343,4 +343,22 @@ public class SarStandProjectLibraryController extends BaseController<SarStandPro
.build();
return Result.success(querySelectRspDTO);
}
//标准评估流程 查询项目群接口
@GetMapping("/queryProjectGroup")
@ApiOperation("查询项目群")
public ResponseMessage queryProjectGroup(@RequestParam(defaultValue = "1", value = "current")int current,
@RequestParam(defaultValue = "10", value = "PageSize") int pageSize,
SarStandProjectLibrary sarStandProjectLibrary){
return Result.success( sarStandProjectLibraryService.queryProjectGroup(current,pageSize,sarStandProjectLibrary));
}
//标准评估流程根据项目群查项目接口
@GetMapping("/queryProjects")
@ApiOperation("查询项目群下的项目")
public ResponseMessage queryProjects(@RequestParam(defaultValue = "1", value = "current")int current,
@RequestParam(defaultValue = "10", value = "PageSize") int pageSize,SarStandProjectLibrary sarStandProjectLibrary){
return Result.success( sarStandProjectLibraryService.queryProjects(current,pageSize,sarStandProjectLibrary));
}
}
@@ -33,4 +33,9 @@ public interface SarStandProjectLibraryDao extends BaseMapper<SarStandProjectLib
void deleteByProjectId(@Param("projectId")String projectId);
List<String> selectListByids(@Param("ids") List<String> ids);
List<SarStandProjectLibrary> queryProjectGroup(@Param("current")int current,@Param("size")int size,@Param("sarStandProjectLibrary") SarStandProjectLibrary sarStandProjectLibrary);
Integer queryProjectGroupCount(@Param("sarStandProjectLibrary") SarStandProjectLibrary sarStandProjectLibrary);
List<SarStandProjectLibrary> queryProjects(@Param("current")int current,@Param("size")int size,@Param("sarStandProjectLibrary") SarStandProjectLibrary sarStandProjectLibrary,@Param("groups")List<String> strings);
Integer queryProjectsCount(@Param("sarStandProjectLibrary") SarStandProjectLibrary sarStandProjectLibrary,@Param("groups")List<String> strings);
}
@@ -29,5 +29,8 @@ public interface SarStandProjectLibraryService {
void batchInsertAdd(@Param("ids") List<StandProjectRelationDto> list);
List<StandAttrInfoDto> exportStandAttrInfoExcel(StandAttrInfoExcelDto standAttrInfoExcelDto,String standId);
public Head AnalysisJsonAndStorage(String jsonStr);
public IPage<SarStandProjectLibrary> queryProjectGroup(@Param("current")int current,@Param("size")int size, @Param("sarStandProjectLibrary") SarStandProjectLibrary sarStandProjectLibrary);
public IPage<SarStandProjectLibrary> queryProjects(@Param("current")int current,@Param("size")int size, @Param("sarStandProjectLibrary") SarStandProjectLibrary sarStandProjectLibrary);
}
@@ -17,6 +17,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -78,32 +79,30 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
//把刚刚拿到的值存到实体类里
SarStandProjectLibrary projectInfo = new SarStandProjectLibrary();
projectInfo
.setProjectPlatfor(projectObject.get("eng_platform").getAsString())
.setProjectNumber(projectObject.get("code").getAsString())
.setProjectName(projectObject.get("name").getAsString())
.setProjectClassification(projectObject.get("catalog_name").getAsString())
.setProjectStatus(projectObject.get("project_status_name").getAsString())
.setProjectGroup(projectObject.get("project_group_name").getAsString())
.setCurrentNode(projectObject.get("project_current_milestone").getAsString())
.setProjectLevel(projectObject.get("project_level").getAsString())
.setProductLine(projectObject.get("eng_product_line").getAsString())
.setManagementHostName(projectObject.get("management_host_name").getAsString())
.setDevelopmentHostName(projectObject.get("development_host_name").getAsString())
.setCategoryName(projectObject.get("category_name").getAsString());
.setProjectPlatfor(projectObject.get("eng_platform")==null?"":projectObject.get("eng_platform").getAsString())
.setProjectNumber(projectObject.get("code")==null?"":projectObject.get("code").getAsString())
.setProjectName(projectObject.get("name")==null?"":projectObject.get("name").getAsString())
.setProjectClassification(projectObject.get("catalog_name")==null?"":projectObject.get("catalog_name").getAsString())
.setProjectStatus(projectObject.get("project_status_name")==null?"":projectObject.get("project_status_name").getAsString())
.setProjectGroup(projectObject.get("project_group_name")==null?"":projectObject.get("project_group_name").getAsString())
.setCurrentNode(projectObject.get("project_current_milestone")==null?"":projectObject.get("project_current_milestone").getAsString())
.setProjectLevel(projectObject.get("project_level")==null?"":projectObject.get("project_level").getAsString())
.setProductLine(projectObject.get("eng_product_line")==null?"":projectObject.get("eng_product_line").getAsString())
.setManagementHostName(projectObject.get("management_host_name")==null?"":projectObject.get("management_host_name").getAsString())
.setDevelopmentHostName(projectObject.get("development_host_name")==null?"":projectObject.get("development_host_name").getAsString())
.setCategoryName(projectObject.get("category_name")==null?"":projectObject.get("category_name").getAsString());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
try {
if(projectObject.get("target_begin_on") != null){
Date targetBeginOn = simpleDateFormat.parse(projectObject.get("target_begin_on").getAsString());
projectInfo
.setProjectStartDate(targetBeginOn);
}
if(projectObject.get("target_end_on") != null){
Date targetEndOn = simpleDateFormat.parse(projectObject.get("target_end_on").getAsString());
projectInfo
.setProjectStartDate(targetBeginOn)
.setProjectEndDate(targetEndOn);
} catch (ParseException e) {
e.printStackTrace();
}
@@ -128,6 +127,39 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
return head;
}
@Override
public IPage<SarStandProjectLibrary> queryProjectGroup(int current,int size,SarStandProjectLibrary sarStandProjectLibrary) {
List<SarStandProjectLibrary> sarStandProjectLibraries=sarStandProjectLibraryDao.queryProjectGroup(current,size,sarStandProjectLibrary);
Integer total=sarStandProjectLibraryDao.queryProjectGroupCount(sarStandProjectLibrary);
Page<SarStandProjectLibrary> page=new Page<>();
page.setRecords(sarStandProjectLibraries);
page.setTotal(total);
page.setCurrent(current);
page.setSize(size);
return page;
}
@Override
public IPage<SarStandProjectLibrary> queryProjects(int current,int size, SarStandProjectLibrary sarStandProjectLibrary) {
List<String> ids=new ArrayList<>();
if (null!=sarStandProjectLibrary.getProjectGroup() && !"".equals(sarStandProjectLibrary.getProjectGroup())){
if (sarStandProjectLibrary.getProjectGroup().contains(",")){
ids.addAll(new ArrayList<>(Arrays.asList(sarStandProjectLibrary.getProjectGroup().split(","))));
}else {
ids.add(sarStandProjectLibrary.getProjectGroup());
}
}
IPage<SarStandProjectLibrary> sarStandProjectLibraryIPage=new Page<>();
List<SarStandProjectLibrary> sarStandProjectLibraries=sarStandProjectLibraryDao.queryProjects(current,size,sarStandProjectLibrary,ids);
Integer total=sarStandProjectLibraryDao.queryProjectsCount(sarStandProjectLibrary,ids);
sarStandProjectLibraryIPage.setTotal(total);
sarStandProjectLibraryIPage.setCurrent(current);
sarStandProjectLibraryIPage.setSize(size);
sarStandProjectLibraryIPage.setRecords(sarStandProjectLibraries);
return sarStandProjectLibraryIPage;
}
@Override
public IPage<SarStandProjectLibrary> queryMaintenanceProject(int current, int pageSize,
SarStandProjectLibraryDto sarDto) {
@@ -24,6 +24,8 @@ import io.swagger.annotations.Api;
import com.adc.da.base.web.BaseController;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
@@ -97,5 +99,12 @@ public class TsUserController extends BaseController<TsUser> {
}
@ApiOperation("调研流程查询人 部门专用接口")
@GetMapping("/selectDeptByDY")
public ResponseMessage<List<TsUser>> selectDeptByDY(@Param("ids") String ids) throws Exception {
List<String> strings=new ArrayList<>(Arrays.asList(ids.split(",")));
return Result.success(tsUserDao.selectDeptByDY(strings));
}
}
@@ -49,11 +49,17 @@ public interface TsUserDao extends BaseMapper<TsUser> {
*/
List<TsUser> getUserAndPositionPage(@Param("start")Integer start, @Param("end")Integer end,@Param("TsUser") TsUser tsUser);
List<TsUser> userUnderInstitution(@Param("start")Integer start, @Param("end")Integer end,@Param("TsUser") TsUser tsUser,@Param("ids") List<String> ids);
Integer getUserAndPositionCount(@Param("TsUser") TsUser tsUser);
Integer userUnderInstitutionCount(@Param("TsUser") TsUser tsUser,@Param("ids") List<String> ids);
/**
* 通过岗位Id列表查询用户ID列表
* @param positionIds:岗位ID列表
* @return List<String>
*/
List<String> getUserIdsByPositionIds(List<String> positionIds);
List<TsUser> selectDeptByDY(@Param("list") List<String> strings);
}
@@ -83,4 +83,6 @@ public interface ITsUserService extends IService<TsUser> {
List<UpDTO> selectByName(String name);
List<UpDTO> selectNameById(List<String> strings,String type);
IPage<TsUser> getAllUsers(TsUser tsUser);
}
@@ -3,6 +3,8 @@ package com.adc.da.slrs.sarUser.service.impl;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.login.util.UserUtils;
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;
@@ -47,6 +49,8 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
@Autowired
private TsUserDao tsUserDao;
@Autowired
private ITsUserService tsUserService;
@Autowired
private ITsPositionService tsPositionService;
@Autowired
@Lazy
@@ -59,6 +63,8 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
private SyncUserService syncUserService;
@Autowired
private TsPositionDao tsPositionDao;
@Autowired
private ITsInstitutionService tsInstitutionService;
public void deleteUser(){
@@ -364,4 +370,40 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
});
return result;
}
@Override
public IPage<TsUser> getAllUsers(TsUser tsUser) {
List<String> ids=new ArrayList<>();
ids.add(tsUser.getInstitutionId());
List<String> middle=new ArrayList<>();
middle.addAll(ids);
boolean flag=true;
while (flag){
QueryWrapper<TsInstitution> queryWrapper=new QueryWrapper<>();
queryWrapper.in("parent_id",middle);
List<TsInstitution> tsmiddle=tsInstitutionService.list(queryWrapper);
if (tsmiddle.size()>0){
tsmiddle.forEach(tsInstitution -> {
middle.add(tsInstitution.getId());
});
middle.removeAll(ids);
ids.addAll(middle);
}else {
tsmiddle.forEach(tsInstitution -> {
middle.add(tsInstitution.getId());
});
middle.removeAll(ids);
ids.addAll(middle);
flag=false;
}
}
Page<TsUser> tsUserPage = new Page<>();
tsUserPage.setCurrent(tsUser.getCurrent());
tsUserPage.setSize(tsUser.getSize());
tsUserPage.setRecords(tsUserDao.userUnderInstitution((tsUser.getCurrent()-1)*tsUser.getSize(),tsUser.getSize(),tsUser,ids));
tsUserPage.setTotal(tsUserDao.userUnderInstitutionCount(tsUser,ids));
return tsUserPage;
}
}
@@ -0,0 +1,100 @@
package com.adc.da.utils.removeHtml;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RemoveHtml {
/**
* 匹配html标签,例如"<p>xxx</p>"这种格式
*/
private static Pattern HTML_TAG_PATTERN = Pattern.compile("<[a-zA-Z]+.*?>([\\s\\S]*?)</[a-zA-Z]*?>");
/**
* 替换掉html标签里面的style内容
*
* @param content
* @return
*/
public static String replaceStyle(String content) {
if (content == null || content.length() == 0) {
return content;
}
String regEx = " style=\"(.*?)\"";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(content);
if (m.find()) {
content = m.replaceAll("");
}
return content;
}
/**
* 移除掉</br>标签
*
* @param src
* @return
*/
public static String removeBrTag(String src) {
if (src != null && !src.isEmpty()) {
src = src.replaceAll("<br/>", "");
}
return src;
}
/**
* 针对多个标签嵌套的情况进行处理
* 比如 <p><span style="white-space: normal;">王者荣耀</span></p>
* 预处理并且正则匹配完之后结果是 <span>王者荣耀
* 需要手工移除掉前面的起始标签
* @param content
* @return
*/
public static String replaceStartTag(String content) {
if (content == null || content.length() == 0) {
return content;
}
String regEx = "<[a-zA-Z]*?>([\\s\\S]*?)";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(content);
if (m.find()) {
content = m.replaceAll("");
}
return content;
}
/**
* 获取html中的数据
* @param htmlStr
* @return
*/
public static String getResultsFromHtml(String htmlStr) {
//定义script的正则表达式,去除js可以防止注入
String scriptRegex="<script[^>]*?>[\\s\\S]*?<\\/script>";
//定义style的正则表达式,去除style样式,防止css代码过多时只截取到css样式代码
String styleRegex="<style[^>]*?>[\\s\\S]*?<\\/style>";
//定义HTML标签的正则表达式,去除标签,只提取文字内容
String htmlRegex="<[^>]+>";
//定义空格,回车,换行符,制表符
String spaceRegex = "\\s*|\t|\r|\n";
// 过滤script标签
htmlStr = htmlStr.replaceAll(scriptRegex, "");
// 过滤style标签
htmlStr = htmlStr.replaceAll(styleRegex, "");
// 过滤html标签
htmlStr = htmlStr.replaceAll(htmlRegex, "");
// 过滤空格等
htmlStr = htmlStr.replaceAll(spaceRegex, "");
return htmlStr.trim(); // 返回文本字符串
}
}
@@ -5,6 +5,8 @@ import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import java.text.MessageFormat;
/**
* @Description: TODO
* @author: super_liu
@@ -12,6 +14,10 @@ import org.apache.poi.ss.usermodel.Row;
*/
public class Utils {
public static String format(String value, Object... paras) {
return MessageFormat.format(value, paras);
}
//判断row是否为空 空返回true
public static boolean isRowEmpty(Row row) {
if (null == row) {
@@ -368,4 +368,86 @@
#{item}
</foreach>
</select>
<select id="queryProjectGroup"
resultType="com.adc.da.slrs.sarStandProjectLibrary.entity.SarStandProjectLibrary">
select distinct sar_stand_project_library.project_group,sar_stand_project_library.management_host_name,sar_stand_project_library.category_name,sar_stand_project_library.development_host_name from sar_stand_project_library
where 1=1
<if test="sarStandProjectLibrary.managementHostName != null and sarStandProjectLibrary.managementHostName != ''">
and sar_stand_project_library.management_host_name=#{sarStandProjectLibrary.managementHostName}
</if>
<if test="sarStandProjectLibrary.developmentHostName != null and sarStandProjectLibrary.developmentHostName != ''">
and sar_stand_project_library.development_host_name=#{sarStandProjectLibrary.developmentHostName}
</if>
<if test="sarStandProjectLibrary.categoryName != null and sarStandProjectLibrary.categoryName != ''">
and sar_stand_project_library.category_name=#{sarStandProjectLibrary.categoryName}
</if>
limit ${(current-1) * size},${size}
</select>
<select id="queryProjectGroupCount"
resultType="java.lang.Integer">
select count(a.project_group) from (
select distinct
sar_stand_project_library.project_group,sar_stand_project_library.management_host_name,sar_stand_project_library.category_name,sar_stand_project_library.development_host_name
from sar_stand_project_library
where 1=1
<if test="sarStandProjectLibrary.managementHostName != null and sarStandProjectLibrary.managementHostName != ''">
and sar_stand_project_library.management_host_name=#{sarStandProjectLibrary.managementHostName}
</if>
<if test="sarStandProjectLibrary.developmentHostName != null and sarStandProjectLibrary.developmentHostName != ''">
and sar_stand_project_library.development_host_name=#{sarStandProjectLibrary.developmentHostName}
</if>
<if test="sarStandProjectLibrary.categoryName != null and sarStandProjectLibrary.categoryName != ''">
and sar_stand_project_library.category_name=#{sarStandProjectLibrary.categoryName}
</if> )a
</select>
<select id="queryProjects"
resultType="com.adc.da.slrs.sarStandProjectLibrary.entity.SarStandProjectLibrary">
select sar_stand_project_library.* , ts_user.UNAME as uName from sar_stand_project_library
left join ts_user on ts_user.USID = sar_stand_project_library.project_manager
where 1=1
<if test="sarStandProjectLibrary.managementHostName != null and sarStandProjectLibrary.managementHostName != ''">
and sar_stand_project_library.management_host_name=#{sarStandProjectLibrary.managementHostName}
</if>
<if test="sarStandProjectLibrary.developmentHostName != null and sarStandProjectLibrary.developmentHostName != ''">
and sar_stand_project_library.development_host_name=#{sarStandProjectLibrary.developmentHostName}
</if>
<if test="sarStandProjectLibrary.categoryName != null and sarStandProjectLibrary.categoryName != ''">
and sar_stand_project_library.category_name=#{sarStandProjectLibrary.categoryName}
</if>
<if test="sarStandProjectLibrary.projectStatus != null and sarStandProjectLibrary.projectStatus != ''">
and sar_stand_project_library.project_status=#{sarStandProjectLibrary.projectStatus}
</if>
<if test="null != groups and groups.size()>0">
and sar_stand_project_library.project_group in
<foreach collection="groups" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
limit ${(current-1) * size},${size}
</select>
<select id="queryProjectsCount"
resultType="java.lang.Integer">
select count(sar_stand_project_library.id) from sar_stand_project_library
left join ts_user on ts_user.USID = sar_stand_project_library.project_manager
where 1=1
<if test="sarStandProjectLibrary.managementHostName != null and sarStandProjectLibrary.managementHostName != ''">
and sar_stand_project_library.management_host_name=#{sarStandProjectLibrary.managementHostName}
</if>
<if test="sarStandProjectLibrary.developmentHostName != null and sarStandProjectLibrary.developmentHostName != ''">
and sar_stand_project_library.development_host_name=#{sarStandProjectLibrary.developmentHostName}
</if>
<if test="sarStandProjectLibrary.categoryName != null and sarStandProjectLibrary.categoryName != ''">
and sar_stand_project_library.category_name=#{sarStandProjectLibrary.categoryName}
</if>
<if test="sarStandProjectLibrary.projectStatus != null and sarStandProjectLibrary.projectStatus != ''">
and sar_stand_project_library.project_status=#{sarStandProjectLibrary.projectStatus}
</if>
<if test="null != groups and groups.size()>0">
and sar_stand_project_library.project_group in
<foreach collection="groups" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>
@@ -48,6 +48,49 @@
limit #{start},#{end}
</select>
<select id="userUnderInstitution" parameterType="com.adc.da.slrs.sarUser.entity.TsUser" resultMap="UserPosition">
select u.*,p.id p_id,p.name p_name from ts_user u
left join ts_user_position up
on u.usid=up.user_id
left join ts_position p
on up.position_id=p.id
where 1=1
<if test="TsUser.uname != null and TsUser.uname != '' ">
and u.uname like concat('%',#{TsUser.uname},'%')
</if>
<if test="TsUser.email != null and TsUser.email != '' ">
and u.email like concat('%',#{TsUser.email},'%')
</if>
<if test=" null != ids and ids.size()> 0">
and INSTITUTION_ID in
<foreach item="id" collection="ids" open="(" separator="," close=")" index="index">
#{id}
</foreach>
</if>
limit #{start},#{end}
</select>
<select id="userUnderInstitutionCount" resultType="java.lang.Integer">
select count(u.USID) from ts_user u
left join ts_user_position up
on u.usid=up.user_id
left join ts_position p
on up.position_id=p.id
where 1=1
<if test="TsUser.uname != null and TsUser.uname != '' ">
and u.uname like concat('%',#{TsUser.uname},'%')
</if>
<if test="TsUser.email != null and TsUser.email != '' ">
and u.email like concat('%',#{TsUser.email},'%')
</if>
<if test=" null != ids and ids.size()> 0">
and INSTITUTION_ID in
<foreach item="id" collection="ids" open="(" separator="," close=")" index="index">
#{id}
</foreach>
</if>
</select>
<select id="getUserAndPositionCount" parameterType="com.adc.da.slrs.sarUser.entity.TsUser" resultType="java.lang.Integer">
select count(u.USID) from ts_user u
left join ts_user_position up
@@ -75,4 +118,13 @@
</foreach>
)
</select>
<select id="selectDeptByDY" resultMap="UserPosition">
select ts_user.USID,ts_user.INSTITUTION_ID,ts_institution.name as institution_name from ts_user
left join ts_institution on ts_institution.id=ts_user.INSTITUTION_ID
where ts_user.USID in
<foreach item="msgId" collection="list" open="(" separator="," close=")" index="index">
#{msgId}
</foreach>
</select>
</mapper>
@@ -129,6 +129,8 @@ public interface UserEODao extends BaseMapper<UserEO> {
String selectOrgByUserId(String userId);
String selectPositionByUserId(String userId);
List<UserEO> queryUserEoList(UserEOPage page);
/***
* 添加SSO来源用户
@@ -55,6 +55,8 @@ public interface IUserEOService extends IService<UserEO> {
public List<String> selectThatOrgUser(String userId);
String selectPositionByUserId(String userId);
public List<UserEO> queryUserEoList(UserEOPage page);
public List<UserEO> queryUserInfoByWordNum(String workNum);
@@ -394,6 +394,11 @@ public class UserEOServiceImpl extends ServiceImpl<UserEODao, UserEO> implements
return userIdList;
}
@Override
public String selectPositionByUserId(String userId) {
return baseMapper.selectPositionByUserId(userId);
}
public List<UserEO> queryUserEoList(UserEOPage page) {
page.setValidFlag("0");
@@ -639,6 +639,14 @@
FROM TS_USER_ORG tuo
WHERE tuo.USER_ID = #{userId}
</select>
<select id="selectPositionByUserId" resultType="java.lang.String"
parameterType="java.lang.String">
SELECT position_id
FROM ts_user_position tuo
WHERE tuo.USER_ID = #{userId}
limit 1
</select>
<!--syt:查询所有用户信息-->
<select id="queryUserEoList" resultMap="BaseResultMap" parameterType="com.adc.da.sys.page.UserEOPage">
SELECT