Commit a8e3a10d authored by 赵啸非's avatar 赵啸非

添加目录字段

parent cec8bf41
...@@ -55,9 +55,8 @@ ...@@ -55,9 +55,8 @@
<id>product</id> <id>product</id>
<properties> <properties>
<profiles.active>product</profiles.active> <profiles.active>product</profiles.active>
<profiles.server.debug>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=15506</profiles.server.debug>
<profiles.filepath>/mortals/app/data/one</profiles.filepath> <profiles.filepath>/mortals/app/data/one</profiles.filepath>
<profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr> <profiles.nacos.server-addr>192.168.0.250:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group> <profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace> <profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
</properties> </properties>
......
...@@ -19,5 +19,10 @@ public class CertificateDocumentVo extends BaseEntityLong { ...@@ -19,5 +19,10 @@ public class CertificateDocumentVo extends BaseEntityLong {
/** 序号,主键,自增长列表 */ /** 序号,主键,自增长列表 */
private List <Long> idList; private List <Long> idList;
/**
* 证照目录id
*/
private Long catalogId;
} }
\ No newline at end of file
...@@ -20,10 +20,7 @@ import com.mortals.xhx.common.pdu.gen.component.ComponentCons; ...@@ -20,10 +20,7 @@ import com.mortals.xhx.common.pdu.gen.component.ComponentCons;
import com.mortals.xhx.common.utils.ExcelUtil; import com.mortals.xhx.common.utils.ExcelUtil;
import com.mortals.xhx.common.utils.StringUtils; import com.mortals.xhx.common.utils.StringUtils;
import com.mortals.xhx.module.certificate.dao.CertificateCatalogDao; import com.mortals.xhx.module.certificate.dao.CertificateCatalogDao;
import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity; import com.mortals.xhx.module.certificate.model.*;
import com.mortals.xhx.module.certificate.model.CertificateChildEntity;
import com.mortals.xhx.module.certificate.model.CertificateChildQuery;
import com.mortals.xhx.module.certificate.model.CertificateClassifyEntity;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService; import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import com.mortals.xhx.module.certificate.service.CertificateChildService; import com.mortals.xhx.module.certificate.service.CertificateChildService;
import com.mortals.xhx.module.certificate.service.CertificateClassifyService; import com.mortals.xhx.module.certificate.service.CertificateClassifyService;
...@@ -34,6 +31,7 @@ import org.springframework.stereotype.Service; ...@@ -34,6 +31,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -83,20 +81,20 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi ...@@ -83,20 +81,20 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
@Override @Override
protected void saveBefore(CertificateCatalogEntity entity, Context context) throws AppException { protected void saveBefore(CertificateCatalogEntity entity, Context context) throws AppException {
validData(entity,context); validData(entity, context);
entity.setStatus(StatusEnum.ENABLE.getValue()); entity.setStatus(StatusEnum.ENABLE.getValue());
if(StringUtils.isNotEmpty(entity.getTemplateFileUrl())){ if (StringUtils.isNotEmpty(entity.getTemplateFileUrl())) {
//entity.setFormContent(parseDocxToJson(entity.getTemplateUrl())); //entity.setFormContent(parseDocxToJson(entity.getTemplateUrl()));
parseDocxToJson(entity,false); parseDocxToJson(entity, false);
} }
} }
@Override @Override
protected void updateBefore(CertificateCatalogEntity entity, Context context) throws AppException { protected void updateBefore(CertificateCatalogEntity entity, Context context) throws AppException {
validData(entity,context); validData(entity, context);
CertificateCatalogEntity old = this.get(entity.getId()); CertificateCatalogEntity old = this.get(entity.getId());
if(!old.getTemplateFileUrl().equals(entity.getTemplateFileUrl())) { if (!old.getTemplateFileUrl().equals(entity.getTemplateFileUrl())) {
if (StringUtils.isNotEmpty(entity.getTemplateFileUrl())) { if (StringUtils.isNotEmpty(entity.getTemplateFileUrl())) {
//entity.setFormContent(parseDocxToJson(entity.getTemplateUrl())); //entity.setFormContent(parseDocxToJson(entity.getTemplateUrl()));
parseDocxToJson(entity, false); parseDocxToJson(entity, false);
...@@ -116,8 +114,15 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi ...@@ -116,8 +114,15 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
@Override @Override
protected void findAfter(CertificateCatalogEntity params, PageInfo pageInfo, Context context, List<CertificateCatalogEntity> list) throws AppException { protected void findAfter(CertificateCatalogEntity params, PageInfo pageInfo, Context context, List<CertificateCatalogEntity> list) throws AppException {
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
List<Long> classifIdList = list.parallelStream().map(CertificateCatalogEntity::getClassifyId).collect(Collectors.toList());
CertificateClassifyQuery certificateClassifyQuery = new CertificateClassifyQuery();
certificateClassifyQuery.setIdList(classifIdList);
Map<Long, CertificateClassifyEntity> collect = certificateClassifyService.find(certificateClassifyQuery, context).parallelStream()
.collect(Collectors.toMap(CertificateClassifyEntity::getId, Function.identity(), (n1, n2) -> n1));
for (CertificateCatalogEntity entity : list) { for (CertificateCatalogEntity entity : list) {
CertificateClassifyEntity certificateClassifyEntity = certificateClassifyService.get(entity.getClassifyId()); CertificateClassifyEntity certificateClassifyEntity = collect.get(entity.getClassifyId());
// CertificateClassifyEntity certificateClassifyEntity = certificateClassifyService.get(entity.getClassifyId());
if (certificateClassifyEntity != null) { if (certificateClassifyEntity != null) {
entity.setClassifyType(certificateClassifyEntity.getClassifyType()); entity.setClassifyType(certificateClassifyEntity.getClassifyType());
} else { } else {
...@@ -138,7 +143,7 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi ...@@ -138,7 +143,7 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
List<Long> idList = list.stream().map(i -> i.getId()).collect(Collectors.toList()); List<Long> idList = list.stream().map(i -> i.getId()).collect(Collectors.toList());
CertificateChildQuery certificateChildQuery = new CertificateChildQuery(); CertificateChildQuery certificateChildQuery = new CertificateChildQuery();
certificateChildQuery.setCatalogIdList(idList); certificateChildQuery.setCatalogIdList(idList);
Map<Long, List<CertificateChildEntity>> certificateChildListMap = certificateChildService.find(certificateChildQuery).stream().collect(Collectors.groupingBy(CertificateChildEntity::getCatalogId)); Map<Long, List<CertificateChildEntity>> certificateChildListMap = certificateChildService.find(certificateChildQuery).parallelStream().collect(Collectors.groupingBy(CertificateChildEntity::getCatalogId));
list.forEach(item -> item.setCertificateChildList(certificateChildListMap.get(item.getId()))); list.forEach(item -> item.setCertificateChildList(certificateChildListMap.get(item.getId())));
} }
...@@ -147,6 +152,7 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi ...@@ -147,6 +152,7 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
if (!ObjectUtils.isEmpty(entity.getCertificateChildList())) { if (!ObjectUtils.isEmpty(entity.getCertificateChildList())) {
entity.getCertificateChildList().stream().peek(item -> { entity.getCertificateChildList().stream().peek(item -> {
item.setCatalogId(entity.getId()); item.setCatalogId(entity.getId());
item.setCatalogName(entity.getCatalogName());
item.setCreateUserId(this.getContextUserId(context)); item.setCreateUserId(this.getContextUserId(context));
item.setCreateTime(new Date()); item.setCreateTime(new Date());
}).count(); }).count();
...@@ -179,7 +185,7 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi ...@@ -179,7 +185,7 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
super.removeAfter(ids, context, result); super.removeAfter(ids, context, result);
} }
private void parseDocxToJson(CertificateCatalogEntity entity,boolean onlyExcel) { private void parseDocxToJson(CertificateCatalogEntity entity, boolean onlyExcel) {
String rootPath = this.filePath.endsWith("/") ? this.filePath : this.filePath + "/"; String rootPath = this.filePath.endsWith("/") ? this.filePath : this.filePath + "/";
String filepath = rootPath + entity.getTemplateFileUrl(); String filepath = rootPath + entity.getTemplateFileUrl();
ConfigureBuilder builder = Configure.builder(); ConfigureBuilder builder = Configure.builder();
...@@ -206,9 +212,9 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi ...@@ -206,9 +212,9 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
// excelList.add("持有者证件号码"); // excelList.add("持有者证件号码");
// excelList.add("企业名称"); // excelList.add("企业名称");
for (MetaTemplate item : template.getElementTemplates()) { for (MetaTemplate item : template.getElementTemplates()) {
if(hs.contains(item.variable())){ if (hs.contains(item.variable())) {
continue; continue;
}else { } else {
hs.add(item.variable()); hs.add(item.variable());
} }
//识别简单输入 //识别简单输入
...@@ -236,9 +242,9 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi ...@@ -236,9 +242,9 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
XWPFTemplate templateTable = XWPFTemplate.compile(filepath, builderTable.build()); XWPFTemplate templateTable = XWPFTemplate.compile(filepath, builderTable.build());
for (MetaTemplate col : templateTable.getElementTemplates()) { for (MetaTemplate col : templateTable.getElementTemplates()) {
if(dhs.contains(col.variable())){ if (dhs.contains(col.variable())) {
continue; continue;
}else { } else {
dhs.add(col.variable()); dhs.add(col.variable());
} }
String colVal = StrUtil.strip(col.variable(), "[", "]"); String colVal = StrUtil.strip(col.variable(), "[", "]");
...@@ -266,18 +272,18 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi ...@@ -266,18 +272,18 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
} }
DesignComponent designComponent = DesignComponent.createType(type); DesignComponent designComponent = DesignComponent.createType(type);
ListItem listItem = designComponent.buildDefaultComponent(cons); ListItem listItem = designComponent.buildDefaultComponent(cons);
if(type.equals(ComponentEnum.QRCODE.getValue())){ if (type.equals(ComponentEnum.QRCODE.getValue())) {
listItem.setValue(qrcode); listItem.setValue(qrcode);
} }
collect.add(listItem); collect.add(listItem);
} }
} }
root.setList(collect); root.setList(collect);
String fileName = "file/fileupload/excel/"+entity.getCatalogName()+"_批量导入模板.xls"; String fileName = "file/fileupload/excel/" + entity.getCatalogName() + "_批量导入模板.xls";
String excelFilePath = rootPath + fileName; String excelFilePath = rootPath + fileName;
ExcelUtil.createCatalogTemplate(excelFilePath, excelList); ExcelUtil.createCatalogTemplate(excelFilePath, excelList);
entity.setExcelFile(fileName); entity.setExcelFile(fileName);
if(!onlyExcel) { if (!onlyExcel) {
entity.setFormContent(JSON.toJSONString(root)); entity.setFormContent(JSON.toJSONString(root));
} }
} }
...@@ -286,7 +292,7 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi ...@@ -286,7 +292,7 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
@Override @Override
public void generateExcel(Long id, Context context) { public void generateExcel(Long id, Context context) {
CertificateCatalogEntity entity = dao.get(id); CertificateCatalogEntity entity = dao.get(id);
parseDocxToJson(entity,true); parseDocxToJson(entity, true);
CertificateCatalogEntity updata = new CertificateCatalogEntity(); CertificateCatalogEntity updata = new CertificateCatalogEntity();
updata.setId(entity.getId()); updata.setId(entity.getId());
updata.setExcelFile(entity.getExcelFile()); updata.setExcelFile(entity.getExcelFile());
......
...@@ -5,14 +5,20 @@ import com.mortals.framework.model.Context; ...@@ -5,14 +5,20 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.StatusEnum; import com.mortals.xhx.common.code.StatusEnum;
import com.mortals.xhx.module.certificate.model.CertificateChildEntity;
import com.mortals.xhx.module.certificate.model.CertificateChildQuery;
import com.mortals.xhx.module.certificate.model.CertificateDocumentEntity; import com.mortals.xhx.module.certificate.model.CertificateDocumentEntity;
import com.mortals.xhx.module.certificate.service.CertificateChildService;
import com.mortals.xhx.module.certificate.service.CertificateDocumentService; import com.mortals.xhx.module.certificate.service.CertificateDocumentService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* *
* 子证配置 * 子证配置
...@@ -25,7 +31,8 @@ import java.util.Map; ...@@ -25,7 +31,8 @@ import java.util.Map;
public class CertificateDocumentController extends BaseCRUDJsonBodyMappingController<CertificateDocumentService,CertificateDocumentEntity,Long> { public class CertificateDocumentController extends BaseCRUDJsonBodyMappingController<CertificateDocumentService,CertificateDocumentEntity,Long> {
@Autowired @Autowired
private ParamService paramService; private CertificateChildService certificateChildService;
public CertificateDocumentController(){ public CertificateDocumentController(){
super.setModuleDesc( "子证配置"); super.setModuleDesc( "子证配置");
...@@ -38,6 +45,18 @@ public class CertificateDocumentController extends BaseCRUDJsonBodyMappingContro ...@@ -38,6 +45,18 @@ public class CertificateDocumentController extends BaseCRUDJsonBodyMappingContro
} }
@Override
protected void doListBefore(CertificateDocumentEntity query, Map<String, Object> model, Context context) throws AppException {
if(!ObjectUtils.isEmpty(query.getCatalogId())){
List<Long> documentIdList = certificateChildService.find(new CertificateChildQuery().catalogId(query.getCatalogId())).stream()
.map(CertificateChildEntity::getDocumentId).collect(Collectors.toList());
if(!ObjectUtils.isEmpty(documentIdList)){
query.setIdList(documentIdList);
}
}
super.doListBefore(query, model, context);
}
@Override @Override
protected void doListAfter(CertificateDocumentEntity query, List<CertificateDocumentEntity> list, Context context) throws AppException { protected void doListAfter(CertificateDocumentEntity query, List<CertificateDocumentEntity> list, Context context) throws AppException {
list.forEach(item->{ list.forEach(item->{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment