Merge remote-tracking branch 'origin/develop_master' into develop_master
This commit is contained in:
@@ -4,7 +4,12 @@ import com.itextpdf.text.BaseColor;
|
|||||||
import com.itextpdf.text.Element;
|
import com.itextpdf.text.Element;
|
||||||
import com.itextpdf.text.Rectangle;
|
import com.itextpdf.text.Rectangle;
|
||||||
import com.itextpdf.text.pdf.*;
|
import com.itextpdf.text.pdf.*;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
@@ -15,6 +20,8 @@ import java.lang.reflect.Field;
|
|||||||
*/
|
*/
|
||||||
public class WaterMarkUtil {
|
public class WaterMarkUtil {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(WaterMarkUtil.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param inputFile 你的PDF文件地址
|
* @param inputFile 你的PDF文件地址
|
||||||
* @param outputFile 添加水印后生成PDF存放的地址
|
* @param outputFile 添加水印后生成PDF存放的地址
|
||||||
@@ -78,4 +85,83 @@ public class WaterMarkUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean waterMarkNew(String inputFile, String outputFile, String waterMarkName) {
|
||||||
|
try {
|
||||||
|
logger.debug("水印追加文件:"+inputFile+" "+outputFile);
|
||||||
|
FileInputStream is = new FileInputStream(inputFile);
|
||||||
|
PdfReader reader = new PdfReader(is);
|
||||||
|
Field f = PdfReader.class.getDeclaredField("encrypted");
|
||||||
|
f.setAccessible(true);
|
||||||
|
f.set(reader, Boolean.FALSE);
|
||||||
|
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(outputFile));
|
||||||
|
|
||||||
|
// 获取总页数 +1, 下面从1开始遍历
|
||||||
|
int total = reader.getNumberOfPages() + 1;
|
||||||
|
//这里的字体设置比较关键,这个设置是支持中文的写法
|
||||||
|
BaseFont base = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);// 使用系统字体
|
||||||
|
|
||||||
|
// 间隔
|
||||||
|
int interval = 5;
|
||||||
|
// 获取水印文字的高度和宽度
|
||||||
|
int textH = 0, textW = 0;
|
||||||
|
JLabel label = new JLabel();
|
||||||
|
label.setText(waterMarkName);
|
||||||
|
FontMetrics metrics = label.getFontMetrics(label.getFont());
|
||||||
|
textH = metrics.getHeight();
|
||||||
|
textW = metrics.stringWidth(label.getText());
|
||||||
|
|
||||||
|
// 设置水印透明度
|
||||||
|
PdfGState gs = new PdfGState();
|
||||||
|
gs.setFillOpacity(0.2f);
|
||||||
|
gs.setStrokeOpacity(0.2f);
|
||||||
|
|
||||||
|
Rectangle pageSizeWithRotation = null;
|
||||||
|
PdfContentByte content = null;
|
||||||
|
for (int i = 1; i < total; i++) {
|
||||||
|
// 在内容上方加水印
|
||||||
|
content = stamper.getOverContent(i);
|
||||||
|
// 在内容下方加水印
|
||||||
|
// content = stamper.getUnderContent(i);
|
||||||
|
content.saveState();
|
||||||
|
content.setGState(gs);
|
||||||
|
|
||||||
|
// 设置字体和字体大小
|
||||||
|
content.beginText();
|
||||||
|
content.setFontAndSize(base, 19);
|
||||||
|
|
||||||
|
// 获取每一页的高度、宽度
|
||||||
|
pageSizeWithRotation = reader.getPageSizeWithRotation(i);
|
||||||
|
float pageHeight = pageSizeWithRotation.getHeight();
|
||||||
|
float pageWidth = pageSizeWithRotation.getWidth();
|
||||||
|
int parityNum = 0;
|
||||||
|
// 根据纸张大小多次添加, 水印文字成30度角倾斜
|
||||||
|
for (int height = interval + textH; height < pageHeight; height = height + textH * 6) {
|
||||||
|
parityNum ++;
|
||||||
|
for (int width = interval + textW; width < pageWidth + textW; width = width + textW * 2) {
|
||||||
|
if(parityNum%2==0){
|
||||||
|
width= width + 50;
|
||||||
|
height = height +50;
|
||||||
|
content.showTextAligned(Element.ALIGN_LEFT, waterMarkName, width - textW, height - textH, 30);
|
||||||
|
}else{
|
||||||
|
content.showTextAligned(Element.ALIGN_LEFT, waterMarkName, width - textW, height - textH, 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
content.endText();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关流
|
||||||
|
stamper.close();
|
||||||
|
reader.close();
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.getMessage(),e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|||||||
addInterceptor.excludePathPatterns("/api/sar-stand-project-team/save");
|
addInterceptor.excludePathPatterns("/api/sar-stand-project-team/save");
|
||||||
//tc模块结构单元数据
|
//tc模块结构单元数据
|
||||||
addInterceptor.excludePathPatterns("/api/sarModelTree/save");
|
addInterceptor.excludePathPatterns("/api/sarModelTree/save");
|
||||||
|
//PLM系统通过ESB推送模块单元数据
|
||||||
|
addInterceptor.excludePathPatterns("/api/sarModelTree/syncModelDto");
|
||||||
//同步用户数据
|
//同步用户数据
|
||||||
addInterceptor.excludePathPatterns("/api/DataSync/importUserData");
|
addInterceptor.excludePathPatterns("/api/DataSync/importUserData");
|
||||||
//同步组织机构数据
|
//同步组织机构数据
|
||||||
|
|||||||
+13
-2
@@ -3,13 +3,14 @@ package com.adc.da.slrs.sarModelTree.controller;
|
|||||||
|
|
||||||
import com.adc.da.http.ResponseMessage;
|
import com.adc.da.http.ResponseMessage;
|
||||||
import com.adc.da.http.Result;
|
import com.adc.da.http.Result;
|
||||||
import com.adc.da.slrs.sarModelTree.entity.SarModuleTree;
|
|
||||||
import com.adc.da.slrs.sarModelTree.service.ISarModelTreeService;
|
import com.adc.da.slrs.sarModelTree.service.ISarModelTreeService;
|
||||||
import com.adc.da.slrs.sarModelTree.service.ISarModuleTreeService;
|
import com.adc.da.slrs.sarModelTree.service.ISarModuleTreeService;
|
||||||
import com.adc.da.slrs.sarStandProjectLibrary.entity.myResponse.Head;
|
import com.adc.da.slrs.sarStandProjectLibrary.entity.myResponse.Head;
|
||||||
import com.adc.da.slrs.sarStandProjectLibrary.entity.myResponse.ResponseDto;
|
import com.adc.da.slrs.sarStandProjectLibrary.entity.myResponse.ResponseDto;
|
||||||
import com.adc.da.util.utils.StringUtils;
|
import com.adc.da.util.utils.StringUtils;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import com.adc.da.slrs.sarModelTree.entity.SarModelTree;
|
import com.adc.da.slrs.sarModelTree.entity.SarModelTree;
|
||||||
@@ -31,6 +32,9 @@ import java.util.List;
|
|||||||
@RequestMapping("/${restPath}/sarModelTree")
|
@RequestMapping("/${restPath}/sarModelTree")
|
||||||
public class SarModelTreeController extends BaseController<SarModelTree> {
|
public class SarModelTreeController extends BaseController<SarModelTree> {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(SarModelTreeController.class);
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISarModelTreeService iSarModelTreeService;
|
private ISarModelTreeService iSarModelTreeService;
|
||||||
|
|
||||||
@@ -82,6 +86,13 @@ public class SarModelTreeController extends BaseController<SarModelTree> {
|
|||||||
return responseDto;
|
return responseDto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("同步模块单元信息")
|
||||||
|
@PostMapping("/syncModelDto")
|
||||||
|
public ResponseDto syncModelDto(@RequestBody String jsonStr){
|
||||||
|
logger.info("===========================开始接收模块单元数据==================================");
|
||||||
|
ResponseDto responseDto = iSarModelTreeService.syncModelTreeDataToDB(jsonStr);
|
||||||
|
logger.info("===========================接收模块单元数据结束==================================");
|
||||||
|
return responseDto;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,29 @@ public class ResponseResult {
|
|||||||
private String MESSAGE; //接口信息 失败时,详细的失败原因
|
private String MESSAGE; //接口信息 失败时,详细的失败原因
|
||||||
|
|
||||||
private String STATUS; //接口状态 B(失败),S(成功)
|
private String STATUS; //接口状态 B(失败),S(成功)
|
||||||
|
|
||||||
|
|
||||||
|
public String getGUID() {
|
||||||
|
return GUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGUID(String GUID) {
|
||||||
|
this.GUID = GUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMESSAGE() {
|
||||||
|
return MESSAGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMESSAGE(String MESSAGE) {
|
||||||
|
this.MESSAGE = MESSAGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSTATUS() {
|
||||||
|
return STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSTATUS(String STATUS) {
|
||||||
|
this.STATUS = STATUS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,62 +10,76 @@ import lombok.Data;
|
|||||||
@TableName("sar_module_tree")
|
@TableName("sar_module_tree")
|
||||||
public class SarModuleTree {
|
public class SarModuleTree {
|
||||||
|
|
||||||
|
//序列号
|
||||||
@SerializedName("GUID")
|
@SerializedName("GUID")
|
||||||
@TableId
|
@TableId
|
||||||
private String guid;
|
private String guid;
|
||||||
|
|
||||||
|
//系统
|
||||||
@SerializedName("FTVSTYPE1")
|
@SerializedName("FTVSTYPE1")
|
||||||
@TableField("FTVSTYPE1")
|
@TableField("FTVSTYPE1")
|
||||||
private String ftvstype1;
|
private String ftvstype1;
|
||||||
|
|
||||||
|
//模块团队代号
|
||||||
@SerializedName("FTVSTYPE2")
|
@SerializedName("FTVSTYPE2")
|
||||||
@TableField("FTVSTYPE2")
|
@TableField("FTVSTYPE2")
|
||||||
private String ftvstype2;
|
private String ftvstype2;
|
||||||
|
//模块团队名称
|
||||||
@SerializedName("FTVSTYPE3")
|
@SerializedName("FTVSTYPE3")
|
||||||
@TableField("FTVSTYPE3")
|
@TableField("FTVSTYPE3")
|
||||||
private String ftvstype3;
|
private String ftvstype3;
|
||||||
|
|
||||||
|
//模块结构家族SF
|
||||||
@SerializedName("FTVSTYPE4")
|
@SerializedName("FTVSTYPE4")
|
||||||
@TableField("FTVSTYPE4")
|
@TableField("FTVSTYPE4")
|
||||||
private String ftvstype4;
|
private String ftvstype4;
|
||||||
|
|
||||||
|
//模块结构元素SE
|
||||||
@SerializedName("FTVSTYPE5")
|
@SerializedName("FTVSTYPE5")
|
||||||
@TableField("FTVSTYPE5")
|
@TableField("FTVSTYPE5")
|
||||||
private String ftvstype5;
|
private String ftvstype5;
|
||||||
|
|
||||||
|
//结构单元SU
|
||||||
@SerializedName("FTVSTYPE6")
|
@SerializedName("FTVSTYPE6")
|
||||||
@TableField("FTVSTYPE6")
|
@TableField("FTVSTYPE6")
|
||||||
private String ftvstype6;
|
private String ftvstype6;
|
||||||
|
|
||||||
|
//功能分组码VSG
|
||||||
@SerializedName("FTVSTYPE7")
|
@SerializedName("FTVSTYPE7")
|
||||||
@TableField("FTVSTYPE7")
|
@TableField("FTVSTYPE7")
|
||||||
private String ftvstype7;
|
private String ftvstype7;
|
||||||
|
|
||||||
|
//关联特征族代号(驱动要素)
|
||||||
@SerializedName("FTVSTYPE9")
|
@SerializedName("FTVSTYPE9")
|
||||||
@TableField("FTVSTYPE9")
|
@TableField("FTVSTYPE9")
|
||||||
private String ftvstype9;
|
private String ftvstype9;
|
||||||
|
|
||||||
|
//是否需要额外描述
|
||||||
@SerializedName("ACLUSERNAMES")
|
@SerializedName("ACLUSERNAMES")
|
||||||
@TableField("ACLUSERNAMES")
|
@TableField("ACLUSERNAMES")
|
||||||
private String aclusernames;
|
private String aclusernames;
|
||||||
|
|
||||||
|
//操作人
|
||||||
@SerializedName("CREATOR")
|
@SerializedName("CREATOR")
|
||||||
@TableField("CREATOR")
|
@TableField("CREATOR")
|
||||||
private String creator;
|
private String creator;
|
||||||
|
|
||||||
|
//SF_ID
|
||||||
@SerializedName("SERIESID")
|
@SerializedName("SERIESID")
|
||||||
@TableField("SERIESID")
|
@TableField("SERIESID")
|
||||||
private String seriesid; //SF_ID
|
private String seriesid; //SF_ID
|
||||||
|
|
||||||
|
//SE_ID
|
||||||
@SerializedName("RESERVED")
|
@SerializedName("RESERVED")
|
||||||
@TableField("RESERVED")
|
@TableField("RESERVED")
|
||||||
private String reserved; //SE_ID
|
private String reserved; //SE_ID
|
||||||
|
|
||||||
|
//SU_ID
|
||||||
@SerializedName("STARTED")
|
@SerializedName("STARTED")
|
||||||
@TableField("STARTED")
|
@TableField("STARTED")
|
||||||
private String started; //SU_ID
|
private String started; //SU_ID
|
||||||
|
|
||||||
|
//操作时间
|
||||||
@SerializedName("CREATIONDATE")
|
@SerializedName("CREATIONDATE")
|
||||||
@TableField("CREATIONDATE")
|
@TableField("CREATIONDATE")
|
||||||
private String creationdate;
|
private String creationdate;
|
||||||
@@ -79,4 +93,14 @@ public class SarModuleTree {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String nextCondition;
|
private String nextCondition;
|
||||||
|
|
||||||
|
//列ID
|
||||||
|
@SerializedName("ROWID")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String rowId;
|
||||||
|
|
||||||
|
//产品线分类
|
||||||
|
@SerializedName("PRODUCTTYPE")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String productType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -1,7 +1,7 @@
|
|||||||
package com.adc.da.slrs.sarModelTree.service;
|
package com.adc.da.slrs.sarModelTree.service;
|
||||||
|
|
||||||
import com.adc.da.slrs.sarModelTree.entity.SarModelTree;
|
import com.adc.da.slrs.sarModelTree.entity.SarModelTree;
|
||||||
import com.adc.da.slrs.sarVppsTree.entity.SarVppsTree;
|
import com.adc.da.slrs.sarStandProjectLibrary.entity.myResponse.ResponseDto;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -19,4 +19,7 @@ public interface ISarModelTreeService extends IService<SarModelTree> {
|
|||||||
List<SarModelTree> getAll(SarModelTree sarModelTree);
|
List<SarModelTree> getAll(SarModelTree sarModelTree);
|
||||||
|
|
||||||
List<SarModelTree> recursionGetChildren(SarModelTree parent);
|
List<SarModelTree> recursionGetChildren(SarModelTree parent);
|
||||||
|
|
||||||
|
public ResponseDto syncModelTreeDataToDB(String json);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -14,4 +14,5 @@ public interface ISarModuleTreeService {
|
|||||||
|
|
||||||
public Head analysisJsonAndStorage(String json);
|
public Head analysisJsonAndStorage(String json);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+271
-2
@@ -1,16 +1,29 @@
|
|||||||
package com.adc.da.slrs.sarModelTree.service.impl;
|
package com.adc.da.slrs.sarModelTree.service.impl;
|
||||||
|
|
||||||
import com.adc.da.slrs.sarModelTree.entity.SarModelTree;
|
import com.adc.da.slrs.sarModelTree.entity.*;
|
||||||
import com.adc.da.slrs.sarModelTree.dao.SarModelTreeDao;
|
import com.adc.da.slrs.sarModelTree.dao.SarModelTreeDao;
|
||||||
import com.adc.da.slrs.sarModelTree.service.ISarModelTreeService;
|
import com.adc.da.slrs.sarModelTree.service.ISarModelTreeService;
|
||||||
|
import com.adc.da.slrs.sarStandProjectLibrary.entity.myResponse.Head;
|
||||||
|
import com.adc.da.slrs.sarStandProjectLibrary.entity.myResponse.ResponseDto;
|
||||||
|
import com.adc.da.util.UUIDUtils;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -23,6 +36,8 @@ import java.util.stream.Stream;
|
|||||||
@Service
|
@Service
|
||||||
public class SarModelTreeServiceImpl extends ServiceImpl<SarModelTreeDao, SarModelTree> implements ISarModelTreeService {
|
public class SarModelTreeServiceImpl extends ServiceImpl<SarModelTreeDao, SarModelTree> implements ISarModelTreeService {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(SarModelTreeServiceImpl.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有菜单
|
* 查询所有菜单
|
||||||
* @param sarModelTree
|
* @param sarModelTree
|
||||||
@@ -94,4 +109,258 @@ public class SarModelTreeServiceImpl extends ServiceImpl<SarModelTreeDao, SarMod
|
|||||||
|
|
||||||
return collect;
|
return collect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = {RuntimeException.class,Exception.class})
|
||||||
|
@Override
|
||||||
|
public ResponseDto syncModelTreeDataToDB(String json){
|
||||||
|
|
||||||
|
String rootId = "10000";
|
||||||
|
String rootPID = "根节点";
|
||||||
|
|
||||||
|
Head head = new Head();
|
||||||
|
//构建返回的结果
|
||||||
|
List<ResponseResult> resultList = new ArrayList<>();
|
||||||
|
try{
|
||||||
|
//把字符串转换成对象
|
||||||
|
JsonObject parse = JsonParser.parseString(json).getAsJsonObject();
|
||||||
|
//要把jsonObject里的HEAD强转成JsonObject类型
|
||||||
|
JsonObject HEAD = (JsonObject) parse.get("HEAD");
|
||||||
|
//因为是最后要取的值了,所以就拿到之后把它转换成String类型
|
||||||
|
HEAD.get("CONSUMER").getAsString();
|
||||||
|
//构建head头信息
|
||||||
|
head.setBIZTRANSACTIONID(HEAD.get("BIZTRANSACTIONID").getAsString());
|
||||||
|
|
||||||
|
//获取json中的list
|
||||||
|
JsonArray list = (JsonArray)parse.get("LIST");
|
||||||
|
Gson gson = new Gson();
|
||||||
|
List<SarModuleTree> moduleTreeList = new LinkedList<>();
|
||||||
|
|
||||||
|
AtomicInteger successCount = new AtomicInteger();
|
||||||
|
|
||||||
|
list.forEach(item->{
|
||||||
|
JsonObject objectJson=(JsonObject) item;
|
||||||
|
SarModuleTree sarModuleTree = gson.fromJson(objectJson, SarModuleTree.class);
|
||||||
|
//返回结果集
|
||||||
|
|
||||||
|
String pName = sarModuleTree.getFtvstype1();
|
||||||
|
String p2Name = sarModuleTree.getFtvstype2();
|
||||||
|
String p3Name = sarModuleTree.getFtvstype3();
|
||||||
|
String p4Name = sarModuleTree.getFtvstype4();
|
||||||
|
String p5Name = sarModuleTree.getFtvstype5();
|
||||||
|
String p6Name = sarModuleTree.getFtvstype6();
|
||||||
|
String jgysName = sarModuleTree.getFtvstype9();
|
||||||
|
String modelType = sarModuleTree.getProductType();
|
||||||
|
if(StringUtils.equals(modelType,"f0_mssg")){
|
||||||
|
modelType ="TRUCK";//卡车类
|
||||||
|
}else{
|
||||||
|
modelType ="CAR";//乘用车类
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(pName)){
|
||||||
|
QueryWrapper<SarModelTree> queryP1Wrapper = new QueryWrapper<>();
|
||||||
|
queryP1Wrapper.eq("NAME",pName);
|
||||||
|
queryP1Wrapper.eq("MODEL_TYPE",modelType);
|
||||||
|
queryP1Wrapper.eq("MODEL_LEVEL",1);
|
||||||
|
queryP1Wrapper.eq("MODEL_PID",rootId);
|
||||||
|
queryP1Wrapper.eq("DEL_FLAG","1");
|
||||||
|
List<SarModelTree> p1TreeDataList = this.baseMapper.selectList(queryP1Wrapper);
|
||||||
|
SarModelTree p1TreeData = null;
|
||||||
|
if (p1TreeDataList !=null && !p1TreeDataList.isEmpty()) {
|
||||||
|
p1TreeData = p1TreeDataList.get(0);
|
||||||
|
p1TreeData.setModel(pName);
|
||||||
|
p1TreeData.setModelLevel(1);
|
||||||
|
p1TreeData.setModelPid(rootId);
|
||||||
|
p1TreeData.setModelType(modelType);
|
||||||
|
p1TreeData.setName(pName);
|
||||||
|
p1TreeData.setPid(rootPID);
|
||||||
|
p1TreeData.setDelFlag("1");
|
||||||
|
p1TreeData.setHasChildren("1");
|
||||||
|
this.baseMapper.updateById(p1TreeData);
|
||||||
|
}else{
|
||||||
|
p1TreeData = new SarModelTree();
|
||||||
|
p1TreeData.setId(UUIDUtils.randomUUID(20));
|
||||||
|
p1TreeData.setModel(pName);
|
||||||
|
p1TreeData.setModelLevel(1);
|
||||||
|
p1TreeData.setModelPid(rootId);
|
||||||
|
p1TreeData.setModelType(modelType);
|
||||||
|
p1TreeData.setName(pName);
|
||||||
|
p1TreeData.setPid(rootPID);
|
||||||
|
p1TreeData.setDelFlag("1");
|
||||||
|
p1TreeData.setHasChildren("1");
|
||||||
|
this.baseMapper.insert(p1TreeData);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtils.isNotBlank(p2Name)){
|
||||||
|
QueryWrapper<SarModelTree> queryP2Wrapper = new QueryWrapper<>();
|
||||||
|
queryP2Wrapper.eq("NAME",pName);
|
||||||
|
queryP2Wrapper.eq("MODEL_TYPE",modelType);
|
||||||
|
queryP2Wrapper.eq("MODEL_LEVEL",1);
|
||||||
|
queryP2Wrapper.eq("MODEL_PID",rootId);
|
||||||
|
queryP2Wrapper.eq("DEL_FLAG","1");
|
||||||
|
List<SarModelTree> p2TreeDataList = this.baseMapper.selectList(queryP2Wrapper);
|
||||||
|
SarModelTree p2TreeData = null;
|
||||||
|
if (p2TreeDataList !=null && !p2TreeDataList.isEmpty()) {
|
||||||
|
p2TreeData = p2TreeDataList.get(0);
|
||||||
|
p2TreeData.setModel(p3Name);
|
||||||
|
p2TreeData.setModelLevel(2);
|
||||||
|
p2TreeData.setModelPid(p1TreeData.getId());
|
||||||
|
p2TreeData.setModelType(modelType);
|
||||||
|
p2TreeData.setName(p2Name);
|
||||||
|
p2TreeData.setPid(p1TreeData.getName());
|
||||||
|
p2TreeData.setDelFlag("1");
|
||||||
|
p2TreeData.setHasChildren("1");
|
||||||
|
this.baseMapper.updateById(p2TreeData);
|
||||||
|
}else{
|
||||||
|
p2TreeData = new SarModelTree();
|
||||||
|
p2TreeData.setId(UUIDUtils.randomUUID(20));
|
||||||
|
p2TreeData.setModel(p3Name);
|
||||||
|
p2TreeData.setModelLevel(2);
|
||||||
|
p2TreeData.setModelPid(p1TreeData.getId());
|
||||||
|
p2TreeData.setModelType(modelType);
|
||||||
|
p2TreeData.setName(p2Name);
|
||||||
|
p2TreeData.setPid(p1TreeData.getName());
|
||||||
|
p2TreeData.setDelFlag("1");
|
||||||
|
p2TreeData.setHasChildren("1");
|
||||||
|
this.baseMapper.insert(p2TreeData);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtils.isNotBlank(p3Name)){
|
||||||
|
QueryWrapper<SarModelTree> queryP3Wrapper = new QueryWrapper<>();
|
||||||
|
queryP3Wrapper.eq("NAME",pName);
|
||||||
|
queryP3Wrapper.eq("MODEL_TYPE",modelType);
|
||||||
|
queryP3Wrapper.eq("MODEL_LEVEL",1);
|
||||||
|
queryP3Wrapper.eq("MODEL_PID",rootId);
|
||||||
|
queryP3Wrapper.eq("DEL_FLAG","1");
|
||||||
|
List<SarModelTree> p3TreeDataList = this.baseMapper.selectList(queryP3Wrapper);
|
||||||
|
SarModelTree p3TreeData = null;
|
||||||
|
|
||||||
|
if (p3TreeDataList !=null && !p3TreeDataList.isEmpty()) {
|
||||||
|
p3TreeData = p3TreeDataList.get(0);
|
||||||
|
p3TreeData.setModel(p4Name);
|
||||||
|
p3TreeData.setModelLevel(3);
|
||||||
|
p3TreeData.setModelPid(p2TreeData.getId());
|
||||||
|
p3TreeData.setModelType(modelType);
|
||||||
|
p3TreeData.setName(p4Name);
|
||||||
|
p3TreeData.setPid(p2TreeData.getName());
|
||||||
|
p3TreeData.setDelFlag("1");
|
||||||
|
p3TreeData.setHasChildren("1");
|
||||||
|
this.baseMapper.updateById(p3TreeData);
|
||||||
|
}else{
|
||||||
|
p3TreeData = new SarModelTree();
|
||||||
|
p3TreeData.setId(UUIDUtils.randomUUID(20));
|
||||||
|
p3TreeData.setModel(p4Name);
|
||||||
|
p3TreeData.setModelLevel(3);
|
||||||
|
p3TreeData.setModelPid(p2TreeData.getId());
|
||||||
|
p3TreeData.setModelType(modelType);
|
||||||
|
p3TreeData.setName(p4Name);
|
||||||
|
p3TreeData.setPid(p2TreeData.getName());
|
||||||
|
p3TreeData.setDelFlag("1");
|
||||||
|
p3TreeData.setHasChildren("1");
|
||||||
|
this.baseMapper.insert(p3TreeData);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtils.isNotBlank(p4Name)){
|
||||||
|
QueryWrapper<SarModelTree> queryP4Wrapper = new QueryWrapper<>();
|
||||||
|
queryP4Wrapper.eq("NAME",pName);
|
||||||
|
queryP4Wrapper.eq("MODEL_TYPE",modelType);
|
||||||
|
queryP4Wrapper.eq("MODEL_LEVEL",1);
|
||||||
|
queryP4Wrapper.eq("MODEL_PID",rootId);
|
||||||
|
queryP4Wrapper.eq("DEL_FLAG","1");
|
||||||
|
List<SarModelTree> p4TreeDataList = this.baseMapper.selectList(queryP4Wrapper);
|
||||||
|
SarModelTree p4TreeData = null;
|
||||||
|
|
||||||
|
if (p4TreeDataList !=null && !p4TreeDataList.isEmpty()) {
|
||||||
|
p4TreeData = p4TreeDataList.get(0);
|
||||||
|
p4TreeData.setModel(p5Name);
|
||||||
|
p4TreeData.setModelLevel(4);
|
||||||
|
p4TreeData.setModelPid(p3TreeData.getId());
|
||||||
|
p4TreeData.setModelType(modelType);
|
||||||
|
p4TreeData.setName(p5Name);
|
||||||
|
p4TreeData.setPid(p3TreeData.getName());
|
||||||
|
p4TreeData.setDelFlag("1");
|
||||||
|
p4TreeData.setHasChildren("1");
|
||||||
|
this.baseMapper.updateById(p4TreeData);
|
||||||
|
}else{
|
||||||
|
p4TreeData = new SarModelTree();
|
||||||
|
p4TreeData.setId(UUIDUtils.randomUUID(20));
|
||||||
|
p4TreeData.setModel(p5Name);
|
||||||
|
p4TreeData.setModelLevel(4);
|
||||||
|
p4TreeData.setModelPid(p3TreeData.getId());
|
||||||
|
p4TreeData.setModelType(modelType);
|
||||||
|
p4TreeData.setName(p5Name);
|
||||||
|
p4TreeData.setPid(p3TreeData.getName());
|
||||||
|
p4TreeData.setDelFlag("1");
|
||||||
|
p4TreeData.setHasChildren("1");
|
||||||
|
this.baseMapper.insert(p4TreeData);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtils.isNotBlank(p5Name)){
|
||||||
|
QueryWrapper<SarModelTree> queryP5Wrapper = new QueryWrapper<>();
|
||||||
|
queryP5Wrapper.eq("NAME",pName);
|
||||||
|
queryP5Wrapper.eq("MODEL_TYPE",modelType);
|
||||||
|
queryP5Wrapper.eq("MODEL_LEVEL",1);
|
||||||
|
queryP5Wrapper.eq("MODEL_PID",rootId);
|
||||||
|
queryP5Wrapper.eq("DEL_FLAG","1");
|
||||||
|
List<SarModelTree> p5TreeDataList = this.baseMapper.selectList(queryP5Wrapper);
|
||||||
|
SarModelTree p5TreeData = null;
|
||||||
|
|
||||||
|
if (p5TreeDataList !=null && !p5TreeDataList.isEmpty()) {
|
||||||
|
p5TreeData = p5TreeDataList.get(0);
|
||||||
|
p5TreeData.setModel(p6Name);
|
||||||
|
p5TreeData.setModelLevel(5);
|
||||||
|
p5TreeData.setModelPid(p4TreeData.getId());
|
||||||
|
p5TreeData.setModelType(modelType);
|
||||||
|
p5TreeData.setName(p6Name);
|
||||||
|
p5TreeData.setPid(p4TreeData.getName());
|
||||||
|
p5TreeData.setFeatures(jgysName);
|
||||||
|
p5TreeData.setDelFlag("1");
|
||||||
|
p5TreeData.setHasChildren("1");
|
||||||
|
this.baseMapper.updateById(p5TreeData);
|
||||||
|
}else{
|
||||||
|
p5TreeData = new SarModelTree();
|
||||||
|
p5TreeData.setId(UUIDUtils.randomUUID(20));
|
||||||
|
p5TreeData.setModel(p6Name);
|
||||||
|
p5TreeData.setModelLevel(5);
|
||||||
|
p5TreeData.setModelPid(p4TreeData.getId());
|
||||||
|
p5TreeData.setModelType(modelType);
|
||||||
|
p5TreeData.setName(p6Name);
|
||||||
|
p5TreeData.setPid(p4TreeData.getName());
|
||||||
|
p5TreeData.setFeatures(jgysName);
|
||||||
|
p5TreeData.setDelFlag("1");
|
||||||
|
p5TreeData.setHasChildren("1");
|
||||||
|
this.baseMapper.insert(p5TreeData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
successCount.getAndIncrement();
|
||||||
|
});
|
||||||
|
head.setERRORCODE("0");
|
||||||
|
head.setRESULT("成功");
|
||||||
|
ResponseResult returnData = new ResponseResult();
|
||||||
|
returnData.setGUID("-1");
|
||||||
|
returnData.setMESSAGE("");
|
||||||
|
returnData.setSTATUS("S");
|
||||||
|
resultList.add(returnData);
|
||||||
|
ResponseDto dto = new ResponseDto(head,resultList);
|
||||||
|
return dto;
|
||||||
|
}catch (Exception ex){
|
||||||
|
logger.error(ex.getMessage(),ex);
|
||||||
|
head.setERRORCODE("2");
|
||||||
|
head.setRESULT("业务失败需要重做");
|
||||||
|
ResponseResult returnData = new ResponseResult();
|
||||||
|
returnData.setGUID("-1");
|
||||||
|
returnData.setMESSAGE("数据写入过程中发生错误,需重新推送");
|
||||||
|
returnData.setSTATUS("E");
|
||||||
|
resultList.add(returnData);
|
||||||
|
ResponseDto dto = new ResponseDto(head,resultList);
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -128,7 +128,7 @@ public class SarModuleTreeServiceImpl extends ServiceImpl<SarModuleTreeDao, SarM
|
|||||||
sarModuleTree.setGuid(UUIDUtils.randomUUID20());
|
sarModuleTree.setGuid(UUIDUtils.randomUUID20());
|
||||||
moduleTreeList.add(sarModuleTree);
|
moduleTreeList.add(sarModuleTree);
|
||||||
});
|
});
|
||||||
|
//此处
|
||||||
|
|
||||||
//进行全量覆盖即删除表中所有数据,之后插入新的数据
|
//进行全量覆盖即删除表中所有数据,之后插入新的数据
|
||||||
sarModuleTreeService.remove(null);
|
sarModuleTreeService.remove(null);
|
||||||
@@ -145,6 +145,9 @@ public class SarModuleTreeServiceImpl extends ServiceImpl<SarModuleTreeDao, SarM
|
|||||||
return head;
|
return head;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 把SarModuleTree类型的list集合转换为SarModelTree类型的list集合,这样就不用修改前端代码( •̀ ω •́ )✧
|
* 把SarModuleTree类型的list集合转换为SarModelTree类型的list集合,这样就不用修改前端代码( •̀ ω •́ )✧
|
||||||
* --->对修改关闭,对扩展开放
|
* --->对修改关闭,对扩展开放
|
||||||
|
|||||||
@@ -51,6 +51,12 @@ public interface TsPositionDao extends BaseMapper<TsPosition> {
|
|||||||
*/
|
*/
|
||||||
List<TsRole> getRole(String positionId);
|
List<TsRole> getRole(String positionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID获取岗位信息
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TsPosition> getPositionDataByUserId(@Param("userId") String userId);
|
||||||
/**
|
/**
|
||||||
* 查询岗位以及绑定的角色信息
|
* 查询岗位以及绑定的角色信息
|
||||||
* @param tsPosition:岗位信息
|
* @param tsPosition:岗位信息
|
||||||
|
|||||||
@@ -40,6 +40,12 @@ public interface ITsPositionService extends IService<TsPosition> {
|
|||||||
*/
|
*/
|
||||||
List<TsRole> getRole(String positionId);
|
List<TsRole> getRole(String positionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID获取岗位信息
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TsPosition> getPositionDataByUserId(String userId);
|
||||||
/**
|
/**
|
||||||
* 添加岗位
|
* 添加岗位
|
||||||
* @param tsPosition:岗位信息
|
* @param tsPosition:岗位信息
|
||||||
|
|||||||
+10
@@ -108,6 +108,16 @@ public class TsPositionServiceImpl extends ServiceImpl<TsPositionDao, TsPosition
|
|||||||
return tsPositionDao.getRole(positionId);
|
return tsPositionDao.getRole(positionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID获取岗位信息
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<TsPosition> getPositionDataByUserId(String userId) {
|
||||||
|
return tsPositionDao.getPositionDataByUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加岗位
|
* 添加岗位
|
||||||
* @param tsPosition:岗位信息
|
* @param tsPosition:岗位信息
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ public interface TsUserDao extends BaseMapper<TsUser> {
|
|||||||
@Select("select position_id from ts_user_position where user_id=#{userId}")
|
@Select("select position_id from ts_user_position where user_id=#{userId}")
|
||||||
List<String> selectPositionIds(String userId);
|
List<String> selectPositionIds(String userId);
|
||||||
|
|
||||||
|
@Update("UPDATE ts_user SET SYS_POSITION_IDS =#{positionIds} WHERE USID = #{userId}")
|
||||||
|
void updateUserPositionIds(@Param("userId") String userId,@Param("positionIds")String positionIds);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加岗位
|
* 添加岗位
|
||||||
* @param userId:用户ID
|
* @param userId:用户ID
|
||||||
|
|||||||
@@ -138,6 +138,10 @@ public class TsUser extends BaseEntity {
|
|||||||
@TableField("SSO_ID")
|
@TableField("SSO_ID")
|
||||||
private String ssoId;
|
private String ssoId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "系统设置岗位ID集合")
|
||||||
|
@TableField("SYS_POSITION_IDS")
|
||||||
|
private String sysPositionIds;
|
||||||
|
|
||||||
@ApiModelProperty(value = "岗位")
|
@ApiModelProperty(value = "岗位")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<TsPosition> positions;
|
private List<TsPosition> positions;
|
||||||
|
|||||||
+62
-38
@@ -28,6 +28,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -135,8 +136,16 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
|
|||||||
if(tsUser==null){
|
if(tsUser==null){
|
||||||
return Result.error("该用户不存在");
|
return Result.error("该用户不存在");
|
||||||
}
|
}
|
||||||
|
//此处更新user表中的岗位字段
|
||||||
|
List<String> positionIds = userPositionVO.getPositionIds();
|
||||||
|
positionIds.removeIf(s -> null==s||""==s);
|
||||||
|
String optionsIdStr = StringUtils.join(positionIds, ",");
|
||||||
|
if(StringUtils.isBlank(optionsIdStr)){
|
||||||
|
optionsIdStr = null;
|
||||||
|
}
|
||||||
|
tsUserDao.updateUserPositionIds(userPositionVO.getUserId(),optionsIdStr);
|
||||||
List<String> oldPositionIds=tsUserDao.selectPositionIds(userPositionVO.getUserId());
|
List<String> oldPositionIds=tsUserDao.selectPositionIds(userPositionVO.getUserId());
|
||||||
Map<String,List<String>> ids= ListUtil.difList(userPositionVO.getPositionIds(),oldPositionIds);
|
Map<String,List<String>> ids= ListUtil.difList(positionIds,oldPositionIds);
|
||||||
List<String> insertIds=ids.get("insert");
|
List<String> insertIds=ids.get("insert");
|
||||||
List<String> deleteIds=ids.get("delete");
|
List<String> deleteIds=ids.get("delete");
|
||||||
if(insertIds!=null&&insertIds.size()>0){
|
if(insertIds!=null&&insertIds.size()>0){
|
||||||
@@ -163,7 +172,13 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
|
|||||||
public ResponseMessage<Object> setPositionBatch(UserPositionBatchVO userPositionVO2) {
|
public ResponseMessage<Object> setPositionBatch(UserPositionBatchVO userPositionVO2) {
|
||||||
|
|
||||||
boolean flag=true;
|
boolean flag=true;
|
||||||
|
//此处更新user表中的岗位字段
|
||||||
|
List<String> positionIds = userPositionVO2.getPositionIds();
|
||||||
|
positionIds.removeIf(s -> null==s||""==s);
|
||||||
|
String optionsIdStr = StringUtils.join(positionIds, ",");
|
||||||
|
if(StringUtils.isBlank(optionsIdStr)){
|
||||||
|
optionsIdStr = null;
|
||||||
|
}
|
||||||
for (String s:userPositionVO2.getUserId()) {
|
for (String s:userPositionVO2.getUserId()) {
|
||||||
UserPositionVO userPositionVO=new UserPositionVO();
|
UserPositionVO userPositionVO=new UserPositionVO();
|
||||||
userPositionVO.setUserId(s);
|
userPositionVO.setUserId(s);
|
||||||
@@ -171,9 +186,11 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
|
|||||||
TsUser tsUser=tsUserDao.selectById(userPositionVO.getUserId());
|
TsUser tsUser=tsUserDao.selectById(userPositionVO.getUserId());
|
||||||
if(tsUser==null){
|
if(tsUser==null){
|
||||||
flag=false;
|
flag=false;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
tsUserDao.updateUserPositionIds(userPositionVO.getUserId(),optionsIdStr);
|
||||||
List<String> oldPositionIds=tsUserDao.selectPositionIds(userPositionVO.getUserId());
|
List<String> oldPositionIds=tsUserDao.selectPositionIds(userPositionVO.getUserId());
|
||||||
Map<String,List<String>> ids= ListUtil.difList(userPositionVO.getPositionIds(),oldPositionIds);
|
Map<String,List<String>> ids= ListUtil.difList(positionIds,oldPositionIds);
|
||||||
List<String> insertIds=ids.get("insert");
|
List<String> insertIds=ids.get("insert");
|
||||||
List<String> deleteIds=ids.get("delete");
|
List<String> deleteIds=ids.get("delete");
|
||||||
if(insertIds!=null&&insertIds.size()>0){
|
if(insertIds!=null&&insertIds.size()>0){
|
||||||
@@ -210,6 +227,13 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
|
|||||||
List<String> middle=new ArrayList<>();
|
List<String> middle=new ArrayList<>();
|
||||||
middle.addAll(orgIds);
|
middle.addAll(orgIds);
|
||||||
boolean Orgflag=true;
|
boolean Orgflag=true;
|
||||||
|
//此处更新user表中的岗位字段
|
||||||
|
List<String> positionIds = userPositionVO2.getPositionIds();
|
||||||
|
positionIds.removeIf(s -> null==s||""==s);
|
||||||
|
String optionsIdStr = StringUtils.join(positionIds, ",");
|
||||||
|
if(StringUtils.isBlank(optionsIdStr)){
|
||||||
|
optionsIdStr = null;
|
||||||
|
}
|
||||||
while (Orgflag){
|
while (Orgflag){
|
||||||
QueryWrapper<TsInstitution> queryWrapper=new QueryWrapper<>();
|
QueryWrapper<TsInstitution> queryWrapper=new QueryWrapper<>();
|
||||||
queryWrapper.in("parent_id",middle);
|
queryWrapper.in("parent_id",middle);
|
||||||
@@ -234,25 +258,23 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
|
|||||||
|
|
||||||
for (TsUser user : allUsers) {
|
for (TsUser user : allUsers) {
|
||||||
String userId = user.getUserId();
|
String userId = user.getUserId();
|
||||||
UserPositionVO userPositionVO=new UserPositionVO();
|
TsUser tsUser=tsUserDao.selectById(userId);
|
||||||
userPositionVO.setUserId(userId);
|
|
||||||
userPositionVO.setPositionIds(userPositionVO2.getPositionIds());
|
|
||||||
TsUser tsUser=tsUserDao.selectById(userPositionVO.getUserId());
|
|
||||||
if(tsUser==null){
|
if(tsUser==null){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
List<String> oldPositionIds=tsUserDao.selectPositionIds(userPositionVO.getUserId());
|
tsUserDao.updateUserPositionIds(userId,optionsIdStr);
|
||||||
Map<String,List<String>> ids= ListUtil.difList(userPositionVO.getPositionIds(),oldPositionIds);
|
List<String> oldPositionIds=tsUserDao.selectPositionIds(userId);
|
||||||
|
Map<String,List<String>> ids= ListUtil.difList(positionIds,oldPositionIds);
|
||||||
List<String> insertIds=ids.get("insert");
|
List<String> insertIds=ids.get("insert");
|
||||||
List<String> deleteIds=ids.get("delete");
|
List<String> deleteIds=ids.get("delete");
|
||||||
if(insertIds!=null&&insertIds.size()>0){
|
if(insertIds!=null&&insertIds.size()>0){
|
||||||
for(String positionId:insertIds){
|
for(String positionId:insertIds){
|
||||||
tsUserDao.addPosition(userPositionVO.getUserId(),positionId);
|
tsUserDao.addPosition(userId,positionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(deleteIds!=null&&deleteIds.size()>0){
|
if(deleteIds!=null&&deleteIds.size()>0){
|
||||||
for(String positionId:deleteIds){
|
for(String positionId:deleteIds){
|
||||||
tsUserDao.delPosition(userPositionVO.getUserId(),positionId);
|
tsUserDao.delPosition(userId,positionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -459,42 +481,44 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
|
|||||||
@Override
|
@Override
|
||||||
public IPage<TsUser> getAllUsers(TsUser tsUser) {
|
public IPage<TsUser> getAllUsers(TsUser tsUser) {
|
||||||
List<String> ids=new ArrayList<>();
|
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<TsInstitution> queryWrapper=new QueryWrapper<>();
|
||||||
queryWrapper.like("parent_id",tsUser.getInstitutionId());
|
queryWrapper.in("parent_id",middle);
|
||||||
List<TsInstitution> tsmiddle=tsInstitutionService.list(queryWrapper);
|
List<TsInstitution> tsmiddle=tsInstitutionService.list(queryWrapper);
|
||||||
if(tsmiddle!=null && !tsmiddle.isEmpty()){
|
if (tsmiddle.size()>0){
|
||||||
tsmiddle.forEach(tsInstitution -> {
|
tsmiddle.forEach(tsInstitution -> {
|
||||||
ids.add(tsInstitution.getId());
|
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;
|
||||||
}
|
}
|
||||||
// List<String> middle=new ArrayList<>();
|
}
|
||||||
// middle.addAll(ids);
|
ids.removeIf(s -> null==s);
|
||||||
// boolean flag=true;
|
List<TsUser> tsUsers = tsUserDao.userUnderInstitution((tsUser.getCurrent() - 1) * tsUser.getSize(), tsUser.getSize(), tsUser, ids);
|
||||||
// while (flag){
|
if(tsUsers!=null && !tsUsers.isEmpty()){
|
||||||
// QueryWrapper<TsInstitution> queryWrapper=new QueryWrapper<>();
|
for (TsUser user:tsUsers) {
|
||||||
// queryWrapper.in("parent_id",middle);
|
List<TsPosition> positionList = tsPositionService.getPositionDataByUserId(user.getUserId());
|
||||||
// List<TsInstitution> tsmiddle=tsInstitutionService.list(queryWrapper);
|
user.setPositions(positionList);
|
||||||
// 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;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// ids.removeIf(s -> null==s);
|
|
||||||
Page<TsUser> tsUserPage = new Page<>();
|
Page<TsUser> tsUserPage = new Page<>();
|
||||||
tsUserPage.setCurrent(tsUser.getCurrent());
|
tsUserPage.setCurrent(tsUser.getCurrent());
|
||||||
tsUserPage.setSize(tsUser.getSize());
|
tsUserPage.setSize(tsUser.getSize());
|
||||||
tsUserPage.setRecords(tsUserDao.userUnderInstitution((tsUser.getCurrent()-1)*tsUser.getSize(),tsUser.getSize(),tsUser,ids));
|
tsUserPage.setRecords(tsUsers);
|
||||||
tsUserPage.setTotal(tsUserDao.userUnderInstitutionCount(tsUser,ids));
|
tsUserPage.setTotal(tsUserDao.userUnderInstitutionCount(tsUser,ids));
|
||||||
|
|
||||||
return tsUserPage;
|
return tsUserPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
<result property="uname" column="UNAME"/>
|
<result property="uname" column="UNAME"/>
|
||||||
</collection>
|
</collection>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="getRole" resultType="com.adc.da.slrs.sarRole.entity.TsRole">
|
<select id="getRole" resultType="com.adc.da.slrs.sarRole.entity.TsRole">
|
||||||
select * from ts_role r
|
select * from ts_role r
|
||||||
left join ts_position_role ps
|
left join ts_position_role ps
|
||||||
@@ -24,6 +25,12 @@
|
|||||||
where ps.position_id=#{positionId}
|
where ps.position_id=#{positionId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getPositionDataByUserId" resultType="com.adc.da.slrs.sarPosition.entity.TsPosition">
|
||||||
|
SELECT id,name FROM ts_position
|
||||||
|
LEFT JOIN ts_user_position ON ts_position.id = ts_user_position.position_id
|
||||||
|
WHERE ts_user_position.user_id =#{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectPositionAndRole" resultMap="PositionAndRole">
|
<select id="selectPositionAndRole" resultMap="PositionAndRole">
|
||||||
select p.*,r.id rid,r.name r_name ,tu.UNAME as UNAME from ts_position p
|
select p.*,r.id rid,r.name r_name ,tu.UNAME as UNAME from ts_position p
|
||||||
left join ts_position_role pr
|
left join ts_position_role pr
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
<result property="unlockFlag" column="unlock_flag"/>
|
<result property="unlockFlag" column="unlock_flag"/>
|
||||||
<result property="userType" column="user_type"/>
|
<result property="userType" column="user_type"/>
|
||||||
<result property="ssoId" column="sso_id"/>
|
<result property="ssoId" column="sso_id"/>
|
||||||
|
<result property="sysPositionIds" column="sys_position_ids"/>
|
||||||
<collection property="positions" ofType="com.adc.da.slrs.sarPosition.entity.TsPosition">
|
<collection property="positions" ofType="com.adc.da.slrs.sarPosition.entity.TsPosition">
|
||||||
<result property="id" column="p_id"/>
|
<result property="id" column="p_id"/>
|
||||||
<result property="name" column="p_name"/>
|
<result property="name" column="p_name"/>
|
||||||
@@ -51,12 +52,8 @@
|
|||||||
<select id="getUserUnderInstitutionAll" resultMap="UserPosition">
|
<select id="getUserUnderInstitutionAll" resultMap="UserPosition">
|
||||||
select u.USID,u.ACCOUNT,u.PASSWORD,u.OPER_USER,u.UNAME,u.SEX,u.USER_SOURCE,u.PHONE,u.EMAIL,u.INSTITUTION_NAME,u.INSTITUTION_ID
|
select u.USID,u.ACCOUNT,u.PASSWORD,u.OPER_USER,u.UNAME,u.SEX,u.USER_SOURCE,u.PHONE,u.EMAIL,u.INSTITUTION_NAME,u.INSTITUTION_ID
|
||||||
,u.POSITION_NAME,u.STATE,u.POSITION_ID,u.WORK_NUM,u.EXT_INFO,u.CREATION_TIME,u.MODIFY_TIME,u.VALID_FLAG
|
,u.POSITION_NAME,u.STATE,u.POSITION_ID,u.WORK_NUM,u.EXT_INFO,u.CREATION_TIME,u.MODIFY_TIME,u.VALID_FLAG
|
||||||
,u.DISABLE_FLAG,u.UNLOCK_FLAG,u.USER_TYPE,u.SSO_ID,
|
,u.DISABLE_FLAG,u.UNLOCK_FLAG,u.USER_TYPE,u.SSO_ID,u.SYS_POSITION_IDS
|
||||||
p.id p_id,p.name p_name from ts_user u
|
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
|
where 1=1
|
||||||
<if test=" null != ids and ids.size()> 0">
|
<if test=" null != ids and ids.size()> 0">
|
||||||
and INSTITUTION_ID in
|
and INSTITUTION_ID in
|
||||||
@@ -76,12 +73,7 @@
|
|||||||
<select id="userUnderInstitution" parameterType="com.adc.da.slrs.sarUser.entity.TsUser" resultMap="UserPosition">
|
<select id="userUnderInstitution" parameterType="com.adc.da.slrs.sarUser.entity.TsUser" resultMap="UserPosition">
|
||||||
select u.USID,u.ACCOUNT,u.PASSWORD,u.OPER_USER,u.UNAME,u.SEX,u.USER_SOURCE,u.PHONE,u.EMAIL,u.INSTITUTION_NAME,u.INSTITUTION_ID
|
select u.USID,u.ACCOUNT,u.PASSWORD,u.OPER_USER,u.UNAME,u.SEX,u.USER_SOURCE,u.PHONE,u.EMAIL,u.INSTITUTION_NAME,u.INSTITUTION_ID
|
||||||
,u.POSITION_NAME,u.STATE,u.POSITION_ID,u.WORK_NUM,u.EXT_INFO,u.CREATION_TIME,u.MODIFY_TIME,u.VALID_FLAG
|
,u.POSITION_NAME,u.STATE,u.POSITION_ID,u.WORK_NUM,u.EXT_INFO,u.CREATION_TIME,u.MODIFY_TIME,u.VALID_FLAG
|
||||||
,u.DISABLE_FLAG,u.UNLOCK_FLAG,u.USER_TYPE,u.SSO_ID,
|
,u.DISABLE_FLAG,u.UNLOCK_FLAG,u.USER_TYPE,u.SSO_ID,u.SYS_POSITION_IDS from ts_user 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
|
where 1=1
|
||||||
<if test="TsUser.uname != null and TsUser.uname != '' ">
|
<if test="TsUser.uname != null and TsUser.uname != '' ">
|
||||||
and (u.uname like concat('%',#{TsUser.uname},'%') or u.ACCOUNT like concat(#{TsUser.uname},'%'))
|
and (u.uname like concat('%',#{TsUser.uname},'%') or u.ACCOUNT like concat(#{TsUser.uname},'%'))
|
||||||
@@ -90,21 +82,17 @@
|
|||||||
and u.email like concat('%',#{TsUser.email},'%')
|
and u.email like concat('%',#{TsUser.email},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test=" null != ids and ids.size()> 0">
|
<if test=" null != ids and ids.size()> 0">
|
||||||
and INSTITUTION_ID in
|
and u.INSTITUTION_ID in
|
||||||
<foreach item="id" collection="ids" open="(" separator="," close=")" index="index">
|
<foreach item="id" collection="ids" open="(" separator="," close=")" index="index">
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
ORDER BY p.id is null,p.create_time
|
ORDER BY u.SYS_POSITION_IDS is null,u.USID
|
||||||
limit #{start},#{end}
|
limit #{start},#{end}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="userUnderInstitutionCount" resultType="java.lang.Integer">
|
<select id="userUnderInstitutionCount" resultType="java.lang.Integer">
|
||||||
select count(u.USID) from ts_user u
|
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
|
where 1=1
|
||||||
<if test="TsUser.uname != null and TsUser.uname != '' ">
|
<if test="TsUser.uname != null and TsUser.uname != '' ">
|
||||||
and u.uname like concat('%',#{TsUser.uname},'%')
|
and u.uname like concat('%',#{TsUser.uname},'%')
|
||||||
@@ -113,7 +101,7 @@
|
|||||||
and u.email like concat('%',#{TsUser.email},'%')
|
and u.email like concat('%',#{TsUser.email},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test=" null != ids and ids.size()> 0">
|
<if test=" null != ids and ids.size()> 0">
|
||||||
and INSTITUTION_ID in
|
and u.INSTITUTION_ID in
|
||||||
<foreach item="id" collection="ids" open="(" separator="," close=")" index="index">
|
<foreach item="id" collection="ids" open="(" separator="," close=")" index="index">
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
@@ -122,10 +110,6 @@
|
|||||||
|
|
||||||
<select id="getUserAndPositionCount" parameterType="com.adc.da.slrs.sarUser.entity.TsUser" resultType="java.lang.Integer">
|
<select id="getUserAndPositionCount" parameterType="com.adc.da.slrs.sarUser.entity.TsUser" resultType="java.lang.Integer">
|
||||||
select count(u.USID) from ts_user u
|
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
|
where 1=1
|
||||||
<if test="TsUser.institutionId != null and TsUser.institutionId != '' ">
|
<if test="TsUser.institutionId != null and TsUser.institutionId != '' ">
|
||||||
and u.institution_id=#{TsUser.institutionId}
|
and u.institution_id=#{TsUser.institutionId}
|
||||||
|
|||||||
@@ -441,7 +441,7 @@ public class AttFileEOController {
|
|||||||
String waterContent = userMsg;
|
String waterContent = userMsg;
|
||||||
//2020年9月5日 去掉水印处理
|
//2020年9月5日 去掉水印处理
|
||||||
//2021年7月25日要求下载生成水印
|
//2021年7月25日要求下载生成水印
|
||||||
WaterMarkUtil.waterMark(oldFilePath,waterFilePath,waterContent);
|
WaterMarkUtil.waterMarkNew(oldFilePath,waterFilePath,waterContent);
|
||||||
response.setHeader("Content-Disposition", "attachment;filename=\""+fileOldName+"\"");
|
response.setHeader("Content-Disposition", "attachment;filename=\""+fileOldName+"\"");
|
||||||
response.setContentType("application/octet-stream");
|
response.setContentType("application/octet-stream");
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE `ts_user` ADD COLUMN `SYS_POSITION_IDS` varchar(2000) NULL COMMENT '设置的岗位ID集合' AFTER `SSO_ID`;
|
||||||
Reference in New Issue
Block a user