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

This commit is contained in:
zyx.net
2022-08-17 14:05:56 +08:00
9 changed files with 131 additions and 18 deletions
@@ -134,6 +134,22 @@ public class LawsMonthlyReportTitleTemplateEOController extends JeroController<L
return Result.OK("批量删除成功!");
}
/**
* 目录删除验证
*
* @param ids
* @return
*/
@AutoLog(value = "月报标题模板-批量删除")
@ApiOperation(value="月报标题模板-批量删除", notes="月报标题模板-批量删除")
@GetMapping(value = "/verifyDelete")
public Result<?> verifyDelete(@RequestParam(name="ids",required=true) String ids) {
String flag = this.lawsMonthlyReportTitleTemplateEOService.verifyDelete(Arrays.asList(ids.split(",")));
return Result.OK(flag);
}
/**
* 通过id查询
*
@@ -48,6 +48,13 @@ public interface ILawsMonthlyReportTitleTemplateEOService extends IService<LawsM
*/
void deleteByIds(List<String> ids);
/**
* 目录删除验证
* @param ids
* @return
*/
String verifyDelete(List<String> ids);
/**
* 通过id查询
*
@@ -121,6 +121,32 @@ public class LawsMonthlyReportTitleTemplateEOServiceImpl extends ServiceImpl<Law
removeByIds(ids);
}
/**
* 目录删除验证
* @param ids
*/
@Override
public String verifyDelete(List<String> ids) {
//标题下存在内容或子标题时不能删除
//1. 判断是否存在子标题
LambdaQueryWrapper<LawsMonthlyReportTitleTemplateEO> wrapper = new LambdaQueryWrapper<>();
wrapper.in(LawsMonthlyReportTitleTemplateEO::getParentId,ids);
List<LawsMonthlyReportTitleTemplateEO> list = this.list(wrapper);
if(list.size() != 0){
//不能删除
return "false";
}
//2. 判断是否存在内容 memories_chapter
LambdaQueryWrapper<LawsMonthlyReportWriteEO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(LawsMonthlyReportWriteEO::getMemoriesChapter,ids);
List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS = lawsMonthlyReportWriteEOService.list(lambdaQueryWrapper);
if(lawsMonthlyReportWriteEOS.size() != 0){
//不能删除
return "false";
}
return "true";
}
/**
* 通过id查询
*
@@ -421,6 +421,9 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
wrapper.in(LawsMonthlyReportWriteEO::getCreateBy,currentUser.getUsername());
}
List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS = this.list(wrapper);
//法规联系人
List<LoginUser> loginUserList = getlawsContact(lawsMonthlyReportWriteEOS);
List<String> lawsMonthlyReportIdList = lawsMonthlyReportWriteEOS.stream().map(LawsMonthlyReportWriteEO::getId).collect(Collectors.toList());
//新征求意见清单模板
@@ -471,7 +474,7 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
fileTemp.mkdirs();
OutputStream os = null;
try {
createWord(path,lawsMonthlyReportWriteEOS,lawsMonthlyReportTitleTemplateEOS);
createWord(path,lawsMonthlyReportWriteEOS,lawsMonthlyReportTitleTemplateEOS,loginUserList);
ZipUtil.zip(path, path + ".zip");
//文件
os = response.getOutputStream();
@@ -513,6 +516,28 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
}
}
private List<LoginUser> getlawsContact(List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS) {
List<String> userIdList = lawsMonthlyReportWriteEOS.stream().map(LawsMonthlyReportWriteEO::getLawsContact).collect(Collectors.toList());
//法规联系人
List<String> userIds = new ArrayList<>();
for (String s : userIdList) {
if(StringUtils.isNotBlank(s)){
if(s.contains(",")){
userIds.addAll(Arrays.asList(s.split(",")));
}else{
userIds.add(s);
}
}
}
List<JSONObject> jsonObjects = sysBaseApi.queryUsersByIds(StringUtils.join(userIds, ","));
List<LoginUser> userList = new ArrayList<>();
for (JSONObject jsonObject : jsonObjects) {
LoginUser loginUser = JSONObject.parseObject(jsonObject.toJSONString(), LoginUser.class);
userList.add(loginUser);
}
return userList;
}
/**
*创建word文件
@@ -522,7 +547,8 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
*/
private void createWord(String path,
List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS,
List<LawsMonthlyReportTitleTemplateEO> lawsMonthlyReportTitleTemplateEOS){
List<LawsMonthlyReportTitleTemplateEO> lawsMonthlyReportTitleTemplateEOS,
List<LoginUser> loginUserList){
//一级菜单
List<String> parentIdList = lawsMonthlyReportTitleTemplateEOS.stream().map(LawsMonthlyReportTitleTemplateEO::getParentId).distinct().collect(Collectors.toList());
LambdaQueryWrapper<LawsMonthlyReportTitleTemplateEO> wrapper = new LambdaQueryWrapper<>();
@@ -591,13 +617,15 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
//内容中文版
XWPFDocument documentContentCn = new XWPFDocument();
FileOutputStream outContentCn = new FileOutputStream(wordFileContentCn);
wordContent(lawsMonthlyReportWriteEOS, lawsMonthlyReportTitleTemplateEOS, reportTitleOneList, titleCN, documentContentCn,CutEnum.CN.getValue());
wordContent(lawsMonthlyReportWriteEOS, lawsMonthlyReportTitleTemplateEOS, reportTitleOneList, titleCN,
documentContentCn,CutEnum.CN.getValue(),loginUserList);
documentContentCn.write(outContentCn);
//内容英文版
XWPFDocument documentContentEn = new XWPFDocument();
FileOutputStream outContentEn = new FileOutputStream(wordFileContentEn);
wordContent(lawsMonthlyReportWriteEOS, lawsMonthlyReportTitleTemplateEOS, reportTitleOneList, titleEN, documentContentEn,CutEnum.EN.getValue());
wordContent(lawsMonthlyReportWriteEOS, lawsMonthlyReportTitleTemplateEOS, reportTitleOneList, titleEN,
documentContentEn,CutEnum.EN.getValue(), loginUserList);
documentContentEn.write(outContentEn);
} catch (IOException e) {
@@ -683,7 +711,8 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
List<LawsMonthlyReportTitleTemplateEO> reportTitleOneList,
String titleCN,
XWPFDocument document,
String cut) {
String cut,
List<LoginUser> loginUserList) {
//数据字典
List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();
@@ -761,7 +790,7 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
String contentTemplate = lawsMonthlyReportWriteEO.getContentTemplate();
if(ContentTemplateEnum.DEFAULT_TEMPLATE.getValue().equals(contentTemplate)){
//写入模板
WordUtil.exportWordExcelDefault(document,lawsMonthlyReportWriteEO,sysDictItems,categoryList,cut);
WordUtil.exportWordExcelDefault(document,lawsMonthlyReportWriteEO,sysDictItems,categoryList,cut,loginUserList);
}
// else if(ContentTemplateEnum.NEW_REQUEST_LIST_TEMPLATE.getValue().equals(contentTemplate)){
@@ -2,7 +2,7 @@ package com.jero.modules.report.util;
import cn.hutool.core.util.ObjectUtil;
import com.jero.common.constant.enums.CutEnum;
import com.jero.modules.project.service.impl.ProjectLawsInventoryEOServiceImpl;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.report.entity.LawsMonthlyReportWriteEO;
import com.jero.modules.report.entity.NewOpinionTemplateEO;
import com.jero.modules.report.entity.NewStandardTemplateEO;
@@ -36,7 +36,6 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.STFldCharType;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STJc;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTblWidth;
import java.io.FileInputStream;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.Arrays;
@@ -44,6 +43,7 @@ import java.util.List;
import java.util.stream.Collectors;
public class WordUtil {
/**
* 导出工具示例
*
@@ -350,7 +350,8 @@ public class WordUtil {
LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO,
List<SysDictItem> sysDictItems,
List<SysCategory> categoryList,
String cut) {
String cut,
List<LoginUser> loginUserList) {
String technologyTerritory = lawsMonthlyReportWriteEO.getTechnologyTerritory();//技术领域
String applyCar = lawsMonthlyReportWriteEO.getApplyCar();//适用车型
String applyScope = lawsMonthlyReportWriteEO.getApplyScope();//适用范围
@@ -363,7 +364,8 @@ public class WordUtil {
String contentEn = lawsMonthlyReportWriteEO.getContentEn();//主要内容英文
String workProgressCn = lawsMonthlyReportWriteEO.getWorkProgressCn();//NIO工作进展中文
String workProgressEn = lawsMonthlyReportWriteEO.getWorkProgressEn();//NIO工作进展英文
String lawsContact = lawsMonthlyReportWriteEO.getLawsContact();//法规联系人
String lawsContactTemp = lawsMonthlyReportWriteEO.getLawsContact();//法规联系人
String lawsContact = getLawsContact(loginUserList, lawsContactTemp);
String link = lawsMonthlyReportWriteEO.getLink();//链接
String technologyTerritoryName = "";
if(org.apache.commons.lang3.StringUtils.isNotBlank(technologyTerritory)){
@@ -404,7 +406,7 @@ public class WordUtil {
//第1行
if(CutEnum.CN.getValue().equals(cut)){
//第1行
setCell(table.getRow(0), "技术领域",technologyTerritoryName);
setCell(table.getRow(0), "相关领域",technologyTerritoryName);
//第2行
setCell(table.getRow(1), "适用车型",applyCarName);
//第3行
@@ -420,16 +422,16 @@ public class WordUtil {
//第8行
setCell(table.getRow(7), "在产车实施日期",productionCarImplementTime);
//第9行
setCell(table.getRow(8), "主要内容中文",contentCn);
setCell(table.getRow(8), "主要内容",contentCn);
//第10行
setCell(table.getRow(9), "NIO工作进展中文",workProgressCn);
setCell(table.getRow(9), "NIO工作进展",workProgressCn);
//第11行
setCell(table.getRow(10), "法规联系人",lawsContact);
//第12行
setCell(table.getRow(11), "链接",link);
}else{
//第1行
setCell(table.getRow(0), "Technical Field",technologyTerritoryName);
setCell(table.getRow(0), "Related Areas",technologyTerritoryName);
//第2行
setCell(table.getRow(1), "Vehicle Type",applyCarName);
//第3行
@@ -445,9 +447,9 @@ public class WordUtil {
//第8行
setCell(table.getRow(7), "New Vehicle Execution Date",productionCarImplementTime);
//第9行
setCell(table.getRow(8), "Main Content (English)",contentEn);
setCell(table.getRow(8), "Main Content",contentEn);
//第10行
setCell(table.getRow(9), "NIO Work Progress (English)",workProgressEn);
setCell(table.getRow(9), "NIO Work Progress",workProgressEn);
//第11行
setCell(table.getRow(10), "Regulatory Contact",lawsContact);
//第12行
@@ -679,5 +681,23 @@ public class WordUtil {
tableRow.getCell(0).setText(fieldName);
tableRow.getCell(1).setText(technologyTerritory);
}
private static String getLawsContact(List<LoginUser> userList, String lawsContact) {
if(com.jero.modules.system.util.StringUtils.isNotBlank(lawsContact)){
List<LoginUser> collect = userList.stream().filter(e -> lawsContact.contains(e.getId())).collect(Collectors.toList());
StringBuilder sb = new StringBuilder();
for (String s : lawsContact.split(",")) {
List<LoginUser> loginUserList = collect.stream().filter(e -> e.getId().equals(s)).collect(Collectors.toList());
if(loginUserList.size() != 0){
sb.append(loginUserList.get(0).getUsername()+",");
}
}
if(com.jero.modules.system.util.StringUtils.isNotBlank(sb)){
String substring = sb.substring(0, sb.length() - 1);
return substring;
}
}
return null;
}
}
+1
View File
@@ -1261,4 +1261,5 @@ module.exports = {
currentlyTheFirstOneThatCannotMovedUp:'Currently the first one that cannot be moved up',
currentlyTheLastOneCannotmovedDown:'Currently the last one cannot be moved down',
weilaiRegulationMonthlyReport:'Weilai Regulation Monthly Report',
thereTitleWhichCannotBeDeleted:'There are new contents under this title, which cannot be deleted',
}
+1
View File
@@ -1363,4 +1363,5 @@ module.exports = {
currentlyTheFirstOneThatCannotMovedUp:'当前已是第一个无法进行上移',
currentlyTheLastOneCannotmovedDown:'当前已是最后一个无法进行下移',
weilaiRegulationMonthlyReport:'蔚来法规月报',
thereTitleWhichCannotBeDeleted:'该标题下存在新增内容,不能删除',
}
@@ -455,6 +455,7 @@
console.log(res)
if (res.data.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
// this.$refs['ruleFormOne'].resetFields()
_this.areaVisiblezr = false
this.getLoginUserType()
} else {
@@ -495,6 +496,7 @@
console.log(res)
if (res.data.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
this.$refs['ruleForm'].resetFields()
_this.areaVisible = false
this.getLoginUserType()
} else {
@@ -518,23 +520,25 @@
},
// 点击工程接口人的详情人员 有权限
areaOfResponsibility(record) {
this.areaVisible = true
// this.$refs.ruleForm.clearValidate()
this.$nextTick(() => {
this.Dateline = { ...this.Dateline }
this.getquerySdtList(record)
this.$refs.ruleForm.clearValidate()
})
this.areaVisible = true
},
// 点击责任领域的详情人员 有权限
ondataValueTobe(record) {
this.areaVisiblezr = true
// this.$refs.ruleForm.clearValidate()
this.$nextTick(() => {
this.Dateline = { ...this.Dateline }
this.getquerySdtId = record.id
this.$refs.ruleFormOne.clearValidate()
})
this.areaVisiblezr = true
},
dataValueTobeinitiated() {
this.$message.warning(this.$t('certifiedEngineer') + this.$t('and') + this.$t('Statusis') + this.$t('CollectionInitiated') + this.$t('ReturnedPerson') + this.$t('alteration') + this.$t('toHavePermission'))
@@ -205,6 +205,15 @@
this.$message.warning(this.$t('thereWhichCannotDeleted'))
return
}
getAction('/report/lawsMonthlyReportTitleTemplateEO/verifyDelete', { ids: val.id }).then((res) => {
if (res.result == 'true') {
this.deleteBatch(val)
} else {
this.$message.warning(this.$t('thereTitleWhichCannotBeDeleted'))
}
})
},
deleteBatch(val) {
let _this = this
this.$confirm({
content: _this.$t('ConfirmDelete'),