Commit 34d1e119 authored by 廖旭伟's avatar 廖旭伟

新增证照目录模板配置功能

parent a25c3e74
package com.mortals.xhx.base.login.web;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.ap.SysConstains;
......@@ -8,7 +7,6 @@ import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.ITokenService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.AESUtil;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.HttpUtil;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
......@@ -58,7 +56,6 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
@RequestMapping("login")
public String login( @RequestBody LoginForm loginForm) throws Exception {
String loginName = loginForm.getLoginName();
String password = loginForm.getPassword();
......@@ -70,59 +67,59 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
return resp;
/*JSONObject ret = new JSONObject();
String loginName = loginForm.getLoginName();
String password = loginForm.getPassword();
//String securityCode = loginForm.getSecurityCode();
String ip = super.getRequestIP(request);
if (StringUtils.isEmpty(loginName) || StringUtils.isEmpty(password)) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, "未获取到用户信息,请重新登录");
return ret.toJSONString();
}
UserEntity userEntity = null;
try {
loginForm.validate();
userEntity = userService.doLogin(loginName, password, ip);
userEntity.setLastLoginAddress(ip);
//saveCurrUser(request, response, userEntity);
recordSysLog(request, userEntity, "用户登录系统成功!");
// 返回拥有的菜单数据
Set<String> urls = resourceService.findUrlSetByUserId(userEntity.getId());
List<MenuEntity> outlookBarList = menuService.findTreeMenu(userEntity, urls);
String currUserName = userEntity.getRealName();
if (currUserName == null || currUserName.trim().length() == 0) {
currUserName = "管理员";
}
userEntity.setLoginTime(System.currentTimeMillis());
userEntity.setToken(IdUtil.fastSimpleUUID());
userEntity.setExpireTime(DateUtils.addCurrDate(7).getTime());
String token = authTokenService.createToken(userEntity);
JSONObject data = new JSONObject();
data.put("token", token);
data.put("currUserName", currUserName);
data.put("barList", outlookBarList);
data.put("id", userEntity.getId());
data.put("userType", userEntity.getUserType());
//this.generateBlackCookie(request, response, loginName, urls);
ret.put(KEY_RESULT_DATA, data);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "用户登录系统成功!");
ret.put("resources", urls);
return ret.toJSONString();
} catch (Exception e) {
log.error("login error ", e);
if (userEntity == null) {
userEntity = new UserEntity();
userEntity.setLoginName(loginName);
}
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString();
}*/
// JSONObject ret = new JSONObject();
// String loginName = loginForm.getLoginName();
// String password = loginForm.getPassword();
// //String securityCode = loginForm.getSecurityCode();
// String ip = super.getRequestIP(request);
// if (StringUtils.isEmpty(loginName) || StringUtils.isEmpty(password)) {
// ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
// ret.put(KEY_RESULT_MSG, "未获取到用户信息,请重新登录");
// return ret.toJSONString();
// }
// UserEntity userEntity = null;
// try {
// loginForm.validate();
//
// userEntity = userService.doLogin(loginName, password, ip);
// userEntity.setLastLoginAddress(ip);
// //saveCurrUser(request, response, userEntity);
// recordSysLog(request, userEntity, "用户登录系统成功!");
// // 返回拥有的菜单数据
// Set<String> urls = resourceService.findUrlSetByUserId(userEntity.getId());
// List<MenuEntity> outlookBarList = menuService.findTreeMenu(userEntity, urls);
// String currUserName = userEntity.getRealName();
// if (currUserName == null || currUserName.trim().length() == 0) {
// currUserName = "管理员";
// }
// userEntity.setLoginTime(System.currentTimeMillis());
// userEntity.setToken(IdUtil.fastSimpleUUID());
// userEntity.setExpireTime(DateUtils.addCurrDate(7).getTime());
// String token = authTokenService.createToken(userEntity);
// JSONObject data = new JSONObject();
// data.put("token", token);
// data.put("currUserName", currUserName);
// data.put("barList", outlookBarList);
// data.put("id", userEntity.getId());
// data.put("userType", userEntity.getUserType());
//
// //this.generateBlackCookie(request, response, loginName, urls);
// ret.put(KEY_RESULT_DATA, data);
// ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
// ret.put(KEY_RESULT_MSG, "用户登录系统成功!");
// ret.put("resources", urls);
//
// return ret.toJSONString();
// } catch (Exception e) {
// log.error("login error ", e);
// if (userEntity == null) {
// userEntity = new UserEntity();
// userEntity.setLoginName(loginName);
// }
// ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
// ret.put(KEY_RESULT_MSG, super.convertException(e));
// return ret.toJSONString();
// }
}
@RequestMapping("logout")
......
......@@ -17,6 +17,14 @@ public class CatalogVO {
* 目录编号
*/
private String catalogCode;
/**
* 证照目录模板ID
*/
private Long templateId;
/**
* 证照模板名称
*/
private String templateName;
/**
* 证照模板表单内容
*/
......
......@@ -9,10 +9,13 @@ import com.mortals.framework.web.BaseJsonBodyController;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity;
import com.mortals.xhx.module.certificate.model.CertificateCatalogQuery;
import com.mortals.xhx.module.certificate.model.CertificateCatalogTemplateEntity;
import com.mortals.xhx.module.certificate.model.CertificateCatalogTemplateQuery;
import com.mortals.xhx.module.certificate.pdu.ApplyLogPdu;
import com.mortals.xhx.module.certificate.pdu.PrintListPdu;
import com.mortals.xhx.module.certificate.pdu.PrintLogPdu;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import com.mortals.xhx.module.certificate.service.CertificateCatalogTemplateService;
import com.mortals.xhx.module.print.model.PrintCatalogEntity;
import com.mortals.xhx.module.print.model.PrintCatalogQuery;
import com.mortals.xhx.module.print.model.PrintServiceEntity;
......@@ -45,6 +48,8 @@ public class CertificateApi extends BaseJsonBodyController {
private PrintCatalogService printCatalogService;
@Autowired
private PrintWaitQueueService printWaitQueueService;
@Autowired
private CertificateCatalogTemplateService certificateCatalogTemplateService;
@PostMapping({"catalog/list"})
@UnAuth
......@@ -60,8 +65,15 @@ public class CertificateApi extends BaseJsonBodyController {
if(CollectionUtils.isNotEmpty(list)){
List<CatalogVO> catalogList = new ArrayList<>();
for(CertificateCatalogEntity entity:list){
List<CertificateCatalogTemplateEntity> templateEntityList = certificateCatalogTemplateService.find(new CertificateCatalogTemplateQuery().catalogId(entity.getId()));
if(CollectionUtils.isNotEmpty(templateEntityList)){
for (CertificateCatalogTemplateEntity item:templateEntityList){
CatalogVO catalogVO = new CatalogVO(entity.getId(),entity.getCatalogName(),entity.getCatalogCode());
JSONObject formContent = JSONObject.parseObject(entity.getFormContent());
catalogVO.setTemplateId(item.getId());
catalogVO.setTemplateName(item.getTemplateName());
JSONObject formContent = JSONObject.parseObject(item.getFormContent());
JSONArray formList = formContent.getJSONArray("list");
JSONObject json = new JSONObject();
for (int j = 0; j < formList.size(); j++) {
......@@ -72,6 +84,9 @@ public class CertificateApi extends BaseJsonBodyController {
catalogList.add(catalogVO);
}
}
}
model.put("message_info", "获取证照目录成功");
ret.put("data", catalogList);
}else {
......@@ -207,7 +222,7 @@ public class CertificateApi extends BaseJsonBodyController {
if(CollectionUtils.isNotEmpty(list)){
List<PrintWaitQueueVO> waitQueueVOList = new ArrayList<>();
for(PrintWaitQueueEntity printWaitQueueEntity:list){
PrintCatalogEntity printCatalogEntity = printCatalogService.getPrintCatalogByService(pdu.getServiceId(),printWaitQueueEntity.getCatalogId());
PrintCatalogEntity printCatalogEntity = printCatalogService.getPrintCatalogByService(pdu.getServiceId(),printWaitQueueEntity.getCatalogId(),printWaitQueueEntity.getTemplateId());
PrintWaitQueueVO printWaitQueueVO = new PrintWaitQueueVO();
printWaitQueueVO.setCatalogId(printWaitQueueEntity.getCatalogId());
printWaitQueueVO.setCatalogCode(printWaitQueueEntity.getCatalogCode());
......
package com.mortals.xhx.module.certificate.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.certificate.model.CertificateCatalogTemplateEntity;
import java.util.List;
/**
* 证照目录模板Dao
* 证照目录模板 DAO接口
*
* @author zxfei
* @date 2023-05-23
*/
public interface CertificateCatalogTemplateDao extends ICRUDDao<CertificateCatalogTemplateEntity,Long>{
}
package com.mortals.xhx.module.certificate.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.certificate.dao.CertificateCatalogTemplateDao;
import com.mortals.xhx.module.certificate.model.CertificateCatalogTemplateEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 证照目录模板DaoImpl DAO接口
*
* @author zxfei
* @date 2023-05-23
*/
@Repository("certificateCatalogTemplateDao")
public class CertificateCatalogTemplateDaoImpl extends BaseCRUDDaoMybatis<CertificateCatalogTemplateEntity,Long> implements CertificateCatalogTemplateDao {
}
package com.mortals.xhx.module.certificate.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.certificate.model.vo.CertificateCatalogTemplateVo;
import lombok.Data;
/**
* 证照目录模板实体对象
*
* @author zxfei
* @date 2023-05-24
*/
@Data
public class CertificateCatalogTemplateEntity extends CertificateCatalogTemplateVo {
private static final long serialVersionUID = 1L;
/**
* 站点id
*/
private Long siteId;
/**
* 目录id
*/
private Long catalogId;
/**
* 证照模板名称
*/
private String templateName;
/**
* 模板类型1普通2正本3副本
*/
private Integer templateType;
/**
* 证照模板文件名称
*/
private String templateFileName;
/**
* 证照模板文件地址
*/
private String templateFileUrl;
/**
* 证照模板表单内容
*/
private String formContent;
/**
* 证照示例图地址
*/
private String exampleFileUrl;
/**
* 证照状态,0:禁用1:启用
*/
private Integer status;
/**
* 批量导入模板文件地址
*/
private String excelFile;
/**
* 是否生成PDF,0:否1:是
*/
private Integer isPdf;
/**
* 打印设备Id
*/
private Long deviceId;
/**
* 打印机名称
*/
private String printerName;
/**
* 打印机网络地址
*/
private String printerIp;
/**
* 打印机纸盒
*/
private String paperSource;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof CertificateCatalogTemplateEntity) {
CertificateCatalogTemplateEntity tmp = (CertificateCatalogTemplateEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.siteId = -1L;
this.catalogId = -1L;
this.templateName = "";
this.templateType = 0;
this.templateFileName = "";
this.templateFileUrl = "";
this.formContent = "";
this.exampleFileUrl = "";
this.status = 1;
this.excelFile = "";
this.isPdf = 0;
this.deviceId = -1L;
this.printerName = "";
this.printerIp = "";
this.paperSource = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.certificate.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.certificate.model.CertificateCatalogTemplateEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 证照目录模板视图对象
*
* @author zxfei
* @date 2023-05-23
*/
@Data
public class CertificateCatalogTemplateVo extends BaseEntityLong {
}
\ No newline at end of file
......@@ -10,6 +10,8 @@ public class ApplyLogPdu {
* 证照目录ID
*/
private Long catalogId;
/** 目录模板ID **/
private Long templateId;
/**
* 证件编号
*/
......
package com.mortals.xhx.module.certificate.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.certificate.model.CertificateCatalogTemplateEntity;
import com.mortals.xhx.module.certificate.dao.CertificateCatalogTemplateDao;
/**
* CertificateCatalogTemplateService
*
* 证照目录模板 service接口
*
* @author zxfei
* @date 2023-05-23
*/
public interface CertificateCatalogTemplateService extends ICRUDService<CertificateCatalogTemplateEntity,Long>{
CertificateCatalogTemplateDao getDao();
}
\ No newline at end of file
package com.mortals.xhx.module.certificate.service.impl;
import cn.hutool.core.text.StrSplitter;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.config.ConfigureBuilder;
import com.deepoove.poi.template.MetaTemplate;
import com.deepoove.poi.util.RegexUtils;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.common.code.ClassifyType;
import com.mortals.xhx.common.code.ComponentEnum;
import com.mortals.xhx.common.code.StatusEnum;
import com.mortals.xhx.common.formdesign.*;
import com.mortals.xhx.common.pdu.gen.component.ComponentCons;
import com.mortals.xhx.common.utils.ExcelUtil;
import com.mortals.xhx.common.utils.StringUtils;
import com.mortals.xhx.module.certificate.dao.CertificateCatalogDao;
import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity;
import com.mortals.xhx.module.certificate.model.CertificateClassifyEntity;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import com.mortals.xhx.module.certificate.service.CertificateClassifyService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.certificate.dao.CertificateCatalogDao;
import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import java.util.*;
import java.util.List;
/**
......@@ -71,11 +58,6 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
if(entity.getIndustryId()==null){
throw new AppException("所属行业不能为空");
}
entity.setStatus(StatusEnum.ENABLE.getValue());
if(StringUtils.isNotEmpty(entity.getTemplateUrl())){
//entity.setFormContent(parseDocxToJson(entity.getTemplateUrl()));
parseDocxToJson(entity,false);
}
}
......@@ -96,25 +78,9 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
if(entity.getIndustryId()==null){
throw new AppException("所属行业不能为空");
}
CertificateCatalogEntity old = this.get(entity.getId());
if(!old.getTemplateUrl().equals(entity.getTemplateUrl())) {
if (StringUtils.isNotEmpty(entity.getTemplateUrl())) {
//entity.setFormContent(parseDocxToJson(entity.getTemplateUrl()));
parseDocxToJson(entity, false);
}
}
}
// @Override
// protected void validData(CertificateCatalogEntity entity, Context context) throws AppException {
// Map<String,Object> condition = new HashMap<>();
// condition.put("catalogName",entity.getCatalogName());
// List<CertificateCatalogEntity> list = this.dao.getList(condition);
// if(CollectionUtils.isNotEmpty(list)){
// throw new AppException("目录名称重复");
// }
// }
@Override
protected CertificateCatalogEntity findBefore(CertificateCatalogEntity params, PageInfo pageInfo, Context context) throws AppException {
......@@ -138,108 +104,6 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
}
}
private void parseDocxToJson(CertificateCatalogEntity entity,boolean onlyExcel) {
String rootPath = this.filePath.endsWith("/") ? this.filePath : this.filePath + "/";
String filepath = rootPath + entity.getTemplateUrl();
ConfigureBuilder builder = Configure.builder();
builder.setValidErrorHandler(new Configure.DiscardHandler());
builder.useDefaultEL(false);
builder.buildGrammerRegex(RegexUtils.createGeneral("{{", "}}"));
//builder.buildGramer("[","]");
XWPFTemplate template = XWPFTemplate.compile(filepath, builder.build());
FormDesignRoot root = new FormDesignRoot();
FormDesignConfig config = new FormDesignConfig();
config.initAttribute();
root.setConfig(config);
List<ListItem> collect = new ArrayList<>();
HashSet<String> hs = new HashSet<>(); //去除重复标签
List<String> excelList = new ArrayList<>(); //Excel模板
// excelList.add("证照目录ID");
// excelList.add("证照编号");
// excelList.add("证照名称");
// excelList.add("颁发时间");
// excelList.add("取件人姓名");
// excelList.add("取件人证件号码");
// excelList.add("持有者名称");
// excelList.add("持有者证件号码");
// excelList.add("企业名称");
for (MetaTemplate item : template.getElementTemplates()) {
if(hs.contains(item.variable())){
continue;
}else {
hs.add(item.variable());
}
//识别简单输入
String val = StrUtil.strip(item.variable(), "{{", "}}");
excelList.add(val);
List<String> keys = StrSplitter.split(val, "_", true, true);
//切分分隔符后动态 创建组件 i_1_姓名(第一个代表类型,第二个如果是多个累加,第三个显示label)
if (keys.size() > 2) {
String label = keys.get(2);
String type = keys.get(0);
ComponentCons cons = new ComponentCons();
cons.setLabel(label);
cons.setVal(val);
cons.setEl(item.variable());
cons.setUploadFileUrl(uploadUrl);
if (type.equalsIgnoreCase(ComponentEnum.DYNAMIC_TABLE.getValue())) {
HashSet<String> dhs = new HashSet<>(); //去除重复标签
List<TableColItem> colList = new ArrayList<>();
//表格 结构化绑定数据
ConfigureBuilder builderTable = Configure.builder();
builderTable.setValidErrorHandler(new Configure.DiscardHandler());
builderTable.useDefaultEL(false);
builderTable.buildGramer("[", "]");
XWPFTemplate templateTable = XWPFTemplate.compile(filepath, builderTable.build());
for (MetaTemplate col : templateTable.getElementTemplates()) {
if(dhs.contains(col.variable())){
continue;
}else {
dhs.add(col.variable());
}
String colVal = StrUtil.strip(col.variable(), "[", "]");
if (!StrUtil.startWith(colVal, label)) {
continue;
}
List<String> colKeys = StrSplitter.split(colVal, "_", true, true);
//提取当前table中的列元素
if (colKeys.size() > 3) {
String colLabel = colKeys.get(3);
String colType = colKeys.get(1);
TableColItem tableColItem = new TableColItem();
tableColItem.setLabel(colLabel);
tableColItem.setColType(colType);
tableColItem.setVal(colVal);
colList.add(tableColItem);
//System.out.println("列元素" + col.variable());
}
}
cons.setColList(colList);
DesignComponent designComponent = DesignComponent.createType(type);
ListItem listItem = designComponent.buildDefaultComponent(cons);
collect.add(listItem);
continue;
}
DesignComponent designComponent = DesignComponent.createType(type);
ListItem listItem = designComponent.buildDefaultComponent(cons);
if(type.equals(ComponentEnum.QRCODE.getValue())){
listItem.setValue(qrcode);
}
collect.add(listItem);
}
}
root.setList(collect);
String fileName = "file/uploadfile/excel/"+entity.getCatalogName()+"_批量导入模板.xls";
String excelFilePath = rootPath + fileName;
ExcelUtil.createCatalogTemplate(excelFilePath, excelList);
entity.setExcelFile(fileName);
if(!onlyExcel) {
entity.setFormContent(JSON.toJSONString(root));
}
}
public static void main(String[] args){
// String excelFilePath = "D:/mortals/app/data/cpm/" + "excel/test1.xls";
......@@ -255,12 +119,12 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
@Override
public void generateExcel(Long id, Context context) {
CertificateCatalogEntity entity = dao.get(id);
parseDocxToJson(entity,true);
CertificateCatalogEntity updata = new CertificateCatalogEntity();
updata.setId(entity.getId());
updata.setExcelFile(entity.getExcelFile());
updata.setUpdateTime(new Date());
dao.update(updata);
// CertificateCatalogEntity entity = dao.get(id);
// parseDocxToJson(entity,true);
// CertificateCatalogEntity updata = new CertificateCatalogEntity();
// updata.setId(entity.getId());
// updata.setExcelFile(entity.getExcelFile());
// updata.setUpdateTime(new Date());
// dao.update(updata);
}
}
\ No newline at end of file
package com.mortals.xhx.module.certificate.service.impl;
import cn.hutool.core.text.StrSplitter;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.config.ConfigureBuilder;
import com.deepoove.poi.template.MetaTemplate;
import com.deepoove.poi.util.RegexUtils;
import com.mortals.xhx.common.code.ComponentEnum;
import com.mortals.xhx.common.code.StatusEnum;
import com.mortals.xhx.common.formdesign.*;
import com.mortals.xhx.common.pdu.gen.component.ComponentCons;
import com.mortals.xhx.common.utils.ExcelUtil;
import com.mortals.xhx.common.utils.StringUtils;
import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.certificate.dao.CertificateCatalogTemplateDao;
import com.mortals.xhx.module.certificate.model.CertificateCatalogTemplateEntity;
import com.mortals.xhx.module.certificate.service.CertificateCatalogTemplateService;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
/**
* CertificateCatalogTemplateService
* 证照目录模板 service实现
*
* @author zxfei
* @date 2023-05-23
*/
@Service("certificateCatalogTemplateService")
@Slf4j
public class CertificateCatalogTemplateServiceImpl extends AbstractCRUDServiceImpl<CertificateCatalogTemplateDao, CertificateCatalogTemplateEntity, Long> implements CertificateCatalogTemplateService {
@Value("${upload.path}")
private String filePath;
@Value("${upload.url:http://192.168.0.98:17216/cpm/file/commonupload?prePath=/file/uploadfile}")
private String uploadUrl;
@Value("${qrcode.url:http://rhpt.scjg.chengdu.gov.cn:8091/adap/spjy/process/generateQrCode.do?dto.applyId=}")
private String qrcode;
@Override
protected void saveBefore(CertificateCatalogTemplateEntity entity, Context context) throws AppException {
if(entity.getCatalogId()==null){
throw new AppException("证照目录不能为空");
}
entity.setStatus(StatusEnum.ENABLE.getValue());
if(StringUtils.isNotEmpty(entity.getTemplateFileUrl())){
//entity.setFormContent(parseDocxToJson(entity.getTemplateUrl()));
parseDocxToJson(entity,false);
}
}
@Override
protected void updateBefore(CertificateCatalogTemplateEntity entity, Context context) throws AppException {
CertificateCatalogTemplateEntity old = this.get(entity.getId());
if(!old.getTemplateFileUrl().equals(entity.getTemplateFileUrl())) {
if (StringUtils.isNotEmpty(entity.getTemplateFileUrl())) {
//entity.setFormContent(parseDocxToJson(entity.getTemplateUrl()));
parseDocxToJson(entity, false);
}
}
}
private void parseDocxToJson(CertificateCatalogTemplateEntity entity, boolean onlyExcel) {
String rootPath = this.filePath.endsWith("/") ? this.filePath : this.filePath + "/";
String filepath = rootPath + entity.getTemplateFileUrl();
ConfigureBuilder builder = Configure.builder();
builder.setValidErrorHandler(new Configure.DiscardHandler());
builder.useDefaultEL(false);
builder.buildGrammerRegex(RegexUtils.createGeneral("{{", "}}"));
//builder.buildGramer("[","]");
XWPFTemplate template = XWPFTemplate.compile(filepath, builder.build());
FormDesignRoot root = new FormDesignRoot();
FormDesignConfig config = new FormDesignConfig();
config.initAttribute();
root.setConfig(config);
List<ListItem> collect = new ArrayList<>();
HashSet<String> hs = new HashSet<>(); //去除重复标签
List<String> excelList = new ArrayList<>(); //Excel模板
for (MetaTemplate item : template.getElementTemplates()) {
if(hs.contains(item.variable())){
continue;
}else {
hs.add(item.variable());
}
//识别简单输入
String val = StrUtil.strip(item.variable(), "{{", "}}");
excelList.add(val);
List<String> keys = StrSplitter.split(val, "_", true, true);
//切分分隔符后动态 创建组件 i_1_姓名(第一个代表类型,第二个如果是多个累加,第三个显示label)
if (keys.size() > 2) {
String label = keys.get(2);
String type = keys.get(0);
ComponentCons cons = new ComponentCons();
cons.setLabel(label);
cons.setVal(val);
cons.setEl(item.variable());
cons.setUploadFileUrl(uploadUrl);
if (type.equalsIgnoreCase(ComponentEnum.DYNAMIC_TABLE.getValue())) {
HashSet<String> dhs = new HashSet<>(); //去除重复标签
List<TableColItem> colList = new ArrayList<>();
//表格 结构化绑定数据
ConfigureBuilder builderTable = Configure.builder();
builderTable.setValidErrorHandler(new Configure.DiscardHandler());
builderTable.useDefaultEL(false);
builderTable.buildGramer("[", "]");
XWPFTemplate templateTable = XWPFTemplate.compile(filepath, builderTable.build());
for (MetaTemplate col : templateTable.getElementTemplates()) {
if(dhs.contains(col.variable())){
continue;
}else {
dhs.add(col.variable());
}
String colVal = StrUtil.strip(col.variable(), "[", "]");
if (!StrUtil.startWith(colVal, label)) {
continue;
}
List<String> colKeys = StrSplitter.split(colVal, "_", true, true);
//提取当前table中的列元素
if (colKeys.size() > 3) {
String colLabel = colKeys.get(3);
String colType = colKeys.get(1);
TableColItem tableColItem = new TableColItem();
tableColItem.setLabel(colLabel);
tableColItem.setColType(colType);
tableColItem.setVal(colVal);
colList.add(tableColItem);
//System.out.println("列元素" + col.variable());
}
}
cons.setColList(colList);
DesignComponent designComponent = DesignComponent.createType(type);
ListItem listItem = designComponent.buildDefaultComponent(cons);
collect.add(listItem);
continue;
}
DesignComponent designComponent = DesignComponent.createType(type);
ListItem listItem = designComponent.buildDefaultComponent(cons);
if(type.equals(ComponentEnum.QRCODE.getValue())){
listItem.setValue(qrcode);
}
collect.add(listItem);
}
}
root.setList(collect);
String fileName = "file/uploadfile/excel/"+entity.getTemplateName()+"_批量导入模板.xls";
String excelFilePath = rootPath + fileName;
ExcelUtil.createCatalogTemplate(excelFilePath, excelList);
entity.setExcelFile(fileName);
if(!onlyExcel) {
entity.setFormContent(JSON.toJSONString(root));
}
}
}
\ No newline at end of file
package com.mortals.xhx.module.certificate.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.certificate.model.CertificateCatalogTemplateEntity;
import com.mortals.xhx.module.certificate.service.CertificateCatalogTemplateService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 证照目录模板
*
* @author zxfei
* @date 2023-05-23
*/
@RestController
@RequestMapping("certificate/catalog/template")
public class CertificateCatalogTemplateController extends BaseCRUDJsonBodyMappingController<CertificateCatalogTemplateService,CertificateCatalogTemplateEntity,Long> {
@Autowired
private ParamService paramService;
public CertificateCatalogTemplateController(){
super.setModuleDesc( "证照目录模板");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "templateType", paramService.getParamBySecondOrganize("CertificateCatalogTemplate","templateType"));
this.addDict(model, "status", paramService.getParamBySecondOrganize("CertificateCatalogTemplate","status"));
this.addDict(model, "isPdf", paramService.getParamBySecondOrganize("CertificateCatalogTemplate","isPdf"));
super.init(model, context);
}
}
\ No newline at end of file
......@@ -7,19 +7,15 @@ import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.web.BaseJsonBodyController;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.mid.MidReq;
import com.mortals.xhx.feign.mid.IMidFeign;
import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity;
import com.mortals.xhx.module.certificate.model.CertificateCatalogQuery;
import com.mortals.xhx.module.certificate.pdu.ApplyLogPdu;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import com.mortals.xhx.module.mid.pdu.*;
import com.mortals.xhx.module.record.model.ApplyLogEntity;
import com.mortals.xhx.module.record.model.ApplyLogQuery;
import com.mortals.xhx.module.record.service.ApplyLogService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
......
package com.mortals.xhx.module.print.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.print.model.vo.PrintCatalogVo;
import lombok.Data;
/**
* 证照目录打印配置实体对象
*
* @author zxfei
* @date 2023-05-14
*/
* 证照目录打印配置实体对象
*
* @author zxfei
* @date 2023-05-24
*/
@Data
public class PrintCatalogEntity extends PrintCatalogVo {
private static final long serialVersionUID = 1L;
/**
* 站点id
*/
private Long siteId;
/**
* 打印服务配置ID
*/
private Long serviceId;
/**
* 证照目录ID
*/
......@@ -29,6 +37,14 @@ public class PrintCatalogEntity extends PrintCatalogVo {
*/
private String catalogName;
/**
* 证照目录模板ID
*/
private Long templateId;
/**
* 证照模板名称
*/
private String templateName;
/**
* 打印机名称
*/
private String printerName;
......@@ -40,134 +56,6 @@ public class PrintCatalogEntity extends PrintCatalogVo {
* 打印机纸盒
*/
private String paperSource;
/**
* 打印服务配置ID
*/
private Long serviceId;
/**
* 站点id
*/
private Long siteId;
public PrintCatalogEntity(){}
/**
* 获取 证照目录ID
* @return Long
*/
public Long getCatalogId(){
return catalogId;
}
/**
* 设置 证照目录ID
* @param catalogId
*/
public void setCatalogId(Long catalogId){
this.catalogId = catalogId;
}
/**
* 获取 证照目录编号
* @return String
*/
public String getCatalogCode(){
return catalogCode;
}
/**
* 设置 证照目录编号
* @param catalogCode
*/
public void setCatalogCode(String catalogCode){
this.catalogCode = catalogCode;
}
/**
* 获取 目录名称
* @return String
*/
public String getCatalogName(){
return catalogName;
}
/**
* 设置 目录名称
* @param catalogName
*/
public void setCatalogName(String catalogName){
this.catalogName = catalogName;
}
/**
* 获取 打印机名称
* @return String
*/
public String getPrinterName(){
return printerName;
}
/**
* 设置 打印机名称
* @param printerName
*/
public void setPrinterName(String printerName){
this.printerName = printerName;
}
/**
* 获取 打印机网络地址
* @return String
*/
public String getPrinterIp(){
return printerIp;
}
/**
* 设置 打印机网络地址
* @param printerIp
*/
public void setPrinterIp(String printerIp){
this.printerIp = printerIp;
}
/**
* 获取 打印机纸盒
* @return String
*/
public String getPaperSource(){
return paperSource;
}
/**
* 设置 打印机纸盒
* @param paperSource
*/
public void setPaperSource(String paperSource){
this.paperSource = paperSource;
}
/**
* 获取 打印服务配置ID
* @return Long
*/
public Long getServiceId(){
return serviceId;
}
/**
* 设置 打印服务配置ID
* @param serviceId
*/
public void setServiceId(Long serviceId){
this.serviceId = serviceId;
}
/**
* 获取 站点id
* @return Long
*/
public Long getSiteId(){
return siteId;
}
/**
* 设置 站点id
* @param siteId
*/
public void setSiteId(Long siteId){
this.siteId = siteId;
}
@Override
public int hashCode() {
return this.getId().hashCode();
......@@ -184,35 +72,26 @@ public class PrintCatalogEntity extends PrintCatalogVo {
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",catalogId:").append(getCatalogId());
sb.append(",catalogCode:").append(getCatalogCode());
sb.append(",catalogName:").append(getCatalogName());
sb.append(",printerName:").append(getPrinterName());
sb.append(",printerIp:").append(getPrinterIp());
sb.append(",paperSource:").append(getPaperSource());
sb.append(",serviceId:").append(getServiceId());
sb.append(",siteId:").append(getSiteId());
return sb.toString();
}
public void initAttrValue(){
this.catalogId = null;
this.siteId = -1L;
this.serviceId = -1L;
this.catalogId = -1L;
this.catalogCode = "";
this.catalogName = "";
this.templateId = -1L;
this.templateName = "";
this.printerName = "";
this.printerIp = "";
this.paperSource = "";
this.serviceId = null;
this.siteId = null;
}
}
\ No newline at end of file
......@@ -18,5 +18,5 @@ public interface PrintCatalogService extends ICRUDService<PrintCatalogEntity,Lon
* @param catalogId
* @return
*/
PrintCatalogEntity getPrintCatalogByService(Long serviceId,Long catalogId) throws AppException;
PrintCatalogEntity getPrintCatalogByService(Long serviceId,Long catalogId,Long templateId) throws AppException;
}
\ No newline at end of file
package com.mortals.xhx.module.print.service.impl;
import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity;
import com.mortals.xhx.module.certificate.model.CertificateCatalogTemplateEntity;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import com.mortals.xhx.module.certificate.service.CertificateCatalogTemplateService;
import com.mortals.xhx.module.print.model.PrintCatalogQuery;
import com.mortals.xhx.module.print.model.PrintServiceEntity;
import com.mortals.xhx.module.print.service.PrintServiceService;
......@@ -30,6 +32,8 @@ public class PrintCatalogServiceImpl extends AbstractCRUDServiceImpl<PrintCatalo
private CertificateCatalogService certificateCatalogService;
@Autowired
private PrintServiceService printServiceService;
@Autowired
private CertificateCatalogTemplateService certificateCatalogTemplateService;
@Override
protected void validData(PrintCatalogEntity entity, Context context) throws AppException {
......@@ -53,7 +57,7 @@ public class PrintCatalogServiceImpl extends AbstractCRUDServiceImpl<PrintCatalo
}
@Override
public PrintCatalogEntity getPrintCatalogByService(Long serviceId, Long catalogId) throws AppException {
public PrintCatalogEntity getPrintCatalogByService(Long serviceId, Long catalogId,Long templateId) throws AppException {
PrintServiceEntity printServiceEntity = printServiceService.get(serviceId);
if(printServiceEntity == null){
throw new AppException("打印服务id不正确");
......@@ -71,14 +75,18 @@ public class PrintCatalogServiceImpl extends AbstractCRUDServiceImpl<PrintCatalo
if(catalogEntity == null){
throw new AppException("证照目录id不正确");
}
CertificateCatalogTemplateEntity catalogTemplateEntity = certificateCatalogTemplateService.get(templateId);
if(catalogTemplateEntity == null){
throw new AppException("证照目录模板id不正确");
}
data = new PrintCatalogEntity();
data.setServiceUrl(printServiceEntity.getServiceUrl());
data.setCatalogCode(catalogEntity.getCatalogCode());
data.setCatalogName(catalogEntity.getCatalogName());
data.setCatalogId(catalogEntity.getId());
data.setPrinterIp(catalogEntity.getPrinterIp());
data.setPrinterName(catalogEntity.getPrinterName());
data.setPaperSource(catalogEntity.getPaperSource());
data.setPrinterIp(catalogTemplateEntity.getPrinterIp());
data.setPrinterName(catalogTemplateEntity.getPrinterName());
data.setPaperSource(catalogTemplateEntity.getPaperSource());
}
return data;
}
......
......@@ -50,7 +50,7 @@ public interface ApplyLogService extends ICRUDService<ApplyLogEntity,Long>{
* @param context
* @return
*/
String importData(List<Map<Integer, Object>> dataList,Map<String,String> fileMap,Long catalogId,Context context) throws AppException;
String importData(List<Map<Integer, Object>> dataList,Map<String,String> fileMap,Long catalogId,Long templateId,Context context) throws AppException;
/**
* api接口提交数据
......
......@@ -14,11 +14,4 @@ import com.mortals.xhx.module.record.model.RetainLogEntity;
*/
public interface RetainLogService extends ICRUDService<RetainLogEntity,Long>{
/**
* 添加持有记录
* @param applyLogEntity
* @param context
* @throws AppException
*/
void creatRetainLog(ApplyLogEntity applyLogEntity, Context context) throws AppException;
}
\ No newline at end of file
......@@ -22,12 +22,10 @@ import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.utils.*;
import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity;
import com.mortals.xhx.module.certificate.model.CertificateCatalogQuery;
import com.mortals.xhx.module.certificate.model.CertificateClassifyEntity;
import com.mortals.xhx.module.certificate.model.CertificateClassifyQuery;
import com.mortals.xhx.module.certificate.model.*;
import com.mortals.xhx.module.certificate.pdu.ApplyLogPdu;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import com.mortals.xhx.module.certificate.service.CertificateCatalogTemplateService;
import com.mortals.xhx.module.certificate.service.CertificateClassifyService;
import com.mortals.xhx.module.record.dao.RecordDao;
import com.mortals.xhx.module.record.model.ApplyLogQuery;
......@@ -76,7 +74,8 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
@Autowired
private CertificateCatalogService certificateCatalogService;
@Autowired
private CertificateCatalogTemplateService certificateCatalogTemplateService;
@Autowired
private PrintWaitQueueService printWaitQueueService;
......@@ -143,6 +142,9 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
if(entity.getCatalogId()==null){
throw new AppException("目录ID不能为空");
}
if(entity.getTemplateId()==null){
throw new AppException("目录模板ID不能为空");
}
super.validData(entity, context);
}
......@@ -196,9 +198,10 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
@Override
public String previewOriginal(ApplyLogEntity applyLogEntity, Context context) throws AppException {
validData(applyLogEntity,context);
CertificateCatalogEntity catalog = certificateCatalogService.get(applyLogEntity.getCatalogId());
applyLogEntity.setCatalogCode(catalog.getCatalogCode());
DocTemplateVO docTemplate = new DocTemplateVO(catalog.getTemplateUrl(),applyLogEntity.getFormContent());
// CertificateCatalogEntity catalog = certificateCatalogService.get(applyLogEntity.getCatalogId());
CertificateCatalogTemplateEntity templateEntity = certificateCatalogTemplateService.get(applyLogEntity.getTemplateId());
// applyLogEntity.setCatalogCode(catalog.getCatalogCode());
DocTemplateVO docTemplate = new DocTemplateVO(templateEntity.getTemplateFileUrl(),applyLogEntity.getFormContent());
return preview(docTemplate, context,false);
}
......@@ -211,10 +214,12 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
CertificateCatalogEntity catalog = certificateCatalogService.get(applyLogEntity.getCatalogId());
applyLogEntity.setCatalogCode(catalog.getCatalogCode());
applyLogEntity.setCatalogName(catalog.getCatalogName());
CertificateCatalogTemplateEntity templateEntity = certificateCatalogTemplateService.get(applyLogEntity.getTemplateId());
applyLogEntity.setTemplateName(templateEntity.getTemplateName());
//applyLogEntity.setFormTemplate(catalog.getFormContent());
DocTemplateVO docTemplate = new DocTemplateVO(catalog.getTemplateUrl(),applyLogEntity.getFormContent());
DocTemplateVO docTemplate = new DocTemplateVO(templateEntity.getTemplateFileUrl(),applyLogEntity.getFormContent());
boolean hasPDF = false;
if(catalog.getIsPdf()!=null && catalog.getIsPdf()==1){
if(templateEntity.getIsPdf()!=null && templateEntity.getIsPdf()==1){
hasPDF = true;
}
String paths = preview(docTemplate, context,hasPDF);
......@@ -424,7 +429,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
}
@Override
public String importData(List<Map<Integer, Object>> dataList, Map<String,String> fileMap, Long catalogId, Context context) throws AppException {
public String importData(List<Map<Integer, Object>> dataList, Map<String,String> fileMap, Long catalogId, Long templateId, Context context) throws AppException {
if(catalogId==null){
throw new AppException("目录ID不能为空");
}
......@@ -432,9 +437,15 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
if(catalog==null){
throw new AppException("目录ID不正确");
}
JSONObject formContent = JSONObject.parseObject(catalog.getFormContent());
if(templateId==null){
throw new AppException("目录模板ID不能为空");
}
CertificateCatalogTemplateEntity templateEntity = certificateCatalogTemplateService.get(templateId);
if(templateEntity==null){
throw new AppException("目录模板ID不正确");
}
JSONObject formContent = JSONObject.parseObject(templateEntity.getFormContent());
JSONArray formList = formContent.getJSONArray("list");
Map<Integer, Object> header = dataList.get(0); //表头
List<ApplyLogEntity> applyLogList = new ArrayList<>();
for (int r=1;r<dataList.size();r++){
......@@ -521,10 +532,16 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
if(catalog==null){
throw new AppException("目录ID不正确");
}
CertificateCatalogTemplateEntity templateEntity = certificateCatalogTemplateService.get(pdu.getTemplateId());
if(templateEntity==null){
throw new AppException("目录模板ID不正确");
}
ApplyLogEntity entity = new ApplyLogEntity();
entity.setCatalogId(catalog.getId());
entity.setCatalogCode(catalog.getCatalogCode());
entity.setCatalogName(catalog.getCatalogName());
entity.setTemplateId(templateEntity.getId());
entity.setTemplateName(templateEntity.getTemplateName());
entity.setCertificateCode(pdu.getCertificateCode());
entity.setCertificateName(pdu.getCertificateName());
entity.setHolderName(pdu.getHolderName());
......@@ -561,7 +578,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
}
});
entity.setFormContent(JSONObject.toJSONString(formMap));
JSONObject formTemplate = JSONObject.parseObject(catalog.getFormContent());
JSONObject formTemplate = JSONObject.parseObject(templateEntity.getFormContent());
JSONArray formList = formTemplate.getJSONArray("list");
JSONObject json = new JSONObject();
for (int j = 0; j < formList.size(); j++) {
......@@ -588,10 +605,15 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
List<CertificateCatalogEntity> catalogEntityList = this.certificateCatalogService.find(new CertificateCatalogQuery().classifyId(certificateClassifyEntity.getId()));
if(CollectionUtils.isNotEmpty(catalogEntityList)){
for(CertificateCatalogEntity catalogEntity:catalogEntityList){
List<CertificateCatalogTemplateEntity> templateEntityList = certificateCatalogTemplateService.find(new CertificateCatalogTemplateQuery().catalogId(catalogEntity.getId()));
if(CollectionUtils.isNotEmpty(templateEntityList)){
for (CertificateCatalogTemplateEntity templateEntity:templateEntityList){
ApplyLogEntity entity = new ApplyLogEntity();
entity.setCatalogId(catalogEntity.getId());
entity.setCatalogCode(catalogEntity.getCatalogCode());
entity.setCatalogName(catalogEntity.getCatalogName());
entity.setTemplateId(templateEntity.getId());
entity.setTemplateName(templateEntity.getTemplateName());
entity.setCertificateCode(pdu.getCertificateCode());
entity.setCertificateName(pdu.getCertificateName());
entity.setSiteId(pdu.getSiteId());
......@@ -629,7 +651,7 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
}
});
entity.setFormContent(JSONObject.toJSONString(formMap));
JSONObject formTemplate = JSONObject.parseObject(catalogEntity.getFormContent());
JSONObject formTemplate = JSONObject.parseObject(templateEntity.getFormContent());
JSONArray formList = formTemplate.getJSONArray("list");
JSONObject json = new JSONObject();
for (int j = 0; j < formList.size(); j++) {
......@@ -646,6 +668,9 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
throw new AppException("微中台数据生成证照失败");
}
}
}
}
}else {
throw new AppException("目录类型不正确,无法找到相应证照目录");
}
......
package com.mortals.xhx.module.record.service.impl;
import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.common.code.CertificateStatus;
import com.mortals.xhx.common.code.ClassifyType;
import com.mortals.xhx.common.code.PrintStatus;
import com.mortals.xhx.common.utils.StringUtils;
import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity;
import com.mortals.xhx.module.certificate.model.CertificateClassifyEntity;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import com.mortals.xhx.module.certificate.service.CertificateClassifyService;
import com.mortals.xhx.module.record.model.ApplyLogEntity;
import com.mortals.xhx.module.record.model.ApplyLogQuery;
import com.mortals.xhx.module.record.model.PrintLogQuery;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.common.utils.StringUtils;
import com.mortals.xhx.module.record.dao.PrintLogDao;
import com.mortals.xhx.module.record.model.PrintLogEntity;
import com.mortals.xhx.module.record.model.PrintLogQuery;
import com.mortals.xhx.module.record.service.PrintLogService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......
package com.mortals.xhx.module.record.service.impl;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.record.dao.RecordDao;
import com.mortals.xhx.module.record.model.RecordEntity;
import com.mortals.xhx.module.record.service.RecordService;
import org.springframework.stereotype.Service;
/**
* RecordService
* 证照申请 service实现
......
......@@ -136,7 +136,7 @@ public class ApplyLogController extends BaseCRUDJsonBodyMappingController<ApplyL
}
@PostMapping({"/import"})
public String importFile(MultipartFile file, Long catalogId) {
public String importFile(MultipartFile file, Long catalogId,Long templateId) {
JSONObject ret = new JSONObject();
Map<String, Object> model = new HashMap();
Context context = this.getContext();
......@@ -147,7 +147,7 @@ public class ApplyLogController extends BaseCRUDJsonBodyMappingController<ApplyL
List<Map<Integer, Object>> returnList = ImportExcelUtil.readExcelContent(fileName,file.getInputStream(),1,null,null);
Map<String, PictureData> pictureDataMap = ReadExcelPictureUtil.readExcelPictureMap(file);
Map<String,String> fileMap = ReadExcelPictureUtil.savePicture(this.filePath,pictureDataMap);
String message = this.service.importData(returnList, fileMap, catalogId, context);
String message = this.service.importData(returnList, fileMap, catalogId, templateId, context);
model.put("message_info", message);
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var13) {
......
package com.mortals.xhx.module.record.web;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.record.model.RecordEntity;
import com.mortals.xhx.module.record.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.record.model.RecordEntity;
import com.mortals.xhx.module.record.service.RecordService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 证照申请
......
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