Merge remote-tracking branch 'origin/dev_third_stage' into dev_third_stage
This commit is contained in:
+1
@@ -53,6 +53,7 @@ public interface IParamsReportDetailEOService extends IService<ParamsReportDetai
|
||||
// 自定义导出-word模板
|
||||
void exportCustomWord(ParamsReportDetailVO paramsReportDetailVO, HttpServletResponse response, HttpServletRequest request);
|
||||
|
||||
// 自定义导出-excel模板
|
||||
void exportCustomExcel(ParamsReportDetailVO paramsReportDetailVO, HttpServletResponse response, HttpServletRequest request);
|
||||
|
||||
}
|
||||
|
||||
+12
-1
@@ -36,11 +36,14 @@ import com.jero.modules.system.service.ISysDictItemService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.hssf.util.HSSFColor;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.xssf.usermodel.*;
|
||||
import org.aspectj.util.FileUtil;
|
||||
import org.docx4j.Docx4J;
|
||||
import org.docx4j.openpackaging.exceptions.Docx4JException;
|
||||
import org.docx4j.openpackaging.packages.SpreadsheetMLPackage;
|
||||
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -795,6 +798,7 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
|
||||
// 查询导出数据
|
||||
List<Map> allParamsInfoList = queryForExportCustom(paramsReportDetailVO);
|
||||
HashMap<String, String> params = (HashMap<String, String>) allParamsInfoList.get(0);
|
||||
List<Map<String, Object>> imgListAll = (List<Map<String, Object>>) allParamsInfoList.get(1).get("imgListAll");
|
||||
|
||||
String templateUrl = "";
|
||||
ParamsExportTemplateEO paramsExportTemplateEO = paramsExportTemplateEOService.getById(paramsReportDetailVO.getExportTemplateId());
|
||||
@@ -820,7 +824,14 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
|
||||
InputStream wordTemplate = CosBootUtil.download(templateUrl);
|
||||
// com.qcloud.cos.utils.IOUtils.copy(wordTemplate, wordOS);
|
||||
|
||||
ExcelUtil.variableReplace(wordTemplate, wordOS, params);
|
||||
// 替换占位符内容
|
||||
// docx4j方式
|
||||
InputStream excelTemplate = CosBootUtil.download(templateUrl);
|
||||
SpreadsheetMLPackage pkg = SpreadsheetMLPackage.load(wordTemplate);
|
||||
Workbook workbook = WorkbookFactory.create(excelTemplate);
|
||||
ExcelUtil.replacePictureBatchPOI(workbook, pkg, imgListAll);
|
||||
ExcelUtil.variableReplace(pkg, params);
|
||||
pkg.save(wordOS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+9
-4
@@ -4770,9 +4770,13 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
|
||||
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String content = sysUser.getUsername() + " pushed " + StringUtils.join(serialNumberList, ",") + " to you. Please be reminded to check it out.";
|
||||
String contentInfo = sysUser.getUsername() + " pushed " + StringUtils.join(hrefList, ",") + " to you. Please be reminded to check it out.";
|
||||
String title = StringUtils.join(serialNumberList, ",") + " has been pushed to you, please check";
|
||||
String content = StringUtils.join(serialNumberList, ",") + " has been shared with you, please be reminded to check it out.";
|
||||
String contentInfo = sysUser.getUsername() + " shared " + StringUtils.join(hrefList, ",") + " with you, please be reminded to check it out.";
|
||||
String title = StringUtils.join(serialNumberList, ",") + " has been shared with you, please check.";
|
||||
// String content = sysUser.getUsername() + " pushed " + StringUtils.join(serialNumberList, ",") + " to you. Please be reminded to check it out.";
|
||||
// String contentInfo = sysUser.getUsername() + " pushed " + StringUtils.join(hrefList, ",") + " to you. Please be reminded to check it out.";
|
||||
// String title = StringUtils.join(serialNumberList, ",") + " has been pushed to you, please check";
|
||||
|
||||
//封装消息的实体类
|
||||
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, title, content, contentInfo,MessageTypeEnum.PUSH.getValue(),MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
|
||||
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
|
||||
@@ -4788,7 +4792,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
list.add(serialNumber);
|
||||
}
|
||||
});
|
||||
String contentTemp = sysUser.getUsername() + " pushed " + StringUtils.join(list, ",") + " to you. Please be reminded to check it out.";
|
||||
String contentTemp = sysUser.getUsername() + " shared " + StringUtils.join(list, ",") + " with you, please be reminded to check it out.";
|
||||
// String contentTemp = sysUser.getUsername() + " pushed " + StringUtils.join(list, ",") + " to you. Please be reminded to check it out.";
|
||||
// FeishuMsgVo feishuMsgVo = getFeishuMsgVo(MessageTypeEnum.PUSH.getName(),null, contentTemp, encode);
|
||||
// iFeishuService.sendCardMsg(thirdIdList.toArray(new String[]{}), feishuMsgVo);
|
||||
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentTemp, MessageTypeEnum.PUSH.getName(), encode);
|
||||
|
||||
+324
-120
@@ -13,7 +13,11 @@ import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl;
|
||||
import com.jero.modules.domain.service.DomainUserRelService;
|
||||
import com.jero.modules.dummy.entity.*;
|
||||
import com.jero.modules.dummy.entity.DummyContentChangeEO;
|
||||
import com.jero.modules.dummy.entity.DummyInventoryBaseEO;
|
||||
import com.jero.modules.dummy.entity.DummyInventoryInfoEO;
|
||||
import com.jero.modules.dummy.entity.DummyLogEO;
|
||||
import com.jero.modules.dummy.entity.DummyReadEO;
|
||||
import com.jero.modules.dummy.enums.DummyInventoryBaseFieldEnum;
|
||||
import com.jero.modules.dummy.enums.InventoryStateEnum;
|
||||
import com.jero.modules.dummy.enums.ReadFlagEnum;
|
||||
@@ -23,7 +27,6 @@ import com.jero.modules.dummy.service.IDummyContentChangeEOService;
|
||||
import com.jero.modules.dummy.service.IDummyInventoryBaseEOService;
|
||||
import com.jero.modules.dummy.service.IDummyInventoryInfoEOService;
|
||||
import com.jero.modules.dummy.service.IDummyReadEOService;
|
||||
import com.jero.modules.dummy.util.ListDiff;
|
||||
import com.jero.modules.dummy.vo.VirtualCreaterVo;
|
||||
import com.jero.modules.feishu.service.IFeishuService;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
@@ -48,7 +51,13 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -351,33 +360,22 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
|
||||
LambdaQueryWrapper<DummyContentChangeEO> wrapper =new LambdaQueryWrapper<>();
|
||||
wrapper.in(DummyContentChangeEO::getConnectId,dummyInventoryBaseEO.getId());
|
||||
List<DummyContentChangeEO> dummyContentChangeEOList = iDummyContentChangeEOService.list(wrapper);
|
||||
//基础数据
|
||||
LambdaQueryWrapper<DummyInventoryBaseEO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(DummyInventoryBaseEO::getId,dummyInventoryBaseEO.getId());
|
||||
List<DummyInventoryBaseEO> dummyInventoryBaseEOList = this.list(queryWrapper);
|
||||
//详情数据
|
||||
LambdaQueryWrapper<DummyInventoryInfoEO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(DummyInventoryInfoEO::getDummyInventoryBaseId,dummyInventoryBaseEO.getId());
|
||||
List<DummyInventoryInfoEO> dummyInventoryInfoEOList = iDummyInventoryInfoEOService.list(lambdaQueryWrapper);
|
||||
String contentLog = "";
|
||||
String contentLog = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated as follows:" + "</br>";
|
||||
String contentLogFeishu = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated as follows:" + " ";
|
||||
|
||||
if(dummyContentChangeEOList.size() == 0){
|
||||
//没有添加过需要进行第一次添加
|
||||
Date thisTime = new Date();
|
||||
List<DummyContentChangeEO> list = new ArrayList<>();
|
||||
if(dummyInventoryBaseEOList.size() != 0){
|
||||
String base = JSONArray.toJSONString(dummyInventoryBaseEOList);
|
||||
DummyContentChangeEO dummyContentChangeEOBase = new DummyContentChangeEO();
|
||||
dummyContentChangeEOBase.setConnectId(dummyInventoryBaseEO.getId());
|
||||
dummyContentChangeEOBase.setContentJson(base);
|
||||
dummyContentChangeEOBase.setUpdateTime(thisTime);
|
||||
list.add(dummyContentChangeEOBase);
|
||||
}
|
||||
if(dummyInventoryInfoEOList.size() != 0){
|
||||
disposeDataToEn(dummyInventoryInfoEOList);
|
||||
String info = JSONArray.toJSONString(dummyInventoryInfoEOList);
|
||||
DummyContentChangeEO dummyContentChangeEOInfo = new DummyContentChangeEO();
|
||||
dummyContentChangeEOInfo.setParentId(dummyInventoryBaseEO.getId());
|
||||
dummyContentChangeEOInfo.setConnectId(dummyInventoryBaseEO.getId());
|
||||
dummyContentChangeEOInfo.setContentJson(info);
|
||||
dummyContentChangeEOInfo.setUpdateTime(thisTime);
|
||||
list.add(dummyContentChangeEOInfo);
|
||||
@@ -386,132 +384,338 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
|
||||
iDummyContentChangeEOService.saveBatch(list);
|
||||
}
|
||||
}else{
|
||||
//1.查询之前保存过的基础数据
|
||||
LambdaQueryWrapper<DummyContentChangeEO> wrapperBase =new LambdaQueryWrapper<>();
|
||||
wrapperBase.in(DummyContentChangeEO::getConnectId,dummyInventoryBaseEO.getId());
|
||||
List<DummyContentChangeEO> dummyContentChangeEOBaseList = iDummyContentChangeEOService.list(wrapperBase);
|
||||
//2. 查询之前保存过的详情数据
|
||||
LambdaQueryWrapper<DummyContentChangeEO> wrapperInfo =new LambdaQueryWrapper<>();
|
||||
wrapperInfo.in(DummyContentChangeEO::getParentId,dummyInventoryBaseEO.getId());
|
||||
List<DummyContentChangeEO> dummyContentChangeEOInfoList = iDummyContentChangeEOService.list(wrapperInfo);
|
||||
if(dummyContentChangeEOInfoList.size() != 0){
|
||||
String contentJson = dummyContentChangeEOInfoList.get(0).getContentJson();
|
||||
List<DummyInventoryInfoEO> baseCJList = JSONArray.parseArray(contentJson, DummyInventoryInfoEO.class);
|
||||
List<String> serialNumberOldList = baseCJList.stream().map(DummyInventoryInfoEO::getSerialNumber).collect(Collectors.toList());
|
||||
//变更后的数据
|
||||
if(dummyInventoryInfoEOList.size() != 0){
|
||||
List<String> serialNumberNewList = dummyInventoryInfoEOList.stream().map(DummyInventoryInfoEO::getSerialNumber).collect(Collectors.toList());
|
||||
//新增的法规
|
||||
List<DummyInventoryInfoEO> collectAdd = dummyInventoryInfoEOList.stream()
|
||||
.filter(e -> !serialNumberOldList.contains(e.getSerialNumber())).collect(Collectors.toList());
|
||||
|
||||
Date lastIssueTime = null;
|
||||
List<String> serialNumberAddList = serialNumberNewList.stream().filter(e->!serialNumberOldList.contains(e)).collect(Collectors.toList());
|
||||
//删除的法规
|
||||
List<DummyInventoryInfoEO> collectDelete = baseCJList.stream()
|
||||
.filter(e -> !serialNumberNewList.contains(e.getSerialNumber())).collect(Collectors.toList());
|
||||
List<String> serialNumberDeleteList = serialNumberOldList.stream().filter(e->!serialNumberNewList.contains(e)).collect(Collectors.toList());
|
||||
|
||||
|
||||
if (CollectionUtils.isNotEmpty(dummyContentChangeEOInfoList)) {
|
||||
lastIssueTime = dummyContentChangeEOInfoList.get(0).getUpdateTime();
|
||||
|
||||
if(CollectionUtils.isNotEmpty(dummyContentChangeEOInfoList)){
|
||||
//3.对比基础表数据
|
||||
//3.1截止到现在发布,期间修改的数据(基础)
|
||||
//最新的数据为-->dummyInventoryBaseEOList
|
||||
|
||||
//3.2基础表数据对比
|
||||
String baseCJ=dummyContentChangeEOBaseList.get(0).getContentJson();
|
||||
List<DummyInventoryBaseEO> baseCJList = JSONArray.parseArray(baseCJ, DummyInventoryBaseEO.class);//json转list
|
||||
|
||||
//对比,获取值不同的字段
|
||||
Map<String, String> baseDiff = null;
|
||||
for(int i=0;i< baseCJList.size();i++) {
|
||||
baseCJList.get(i);
|
||||
dummyInventoryBaseEOList.get(i);
|
||||
baseDiff = ListDiff.compareObject(baseCJList.get(i), dummyInventoryBaseEOList.get(i));
|
||||
//发消息
|
||||
int count = 1;
|
||||
if(serialNumberAddList.size() != 0){
|
||||
List<String> hrefList = new ArrayList<>();
|
||||
for (DummyInventoryInfoEO dummyInventoryInfoEO : collectAdd) {
|
||||
String href = "<a href='/docManage/library/detail?id=" + dummyInventoryInfoEO.getBussDocumentLibraryId() +
|
||||
"&title=" + dummyInventoryInfoEO.getTitle() +
|
||||
"&serial_number=" + dummyInventoryInfoEO.getSerialNumber() + "'" + " target='_blank'>" + dummyInventoryInfoEO.getSerialNumber() + "</a>";
|
||||
hrefList.add(href);
|
||||
}
|
||||
contentLog += count+". New regulations: " + StringUtils.join(hrefList,",") + "</br>";
|
||||
contentLogFeishu += count+". New regulations: " + StringUtils.join(serialNumberAddList,",") + " ";
|
||||
count++;
|
||||
}
|
||||
if(serialNumberDeleteList.size() != 0){
|
||||
List<String> hrefList = new ArrayList<>();
|
||||
for (DummyInventoryInfoEO dummyInventoryInfoEO : collectDelete) {
|
||||
String href = "<a href='/docManage/library/detail?id=" + dummyInventoryInfoEO.getBussDocumentLibraryId() +
|
||||
"&title=" + dummyInventoryInfoEO.getTitle() +
|
||||
"&serial_number=" + dummyInventoryInfoEO.getSerialNumber() + "'" + " target='_blank'>" + dummyInventoryInfoEO.getSerialNumber() + "</a>";
|
||||
hrefList.add(href);
|
||||
}
|
||||
contentLog += count + ". Remove regulations: " + StringUtils.join(hrefList,",") + "</br>";
|
||||
contentLogFeishu += count + ". Remove regulations: " + StringUtils.join(serialNumberDeleteList,",") + " ";
|
||||
}
|
||||
|
||||
//4.查详情表两次发布的时间之间的数据
|
||||
if(lastIssueTime != now){
|
||||
QueryWrapper<DummyLogEO> logEOQueryWrapper = new QueryWrapper<>();
|
||||
logEOQueryWrapper.orderByAsc("create_time")
|
||||
.between("create_time",lastIssueTime,now)
|
||||
.eq("dummy_inventory_base_id",dummyInventoryBaseEO.getId())
|
||||
.eq("is_en_log",CutEnum.EN.getValue());
|
||||
List<DummyLogEO> updateLogList = dummyLogEOService.list(logEOQueryWrapper);
|
||||
if(CollectionUtils.isNotEmpty(updateLogList)){
|
||||
List<String> contentLogList = updateLogList.stream().map(e -> e.getLogContent()).collect(Collectors.toList());
|
||||
for(int i=0 ; i < contentLogList.size() ;i++){
|
||||
String content = contentLogList.get(i);
|
||||
if(StringUtils.isNotBlank(content) && content.endsWith("</br>")){
|
||||
content = content.substring(0,content.length()-5);
|
||||
}
|
||||
contentLog += "("+ (i+1) +")" + content + "</br>";
|
||||
if(serialNumberAddList.size() != 0 || serialNumberDeleteList.size() != 0){
|
||||
List<String> userNameList = dummyReadEOService.queryReadUserInfo(dummyInventoryBaseEO.getId());
|
||||
List<String> thirdIdList = new ArrayList<>();
|
||||
if(userNameList.size() != 0){
|
||||
List<String> userIdList = sysUserService.queryUserIdListByNameList(userNameList).stream().map(e -> e.getId()).collect(Collectors.toList());
|
||||
thirdIdList = sysUserService.queryUserIdListByNameList(userNameList).stream().map(e -> e.getThirdId()).collect(Collectors.toList());
|
||||
if(userIdList.size() != 0){
|
||||
//封装消息的实体类
|
||||
String title = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated.";
|
||||
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList, title, title, contentLog,MessageTypeEnum.READ.getValue(),MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
|
||||
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
|
||||
bussDocumentLibraryEOService.sendWebsocket(dummyInventoryBaseEO.getId(), title);
|
||||
}
|
||||
}
|
||||
//飞书
|
||||
if(thirdIdList.size() != 0){
|
||||
String href = backUrl + "/virtualListDetails?name=" + baseEO.getName() + "&useExplain=" + baseEO.getUseExplain() +"&id=" + baseEO.getId() +"&title=维护虚拟清单";
|
||||
try {
|
||||
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentLogFeishu, MessageTypeEnum.PUSH.getName(), href);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(contentLog) && contentLog.endsWith("</br>")){
|
||||
contentLog = contentLog.substring(0,contentLog.length()-5);
|
||||
}
|
||||
|
||||
//列表,维护清单不同的字段,addSerialNumber,deleteSerialNumber都为空->证明是没有更新的数据,不发送消息,数据不处理
|
||||
if(MapUtils.isNotEmpty(baseDiff) || StringUtils.isNotEmpty(contentLog)) {
|
||||
//向订阅该领域管理的人发消息和飞书
|
||||
sendMsg(baseDiff, dummyContentChangeEOBaseList.get(0).getConnectId(), contentLog,dummyInventoryBaseEO.getState(),dummyInventoryBaseEO.getCut());
|
||||
|
||||
//5.数据对比完成后.更新之前保存的dummy_inventory_info中的content_json数据,重新保存最新的数据
|
||||
if(MapUtils.isNotEmpty(baseDiff)){//列表有不同字段
|
||||
String base = JSONArray.toJSONString(dummyInventoryBaseEOList);
|
||||
UpdateWrapper<DummyContentChangeEO> baseUpdateWrapper=new UpdateWrapper<>();
|
||||
baseUpdateWrapper.set("content_json",base)
|
||||
.set("update_by",sysUser.getUsername())
|
||||
.set("update_time",now)
|
||||
.eq("connect_id",dummyInventoryBaseEOList.get(0).getId());
|
||||
dummyContentChangeEOMapper.update(null,baseUpdateWrapper);
|
||||
}
|
||||
// if(CollectionUtils.isNotEmpty(infoDiffList) || StringUtils.isNotEmpty(addSerialNumber)
|
||||
// || StringUtils.isNotEmpty(deleteSerialNumber)){//维护清单有不同字段,addSerialNumber,deleteSerialNumber也有数据
|
||||
String info = JSONArray.toJSONString(dummyInventoryInfoEOList);
|
||||
UpdateWrapper<DummyContentChangeEO> infoUpdateWrapper=new UpdateWrapper<>();
|
||||
infoUpdateWrapper.set("content_json",info)
|
||||
.set("update_by",sysUser.getUsername())
|
||||
.set("update_time",now)
|
||||
.eq("parent_id",dummyInventoryBaseEOList.get(0).getId());
|
||||
dummyContentChangeEOMapper.update(null,infoUpdateWrapper);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}else{//基础数据发布过,详情原为空-->有新增,再次发布
|
||||
List<DummyContentChangeEO> list = new ArrayList<>();
|
||||
if(dummyInventoryInfoEOList.size() != 0){
|
||||
disposeDataToEn(dummyInventoryInfoEOList);
|
||||
String info = JSONArray.toJSONString(dummyInventoryInfoEOList);
|
||||
DummyContentChangeEO dummyContentChangeEOInfo = new DummyContentChangeEO();
|
||||
dummyContentChangeEOInfo.setParentId(dummyInventoryBaseEO.getId());
|
||||
dummyContentChangeEOInfo.setContentJson(info);
|
||||
list.add(dummyContentChangeEOInfo);
|
||||
}
|
||||
if(list.size() != 0){//原详情为空,查所有数据,不限时间
|
||||
QueryWrapper<DummyLogEO> logEOQueryWrapper = new QueryWrapper<>();
|
||||
logEOQueryWrapper.orderByAsc("create_time")
|
||||
// .between("create_time",lastIssueTime,now)
|
||||
.eq("dummy_inventory_base_id",dummyInventoryBaseEO.getId())
|
||||
.eq("is_en_log",CutEnum.EN.getValue());
|
||||
List<DummyLogEO> updateLogList = dummyLogEOService.list(logEOQueryWrapper);
|
||||
//删除之前保存的变更的数据
|
||||
iDummyContentChangeEOService.deleteById(dummyContentChangeEOInfoList.get(0).getId());
|
||||
|
||||
List<String> contentLogList = updateLogList.stream().map(e -> e.getLogContent()).collect(Collectors.toList());
|
||||
for(int i=0 ; i < contentLogList.size() ;i++){
|
||||
String content = contentLogList.get(i);
|
||||
if(StringUtils.isNotBlank(content) && content.endsWith("</br>")){
|
||||
content = content.substring(0,content.length()-5);
|
||||
}
|
||||
contentLog += "("+ (i+1) +")" + content + "</br>";
|
||||
}
|
||||
if(StringUtils.isNotBlank(contentLog) && contentLog.endsWith("</br>")){
|
||||
contentLog = contentLog.substring(0,contentLog.length()-5);
|
||||
}
|
||||
iDummyContentChangeEOService.saveBatch(list);
|
||||
sendMsg(null,dummyInventoryInfoEOList.get(0).getDummyInventoryBaseId(),contentLog ,dummyInventoryBaseEO.getState(),dummyInventoryBaseEO.getCut());
|
||||
|
||||
}
|
||||
//重新保存
|
||||
DummyContentChangeEO dummyContentChangeEOInfo = new DummyContentChangeEO();
|
||||
String contentJsonTemp = JSONArray.toJSONString(dummyInventoryInfoEOList);
|
||||
dummyContentChangeEOInfo.setParentId(dummyInventoryBaseEO.getId());
|
||||
dummyContentChangeEOInfo.setConnectId(dummyInventoryBaseEO.getId());
|
||||
dummyContentChangeEOInfo.setContentJson(contentJsonTemp);
|
||||
dummyContentChangeEOInfo.setUpdateTime(new Date());
|
||||
iDummyContentChangeEOService.save(dummyContentChangeEOInfo);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//撤回,需要发消息
|
||||
try {
|
||||
sendMsg(null, dummyInventoryBaseEO.getId(),null,dummyInventoryBaseEO.getState(),dummyInventoryBaseEO.getCut());
|
||||
List<String> userNameList = dummyReadEOService.queryReadUserInfo(dummyInventoryBaseEO.getId());
|
||||
List<String> thirdIdList = new ArrayList<>();
|
||||
if(userNameList.size() != 0){
|
||||
List<String> userIdList = sysUserService.queryUserIdListByNameList(userNameList).stream().map(e -> e.getId()).collect(Collectors.toList());
|
||||
thirdIdList = sysUserService.queryUserIdListByNameList(userNameList).stream().map(e -> e.getThirdId()).collect(Collectors.toList());
|
||||
if(userIdList.size() != 0){
|
||||
//封装消息的实体类 The XX virtual list you subscribed to has been withdrawn
|
||||
String title = "The "+ baseEO.getName()+" virtual list you subscribed to has been withdrawn.";
|
||||
//Please note that the XX virtual list you subscribed to has been withdrawn.
|
||||
String contentLog = "Please note that the "+ baseEO.getName()+" virtual list you subscribed to has been withdrawn.";
|
||||
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList, title, title, contentLog,MessageTypeEnum.READ.getValue(),MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
|
||||
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
|
||||
bussDocumentLibraryEOService.sendWebsocket(dummyInventoryBaseEO.getId(), title);
|
||||
}
|
||||
}
|
||||
//飞书
|
||||
if(thirdIdList.size() != 0){
|
||||
String contentInfoTemp = "Please note that the "+ baseEO.getName()+" virtual list you subscribed to has been withdrawn.";
|
||||
String href = backUrl + "/virtualListDetails?name=" + baseEO.getName() + "&useExplain=" + baseEO.getUseExplain() +"&id=" + baseEO.getId() +"&title=维护虚拟清单";
|
||||
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentInfoTemp, MessageTypeEnum.PUSH.getName(), href);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
// /**
|
||||
// * 发布
|
||||
// * 发布与撤回均需要发消息
|
||||
// * 首次发布不发消息
|
||||
// *
|
||||
// * @param dummyInventoryBaseEO
|
||||
// */
|
||||
// @Override
|
||||
// @Transactional
|
||||
// public void issue(DummyInventoryBaseEO dummyInventoryBaseEO){
|
||||
// // 增加创建者校验
|
||||
// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
// String loginUserName = sysUser.getUsername();
|
||||
//
|
||||
// DummyInventoryBaseEO baseEO = queryById(dummyInventoryBaseEO.getId());
|
||||
// List<String> createByNameList =new ArrayList<>();
|
||||
// if (StringUtils.isNotBlank(baseEO.getCreateBy())) {
|
||||
// createByNameList = Arrays.asList(baseEO.getCreateBy().split(","));
|
||||
//
|
||||
// if (CollectionUtils.isNotEmpty(createByNameList)){
|
||||
// if (!createByNameList.contains(loginUserName)) {
|
||||
// if (CutEnum.CN.getValue().equals(dummyInventoryBaseEO.getCut())) {
|
||||
// throw new JeroBootException("当前用户非创建者,无法发布");
|
||||
// } else {
|
||||
// throw new JeroBootException("The current user is not the creator and cannot be issued.");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// Date now = new Date();
|
||||
// UpdateWrapper<DummyInventoryBaseEO> baseWrapper=new UpdateWrapper<>();
|
||||
// baseWrapper.set("state",dummyInventoryBaseEO.getState());
|
||||
//
|
||||
// if(InventoryStateEnum.ISSUE.getValue().equals(dummyInventoryBaseEO.getState())){
|
||||
// baseWrapper.set("update_by",sysUser.getUsername())
|
||||
// .set("update_time",now);
|
||||
// }
|
||||
// baseWrapper.eq("id",dummyInventoryBaseEO.getId());
|
||||
// dummyInventoryBaseEOMapper.update(null,baseWrapper);
|
||||
//// this.updateById(dummyInventoryBaseEO);
|
||||
// //不管有没有维护清单,都返回操作成功
|
||||
// //发布与撤回均需要发消息(向订阅的人员发消息)
|
||||
// //首次发布不发消息
|
||||
// //(1)首次发布将虚拟清单的基础数据和详情数据存入维护清单内容变更表_dummy_content_change
|
||||
// //(2)撤回再次编辑完后再次发布,发消息
|
||||
// //A. 分别判断基础数据和详情数据同上次发布的数据是否发生变化
|
||||
// //发生变化-->发消息,删除dummy_content_change中上一次存入的数据,将本次数据存入
|
||||
// //没有变化-->不发消息,数据不处理
|
||||
//
|
||||
// //先判断是发布还是撤回 1-->发布 2-->撤回
|
||||
// //撤回需要发消息
|
||||
//
|
||||
// if(InventoryStateEnum.ISSUE.getValue().equals(dummyInventoryBaseEO.getState())){
|
||||
// //先判断第一次发布的时候是否保存过数据
|
||||
// LambdaQueryWrapper<DummyContentChangeEO> wrapper =new LambdaQueryWrapper<>();
|
||||
// wrapper.in(DummyContentChangeEO::getConnectId,dummyInventoryBaseEO.getId());
|
||||
// List<DummyContentChangeEO> dummyContentChangeEOList = iDummyContentChangeEOService.list(wrapper);
|
||||
// //基础数据
|
||||
// LambdaQueryWrapper<DummyInventoryBaseEO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper.in(DummyInventoryBaseEO::getId,dummyInventoryBaseEO.getId());
|
||||
// List<DummyInventoryBaseEO> dummyInventoryBaseEOList = this.list(queryWrapper);
|
||||
// //详情数据
|
||||
// LambdaQueryWrapper<DummyInventoryInfoEO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// lambdaQueryWrapper.in(DummyInventoryInfoEO::getDummyInventoryBaseId,dummyInventoryBaseEO.getId());
|
||||
// List<DummyInventoryInfoEO> dummyInventoryInfoEOList = iDummyInventoryInfoEOService.list(lambdaQueryWrapper);
|
||||
// String contentLog = "";
|
||||
//
|
||||
// if(dummyContentChangeEOList.size() == 0){
|
||||
// //没有添加过需要进行第一次添加
|
||||
// Date thisTime = new Date();
|
||||
// List<DummyContentChangeEO> list = new ArrayList<>();
|
||||
// if(dummyInventoryBaseEOList.size() != 0){
|
||||
// String base = JSONArray.toJSONString(dummyInventoryBaseEOList);
|
||||
// DummyContentChangeEO dummyContentChangeEOBase = new DummyContentChangeEO();
|
||||
// dummyContentChangeEOBase.setConnectId(dummyInventoryBaseEO.getId());
|
||||
// dummyContentChangeEOBase.setContentJson(base);
|
||||
// dummyContentChangeEOBase.setUpdateTime(thisTime);
|
||||
// list.add(dummyContentChangeEOBase);
|
||||
// }
|
||||
// if(dummyInventoryInfoEOList.size() != 0){
|
||||
// disposeDataToEn(dummyInventoryInfoEOList);
|
||||
// String info = JSONArray.toJSONString(dummyInventoryInfoEOList);
|
||||
// DummyContentChangeEO dummyContentChangeEOInfo = new DummyContentChangeEO();
|
||||
// dummyContentChangeEOInfo.setParentId(dummyInventoryBaseEO.getId());
|
||||
// dummyContentChangeEOInfo.setContentJson(info);
|
||||
// dummyContentChangeEOInfo.setUpdateTime(thisTime);
|
||||
// list.add(dummyContentChangeEOInfo);
|
||||
// }
|
||||
// if(list.size() != 0){
|
||||
// iDummyContentChangeEOService.saveBatch(list);
|
||||
// }
|
||||
// }else{
|
||||
// //1.查询之前保存过的基础数据
|
||||
// LambdaQueryWrapper<DummyContentChangeEO> wrapperBase =new LambdaQueryWrapper<>();
|
||||
// wrapperBase.in(DummyContentChangeEO::getConnectId,dummyInventoryBaseEO.getId());
|
||||
// List<DummyContentChangeEO> dummyContentChangeEOBaseList = iDummyContentChangeEOService.list(wrapperBase);
|
||||
// //2. 查询之前保存过的详情数据
|
||||
// LambdaQueryWrapper<DummyContentChangeEO> wrapperInfo =new LambdaQueryWrapper<>();
|
||||
// wrapperInfo.in(DummyContentChangeEO::getParentId,dummyInventoryBaseEO.getId());
|
||||
// List<DummyContentChangeEO> dummyContentChangeEOInfoList = iDummyContentChangeEOService.list(wrapperInfo);
|
||||
//
|
||||
// Date lastIssueTime = null;
|
||||
//
|
||||
//
|
||||
// if (CollectionUtils.isNotEmpty(dummyContentChangeEOInfoList)) {
|
||||
// lastIssueTime = dummyContentChangeEOInfoList.get(0).getUpdateTime();
|
||||
//
|
||||
// if(CollectionUtils.isNotEmpty(dummyContentChangeEOInfoList)){
|
||||
// //3.对比基础表数据
|
||||
// //3.1截止到现在发布,期间修改的数据(基础)
|
||||
// //最新的数据为-->dummyInventoryBaseEOList
|
||||
//
|
||||
// //3.2基础表数据对比
|
||||
// String baseCJ=dummyContentChangeEOBaseList.get(0).getContentJson();
|
||||
// List<DummyInventoryBaseEO> baseCJList = JSONArray.parseArray(baseCJ, DummyInventoryBaseEO.class);//json转list
|
||||
//
|
||||
// //对比,获取值不同的字段
|
||||
// Map<String, String> baseDiff = null;
|
||||
// for(int i=0;i< baseCJList.size();i++) {
|
||||
// baseCJList.get(i);
|
||||
// dummyInventoryBaseEOList.get(i);
|
||||
// baseDiff = ListDiff.compareObject(baseCJList.get(i), dummyInventoryBaseEOList.get(i));
|
||||
// }
|
||||
//
|
||||
// //4.查详情表两次发布的时间之间的数据
|
||||
// if(lastIssueTime != now){
|
||||
// QueryWrapper<DummyLogEO> logEOQueryWrapper = new QueryWrapper<>();
|
||||
// logEOQueryWrapper.orderByAsc("create_time")
|
||||
// .between("create_time",lastIssueTime,now)
|
||||
// .eq("dummy_inventory_base_id",dummyInventoryBaseEO.getId())
|
||||
// .eq("is_en_log",CutEnum.EN.getValue());
|
||||
// List<DummyLogEO> updateLogList = dummyLogEOService.list(logEOQueryWrapper);
|
||||
// if(CollectionUtils.isNotEmpty(updateLogList)){
|
||||
// List<String> contentLogList = updateLogList.stream().map(e -> e.getLogContent()).collect(Collectors.toList());
|
||||
// for(int i=0 ; i < contentLogList.size() ;i++){
|
||||
// String content = contentLogList.get(i);
|
||||
// if(StringUtils.isNotBlank(content) && content.endsWith("</br>")){
|
||||
// content = content.substring(0,content.length()-5);
|
||||
// }
|
||||
// contentLog += "("+ (i+1) +")" + content + "</br>";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if(StringUtils.isNotBlank(contentLog) && contentLog.endsWith("</br>")){
|
||||
// contentLog = contentLog.substring(0,contentLog.length()-5);
|
||||
// }
|
||||
//
|
||||
// //列表,维护清单不同的字段,addSerialNumber,deleteSerialNumber都为空->证明是没有更新的数据,不发送消息,数据不处理
|
||||
// if(MapUtils.isNotEmpty(baseDiff) || StringUtils.isNotEmpty(contentLog)) {
|
||||
// //向订阅该领域管理的人发消息和飞书
|
||||
// sendMsg(baseDiff, dummyContentChangeEOBaseList.get(0).getConnectId(), contentLog,dummyInventoryBaseEO.getState(),dummyInventoryBaseEO.getCut());
|
||||
//
|
||||
// //5.数据对比完成后.更新之前保存的dummy_inventory_info中的content_json数据,重新保存最新的数据
|
||||
// if(MapUtils.isNotEmpty(baseDiff)){//列表有不同字段
|
||||
// String base = JSONArray.toJSONString(dummyInventoryBaseEOList);
|
||||
// UpdateWrapper<DummyContentChangeEO> baseUpdateWrapper=new UpdateWrapper<>();
|
||||
// baseUpdateWrapper.set("content_json",base)
|
||||
// .set("update_by",sysUser.getUsername())
|
||||
// .set("update_time",now)
|
||||
// .eq("connect_id",dummyInventoryBaseEOList.get(0).getId());
|
||||
// dummyContentChangeEOMapper.update(null,baseUpdateWrapper);
|
||||
// }
|
||||
//// if(CollectionUtils.isNotEmpty(infoDiffList) || StringUtils.isNotEmpty(addSerialNumber)
|
||||
//// || StringUtils.isNotEmpty(deleteSerialNumber)){//维护清单有不同字段,addSerialNumber,deleteSerialNumber也有数据
|
||||
// String info = JSONArray.toJSONString(dummyInventoryInfoEOList);
|
||||
// UpdateWrapper<DummyContentChangeEO> infoUpdateWrapper=new UpdateWrapper<>();
|
||||
// infoUpdateWrapper.set("content_json",info)
|
||||
// .set("update_by",sysUser.getUsername())
|
||||
// .set("update_time",now)
|
||||
// .eq("parent_id",dummyInventoryBaseEOList.get(0).getId());
|
||||
// dummyContentChangeEOMapper.update(null,infoUpdateWrapper);
|
||||
//// }
|
||||
// }
|
||||
// }
|
||||
// }else{//基础数据发布过,详情原为空-->有新增,再次发布
|
||||
// List<DummyContentChangeEO> list = new ArrayList<>();
|
||||
// if(dummyInventoryInfoEOList.size() != 0){
|
||||
// disposeDataToEn(dummyInventoryInfoEOList);
|
||||
// String info = JSONArray.toJSONString(dummyInventoryInfoEOList);
|
||||
// DummyContentChangeEO dummyContentChangeEOInfo = new DummyContentChangeEO();
|
||||
// dummyContentChangeEOInfo.setParentId(dummyInventoryBaseEO.getId());
|
||||
// dummyContentChangeEOInfo.setContentJson(info);
|
||||
// list.add(dummyContentChangeEOInfo);
|
||||
// }
|
||||
// if(list.size() != 0){//原详情为空,查所有数据,不限时间
|
||||
// QueryWrapper<DummyLogEO> logEOQueryWrapper = new QueryWrapper<>();
|
||||
// logEOQueryWrapper.orderByAsc("create_time")
|
||||
//// .between("create_time",lastIssueTime,now)
|
||||
// .eq("dummy_inventory_base_id",dummyInventoryBaseEO.getId())
|
||||
// .eq("is_en_log",CutEnum.EN.getValue());
|
||||
// List<DummyLogEO> updateLogList = dummyLogEOService.list(logEOQueryWrapper);
|
||||
//
|
||||
// List<String> contentLogList = updateLogList.stream().map(e -> e.getLogContent()).collect(Collectors.toList());
|
||||
// for(int i=0 ; i < contentLogList.size() ;i++){
|
||||
// String content = contentLogList.get(i);
|
||||
// if(StringUtils.isNotBlank(content) && content.endsWith("</br>")){
|
||||
// content = content.substring(0,content.length()-5);
|
||||
// }
|
||||
// contentLog += "("+ (i+1) +")" + content + "</br>";
|
||||
// }
|
||||
// if(StringUtils.isNotBlank(contentLog) && contentLog.endsWith("</br>")){
|
||||
// contentLog = contentLog.substring(0,contentLog.length()-5);
|
||||
// }
|
||||
// iDummyContentChangeEOService.saveBatch(list);
|
||||
// sendMsg(null,dummyInventoryInfoEOList.get(0).getDummyInventoryBaseId(),contentLog ,dummyInventoryBaseEO.getState(),dummyInventoryBaseEO.getCut());
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }else{
|
||||
// //撤回,需要发消息
|
||||
// try {
|
||||
// sendMsg(null, dummyInventoryBaseEO.getId(),null,dummyInventoryBaseEO.getState(),dummyInventoryBaseEO.getCut());
|
||||
// }catch (Exception e){
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//翻译成中文名
|
||||
public void disposeData(List<DummyInventoryInfoEO> records) {
|
||||
|
||||
|
||||
+1
@@ -1501,6 +1501,7 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
dummyInventoryInfoEO.setShi4Yong4Fan4Wei2(collect.get(0).getShi4Yong4Fan4Wei2());
|
||||
dummyInventoryInfoEO.setImplementTime(collect.get(0).getImplementTime());
|
||||
dummyInventoryInfoEO.setXin1Che1Xing2Shi2Shi1Ri4Qi1(collect.get(0).getXin1Che1Xing2Shi2Shi1Ri4Qi1());
|
||||
dummyInventoryInfoEO.setBussDocumentLibraryId(collect.get(0).getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+28
@@ -360,6 +360,17 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
|
||||
//校验文件格式
|
||||
int pos = file.getOriginalFilename().lastIndexOf(".");
|
||||
String fileSuffixStr = file.getOriginalFilename().substring(pos+1).toLowerCase();
|
||||
|
||||
String title = "";
|
||||
String verifyTemplateMsg = "";
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
title = "条款号,条款名称,条款内容";
|
||||
verifyTemplateMsg = "模板不正确,请下载正确的模板导入!";
|
||||
} else {
|
||||
title = "Item num,Item name,Item Contents";
|
||||
verifyTemplateMsg = "The template is not correct, please download the correct template to import!";
|
||||
}
|
||||
|
||||
if(!StringUtils.equals(fileSuffixStr,"xls")){
|
||||
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
|
||||
throw new JeroBootException("请上传xls文件");
|
||||
@@ -377,6 +388,23 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
|
||||
if (workbook != null) {
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
if (sheet != null) {
|
||||
Row firstRow = sheet.getRow(0);
|
||||
List<String> titleList = Arrays.asList(title.split(","));
|
||||
//校验模板
|
||||
for (int cellIndex = 0; cellIndex < 3; cellIndex++){
|
||||
boolean flag = false;
|
||||
Cell cell = firstRow.getCell(cellIndex);
|
||||
for (String titl : titleList) {
|
||||
if(StringUtils.equals(titl,cell.toString())){
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!flag){
|
||||
throw new JeroBootException(verifyTemplateMsg);
|
||||
}
|
||||
}
|
||||
|
||||
int rowNos = sheet.getPhysicalNumberOfRows();// 得到excel的总记录条数
|
||||
for (int i = 0; i < rowNos ; i++) {
|
||||
Row row = sheet.getRow(i + 1);
|
||||
|
||||
+6
-4
@@ -4,11 +4,13 @@ public enum ProjectTaskPlanningNameEnum {
|
||||
LIST_CONFIRMATION("清单确认"," Checklist confirmation"),
|
||||
LEGAL_TASK_CONFIRMATION("任务确认","Task confirmation"),
|
||||
DESIGN_DEADLINE("设计符合性","Design compliance"),
|
||||
PREHOMO_DEADLINE("Pre-Homo","Pre-Homo"),
|
||||
ATTESTATION_START_TIME("认证开始","Certification begins"),
|
||||
ATTESTATION_END_TIME("认证结束"," End of certification"),
|
||||
// PREHOMO_DEADLINE("Pre-Homo","Pre-Homo"),
|
||||
// ATTESTATION_START_TIME("认证开始","Certification begins"),
|
||||
// ATTESTATION_END_TIME("认证结束"," End of certification"),
|
||||
PREHOMO_DEADLINE("摸底试验结束","Pre-Homo Completion"), // name:Pre-Homo value:Pre-Homo
|
||||
ATTESTATION_START_TIME("认证试验结束","Homo Test Completion"),// name:认证开始 value:Certification begins
|
||||
ATTESTATION_END_TIME("认证批准","Type Approval"),// name:认证结束 value:End of certification
|
||||
VERIFY_DEADLINE("验证符合性","Verify compliance"),
|
||||
|
||||
;
|
||||
String name;
|
||||
String value;
|
||||
|
||||
+111
-40
@@ -2831,49 +2831,76 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
|
||||
//法规工程师
|
||||
if (StringUtils.isNotBlank(projectLawsInventoryEO.getRegulationOwnerId())) {
|
||||
String userName = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getRegulationOwnerId())).map(f -> f.getUsername()).collect(Collectors.toList()).get(0);
|
||||
projectLawsInventoryEO.setRegulationOwnerName(userName);
|
||||
List<String> collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getRegulationOwnerId())).map(f -> f.getUsername()).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
String userName = collect.get(0);
|
||||
projectLawsInventoryEO.setRegulationOwnerName(userName);
|
||||
}
|
||||
}
|
||||
|
||||
//认证工程师
|
||||
if (StringUtils.isNotBlank(projectLawsInventoryEO.getHomologationEngineerId())) {
|
||||
String userName = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getHomologationEngineerId())).map(f -> f.getUsername()).collect(Collectors.toList()).get(0);
|
||||
projectLawsInventoryEO.setHomologationEngineerName(userName);
|
||||
List<String> collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getHomologationEngineerId())).map(f -> f.getUsername()).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
String userName = collect.get(0);
|
||||
projectLawsInventoryEO.setHomologationEngineerName(userName);
|
||||
}
|
||||
}
|
||||
|
||||
//工程接口人
|
||||
if (StringUtils.isNotBlank(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
|
||||
String userName = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getEngineeringInterfacePerson())).map(f -> f.getUsername()).collect(Collectors.toList()).get(0);
|
||||
projectLawsInventoryEO.setEngineeringInterfacePersonName(userName);
|
||||
List<String> collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getEngineeringInterfacePerson())).map(f -> f.getUsername()).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
String userName = collect.get(0);
|
||||
projectLawsInventoryEO.setEngineeringInterfacePersonName(userName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//发起人
|
||||
if (StringUtils.isNotBlank(projectLawsInventoryEO.getDesignInitiatorId())) {
|
||||
String userName = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getDesignInitiatorId())).map(f -> f.getUsername()).collect(Collectors.toList()).get(0);
|
||||
projectLawsInventoryEO.setDesignInitiatorName(userName);
|
||||
List<String> collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getDesignInitiatorId())).map(f -> f.getUsername()).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
String userName = collect.get(0);
|
||||
projectLawsInventoryEO.setDesignInitiatorName(userName);
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectLawsInventoryEO.getPrehomoInitiatorId())) {
|
||||
String userName = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getPrehomoInitiatorId())).map(f -> f.getUsername()).collect(Collectors.toList()).get(0);
|
||||
projectLawsInventoryEO.setPrehomoInitiatorName(userName);
|
||||
List<String> collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getPrehomoInitiatorId())).map(f -> f.getUsername()).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
String userName = collect.get(0);
|
||||
projectLawsInventoryEO.setPrehomoInitiatorName(userName);
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectLawsInventoryEO.getVerifyInitiatorId())) {
|
||||
String userName = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getVerifyInitiatorId())).map(f -> f.getUsername()).collect(Collectors.toList()).get(0);
|
||||
projectLawsInventoryEO.setVerifyInitiatorName(userName);
|
||||
List<String> collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getVerifyInitiatorId())).map(f -> f.getUsername()).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
String userName = collect.get(0);
|
||||
projectLawsInventoryEO.setVerifyInitiatorName(userName);
|
||||
}
|
||||
}
|
||||
|
||||
//责任人
|
||||
if (StringUtils.isNotBlank(projectLawsInventoryEO.getDesignDutyId())) {
|
||||
String userName = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getDesignDutyId())).map(f -> f.getUsername()).collect(Collectors.toList()).get(0);
|
||||
projectLawsInventoryEO.setDesignDutyName(userName);
|
||||
List<String> collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getDesignDutyId())).map(f -> f.getUsername()).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
String userName = collect.get(0);
|
||||
projectLawsInventoryEO.setDesignDutyName(userName);
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectLawsInventoryEO.getPrehomoDutyId())) {
|
||||
String userName = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getPrehomoDutyId())).map(f -> f.getUsername()).collect(Collectors.toList()).get(0);
|
||||
projectLawsInventoryEO.setPrehomoDutyName(userName);
|
||||
List<String> collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getPrehomoDutyId())).map(f -> f.getUsername()).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
String userName = collect.get(0);
|
||||
projectLawsInventoryEO.setPrehomoDutyName(userName);
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectLawsInventoryEO.getVerifyDutyId())) {
|
||||
String userName = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getVerifyDutyId())).map(f -> f.getUsername()).collect(Collectors.toList()).get(0);
|
||||
projectLawsInventoryEO.setVerifyDutyName(userName);
|
||||
List<String> collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getVerifyDutyId())).map(f -> f.getUsername()).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
String userName = collect.get(0);
|
||||
projectLawsInventoryEO.setVerifyDutyName(userName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3197,49 +3224,76 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
|
||||
//法规工程师
|
||||
if (StringUtils.isNotBlank(projectLawsInventoryEO.getRegulationOwnerId())) {
|
||||
String userName = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getRegulationOwnerId())).map(f -> f.getUsername()).collect(Collectors.toList()).get(0);
|
||||
projectLawsInventoryEO.setRegulationOwnerName(userName);
|
||||
List<String> collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getRegulationOwnerId())).map(f -> f.getUsername()).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
String userName = collect.get(0);
|
||||
projectLawsInventoryEO.setRegulationOwnerName(userName);
|
||||
}
|
||||
}
|
||||
|
||||
//认证工程师
|
||||
if (StringUtils.isNotBlank(projectLawsInventoryEO.getHomologationEngineerId())) {
|
||||
String userName = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getHomologationEngineerId())).map(f -> f.getUsername()).collect(Collectors.toList()).get(0);
|
||||
projectLawsInventoryEO.setHomologationEngineerName(userName);
|
||||
List<String> collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getHomologationEngineerId())).map(f -> f.getUsername()).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
String userName = collect.get(0);
|
||||
projectLawsInventoryEO.setHomologationEngineerName(userName);
|
||||
}
|
||||
}
|
||||
|
||||
//工程接口人
|
||||
if (StringUtils.isNotBlank(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
|
||||
String userName = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getEngineeringInterfacePerson())).map(f -> f.getUsername()).collect(Collectors.toList()).get(0);
|
||||
projectLawsInventoryEO.setEngineeringInterfacePersonName(userName);
|
||||
List<String> collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getEngineeringInterfacePerson())).map(f -> f.getUsername()).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
String userName = collect.get(0);
|
||||
projectLawsInventoryEO.setEngineeringInterfacePersonName(userName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//发起人
|
||||
if (StringUtils.isNotBlank(projectLawsInventoryEO.getDesignInitiatorId())) {
|
||||
String userName = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getDesignInitiatorId())).map(f -> f.getUsername()).collect(Collectors.toList()).get(0);
|
||||
projectLawsInventoryEO.setDesignInitiatorName(userName);
|
||||
List<String> collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getDesignInitiatorId())).map(f -> f.getUsername()).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
String userName = collect.get(0);
|
||||
projectLawsInventoryEO.setDesignInitiatorName(userName);
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectLawsInventoryEO.getPrehomoInitiatorId())) {
|
||||
String userName = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getPrehomoInitiatorId())).map(f -> f.getUsername()).collect(Collectors.toList()).get(0);
|
||||
projectLawsInventoryEO.setPrehomoInitiatorName(userName);
|
||||
List<String> collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getPrehomoInitiatorId())).map(f -> f.getUsername()).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
String userName = collect.get(0);
|
||||
projectLawsInventoryEO.setPrehomoInitiatorName(userName);
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectLawsInventoryEO.getVerifyInitiatorId())) {
|
||||
String userName = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getVerifyInitiatorId())).map(f -> f.getUsername()).collect(Collectors.toList()).get(0);
|
||||
projectLawsInventoryEO.setVerifyInitiatorName(userName);
|
||||
List<String> collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getVerifyInitiatorId())).map(f -> f.getUsername()).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
String userName = collect.get(0);
|
||||
projectLawsInventoryEO.setVerifyInitiatorName(userName);
|
||||
}
|
||||
}
|
||||
|
||||
//责任人
|
||||
if (StringUtils.isNotBlank(projectLawsInventoryEO.getDesignDutyId())) {
|
||||
String userName = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getDesignDutyId())).map(f -> f.getUsername()).collect(Collectors.toList()).get(0);
|
||||
projectLawsInventoryEO.setDesignDutyName(userName);
|
||||
List<String> collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getDesignDutyId())).map(f -> f.getUsername()).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
String userName = collect.get(0);
|
||||
projectLawsInventoryEO.setDesignDutyName(userName);
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectLawsInventoryEO.getPrehomoDutyId())) {
|
||||
String userName = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getPrehomoDutyId())).map(f -> f.getUsername()).collect(Collectors.toList()).get(0);
|
||||
projectLawsInventoryEO.setPrehomoDutyName(userName);
|
||||
List<String> collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getPrehomoDutyId())).map(f -> f.getUsername()).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
String userName = collect.get(0);
|
||||
projectLawsInventoryEO.setPrehomoDutyName(userName);
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectLawsInventoryEO.getVerifyDutyId())) {
|
||||
String userName = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getVerifyDutyId())).map(f -> f.getUsername()).collect(Collectors.toList()).get(0);
|
||||
projectLawsInventoryEO.setVerifyDutyName(userName);
|
||||
List<String> collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getVerifyDutyId())).map(f -> f.getUsername()).collect(Collectors.toList());
|
||||
if(collect.size() != 0){
|
||||
String userName = collect.get(0);
|
||||
projectLawsInventoryEO.setVerifyDutyName(userName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3576,6 +3630,17 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
queryWrapper.in("id",Arrays.asList(projectLawsInventoryEO.getIds().split(",")));
|
||||
}
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
|
||||
int isProjectRole = Integer.parseInt(projectLawsInventoryEO.getRoleCode());
|
||||
if(isProjectRole != Integer.parseInt(ProjectRoleEnum.STUDIO_ENGINEER.getValue())
|
||||
&& isProjectRole != Integer.parseInt(ProjectRoleEnum.MANAGER.getValue())
|
||||
&& isProjectRole != Integer.parseInt(ProjectRoleEnum.ADMIN.getValue())){
|
||||
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
queryWrapper.and(q ->{
|
||||
q.eq("regulation_owner_id",currentUser.getId()).
|
||||
or().eq("homologation_engineer_id",currentUser.getId());
|
||||
});
|
||||
}
|
||||
//导出的数据
|
||||
dataList = this.list(queryWrapper);
|
||||
|
||||
@@ -4029,13 +4094,15 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
String projectLawsInventoryIds = ids;
|
||||
String pIds = "";
|
||||
|
||||
QueryWrapper<ProjectLawsInventoryEO> updateLawsInventoryWrapper = new QueryWrapper<>();
|
||||
updateLawsInventoryWrapper.lambda().in(ProjectLawsInventoryEO::getId,idList);
|
||||
ProjectLawsInventoryEO projectLawsInventoryEO = new ProjectLawsInventoryEO();
|
||||
projectLawsInventoryEO.setInventoryAffirmStatus(InventoryAffirmStatusEnum.NOT_STARTED.getValue());
|
||||
projectLawsInventoryEO.setTaskAffirmStatus(TaskAffirmStatusEnum.NOT_STARTED.getValue());
|
||||
//清单、任务确认初始化。
|
||||
this.baseMapper.update(projectLawsInventoryEO,updateLawsInventoryWrapper);
|
||||
LambdaUpdateWrapper<ProjectLawsInventoryEO> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.in(ProjectLawsInventoryEO::getId,idList);
|
||||
updateWrapper.set(ProjectLawsInventoryEO::getRegulationOwnerSubmitStatus,null);
|
||||
updateWrapper.set(ProjectLawsInventoryEO::getHomologationEngineerSubmitStatus,null);
|
||||
super.update(projectLawsInventoryEO, updateWrapper);
|
||||
|
||||
QueryWrapper<ProjectTaskInventoryEO> taskInventoryQueryWrapper = new QueryWrapper<>();
|
||||
taskInventoryQueryWrapper.lambda().in(ProjectTaskInventoryEO::getProjectLawsInventoryId,idList);
|
||||
@@ -4061,8 +4128,11 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
pIds = actiProcInstIdList.stream().map(String::valueOf).collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
QueryWrapper<ProjectLawsInventoryEO> queryLawsInventoryWrapper = new QueryWrapper<>();
|
||||
queryLawsInventoryWrapper.lambda().in(ProjectLawsInventoryEO::getId,idList);
|
||||
|
||||
List<ProjectTaskInventoryEO> projectTaskInventoryEOList = new ArrayList<>();
|
||||
List<ProjectLawsInventoryEO> projectLawsInventoryEOList = this.baseMapper.selectList(updateLawsInventoryWrapper);
|
||||
List<ProjectLawsInventoryEO> projectLawsInventoryEOList = this.baseMapper.selectList(queryLawsInventoryWrapper);
|
||||
projectLawsInventoryEOList.forEach(projectLawsInventory -> {
|
||||
ProjectTaskInventoryEO projectTaskInventoryEO = new ProjectTaskInventoryEO();
|
||||
String projectTaskInventoryId = UUID.randomUUID().toString().replace("-", "");
|
||||
@@ -4562,6 +4632,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
projectLawsInventoryEO.setRegion(collect.get(0).getRegion());//适用地区
|
||||
projectLawsInventoryEO.setImplementTime(collect.get(0).getImplementTime());//在产车实施日期
|
||||
projectLawsInventoryEO.setXin1Che1Xing2Shi2Shi1Ri4Qi1(collect.get(0).getXin1Che1Xing2Shi2Shi1Ri4Qi1());//新车实施日期
|
||||
projectLawsInventoryEO.setStandId(collect.get(0).getId());//新车实施日期
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright 2013 Haulmont
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.jero.modules.project.util;
|
||||
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.xlsx4j.sml.Cell;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class CellReference implements Comparable {
|
||||
public static final Pattern CELL_COORDINATES_PATTERN = Pattern.compile("([A-z]+)([0-9]+)");
|
||||
private int column;
|
||||
private int row;
|
||||
private String sheet;
|
||||
|
||||
public CellReference(String sheet, int row, int column) {
|
||||
this.column = column;
|
||||
this.row = row;
|
||||
this.sheet = sheet;
|
||||
}
|
||||
|
||||
public CellReference(String sheet, String cellRef) {
|
||||
Matcher matcher = CELL_COORDINATES_PATTERN.matcher(cellRef);
|
||||
if (matcher.find()) {
|
||||
column = XlsxUtils.getNumberFromColumnReference(matcher.group(1));
|
||||
row = Integer.valueOf(matcher.group(2));
|
||||
this.sheet = sheet;
|
||||
} else {
|
||||
throw new RuntimeException(String.format("Wrong cell %s", cellRef));
|
||||
}
|
||||
}
|
||||
|
||||
public CellReference(String sheet, Cell cell) {
|
||||
this(sheet, cell.getR());
|
||||
}
|
||||
|
||||
public CellReference shift(int downShift, int rightShift) {
|
||||
row += downShift;
|
||||
column += rightShift;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CellReference move(int row, int col) {
|
||||
this.row = row;
|
||||
this.column = col;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String toReference() {
|
||||
return XlsxUtils.getColumnReferenceFromNumber(getColumn()) + getRow();
|
||||
}
|
||||
|
||||
public int getColumn() {
|
||||
return column;
|
||||
}
|
||||
|
||||
public int getRow() {
|
||||
return row;
|
||||
}
|
||||
|
||||
public String getSheet() {
|
||||
return sheet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
CellReference that = (CellReference) o;
|
||||
|
||||
if (column != that.column) return false;
|
||||
if (row != that.row) return false;
|
||||
if (sheet != null ? !sheet.equals(that.sheet) : that.sheet != null) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = column;
|
||||
result = 31 * result + row;
|
||||
result = 31 * result + (sheet != null ? sheet.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object o) {
|
||||
if (o instanceof CellReference) {
|
||||
int rows = ObjectUtils.compare(row, ((CellReference) o).row);
|
||||
int columns = ObjectUtils.compare(column, ((CellReference) o).column);
|
||||
return rows != 0 ? rows : columns;
|
||||
|
||||
} else {
|
||||
throw new IllegalArgumentException("Could not compare with " + o);
|
||||
}
|
||||
}
|
||||
}
|
||||
+371
-44
@@ -1,50 +1,384 @@
|
||||
package com.jero.modules.project.util;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.docx4j.XmlUtils;
|
||||
import org.docx4j.dml.*;
|
||||
import org.docx4j.dml.spreadsheetdrawing.*;
|
||||
import org.docx4j.openpackaging.io.SaveToZipFile;
|
||||
import org.docx4j.openpackaging.io3.stores.PartStore;
|
||||
import org.docx4j.openpackaging.packages.SpreadsheetMLPackage;
|
||||
import org.docx4j.openpackaging.parts.DrawingML.Drawing;
|
||||
import org.docx4j.openpackaging.parts.Part;
|
||||
import org.docx4j.openpackaging.parts.PartName;
|
||||
import org.docx4j.openpackaging.parts.Parts;
|
||||
import org.docx4j.openpackaging.parts.SpreadsheetML.JaxbSmlPart;
|
||||
import org.docx4j.openpackaging.parts.SpreadsheetML.WorkbookPart;
|
||||
import org.docx4j.openpackaging.parts.SpreadsheetML.WorksheetPart;
|
||||
import org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage;
|
||||
import org.docx4j.openpackaging.parts.relationships.Namespaces;
|
||||
import org.docx4j.openpackaging.parts.relationships.RelationshipsPart;
|
||||
import org.docx4j.relationships.Relationship;
|
||||
import org.xlsx4j.sml.Cell;
|
||||
import org.xlsx4j.sml.SheetData;
|
||||
import org.xlsx4j.sml.Worksheet;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.util.JAXBResult;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.Templates;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Slf4j
|
||||
public class ExcelUtil {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String inputfilepath = "D:\\text\\072001自定义模板.xlsx";
|
||||
SpreadsheetMLPackage pkg = SpreadsheetMLPackage.load(new File(inputfilepath));
|
||||
WorksheetPart worksheet = pkg.getWorkbookPart().getWorksheet(0);
|
||||
JAXBResult result = XmlUtils.prepareJAXBResult(worksheet.getJAXBContext());
|
||||
// .createWorksheetPart(new PartName("/xl/worksheets/sheet1.xml"), "Sheet1", 1);
|
||||
JaxbSmlPart smlPart = (JaxbSmlPart)pkg.getParts().get(new PartName("/xl/sharedStrings.xml")); // 获取所有sheet中的文本
|
||||
Parts parts = pkg.getParts();
|
||||
System.out.println("mmmmmmm");
|
||||
|
||||
/*JAXBResult result = XmlUtils.prepareJAXBResult(worksheet.getJAXBContext());
|
||||
Map<String, Object> transformParameters = new HashMap<>();
|
||||
transformParameters.put("NIO 07200103", "dfasdfas");
|
||||
|
||||
// InputStream smlPart = pkg.getParts().get(new PartName("/xl/sharedStrings.xml")); // 获取所有sheet
|
||||
|
||||
Source xsltSource = new StreamSource(new File("D:\\text\\sharedStrings.xml"));
|
||||
TransformerFactory transFact = TransformerFactory.newInstance();
|
||||
Templates cachedXSLT = transFact.newTemplates(xsltSource);
|
||||
|
||||
pkg.getWorkbookPart().transform(cachedXSLT,transformParameters,result);
|
||||
pkg.getWorkbookPart().transform(cachedXSLT,transformParameters,result);*/
|
||||
|
||||
// variableReplace();
|
||||
// xlsx4JAddImage();
|
||||
|
||||
WorkbookPart workbookPart = pkg.getWorkbookPart();
|
||||
WorksheetPart sheet = workbookPart.getWorksheet(0);
|
||||
Worksheet ws = sheet.getContents();
|
||||
SheetData data = ws.getSheetData();
|
||||
System.out.println("mmmmmmm");
|
||||
}
|
||||
|
||||
public static void replacePictureBatchPOI(Workbook workbook, SpreadsheetMLPackage pkg, List<Map<String, Object>> imgListAll) throws Exception {
|
||||
//获取全部sheet页中表格
|
||||
Sheet sheet=null;
|
||||
int partNameNum = 0;
|
||||
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {//获取每个Sheet表
|
||||
sheet = workbook.getSheetAt(i);
|
||||
WorksheetPart worksheetPart = (WorksheetPart) pkg.getParts().get(new PartName("/xl/worksheets/" + sheet.getSheetName().toLowerCase() + ".xml"));
|
||||
partNameNum++;
|
||||
|
||||
//获得数据的总行数
|
||||
int totalRowNum = sheet.getLastRowNum();
|
||||
|
||||
//获得所有数据
|
||||
for (int x = 0; x < totalRowNum; x++) {
|
||||
//获得第x行对象
|
||||
Row row = sheet.getRow(x);
|
||||
if (!(row == null)) {
|
||||
//获得总列数
|
||||
int cellLength = row.getLastCellNum();
|
||||
//如果x行里的所有单元格
|
||||
for (int y = 0; y < cellLength; y++) {
|
||||
|
||||
org.apache.poi.ss.usermodel.Cell cell = row.getCell(y);
|
||||
if(ObjectUtil.isNull(cell)) {
|
||||
continue;
|
||||
}
|
||||
String cellValue = cell.getStringCellValue();
|
||||
|
||||
for (Map<String, Object> imgMap : imgListAll) {
|
||||
String key = (String) imgMap.get("key");
|
||||
String text = (String) imgMap.get("text");
|
||||
byte[] bytes = (byte[]) imgMap.get("bytes");
|
||||
if (("${" + key + "}").equals(cellValue)) {
|
||||
putImagePOI(worksheetPart, pkg, cell, bytes, sheet.getSheetName().toLowerCase(), String.valueOf(partNameNum));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void replacePictureBatch(SpreadsheetMLPackage pkg,List<Map<String, Object>> imgListAll) throws Exception {
|
||||
Parts parts = pkg.getParts();
|
||||
Map<PartName, Part> map = parts.getParts();
|
||||
|
||||
for (Map.Entry<PartName, Part> partMap : map.entrySet()) {
|
||||
int partNameNum = 0;
|
||||
if (partMap.getValue() instanceof WorksheetPart) {
|
||||
String partName = String.valueOf(partMap.getKey());
|
||||
WorksheetPart worksheetPart = (WorksheetPart) partMap.getValue();
|
||||
SheetData sheetData = worksheetPart.getJaxbElement().getSheetData();
|
||||
partNameNum++;
|
||||
|
||||
for (org.xlsx4j.sml.Row r : sheetData.getRow() ) { // 循环表格行
|
||||
for (Cell c : r.getC()) { // 循环表格单元格
|
||||
Object cellValue = c.getV(); // 获取单元格数内容
|
||||
|
||||
if (cellValue instanceof String) {
|
||||
for (Map<String, Object> imgMap : imgListAll) {
|
||||
String key = (String) imgMap.get("key");
|
||||
String text = (String) imgMap.get("text");
|
||||
byte[] bytes = (byte[]) imgMap.get("bytes");
|
||||
|
||||
if (("${" + key + "}").equals(cellValue)) {
|
||||
c.setV(text);
|
||||
putImage(worksheetPart, pkg, c, bytes, partName, String.valueOf(partNameNum));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void putImagePOI(WorksheetPart worksheetPart, SpreadsheetMLPackage pkg, org.apache.poi.ss.usermodel.Cell newCell, byte[] bytes, String sheetName, String partName) throws Exception {
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(bytes);
|
||||
BufferedImage bufferedImage = ImageIO.read(in);
|
||||
BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(pkg, worksheetPart, bytes);
|
||||
String imagePartName = imagePart.getPartName().getName();
|
||||
|
||||
PartName drawingPart = new PartName(worksheetPart.getPartName().getName().replace("worksheets/" + sheetName, "drawings/drawing" + partName));
|
||||
Drawing drawing = (Drawing) pkg.getParts().get(drawingPart);
|
||||
int currentId = 0;
|
||||
if (drawing == null) {
|
||||
drawing = new Drawing(drawingPart);
|
||||
drawing.setContents(new org.docx4j.dml.spreadsheetdrawing.CTDrawing());
|
||||
Relationship relationship = worksheetPart.addTargetPart(drawing);
|
||||
org.xlsx4j.sml.CTDrawing smlDrawing = new org.xlsx4j.sml.CTDrawing();
|
||||
smlDrawing.setId(relationship.getId());
|
||||
smlDrawing.setParent(worksheetPart.getContents());
|
||||
worksheetPart.getContents().setDrawing(smlDrawing);
|
||||
} else {
|
||||
currentId = drawing.getContents().getEGAnchor().size();
|
||||
}
|
||||
|
||||
CTTwoCellAnchor anchor = new CTTwoCellAnchor();
|
||||
anchor.setFrom(new CTMarker());
|
||||
anchor.getFrom().setCol(newCell.getColumnIndex());
|
||||
anchor.getFrom().setRow(newCell.getRowIndex());
|
||||
anchor.setTo(new CTMarker());
|
||||
anchor.getTo().setCol(newCell.getColumnIndex() + 1);
|
||||
anchor.getTo().setRow(newCell.getRowIndex() + 1);
|
||||
|
||||
CTPicture picture = new CTPicture();
|
||||
|
||||
CTBlipFillProperties blipFillProperties = new CTBlipFillProperties();
|
||||
blipFillProperties.setStretch(new CTStretchInfoProperties());
|
||||
blipFillProperties.getStretch().setFillRect(new CTRelativeRect());
|
||||
blipFillProperties.setBlip(new CTBlip());
|
||||
blipFillProperties.getBlip().setEmbed("rId" + (currentId + 1));
|
||||
blipFillProperties.getBlip().setCstate(STBlipCompression.NONE);
|
||||
|
||||
picture.setBlipFill(blipFillProperties);
|
||||
|
||||
CTNonVisualDrawingProps nonVisualDrawingProps = new CTNonVisualDrawingProps();
|
||||
nonVisualDrawingProps.setId(currentId + 2);
|
||||
nonVisualDrawingProps.setName(imagePartName.substring(imagePartName.lastIndexOf("/") + 1));
|
||||
nonVisualDrawingProps.setDescr(nonVisualDrawingProps.getName());
|
||||
|
||||
CTNonVisualPictureProperties nonVisualPictureProperties = new CTNonVisualPictureProperties();
|
||||
nonVisualPictureProperties.setPicLocks(new CTPictureLocking());
|
||||
nonVisualPictureProperties.getPicLocks().setNoChangeAspect(true);
|
||||
CTPictureNonVisual nonVisualPicture = new CTPictureNonVisual();
|
||||
|
||||
nonVisualPicture.setCNvPr(nonVisualDrawingProps);
|
||||
nonVisualPicture.setCNvPicPr(nonVisualPictureProperties);
|
||||
|
||||
picture.setNvPicPr(nonVisualPicture);
|
||||
|
||||
CTShapeProperties shapeProperties = new CTShapeProperties();
|
||||
CTTransform2D transform2D = new CTTransform2D();
|
||||
transform2D.setOff(new CTPoint2D());
|
||||
transform2D.setExt(new CTPositiveSize2D());
|
||||
shapeProperties.setXfrm(transform2D);
|
||||
shapeProperties.setPrstGeom(new CTPresetGeometry2D());
|
||||
shapeProperties.getPrstGeom().setPrst(STShapeType.RECT);
|
||||
shapeProperties.getPrstGeom().setAvLst(new CTGeomGuideList());
|
||||
CTPositiveSize2D positivesize2D = new CTPositiveSize2D();
|
||||
transform2D.setExt(positivesize2D);
|
||||
positivesize2D.setCx( XlsxUtils.convertPxToEmu(bufferedImage.getWidth()) );
|
||||
positivesize2D.setCy( XlsxUtils.convertPxToEmu(bufferedImage.getHeight()) );
|
||||
|
||||
picture.setSpPr(shapeProperties);
|
||||
|
||||
anchor.setPic(picture);
|
||||
anchor.setClientData(new CTAnchorClientData());
|
||||
anchor.setEditAs(STEditAs.ONE_CELL);
|
||||
drawing.getContents().getEGAnchor().add(anchor);
|
||||
|
||||
Relationship rel = new Relationship();
|
||||
rel.setId("rId" + (currentId + 1));
|
||||
rel.setType(Namespaces.IMAGE);
|
||||
rel.setTarget(imagePartName);
|
||||
|
||||
drawing.getRelationshipsPart().addRelationship(rel);
|
||||
RelationshipsPart relPart = drawing.getRelationshipsPart();
|
||||
pkg.getParts().remove(relPart.getPartName());
|
||||
pkg.getParts().put(relPart);
|
||||
pkg.getParts().remove(drawing.getPartName());
|
||||
pkg.getParts().put(drawing);
|
||||
}
|
||||
|
||||
private static void putImage(WorksheetPart worksheetPart, SpreadsheetMLPackage pkg, Cell newCell, byte[] bytes, String sheetName, String partName) throws Exception {
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(bytes);
|
||||
BufferedImage bufferedImage = ImageIO.read(in);
|
||||
|
||||
BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(pkg, worksheetPart, bytes);
|
||||
CTTwoCellAnchor anchor = new CTTwoCellAnchor();
|
||||
anchor.setFrom(new CTMarker());
|
||||
CellReference cellReference = new CellReference("", newCell.getR());
|
||||
anchor.getFrom().setCol(cellReference.getColumn() - 1);
|
||||
anchor.getFrom().setRow(cellReference.getRow() - 1);
|
||||
anchor.setTo(new CTMarker());
|
||||
anchor.getTo().setCol(cellReference.getColumn());
|
||||
anchor.getTo().setRow(cellReference.getRow());
|
||||
|
||||
PartName drawingPart = new PartName(worksheetPart.getPartName().getName().replace("worksheets/" + sheetName, "drawings/drawing" + partName));
|
||||
String imagePartName = imagePart.getPartName().getName();
|
||||
Drawing drawing = (Drawing) pkg.getParts().get(drawingPart);
|
||||
int currentId = 0;
|
||||
if (drawing == null) {
|
||||
drawing = new Drawing(drawingPart);
|
||||
drawing.setContents(new org.docx4j.dml.spreadsheetdrawing.CTDrawing());
|
||||
Relationship relationship = worksheetPart.addTargetPart(drawing);
|
||||
org.xlsx4j.sml.CTDrawing smlDrawing = new org.xlsx4j.sml.CTDrawing();
|
||||
smlDrawing.setId(relationship.getId());
|
||||
smlDrawing.setParent(worksheetPart.getContents());
|
||||
worksheetPart.getContents().setDrawing(smlDrawing);
|
||||
} else {
|
||||
currentId = drawing.getContents().getEGAnchor().size();
|
||||
}
|
||||
|
||||
CTPicture picture = new CTPicture();
|
||||
|
||||
CTBlipFillProperties blipFillProperties = new CTBlipFillProperties();
|
||||
blipFillProperties.setStretch(new CTStretchInfoProperties());
|
||||
blipFillProperties.getStretch().setFillRect(new CTRelativeRect());
|
||||
blipFillProperties.setBlip(new CTBlip());
|
||||
blipFillProperties.getBlip().setEmbed("rId" + (currentId + 1));
|
||||
blipFillProperties.getBlip().setCstate(STBlipCompression.PRINT);
|
||||
|
||||
picture.setBlipFill(blipFillProperties);
|
||||
|
||||
CTNonVisualDrawingProps nonVisualDrawingProps = new CTNonVisualDrawingProps();
|
||||
nonVisualDrawingProps.setId(currentId + 2);
|
||||
nonVisualDrawingProps.setName(imagePartName.substring(imagePartName.lastIndexOf("/") + 1));
|
||||
nonVisualDrawingProps.setDescr(nonVisualDrawingProps.getName());
|
||||
|
||||
CTNonVisualPictureProperties nonVisualPictureProperties = new CTNonVisualPictureProperties();
|
||||
nonVisualPictureProperties.setPicLocks(new CTPictureLocking());
|
||||
nonVisualPictureProperties.getPicLocks().setNoChangeAspect(true);
|
||||
CTPictureNonVisual nonVisualPicture = new CTPictureNonVisual();
|
||||
|
||||
nonVisualPicture.setCNvPr(nonVisualDrawingProps);
|
||||
nonVisualPicture.setCNvPicPr(nonVisualPictureProperties);
|
||||
|
||||
picture.setNvPicPr(nonVisualPicture);
|
||||
|
||||
CTShapeProperties shapeProperties = new CTShapeProperties();
|
||||
CTTransform2D transform2D = new CTTransform2D();
|
||||
transform2D.setOff(new CTPoint2D());
|
||||
transform2D.setExt(new CTPositiveSize2D());
|
||||
shapeProperties.setXfrm(transform2D);
|
||||
shapeProperties.setPrstGeom(new CTPresetGeometry2D());
|
||||
shapeProperties.getPrstGeom().setPrst(STShapeType.RECT);
|
||||
shapeProperties.getPrstGeom().setAvLst(new CTGeomGuideList());
|
||||
CTPositiveSize2D positivesize2D = new CTPositiveSize2D();
|
||||
transform2D.setExt(positivesize2D);
|
||||
positivesize2D.setCx( XlsxUtils.convertPxToEmu(bufferedImage.getWidth()) );
|
||||
positivesize2D.setCy( XlsxUtils.convertPxToEmu(bufferedImage.getHeight()) );
|
||||
|
||||
picture.setSpPr(shapeProperties);
|
||||
|
||||
anchor.setPic(picture);
|
||||
anchor.setClientData(new CTAnchorClientData());
|
||||
|
||||
drawing.getContents().getEGAnchor().add(anchor);
|
||||
|
||||
Relationship rel = new Relationship();
|
||||
rel.setId("rId" + (currentId + 1));
|
||||
rel.setType(Namespaces.IMAGE);
|
||||
rel.setTarget(imagePartName);
|
||||
|
||||
drawing.getRelationshipsPart().addRelationship(rel);
|
||||
RelationshipsPart relPart = drawing.getRelationshipsPart();
|
||||
pkg.getParts().remove(relPart.getPartName());
|
||||
pkg.getParts().put(relPart);
|
||||
pkg.getParts().remove(drawing.getPartName());
|
||||
pkg.getParts().put(drawing);
|
||||
}
|
||||
|
||||
private static String getWmlTemplateString(JaxbSmlPart smlPart) {
|
||||
String wmlTemplateString = null;
|
||||
PartStore partStore = smlPart.getPackage().getSourcePartStore();
|
||||
String name = smlPart.getPartName().getName();
|
||||
try {
|
||||
InputStream is = partStore.loadPart(
|
||||
name.substring(1));
|
||||
if (is == null) {
|
||||
log.warn(name + " missing from part store");
|
||||
} else {
|
||||
log.info("Lazily unmarshalling " + name);
|
||||
// wmlTemplateString = convertStreamToString(is);
|
||||
|
||||
// This seems to be about 5% faster than the Scanner approach
|
||||
wmlTemplateString = IOUtils.toString(is, "UTF-8");
|
||||
List<String> placeholderList = new ArrayList<>();
|
||||
getAllPlaceholderElementFromObject(wmlTemplateString, 0, placeholderList);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
|
||||
} finally {
|
||||
return wmlTemplateString;
|
||||
}
|
||||
}
|
||||
|
||||
private static List<String> getAllPlaceholderElementFromObject(String wmlTemplateString, int offset, List<String> placeholderList) {
|
||||
|
||||
int startKey = wmlTemplateString.indexOf("${", offset);
|
||||
if (startKey == -1)
|
||||
return null;
|
||||
else {
|
||||
int keyEnd = wmlTemplateString.indexOf('}', startKey);
|
||||
String placeHolder = wmlTemplateString.substring(startKey, keyEnd + 1);
|
||||
if (isPlaceholder(placeHolder)) {
|
||||
placeholderList.add(placeHolder);
|
||||
}
|
||||
return getAllPlaceholderElementFromObject(wmlTemplateString, keyEnd + 1, placeholderList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断字符串是否有${}占位符
|
||||
*
|
||||
* @param str 需要判断的字符串
|
||||
* @return 是否字符串是否有${}占位符
|
||||
* @author liyawei
|
||||
*/
|
||||
private static boolean isPlaceholder(String str) {
|
||||
if (str != null && !str.isEmpty()) {
|
||||
Pattern pattern = Pattern.compile("([$]\\{[A-Za-z0-9./ -]+\\})"); // 识别范围 认证模块专用
|
||||
Matcher m = pattern.matcher(str);
|
||||
return m.find();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void xlsx4JAddImage() throws Exception {
|
||||
@@ -88,17 +422,11 @@ public class ExcelUtil {
|
||||
System.out.println("\n\n done .. " + outputfilepath);
|
||||
}
|
||||
|
||||
public static void variableReplace(InputStream is, OutputStream os, HashMap<String, String> mappings) throws Exception {
|
||||
|
||||
SpreadsheetMLPackage opcPackagepkg = SpreadsheetMLPackage.load(is);
|
||||
|
||||
public static void variableReplace(SpreadsheetMLPackage pkg, HashMap<String, String> mappings) throws Exception {
|
||||
// Be sure to get the part which actually contains your variables!
|
||||
JaxbSmlPart smlPart = (JaxbSmlPart)opcPackagepkg.getParts().get(new PartName("/xl/sharedStrings.xml")); // 获取所有sheet
|
||||
JaxbSmlPart smlPart = (JaxbSmlPart)pkg.getParts().get(new PartName("/xl/sharedStrings.xml")); // 获取所有sheet
|
||||
//JaxbSmlPart smlPart = (JaxbSmlPart)opcPackagepkg.getParts().get(new PartName("/xl/worksheets/sheet1.xml"));
|
||||
smlPart.variableReplace(mappings);
|
||||
|
||||
// Save it
|
||||
opcPackagepkg.save(os);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,14 +456,14 @@ public class ExcelUtil {
|
||||
CTBlip blip = dmlObjectFactory.createCTBlip();
|
||||
blipfillproperties.setBlip(blip);
|
||||
blip.setCstate(org.docx4j.dml.STBlipCompression.NONE);
|
||||
blip.setEmbed( imageRelID );
|
||||
blip.setEmbed( imageRelID ); //-------
|
||||
// Create object for extLst
|
||||
CTOfficeArtExtensionList officeartextensionlist = dmlObjectFactory.createCTOfficeArtExtensionList();
|
||||
blip.setExtLst(officeartextensionlist);
|
||||
// Create object for ext
|
||||
CTOfficeArtExtension officeartextension = dmlObjectFactory.createCTOfficeArtExtension();
|
||||
officeartextensionlist.getExt().add( officeartextension);
|
||||
officeartextension.setUri( "{28A0092B-C50C-407E-A947-70E740481C1C}");
|
||||
officeartextension.setUri( "{28A0092B-C50C-407E-A947-70E740481C1C}"); //------
|
||||
blip.setLink( "");
|
||||
// Create object for stretch
|
||||
CTStretchInfoProperties stretchinfoproperties = dmlObjectFactory.createCTStretchInfoProperties();
|
||||
@@ -143,10 +471,10 @@ public class ExcelUtil {
|
||||
// Create object for fillRect
|
||||
CTRelativeRect relativerect = dmlObjectFactory.createCTRelativeRect();
|
||||
stretchinfoproperties.setFillRect(relativerect);
|
||||
relativerect.setR( new Integer(0) );
|
||||
relativerect.setT( new Integer(0) );
|
||||
relativerect.setL( new Integer(0) );
|
||||
relativerect.setB( new Integer(0) );
|
||||
relativerect.setR( new Integer(0) ); //------
|
||||
relativerect.setT( new Integer(0) ); //------
|
||||
relativerect.setL( new Integer(0) ); //------
|
||||
relativerect.setB( new Integer(0) ); //------
|
||||
// Create object for spPr
|
||||
CTShapeProperties shapeproperties = dmlObjectFactory.createCTShapeProperties();
|
||||
picture.setSpPr(shapeproperties);
|
||||
@@ -157,13 +485,13 @@ public class ExcelUtil {
|
||||
// Create object for off
|
||||
CTPoint2D point2d = dmlObjectFactory.createCTPoint2D();
|
||||
transform2d.setOff(point2d);
|
||||
point2d.setY( 0 );
|
||||
point2d.setX( 0 );
|
||||
point2d.setY( 0 ); //------
|
||||
point2d.setX( 0 ); //------
|
||||
// Create object for ext
|
||||
CTPositiveSize2D positivesize2d = dmlObjectFactory.createCTPositiveSize2D();
|
||||
transform2d.setExt(positivesize2d);
|
||||
positivesize2d.setCx( 714375 );
|
||||
positivesize2d.setCy( 714375 );
|
||||
positivesize2d.setCx( 714375 ); //------
|
||||
positivesize2d.setCy( 714375 ); //------
|
||||
// Create object for prstGeom
|
||||
CTPresetGeometry2D presetgeometry2d = dmlObjectFactory.createCTPresetGeometry2D();
|
||||
shapeproperties.setPrstGeom(presetgeometry2d);
|
||||
@@ -177,9 +505,9 @@ public class ExcelUtil {
|
||||
// Create object for cNvPr
|
||||
CTNonVisualDrawingProps nonvisualdrawingprops = dmlObjectFactory.createCTNonVisualDrawingProps();
|
||||
picturenonvisual.setCNvPr(nonvisualdrawingprops);
|
||||
nonvisualdrawingprops.setDescr( "");
|
||||
nonvisualdrawingprops.setName( "Picture 1");
|
||||
nonvisualdrawingprops.setId( 2 );
|
||||
nonvisualdrawingprops.setDescr( ""); //------
|
||||
nonvisualdrawingprops.setName( "Picture 1"); //------
|
||||
nonvisualdrawingprops.setId( 2 ); //------
|
||||
// Create object for cNvPicPr
|
||||
CTNonVisualPictureProperties nonvisualpictureproperties = dmlObjectFactory.createCTNonVisualPictureProperties();
|
||||
picturenonvisual.setCNvPicPr(nonvisualpictureproperties);
|
||||
@@ -190,18 +518,18 @@ public class ExcelUtil {
|
||||
// Create object for to
|
||||
CTMarker marker = dmlspreadsheetdrawingObjectFactory.createCTMarker();
|
||||
twocellanchor.setTo(marker);
|
||||
marker.setCol(1);
|
||||
marker.setColOff( 104775 );
|
||||
marker.setRow(3);
|
||||
marker.setRowOff( 142875 );
|
||||
marker.setCol(1); //------
|
||||
marker.setColOff( 104775 ); //------
|
||||
marker.setRow(3); //------
|
||||
marker.setRowOff( 142875 ); //------
|
||||
// Create object for from
|
||||
CTMarker marker2 = dmlspreadsheetdrawingObjectFactory.createCTMarker();
|
||||
twocellanchor.setFrom(marker2);
|
||||
marker2.setCol(0);
|
||||
marker2.setColOff( 0 );
|
||||
marker2.setRow(0);
|
||||
marker2.setRowOff( 0 );
|
||||
twocellanchor.setEditAs(STEditAs.fromValue("name"));
|
||||
marker2.setCol(0); //------
|
||||
marker2.setColOff( 0 ); //------
|
||||
marker2.setRow(0); //------
|
||||
marker2.setRowOff( 0 ); //------
|
||||
twocellanchor.setEditAs(STEditAs.ONE_CELL);
|
||||
|
||||
// return drawingWrapped;
|
||||
return drawing;
|
||||
@@ -264,5 +592,4 @@ public class ExcelUtil {
|
||||
XmlUtils.unmarshalString(openXML));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright 2013 Haulmont
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.jero.modules.project.util;
|
||||
|
||||
public final class XlsxUtils {
|
||||
|
||||
private static final long PX_PER_INCH = 96;
|
||||
private static final long EMU_PER_INCH = 914400;
|
||||
|
||||
private XlsxUtils() {
|
||||
}
|
||||
|
||||
public static int getNumberFromColumnReference(String columnReference) {
|
||||
int sum = 0;
|
||||
|
||||
for (int i = 0; i < columnReference.length(); i++) {
|
||||
char c = columnReference.charAt(i);
|
||||
int number = ((int) c) - 64 - 1;
|
||||
|
||||
int pow = columnReference.length() - i - 1;
|
||||
sum += Math.pow(26, pow) * (number + 1);
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
public static String getColumnReferenceFromNumber(int number) {
|
||||
int remain = 0;
|
||||
StringBuilder ref = new StringBuilder();
|
||||
do {
|
||||
|
||||
remain = (number - 1) % 26;
|
||||
number = (number - 1) / 26;
|
||||
|
||||
ref.append((char) (remain + 64 + 1));
|
||||
} while (number > 0);
|
||||
|
||||
return ref.reverse().toString();
|
||||
}
|
||||
|
||||
public static long convertPxToEmu(long px) {
|
||||
return px * EMU_PER_INCH / PX_PER_INCH;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -136,7 +136,7 @@ public class SpaceJobHandler implements Job {
|
||||
}
|
||||
}
|
||||
projectYearNameInfoEOService.saveBatch(diffYearNameList);
|
||||
log.error("从Space获取项目名称相关数据,成功保存");
|
||||
log.info("从Space获取项目名称相关数据,成功保存");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -713,8 +713,9 @@ module.exports = {
|
||||
|
||||
confirmationOfRegulationsList: 'Regulation List Confirmation',
|
||||
regulatoryTaskConfirmation: 'Regulation Task Confirmation',
|
||||
certificationStart: 'Homo KO',
|
||||
certificationEnd: 'Homo Completion',
|
||||
certificationStart: 'Homo Test Completion',
|
||||
preHomoCompletion:'Pre-Homo Completion',
|
||||
certificationEnd: 'Type Approval',
|
||||
directoryName: 'Catalogue Name',
|
||||
batch: 'Batch',
|
||||
uploadTime: 'Upload Time',
|
||||
|
||||
@@ -729,8 +729,9 @@ module.exports = {
|
||||
time: '时间',
|
||||
confirmationOfRegulationsList: '法规清单确认',
|
||||
regulatoryTaskConfirmation: '法规任务确认',
|
||||
certificationStart: '认证开始',
|
||||
certificationEnd: '认证结束',
|
||||
certificationStart: '认证试验结束',
|
||||
preHomoCompletion:'摸底试验结束',
|
||||
certificationEnd: '认证批准',
|
||||
directoryName: '目录名称',
|
||||
batch: '批次',
|
||||
uploadTime: '上传时间',
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
<template>
|
||||
<div :class="[prefixCls]">
|
||||
<slot name="subtitle">
|
||||
<div :class="[`${prefixCls}-subtitle`]">{{ typeof subTitle === 'string' ? subTitle : subTitle() }}</div>
|
||||
</slot>
|
||||
<div class="number-info-value">
|
||||
<span>{{ total }}</span>
|
||||
<span class="sub-total">
|
||||
{{ subTotal }}
|
||||
<icon :type="`caret-${status}`" />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Icon from 'ant-design-vue/es/icon'
|
||||
|
||||
export default {
|
||||
name: 'NumberInfo',
|
||||
props: {
|
||||
prefixCls: {
|
||||
type: String,
|
||||
default: 'ant-pro-number-info'
|
||||
},
|
||||
total: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
subTotal: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
subTitle: {
|
||||
type: [String, Function],
|
||||
default: ''
|
||||
},
|
||||
status: {
|
||||
type: String,
|
||||
default: 'up'
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Icon
|
||||
},
|
||||
data () {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
@import "index";
|
||||
</style>
|
||||
@@ -1,3 +0,0 @@
|
||||
import NumberInfo from './NumberInfo'
|
||||
|
||||
export default NumberInfo
|
||||
@@ -1,55 +0,0 @@
|
||||
@import "../index";
|
||||
|
||||
@numberInfo-prefix-cls: ~"@{ant-pro-prefix}-number-info";
|
||||
|
||||
.@{numberInfo-prefix-cls} {
|
||||
|
||||
.ant-pro-number-info-subtitle {
|
||||
color: @text-color-secondary;
|
||||
font-size: @font-size-base;
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
word-break: break-all;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.number-info-value {
|
||||
margin-top: 4px;
|
||||
font-size: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
word-break: break-all;
|
||||
white-space: nowrap;
|
||||
|
||||
& > span {
|
||||
color: @heading-color;
|
||||
display: inline-block;
|
||||
line-height: 32px;
|
||||
height: 32px;
|
||||
font-size: 24px;
|
||||
margin-right: 32px;
|
||||
}
|
||||
|
||||
.sub-total {
|
||||
color: @text-color-secondary;
|
||||
font-size: @font-size-lg;
|
||||
vertical-align: top;
|
||||
margin-right: 0;
|
||||
i {
|
||||
font-size: 12px;
|
||||
transform: scale(0.82);
|
||||
margin-left: 4px;
|
||||
}
|
||||
:global {
|
||||
.anticon-caret-up {
|
||||
color: @red-6;
|
||||
}
|
||||
.anticon-caret-down {
|
||||
color: @green-6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,17 +95,6 @@
|
||||
fourth incident in September, according to the safety recall report. After meeting with US regulators in October, the firm decided to issue a voluntary recall.
|
||||
</ellipsis>
|
||||
</a-card>
|
||||
|
||||
<h2># NumberInfo 组件 </h2>
|
||||
|
||||
<a-divider> NumberInfo </a-divider>
|
||||
<a-card>
|
||||
<number-info
|
||||
:sub-title="() => { return 'Visits this week' }"
|
||||
:total="12321"
|
||||
status="up"
|
||||
:sub-total="17.1"></number-info>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -116,14 +105,12 @@
|
||||
import AvatarList from '@/components/AvatarList'
|
||||
import CountDown from '@/components/CountDown/CountDown'
|
||||
import Ellipsis from '@/components/Ellipsis'
|
||||
import NumberInfo from '@/components/NumberInfo'
|
||||
|
||||
const AvatarListItem = AvatarList.AvatarItem
|
||||
|
||||
export default {
|
||||
name: 'Home',
|
||||
components: {
|
||||
NumberInfo,
|
||||
Ellipsis,
|
||||
CountDown,
|
||||
Trend,
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
</div>
|
||||
<a-form-model-item class="itemModel" prop="title">
|
||||
<a-input class="box-input"
|
||||
:disabled="true"
|
||||
:disabled="false"
|
||||
v-model="formInline.title"
|
||||
:placeholder="$t('PleaseEnter')+$t('title')"/>
|
||||
</a-form-model-item>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
</div>
|
||||
<a-form-model-item class="itemModel" prop="title">
|
||||
<a-input class="box-input"
|
||||
:disabled="true"
|
||||
:disabled="formInline.roleCodeIndex == 0 ? false : true"
|
||||
v-model="formInline.title"
|
||||
:placeholder="$t('PleaseEnter')+$t('title')"/>
|
||||
</a-form-model-item>
|
||||
@@ -994,7 +994,7 @@
|
||||
// } else if (row.designInitiator == 0) {
|
||||
// this.designInitiatorList = res.result.studioPersonList || []
|
||||
// } else if (!row.designInitiator || row.designInitiator == '') {
|
||||
this.designInitiatorList = res.result.allPersonList || []
|
||||
this.designInitiatorList = res.result.allPersonList || []
|
||||
// }
|
||||
//设计符合性确认-责任人
|
||||
// if (row.designDuty == 1) {
|
||||
@@ -1006,7 +1006,7 @@
|
||||
// } else if (row.designInitiator == 0) {
|
||||
// this.designDutyList = res.result.studioPersonList || []
|
||||
// } else if (!row.designDuty || row.designDuty == '') {
|
||||
this.designDutyList = res.result.allPersonList || []
|
||||
this.designDutyList = res.result.allPersonList || []
|
||||
// }
|
||||
//prehomo确认-发起人
|
||||
// if (row.prehomoInitiator == 1) {
|
||||
@@ -1018,7 +1018,7 @@
|
||||
// } else if (row.designInitiator == 0) {
|
||||
// this.prehomoInitiatorList = res.result.studioPersonList || []
|
||||
// } else if (!row.prehomoInitiator || row.prehomoInitiator == '') {
|
||||
this.prehomoInitiatorList = res.result.allPersonList || []
|
||||
this.prehomoInitiatorList = res.result.allPersonList || []
|
||||
// }
|
||||
//prehomo确认-责任人
|
||||
// if (row.prehomoDuty == 1) {
|
||||
@@ -1030,7 +1030,7 @@
|
||||
// } else if (row.designInitiator == 0) {
|
||||
// this.prehomoDutyList = res.result.studioPersonList || []
|
||||
// } else if (!row.prehomoDuty || row.prehomoDuty == '') {
|
||||
this.prehomoDutyList = res.result.allPersonList || []
|
||||
this.prehomoDutyList = res.result.allPersonList || []
|
||||
// }
|
||||
//验证符合性确认-发起人
|
||||
// if (row.verifyInitiator == 1) {
|
||||
@@ -1042,7 +1042,7 @@
|
||||
// } else if (row.designInitiator == 0) {
|
||||
// this.verifyInitiatorList = res.result.studioPersonList || []
|
||||
// } else if (!row.verifyInitiator || row.verifyInitiator == '') {
|
||||
this.verifyInitiatorList = res.result.allPersonList || []
|
||||
this.verifyInitiatorList = res.result.allPersonList || []
|
||||
// }
|
||||
//验证符合性确认-责任人
|
||||
// if (row.verifyDuty == 1) {
|
||||
@@ -1054,7 +1054,7 @@
|
||||
// } else if (row.designInitiator == 0) {
|
||||
// this.verifyDutyList = res.result.studioPersonList || []
|
||||
// } else if (!row.verifyDuty || row.verifyDuty == '') {
|
||||
this.verifyDutyList = res.result.allPersonList || []
|
||||
this.verifyDutyList = res.result.allPersonList || []
|
||||
// }
|
||||
callback()
|
||||
},
|
||||
|
||||
@@ -169,6 +169,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!isDisplay" style="float: right;margin-top: 1px;margin-bottom: 0px">
|
||||
<div @click="handleExport" v-has="'projectLawsInventory:exportData'" v-if="isRoleSwitching"
|
||||
class="operator-text">
|
||||
<a-icon type="export" :rotate="-90"/>
|
||||
{{ $t('export') }}
|
||||
</div>
|
||||
<div class="operator-text" @click="submitClick(0)" v-if="isRoleSwitching">
|
||||
<a-icon type="check-circle"/>
|
||||
{{ $t('submit') }}
|
||||
@@ -1061,11 +1066,21 @@
|
||||
}
|
||||
},
|
||||
handleExport() {
|
||||
let roleCodeIndex
|
||||
if (this.isDisplay) {
|
||||
roleCodeIndex = 0
|
||||
} else {
|
||||
roleCodeIndex = 4
|
||||
}
|
||||
if (this.formInlineRoleSwitching.roleSwitchingCode == '11' || this.formInlineRoleSwitching.roleSwitchingCode == '12') {
|
||||
roleCodeIndex = 0
|
||||
}
|
||||
let selectedRowKeys = JSON.parse(JSON.stringify(this.selectedRowKeys))
|
||||
let query = {
|
||||
...this.queryParam,
|
||||
ids: selectedRowKeys.join(','),
|
||||
...this.queryParamQuery,
|
||||
roleCode:roleCodeIndex,
|
||||
projectLibraryId: this.$route.query.id
|
||||
}
|
||||
downloadFile(this.url.exportData, this.$route.query.projectName + this.$t('listOfRegulations') + '.zip', query, this.Deselect)
|
||||
@@ -1733,7 +1748,7 @@
|
||||
} else if (!dataSource[i].designDueDate) {
|
||||
this.rowKeysWarningList.push( < div > { dataSource[i].serialNumber + this.$t('confirmationOfDesignConformity') + this.$t('theDeadlineEmpty') } < /div>)
|
||||
continue
|
||||
}else if (!dataSource[i].designDeliverableType) {
|
||||
} else if (!dataSource[i].designDeliverableType) {
|
||||
this.rowKeysWarningList.push( < div > { dataSource[i].serialNumber + this.$t('confirmationOfDesignConformity') + this.$t('theDeliveryTypeCannotBeEmpty') } < /div>)
|
||||
continue
|
||||
}
|
||||
@@ -1751,7 +1766,7 @@
|
||||
} else if (!dataSource[i].prehomoDueDate) {
|
||||
this.rowKeysWarningList.push( < div > { dataSource[i].serialNumber + this.$t('PrehomoConfirmation') + this.$t('theDeadlineEmpty') } < /div>)
|
||||
continue
|
||||
}else if (!dataSource[i].prehomoDeliverableType) {
|
||||
} else if (!dataSource[i].prehomoDeliverableType) {
|
||||
this.rowKeysWarningList.push( < div > { dataSource[i].serialNumber + this.$t('PrehomoConfirmation') + this.$t('theDeliveryTypeCannotBeEmpty') } < /div>)
|
||||
continue
|
||||
}
|
||||
@@ -1769,7 +1784,7 @@
|
||||
} else if (!dataSource[i].verifyDueDate) {
|
||||
this.rowKeysWarningList.push( < div > { dataSource[i].serialNumber + this.$t('verificationAndConformityconfirmation') + this.$t('theDeadlineEmpty') } < /div>)
|
||||
continue
|
||||
}else if (!dataSource[i].verifyDeliverableType) {
|
||||
} else if (!dataSource[i].verifyDeliverableType) {
|
||||
this.rowKeysWarningList.push( < div > { dataSource[i].serialNumber + this.$t('verificationAndConformityconfirmation') + this.$t('theDeliveryTypeCannotBeEmpty') } < /div>)
|
||||
continue
|
||||
}
|
||||
@@ -1864,7 +1879,7 @@
|
||||
_this.getRowKeys(selectedRowKeys, 2, function() {
|
||||
_this.visibleComment = true
|
||||
_this.formInlineComment = {}
|
||||
_this.$nextTick(()=>{
|
||||
_this.$nextTick(() => {
|
||||
_this.$refs.ruleFormComment.clearValidate()
|
||||
})
|
||||
})
|
||||
@@ -1886,7 +1901,7 @@
|
||||
})
|
||||
}
|
||||
let query = {
|
||||
commentContent: this.$t('For')+content.join(',') + this.$t('markedRejection')+':' + this.formInlineComment.commentContent,
|
||||
commentContent: this.$t('For') + content.join(',') + this.$t('markedRejection') + ':' + this.formInlineComment.commentContent,
|
||||
projectLibraryId: this.$route.query.id
|
||||
}
|
||||
this.confirmLoadingComment = true
|
||||
|
||||
@@ -71,12 +71,12 @@
|
||||
<div class="box-title-text">
|
||||
<div class="title-text">
|
||||
<span class="Required">*</span>
|
||||
<span class="title-text-text" :title="$t('PrehomoConfirmation')">
|
||||
{{$t('PrehomoConfirmation')}}</span>
|
||||
<span class="title-text-text" :title="$t('preHomoCompletion')">
|
||||
{{$t('preHomoCompletion')}}</span>
|
||||
</div>
|
||||
<a-form-model-item class="itemModel" prop="prehomoDeadline">
|
||||
<a-date-picker class="box-input"
|
||||
:placeholder="$t('PleaseSelect')+$t('PrehomoConfirmation')"
|
||||
:placeholder="$t('PleaseSelect')+$t('preHomoCompletion')"
|
||||
@change="dateChange({db_field_name:'prehomoDeadline'})"
|
||||
format="YYYY-MM-DD"
|
||||
:getCalendarContainer="(trigger) => trigger.parentNode"
|
||||
@@ -187,7 +187,7 @@
|
||||
prehomoDeadline: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t('PrehomoConfirmation') + this.$t('cannotEmpty'),
|
||||
message: this.$t('preHomoCompletion') + this.$t('cannotEmpty'),
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
|
||||
@@ -497,7 +497,7 @@
|
||||
.process-content-right-top {
|
||||
font-size: 12px;
|
||||
color: #040B29;
|
||||
width: 70px;
|
||||
width: 75px;
|
||||
background: #fff;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
@@ -509,7 +509,7 @@
|
||||
.process-content-right-button{
|
||||
font-size: 12px;
|
||||
color: #040B29;
|
||||
width: 70px;
|
||||
width: 75px;
|
||||
background: #fff;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
@@ -519,7 +519,7 @@
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.process-content-right-button {
|
||||
width: 70px;
|
||||
width: 75px;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color: #6F7385;
|
||||
|
||||
@@ -648,7 +648,7 @@
|
||||
.process-content-right-top {
|
||||
font-size: 12px;
|
||||
color: #040B29;
|
||||
width: 70px;
|
||||
width: 75px;
|
||||
background: #fff;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
@@ -660,7 +660,7 @@
|
||||
.process-content-right-button{
|
||||
font-size: 12px;
|
||||
color: #040B29;
|
||||
width: 70px;
|
||||
width: 75px;
|
||||
background: #fff;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
@@ -670,7 +670,7 @@
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.process-content-right-button {
|
||||
width: 70px;
|
||||
width: 75px;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color: #6F7385;
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<a-select
|
||||
mode="multiple"
|
||||
style="width: 100%"
|
||||
class="selectUserRole"
|
||||
:placeholder="$t('selectUserRole')"
|
||||
optionFilterProp="children"
|
||||
v-model="selectedRole"
|
||||
@@ -736,4 +737,9 @@
|
||||
background: #fff;
|
||||
border-radius: 0 0 2px 2px;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.selectUserRole .ant-select-selection--multiple {
|
||||
height: 100px!important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user