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

This commit is contained in:
gaosong
2022-08-18 09:41:46 +08:00
91 changed files with 2477 additions and 371 deletions
@@ -97,4 +97,7 @@ public class LawsProcessHistoryEO implements Serializable {
@ApiModelProperty(value = "流程类型")
private String flowType;
/**审批意见*/
@ApiModelProperty(value = "审批意见")
private String approvalOpinion;
}
@@ -59,6 +59,6 @@ public class LawsOpinionGatherJob implements Job {
}
}
}
log.info("法规意见收集流程,定时任务开启 =====================================================");
log.info("法规意见收集流程,定时任务结束 =====================================================");
}
}
@@ -14,5 +14,6 @@
<result column="operator_role_code" property="operatorRoleCode" />
<result column="operator_time" property="operatorTime" />
<result column="flow_type" property="flowType" />
<result column="approval_opinion" property="approvalOpinion" />
</resultMap>
</mapper>
@@ -208,8 +208,7 @@ public class LawsTechnologyEvaluationEOController extends JeroController<LawsTec
@ApiOperation(value = "条款导入")
@PostMapping(value = "/importItemExcel")
public Result<?> importItemExcel(MultipartFile file, @RequestParam(name = "cut") String cut, HttpServletRequest request) throws Exception {
List<Map<String,Object>> result = this.lawsTechnologyEvaluationEOService.importItemExcel(file,cut,request);
return Result.OK(result);
return this.lawsTechnologyEvaluationEOService.importItemExcel(file,cut,request);
}
@ApiOperation(value="根据id查询明细数据", notes="根据id查询明细数据")
@@ -85,7 +85,7 @@ public interface ILawsTechnologyEvaluationEOService extends IService<LawsTechnol
void exportItemTemplate(String cut, HttpServletResponse response, HttpServletRequest request);
List<Map<String,Object>> importItemExcel(MultipartFile file, String cut, HttpServletRequest request)throws Exception;
Result<?> importItemExcel(MultipartFile file, String cut, HttpServletRequest request)throws Exception;
List<Map<String, Object>> queryPageDummyById(Map<String, Object> parameter);
}
@@ -312,7 +312,7 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
title = "条款号,条款名称,条款内容";
fileOriName = "条款信息导入模板.xls";
} else {
title = "Item num,Item name,Item Contents";
title = "Item No.,Item Name,Item Content";
fileOriName = "Item information is imported into the template.xls";
}
@@ -356,7 +356,7 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
}
@Override
public List<Map<String,Object>> importItemExcel(MultipartFile file, String cut, HttpServletRequest request)throws Exception {
public Result<?> importItemExcel(MultipartFile file, String cut, HttpServletRequest request)throws Exception {
//校验文件格式
int pos = file.getOriginalFilename().lastIndexOf(".");
String fileSuffixStr = file.getOriginalFilename().substring(pos+1).toLowerCase();
@@ -367,7 +367,7 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
title = "条款号,条款名称,条款内容";
verifyTemplateMsg = "模板不正确,请下载正确的模板导入!";
} else {
title = "Item num,Item name,Item Contents";
title = "Item No.,Item Name,Item Content";
verifyTemplateMsg = "The template is not correct, please download the correct template to import!";
}
@@ -406,12 +406,35 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
}
int rowNos = sheet.getPhysicalNumberOfRows();// 得到excel的总记录条数
for (int i = 0; i < rowNos ; i++) {
Row row = sheet.getRow(i + 1);
if(row != null){
String itemNum = row.getCell(0, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).toString();
String itemNum = "";
Cell itemNumCell = row.getCell(0);
if(itemNumCell != null){
itemNumCell.setCellType(CellType.STRING);
itemNum = itemNumCell.toString().replaceAll("'","‘").replaceAll("\"","”");
}
String itemName = "";
Cell itemNameCell = row.getCell(1);
if(itemNameCell != null){
itemNameCell.setCellType(CellType.STRING);
itemName = itemNameCell.toString().replaceAll("'","‘").replaceAll("\"","”");
}
String itemContents = "";
Cell itemContentsCell = row.getCell(2);
if(itemContentsCell != null){
itemContentsCell.setCellType(CellType.STRING);
itemContents = itemContentsCell.toString().replaceAll("'","‘").replaceAll("\"","”");
}
/*String itemNum = row.getCell(0, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).toString();
String itemName = row.getCell(1, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).toString();
String itemContents = row.getCell(2, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).toString();
String itemContents = row.getCell(2, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).toString();*/
Map<String,Object> itemInfoMap = new HashMap<>();
String itemId = UUID.randomUUID().toString().replace("-", "");
itemInfoMap.put("itemId",itemId);
@@ -421,9 +444,17 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
result.add(itemInfoMap);
}
}
Map map = validateImportDatas(result,cut);
boolean isOk = (boolean) map.get("result");
if (!isOk) {
//验证没有通过
String message = (String) map.get("message");
return Result.error(message);
}
}
}
return result;
return Result.OK(result);
}
@Override
@@ -511,4 +542,105 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
}
return technologyTerritoryName;
}
public Map validateImportDatas(List<Map<String, Object>> dataList,String cut){
//存放数据验证结果信息
List<String> stringMessage = new ArrayList<>();
int i = 0;
for (Map<String, Object> map : dataList) {
i++;
int countError = 0; //记录失败数据数量
String errorMsg = "";
if(CutEnum.CN.getValue().equals(cut)){
errorMsg = "第" + i + "行:";
}else{
errorMsg = i + " line:";
}
String itemNum = (String) map.get("itemNum");
String itemName = (String) map.get("itemName");
String itemContent = (String) map.get("itemContent");
if(StringUtils.isEmpty(itemNum)){
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
errorMsg += "条款号不能为空;";
}else if (StringUtils.equals(cut,CutEnum.EN.getValue())){
errorMsg += "Item No. cannot be empty;";
}
countError++;
}else if(itemNum.length() > 100){
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
errorMsg += "条款号长度不能超过100;";
}else if (StringUtils.equals(cut,CutEnum.EN.getValue())){
errorMsg += "Item No. length of the cannot exceed 100;";
}
countError++;
}
if(StringUtils.isEmpty(itemName)){
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
errorMsg += "条款名称不能为空;";
}else if (StringUtils.equals(cut,CutEnum.EN.getValue())){
errorMsg += "Item Name cannot be empty;";
}
countError++;
}else if(itemName.length() > 100){
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
errorMsg += "条款名称长度不能超过100;";
}else if (StringUtils.equals(cut,CutEnum.EN.getValue())){
errorMsg += "Item Name length of the cannot exceed 100;";
}
countError++;
}
if(StringUtils.isEmpty(itemContent)){
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
errorMsg += "条款内容不能为空;";
}else if (StringUtils.equals(cut,CutEnum.EN.getValue())){
errorMsg += "Item Content cannot be empty;";
}
countError++;
}else if(itemContent.length() > 500){
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
errorMsg += "条款内容长度不能超过500;";
}else if (StringUtils.equals(cut,CutEnum.EN.getValue())){
errorMsg += "Item Content length of the cannot exceed 500;";
}
countError++;
}
if (countError > 0) {
errorMsg = errorMsg.substring(0,errorMsg.length()-1);
stringMessage.add(errorMsg);
}
}
Map result = new HashMap();
if(CollectionUtils.isEmpty(dataList)){
result.put("result", false);
String message = "";
if (StringUtils.equals(cut, CutEnum.CN.getValue())) {
message = "不能导入空的模板,请检查!";
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
message = "Cannot import empty template, please check!";
}
result.put("message", message);
}else if (stringMessage.isEmpty()) {
result.put("result", true);
result.put("resultList", dataList);
result.put("message", "");
} else {
result.put("result", false);
String html = "";
for (String message : stringMessage) {
html += message + "</br>";
}
result.put("message", html);
}
return result;
}
}
@@ -216,9 +216,12 @@ public class LawsTechnologyEvaluationItemResultEOServiceImpl extends ServiceImpl
List<SysCategory> categoryList = sysCategoryService.list();
for (LawsTechnologyEvaluationItemResultEO data : datas) {
String evaluationMethods = data.getEvaluationMethods();
List<String> evaluationMethodsList = Arrays.asList(evaluationMethods.split(","));
String name = getTreeName(cut, categoryList, evaluationMethodsList);
data.setEvaluationMethodsName(name);
if(StringUtils.isNotEmpty(evaluationMethods)){
List<String> evaluationMethodsList = Arrays.asList(evaluationMethods.split(","));
String name = getTreeName(cut, categoryList, evaluationMethodsList);
data.setEvaluationMethodsName(name);
}
if(StringUtils.isNotEmpty(data.getComplianceResult())){
data.setComplianceResultName(ComplianceResultEnum.getTextByValue(data.getComplianceResult(),cut));
}
@@ -263,7 +266,7 @@ public class LawsTechnologyEvaluationItemResultEOServiceImpl extends ServiceImpl
title = "条款号,条款名称,条款内容,评估人,评估方式,技术文件名称,章节,符合性结果,意见,附件,反馈时间";
fileName = "条款评估结果 " + ".xlsx";
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
title = "Item num,Item name,Item Contents,Evaluator,Evaluation methods,Name of technical document,Section,Compliance results,Opinion,Accessory,Feedback time ";
title = "Item No.,Item Name,Item Content,Assessor,Evaluation method,Name of technical document,chapter,Compliance Results,Opinion,Enclosure,Feedback Time";
fileName = "Item Evaluation results " + ".xlsx";
}
@@ -0,0 +1,48 @@
package com.jero.modules.problemKnowledgeBase.enums;
import com.jero.common.constant.enums.CutEnum;
import org.apache.commons.lang3.StringUtils;
/**
* 问题知识库-查询标识枚举类
*/
public enum QueryFlagEnum {
GET_ALL_APPLY_MARKET("获取所有的适用市场","","0"),
GET_NOT_CREATE_APPLY_MARKET("获取还没有创建过countryCard的适用市场","","1"),
GET_RELEASED_APPLY_MARKET("获取已发布的countryCard的适用市场","","2"),
GET_CREATE_APPLY_MARKET("获取所有自己已创建的countryCard的适用市场","","3"),
;
String cnName;
String enName;
String value;
private QueryFlagEnum(String cnName, String enName, String value) {
this.cnName = cnName;
this.enName = enName;
this.value = value;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static String getTextByValue(String value,String cut) {
QueryFlagEnum[] values = values();
for (QueryFlagEnum queryFlagEnum : values) {
if (queryFlagEnum.value.equals(value)) {
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
return queryFlagEnum.cnName;
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
return queryFlagEnum.enName;
}
}
}
return null;
}
}
@@ -6,9 +6,11 @@ import com.jero.common.api.vo.Result;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.DictModel;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.problemKnowledgeBase.entity.CountryCardManageReleaseDetailEO;
import com.jero.modules.problemKnowledgeBase.entity.CountryCardManageReleaseEO;
import com.jero.modules.problemKnowledgeBase.entity.CountryNationalFlagEO;
import com.jero.modules.problemKnowledgeBase.enums.QueryFlagEnum;
import com.jero.modules.problemKnowledgeBase.enums.ReleaseStatusEnum;
import com.jero.modules.problemKnowledgeBase.mapper.CountryCardManageReleaseEOMapper;
import com.jero.modules.problemKnowledgeBase.service.ICountryCardManageReleaseDetailEOService;
@@ -18,6 +20,7 @@ import com.jero.modules.system.enums.DicCodeEnum;
import com.jero.modules.system.service.ISysDictService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -216,9 +219,9 @@ public class CountryCardManageReleaseEOServiceImpl extends ServiceImpl<CountryCa
//获取已经创建了country Card的适用地区,该接口只返回,在country Card里面没有的适用地区。
List<CountryCardManageReleaseEO> countryCardManageReleaseEOList = this.list();
//如果查询标识是空,则是在countryCard管理发布页面新增数据时使用:管理发布页新增查询的是,所有未创建countryCard的适用市场。
//如果查询标识不是空,则是在CountryCard的首页使用:首页查询的是 所有已创建了countryCard的适用市场。
if (StringUtils.isEmpty(queryFlag)) {
if (StringUtils.equals(queryFlag, QueryFlagEnum.GET_ALL_APPLY_MARKET.getValue())) {
result = dictModelList;
}else if (StringUtils.equals(queryFlag,QueryFlagEnum.GET_NOT_CREATE_APPLY_MARKET.getValue())) {
if(CollectionUtils.isEmpty(countryCardManageReleaseEOList)){
result = dictModelList;
}else {
@@ -236,7 +239,7 @@ public class CountryCardManageReleaseEOServiceImpl extends ServiceImpl<CountryCa
}
}
}
}else {
}else if(StringUtils.equals(queryFlag,QueryFlagEnum.GET_RELEASED_APPLY_MARKET.getValue())){
if(CollectionUtils.isEmpty(countryCardManageReleaseEOList)){
result = null;
}else {
@@ -250,6 +253,26 @@ public class CountryCardManageReleaseEOServiceImpl extends ServiceImpl<CountryCa
}
}
if(flag){
result.add(dictModel);
}
}
}
}else if(StringUtils.equals(queryFlag,QueryFlagEnum.GET_CREATE_APPLY_MARKET.getValue())){
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(CollectionUtils.isEmpty(countryCardManageReleaseEOList)){
result = null;
}else {
for (DictModel dictModel : dictModelList) {
boolean flag = false;
for (CountryCardManageReleaseEO countryCardManageReleaseEO : countryCardManageReleaseEOList) {
if(StringUtils.equals(dictModel.getValue(),countryCardManageReleaseEO.getApplyMarket())
&& StringUtils.equals(countryCardManageReleaseEO.getCreateBy(),currentUser.getUsername())){
flag = true;
break;
}
}
if(flag){
result.add(dictModel);
}
@@ -3,6 +3,7 @@ package com.jero.modules.problemKnowledgeBase.service.impl;
import com.jero.modules.problemKnowledgeBase.entity.ProblemKnowledgeBaseClassifyEO;
import com.jero.modules.problemKnowledgeBase.mapper.ProblemKnowledgeBaseClassifyEOMapper;
import com.jero.modules.problemKnowledgeBase.service.IProblemKnowledgeBaseClassifyEOService;
import com.jero.modules.project.entity.ConditionAssessmentEO;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.service.ISysUserService;
import com.jero.modules.system.util.StringUtils;
@@ -10,10 +11,8 @@ import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Date;
import java.text.Collator;
import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -99,7 +98,15 @@ public class ProblemKnowledgeBaseClassifyEOServiceImpl extends ServiceImpl<Probl
*/
@Override
public List<ProblemKnowledgeBaseClassifyEO> queryList() {
return list();
List<ProblemKnowledgeBaseClassifyEO> result = this.list();
// 匿名比较器排序
Collections.sort(result, new Comparator<ProblemKnowledgeBaseClassifyEO>() {
@Override
public int compare(ProblemKnowledgeBaseClassifyEO p1, ProblemKnowledgeBaseClassifyEO p2) {
return p1.getProblemLabel().compareTo(p2.getProblemLabel());
}
});
return result;
}
@Override
@@ -50,6 +50,8 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
private IProblemKnowledgeBaseClassifyEOService problemKnowledgeBaseClassifyEOService;
@Autowired
private ISysDictService sysDictService;
@Autowired
private IProblemKnowledgeBaseCommentEOService problemKnowledgeBaseCommentEOService;
/**
* 保存
@@ -108,6 +110,18 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
@Override
public void deleteByIds(List<String> ids) {
removeByIds(ids);
QueryWrapper deleteWrapper = new QueryWrapper<>();
deleteWrapper.in("problem_knowledge_base_id",ids);
this.problemKnowledgeBaseUserEOService.remove(deleteWrapper);
this.problemKnowledgeBasePraiseEOService.remove(deleteWrapper);
this.problemKnowledgeBaseCollectEOService.remove(deleteWrapper);
this.problemKnowledgeBaseBrowsingHistoryEOService.remove(deleteWrapper);
this.problemKnowledgeBaseCommentEOService.remove(deleteWrapper);
}
/**
@@ -308,20 +322,25 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
String targetMarket = data.getTargetMarket();
if(StringUtils.isNotEmpty(targetMarket) && CollectionUtils.isNotEmpty(regionList)){
String[] targetMarketArr = targetMarket.split(",");
String targetMarket_dicText = "";
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
targetMarket_dicText = regionList.stream().filter(region -> {
boolean flag = false;
if (StringUtils.equals(targetMarket, region.getValue())) {
flag = true;
for (String s : targetMarketArr) {
if (StringUtils.equals(s, region.getValue())) {
flag = true;
}
}
return flag;
}).map(DictModel::getText).collect(Collectors.joining(","));
}else if(StringUtils.equals(cut, CutEnum.EN.getValue())){
targetMarket_dicText = regionList.stream().filter(region -> {
boolean flag = false;
if (StringUtils.equals(targetMarket, region.getValue())) {
flag = true;
for (String s : targetMarketArr) {
if (StringUtils.equals(s, region.getValue())) {
flag = true;
}
}
return flag;
}).map(DictModel::getTextEn).collect(Collectors.joining(","));
@@ -348,11 +367,13 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
List<String> problemKnowledgeBaseIdList = problemKnowledgeBaseUserEOList.stream().map(ProblemKnowledgeBaseUserEO::getProblemKnowledgeBaseId).distinct().collect(Collectors.toList());
queryWrapper.lambda().and(query -> {
query.eq(ProblemKnowledgeBaseEO::getShowPermissions,ShowPermissionsEnum.OPEN.getValue()).
or(o -> {
query.eq(ProblemKnowledgeBaseEO::getShowPermissions,ShowPermissionsEnum.OPEN.getValue());
if(CollectionUtils.isNotEmpty(problemKnowledgeBaseIdList)){
query.or(o -> {
o.eq(ProblemKnowledgeBaseEO::getShowPermissions,ShowPermissionsEnum.PRIVACY.getValue());
o.in(ProblemKnowledgeBaseEO::getId,problemKnowledgeBaseIdList);
});
}
});
String searchStr = problemKnowledgeBaseEO.getSearchStr();
@@ -44,7 +44,6 @@ public class ProjectLibraryBaseController extends JeroController<ProjectLibraryB
*/
@AutoLog(value = "项目库基础表-分页列表查询")
@ApiOperation(value="项目库基础表-分页列表查询", notes="项目库基础表-分页列表查询")
@RequiresPermissions("projectLibraryBase:page")
@PostMapping(value = "/page")
public Result<?> queryPageList(@RequestBody Map<String,Object> params) {
IPage<ProjectLibraryBase> pageList= projectLibraryBaseService.queryPageList(params);
@@ -7,9 +7,9 @@ public enum ProjectTaskPlanningNameEnum {
// PREHOMO_DEADLINE("Pre-Homo","Pre-Homo"),
// ATTESTATION_START_TIME("认证开始","Certification begins"),
// ATTESTATION_END_TIME("认证结束"," End of certification"),
PREHOMO_DEADLINE("Pre-Homo确认","Pre-Homo Confirmation"), // name:Pre-Homo value:Pre-Homo
ATTESTATION_START_TIME("认证结束","Homo Completion"),// name:认证开始 value:Certification begins
ATTESTATION_END_TIME("认证开始","Homo KO"),// name:认证结束 value:End of certification
PREHOMO_DEADLINE("摸底试验结束","Pre-Homo Confirmation"), // name:Pre-Homo value:Pre-Homo
ATTESTATION_START_TIME("认证试验结束","Homo Completion"),// name:认证开始 value:Certification begins
ATTESTATION_END_TIME("认证批准","Homo KO"),// name:认证结束 value:End of certification
VERIFY_DEADLINE("验证符合性确认","Validation Compliance Confirmation"),
;
String name;
@@ -257,7 +257,7 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
title = "编号,标题,状态,技术领域,责任领域,相关项目,设计符合性,Pre-Homo确认,验证符合性";
fileName = "符合性结果" + ".xlsx";
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
title = "Serial number,Title,State,Technology territory,Responsible Field,Relevant project,Design conformance,Pre-Homo Confirm,Verify conformance";
title = "Number,Title,Status,Tech field,Responsible Field,Relevant project,Design Compliance Confirmation,Pre-Homo Confirmation,Validation Compliance Confirmation";
fileName = "Compliance results" + ".xlsx";
}
OutputStream os = null;
@@ -281,7 +281,7 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
//设置居中、表头值。
for (int i = 0; i < firstLineTitleArr.length; i++){
sheet.setColumnWidth(i,5000);
sheet.setColumnWidth(i,8000);
Cell cell = firstRow.createCell(i);
cell.setCellStyle(titleCellStyle);
cell.setCellValue(firstLineTitleArr[i]);
@@ -367,7 +367,7 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
title = "责任领域,相关项目,设计符合性,Pre-Homo确认,验证符合性";
fileName = "符合性结果" + ".xlsx";
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
title = "Responsible Field,Relevant project,Design conformance,Pre-Homo Confirm,Verify conformance";
title = "Responsible Field,Relevant project,Design Compliance Confirmation,Pre-Homo Confirmation,Validation Compliance Confirmation";
fileName = "Compliance results" + ".xlsx";
}
OutputStream os = null;
@@ -391,7 +391,7 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
//设置居中、表头值。
for (int i = 0; i < firstLineTitleArr.length; i++){
sheet.setColumnWidth(i,5000);
sheet.setColumnWidth(i,8000);
Cell cell = firstRow.createCell(i);
cell.setCellStyle(titleCellStyle);
cell.setCellValue(firstLineTitleArr[i]);
@@ -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查询
*
@@ -193,4 +193,10 @@ public class LawsMonthlyReportWriteEO implements Serializable {
@TableField(exist = false)
private String ids;
//新添字段
private String relatedAreasCn;//相关领域中文
private String relatedAreasEn;//相关领域英文
private String source;//来源
private String time;//日期
}
@@ -9,7 +9,8 @@ package com.jero.modules.report.enums;
public enum ContentTemplateEnum {
DEFAULT_TEMPLATE("默认模板","1"),
NEW_REQUEST_LIST_TEMPLATE("新征求意见清单模板","2"),
NEW_RELEASE_STANDARD_MANIFEST_TEMPLATE("新发布标准清单模板","3");
NEW_RELEASE_STANDARD_MANIFEST_TEMPLATE("新发布标准清单模板","3"),
INDUSTRY_INFORMATION_TRENDS("行业资讯动态","4");
@@ -29,5 +29,9 @@
<result column="laws_contact" property="lawsContact" />
<result column="link" property="link" />
<result column="export_state" property="exportState" />
<result column="related_areas_cn" property="relatedAreasCn" />
<result column="related_areas_en" property="relatedAreasEn" />
<result column="source" property="source" />
<result column="time" property="time" />
</resultMap>
</mapper>
@@ -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查询
*
@@ -414,7 +414,16 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
if(StringUtils.isNotBlank(lawsMonthlyReportWriteEO.getIds())){
wrapper.in(LawsMonthlyReportWriteEO::getId,Arrays.asList(lawsMonthlyReportWriteEO.getIds().split(",")));
}
//管理员查看全部数据,其余人只能查看自己的数据
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> rolesList = sysBaseApi.getRolesByUsername(currentUser.getUsername());
if(!rolesList.contains(ProjectRoleEnum.ADMIN.getCode())){
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());
//新征求意见清单模板
@@ -456,8 +465,8 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
List<LawsMonthlyReportTitleTemplateEO> lawsMonthlyReportTitleTemplateEOS = lawsMonthlyReportTitleTemplateEOService.list();
lawsMonthlyReportTitleTemplateEOS = lawsMonthlyReportTitleTemplateEOS.stream()
.filter(e -> memoriesChapterList.contains(e.getId())).collect(Collectors.toList());
String path = uploadpath + "/tempZip";
long l = System.currentTimeMillis();
String path = uploadpath + "/tempZip"+l;
File fileTemp = new File(path);
if (fileTemp.exists()) {
fileTemp.delete();
@@ -465,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();
@@ -477,13 +486,15 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
os.write(len);
}
os.flush();
os.close();
fis.close();
} catch (Exception e) {
}finally {
IOUtils.closeQuietly(os);
File file = new File(uploadpath + "/tempZip");
File file = new File(uploadpath + "/tempZip"+l);
FileUtil.deleteContents(file);
File fileTem = new File(uploadpath + "/tempZip.zip");
File fileTem = new File(uploadpath + "/tempZip"+l+".zip");
FileUtil.deleteContents(fileTem);
}
//导出月报后修改列表状态
@@ -505,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文件
@@ -514,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<>();
@@ -583,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, titleCN, documentContentEn,CutEnum.EN.getValue());
wordContent(lawsMonthlyReportWriteEOS, lawsMonthlyReportTitleTemplateEOS, reportTitleOneList, titleEN,
documentContentEn,CutEnum.EN.getValue(), loginUserList);
documentContentEn.write(outContentEn);
} catch (IOException e) {
@@ -675,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();
@@ -753,9 +790,12 @@ 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);
}
if(ContentTemplateEnum.INDUSTRY_INFORMATION_TRENDS.getValue().equals(contentTemplate)){
WordUtil.exportWordExcelIndustry(document,lawsMonthlyReportWriteEO,cut);
}
// else if(ContentTemplateEnum.NEW_REQUEST_LIST_TEMPLATE.getValue().equals(contentTemplate)){
// //新征求意见清单模板
// WordUtil.exportWordExcelAsk(document,lawsMonthlyReportWriteEO,cut);
@@ -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,54 +406,163 @@ public class WordUtil {
//第1行
if(CutEnum.CN.getValue().equals(cut)){
//第1行
setCell(table.getRow(0), "技术领域",technologyTerritoryName);
setCell(table, 0, "相关领域",technologyTerritoryName);
//第2行
setCell(table.getRow(1), "适用车型",applyCarName);
setCell(table,1, "适用车型",applyCarName);
//第3行
setCell(table.getRow(2), "适用范围",applyScopeName);
setCell(table,2, "适用范围",applyScopeName);
//第4行
setCell(table.getRow(3), "状态",stateName);
setCell(table,3, "状态",stateName);
//第5行
setCell(table.getRow(4), "用法",useMethodName);
setCell(table,4, "用法",useMethodName);
//第6行
setCell(table.getRow(5), "实施车型",implementCar);
setCell(table,5, "实施车型",implementCar);
//第7行
setCell(table.getRow(6), "新车型实施日期",newCarImplementTime);
setCell(table,6, "新车型实施日期",newCarImplementTime);
//第8行
setCell(table.getRow(7), "在产车实施日期",productionCarImplementTime);
setCell(table,7, "在产车实施日期",productionCarImplementTime);
//第9行
setCell(table.getRow(8), "主要内容中文",contentCn);
setCell(table,8, "主要内容",contentCn);
//第10行
setCell(table.getRow(9), "NIO工作进展中文",workProgressCn);
setCell(table,9, "NIO工作进展",workProgressCn);
//第11行
setCell(table.getRow(10), "法规联系人",lawsContact);
setCell(table,10, "法规联系人",lawsContact);
//第12行
setCell(table.getRow(11), "链接",link);
setCell(table,11, "链接",link);
}else{
//第1行
setCell(table.getRow(0), "Technical Field",technologyTerritoryName);
setCell(table,0, "Related Areas",technologyTerritoryName);
//第2行
setCell(table.getRow(1), "Vehicle Type",applyCarName);
setCell(table,1,"Vehicle Type",applyCarName);
//第3行
setCell(table.getRow(2), "Scope",applyScopeName);
setCell(table,2,"Scope",applyScopeName);
//第4行
setCell(table.getRow(3), "Status",stateName);
setCell(table,3,"Status",stateName);
//第5行
setCell(table.getRow(4), "usage",useMethodName);
setCell(table,4,"usage",useMethodName);
//第6行
setCell(table.getRow(5), "Implementation Model",implementCar);
setCell(table,5,"Implementation Model",implementCar);
//第7行
setCell(table.getRow(6), "New Type Execution Date",newCarImplementTime);
setCell(table,6,"New Type Execution Date",newCarImplementTime);
//第8行
setCell(table.getRow(7), "New Vehicle Execution Date",productionCarImplementTime);
setCell(table,7,"New Vehicle Execution Date",productionCarImplementTime);
//第9行
setCell(table.getRow(8), "Main Content (English)",contentEn);
setCell(table,8,"Main Content",contentEn);
//第10行
setCell(table.getRow(9), "NIO Work Progress (English)",workProgressEn);
setCell(table,9,"NIO Work Progress",workProgressEn);
//第11行
setCell(table.getRow(10), "Regulatory Contact",lawsContact);
setCell(table, 10,"Regulatory Contact",lawsContact);
//第12行
setCell(table.getRow(11), "Link",link);
setCell(table, 11,"Link",link);
}
// if(CutEnum.CN.getValue().equals(cut)){
// //第1行
// setCell(table.getRow(0), "相关领域",technologyTerritoryName);
// //第2行
// setCell(table.getRow(1), "适用车型",applyCarName);
// //第3行
// setCell(table.getRow(2), "适用范围",applyScopeName);
// //第4行
// setCell(table.getRow(3), "状态",stateName);
// //第5行
// setCell(table.getRow(4), "用法",useMethodName);
// //第6行
// setCell(table.getRow(5), "实施车型",implementCar);
// //第7行
// setCell(table.getRow(6), "新车型实施日期",newCarImplementTime);
// //第8行
// setCell(table.getRow(7), "在产车实施日期",productionCarImplementTime);
// //第9行
// setCell(table.getRow(8), "主要内容",contentCn);
// //第10行
// setCell(table.getRow(9), "NIO工作进展",workProgressCn);
// //第11行
// setCell(table.getRow(10), "法规联系人",lawsContact);
// //第12行
// setCell(table.getRow(11), "链接",link);
// }else{
// //第1行
// setCell(table.getRow(0), "Related Areas",technologyTerritoryName);
// //第2行
// setCell(table.getRow(1), "Vehicle Type",applyCarName);
// //第3行
// setCell(table.getRow(2), "Scope",applyScopeName);
// //第4行
// setCell(table.getRow(3), "Status",stateName);
// //第5行
// setCell(table.getRow(4), "usage",useMethodName);
// //第6行
// setCell(table.getRow(5), "Implementation Model",implementCar);
// //第7行
// setCell(table.getRow(6), "New Type Execution Date",newCarImplementTime);
// //第8行
// setCell(table.getRow(7), "New Vehicle Execution Date",productionCarImplementTime);
// //第9行
// setCell(table.getRow(8), "Main Content",contentEn);
// //第10行
// setCell(table.getRow(9), "NIO Work Progress",workProgressEn);
// //第11行
// setCell(table.getRow(10), "Regulatory Contact",lawsContact);
// //第12行
// setCell(table.getRow(11), "Link",link);
// }
}
/**
* 行业资讯动态
* @param document
* @param lawsMonthlyReportWriteEO
* @param cut
*/
public static void exportWordExcelIndustry(XWPFDocument document,
LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO,
String cut) {
String relatedAreasCn = lawsMonthlyReportWriteEO.getRelatedAreasCn();//相关领域中文
String relatedAreasEn = lawsMonthlyReportWriteEO.getRelatedAreasEn();//相关领域英文
String source = lawsMonthlyReportWriteEO.getSource();//来源
String time = lawsMonthlyReportWriteEO.getTime();//日期
String contentCn = lawsMonthlyReportWriteEO.getContentCn();//主要内容中文
String contentEn = lawsMonthlyReportWriteEO.getContentEn();//主要内容英文
String link = lawsMonthlyReportWriteEO.getLink();//链接
XWPFTable table = document.createTable(5, 2);
//表格属性
CTTblPr tablePr = table.getCTTbl().addNewTblPr();
//表格宽度
CTJc cTJc = tablePr.addNewJc();
//居中
cTJc.setVal(STJc.CENTER);
//列宽自动分割
CTTblWidth tableWidth = tablePr.addNewTblW();
//设置表格宽度
tableWidth.setType(STTblWidth.DXA);
tableWidth.setW(BigInteger.valueOf(8000));
//第1行
if(CutEnum.CN.getValue().equals(cut)){
//第1行
setCell(table, 0, "相关领域",relatedAreasCn);
//第2行
setCell(table,1, "来源",source);
//第3行
setCell(table,2, "日期",time);
//第4行
setCell(table,3, "主要内容",contentCn);
//第5行
setCell(table,4, "链接",link);
}else{
//第1行
setCell(table,0, "Related Areas",relatedAreasEn);
//第2行
setCell(table,1,"source",source);
//第3行
setCell(table,2,"Date",time);
//第4行
setCell(table,3,"Main Content",contentEn);
//第5行
setCell(table,4,"Link",link);
}
}
public static void exportWordExcelAsk(XWPFDocument document,
@@ -666,18 +777,49 @@ public class WordUtil {
return fieldValueName;
}
private static void setCell(XWPFTableRow tableRow, String fieldName,String technologyTerritory) {
private static void setCell(XWPFTable table, int number, String fieldName,String technologyTerritory) {
tableRow.setHeight(500);
CTTblWidth ctTblWidth0 = tableRow.getCell(0).getCTTc().addNewTcPr().addNewTcW();
table.getRow(number).setHeight(500);
CTTblWidth ctTblWidth0 = table.getRow(number).getCell(0).getCTTc().addNewTcPr().addNewTcW();
ctTblWidth0.setType(STTblWidth.DXA);
ctTblWidth0.setW(BigInteger.valueOf(3000));
CTTblWidth ctTblWidth1 = tableRow.getCell(1).getCTTc().addNewTcPr().addNewTcW();
ctTblWidth0.setW(BigInteger.valueOf(2000));
CTTblWidth ctTblWidth1 = table.getRow(number).getCell(1).getCTTc().addNewTcPr().addNewTcW();
ctTblWidth1.setType(STTblWidth.DXA);
ctTblWidth1.setW(BigInteger.valueOf(5000));
tableRow.getCell(0).setText(fieldName);
tableRow.getCell(1).setText(technologyTerritory);
table.getRow(number).getCell(0).setText(fieldName);
table.getRow(number).getCell(1).setText(technologyTerritory);
}
// private static void setCell(XWPFTableRow tableRow, String fieldName,String technologyTerritory) {
//
// tableRow.setHeight(500);
// CTTblWidth ctTblWidth0 = tableRow.getCell(0).getCTTc().addNewTcPr().addNewTcW();
// ctTblWidth0.setType(STTblWidth.DXA);
// ctTblWidth0.setW(BigInteger.valueOf(3000));
// CTTblWidth ctTblWidth1 = tableRow.getCell(1).getCTTc().addNewTcPr().addNewTcW();
// ctTblWidth1.setType(STTblWidth.DXA);
// ctTblWidth1.setW(BigInteger.valueOf(5000));
//
// 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;
}
}
@@ -41,9 +41,12 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
@@ -127,9 +130,63 @@ public class LawsWarnService {
bussDocumentLibraryEOService.dictItem(sysDictItems, entry, cut, onlCgformFieldListTemp,null);
bussDocumentLibraryEOService.treeDictItem(categoryList, entry, treeFieldList, cut,null);
}
//到期前6个月显示红色,到期前12个月显示黄色
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String newCarTime = String.valueOf(record.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"));
String implementTime = String.valueOf(record.get("implement_time"));
String currentTime = sdf.format(new Date());
if(StringUtils.isNotBlank(newCarTime) && !"null".equals(newCarTime)){
try {
if(Integer.parseInt(String.valueOf(parameter.get("flag"))) == 0){
Date newCarTimeDate = sdf.parse(newCarTime);
//当前时间的前6个月
String beforeTimeSix = beforeTime(6,new Date());
String beforeTimeTwelve = beforeTime(12,new Date());
Date parseSix = sdf.parse(beforeTimeSix);
Date parseTwelve = sdf.parse(beforeTimeTwelve);
if((newCarTimeDate.after(new Date()) && newCarTimeDate.before(parseSix)) || newCarTime.equals(beforeTimeSix)){
record.put("new_colour","red");
}
if((newCarTimeDate.after(parseSix) && newCarTimeDate.before(parseTwelve)) || newCarTime.equals(beforeTimeTwelve)){
record.put("new_colour","yellow");
}
}
} catch (ParseException e) {
e.printStackTrace();
}
}
if(StringUtils.isNotBlank(implementTime) && !"null".equals(implementTime)){
try {
if(Integer.parseInt(String.valueOf(parameter.get("flag"))) == 1){
Date implementTimeDate = sdf.parse(implementTime);
//当前时间的前6个月
String beforeTimeSix = beforeTime(6,new Date());
String beforeTimeTwelve = beforeTime(12,new Date());
Date parseSix = sdf.parse(beforeTimeSix);
Date parseTwelve = sdf.parse(beforeTimeTwelve);
if((implementTimeDate.after(new Date()) && implementTimeDate.before(parseSix)) || implementTime.equals(beforeTimeSix)){
record.put("implement_colour","red");
}
if((implementTimeDate.after(parseSix) && implementTimeDate.before(parseTwelve)) || implementTime.equals(beforeTimeTwelve)){
record.put("implement_colour","yellow");
}
}
} catch (ParseException e) {
e.printStackTrace();
}
}
}
return infoPage;
}
private String beforeTime (int month, Date date){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendarBefore = Calendar.getInstance();
calendarBefore.setTime(date);
calendarBefore.add(Calendar.MONTH, month);
Date dateBefore = calendarBefore.getTime();
String beforeTime = sdf.format(dateBefore);
return beforeTime;
}
public void exportExcel(Map<String, Object> map, HttpServletResponse response, HttpServletRequest request) {
String cut = (String) map.get("cut");