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

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

parent a25c3e74
package com.mortals.xhx.base.login.web; package com.mortals.xhx.base.login.web;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.ap.GlobalSysInfo; import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.ap.SysConstains; import com.mortals.framework.ap.SysConstains;
...@@ -8,7 +7,6 @@ import com.mortals.framework.service.ICacheService; ...@@ -8,7 +7,6 @@ import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.ITokenService; import com.mortals.framework.service.ITokenService;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.framework.util.AESUtil; import com.mortals.framework.util.AESUtil;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.HttpUtil; import com.mortals.framework.util.HttpUtil;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
...@@ -58,7 +56,6 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -58,7 +56,6 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
@RequestMapping("login") @RequestMapping("login")
public String login( @RequestBody LoginForm loginForm) throws Exception { public String login( @RequestBody LoginForm loginForm) throws Exception {
String loginName = loginForm.getLoginName(); String loginName = loginForm.getLoginName();
String password = loginForm.getPassword(); String password = loginForm.getPassword();
...@@ -70,59 +67,59 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -70,59 +67,59 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
return resp; return resp;
/*JSONObject ret = new JSONObject(); // JSONObject ret = new JSONObject();
String loginName = loginForm.getLoginName(); // String loginName = loginForm.getLoginName();
String password = loginForm.getPassword(); // String password = loginForm.getPassword();
//String securityCode = loginForm.getSecurityCode(); // //String securityCode = loginForm.getSecurityCode();
String ip = super.getRequestIP(request); // String ip = super.getRequestIP(request);
if (StringUtils.isEmpty(loginName) || StringUtils.isEmpty(password)) { // if (StringUtils.isEmpty(loginName) || StringUtils.isEmpty(password)) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE); // ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, "未获取到用户信息,请重新登录"); // ret.put(KEY_RESULT_MSG, "未获取到用户信息,请重新登录");
return ret.toJSONString(); // return ret.toJSONString();
} // }
UserEntity userEntity = null; // UserEntity userEntity = null;
try { // try {
loginForm.validate(); // loginForm.validate();
//
userEntity = userService.doLogin(loginName, password, ip); // userEntity = userService.doLogin(loginName, password, ip);
userEntity.setLastLoginAddress(ip); // userEntity.setLastLoginAddress(ip);
//saveCurrUser(request, response, userEntity); // //saveCurrUser(request, response, userEntity);
recordSysLog(request, userEntity, "用户登录系统成功!"); // recordSysLog(request, userEntity, "用户登录系统成功!");
// 返回拥有的菜单数据 // // 返回拥有的菜单数据
Set<String> urls = resourceService.findUrlSetByUserId(userEntity.getId()); // Set<String> urls = resourceService.findUrlSetByUserId(userEntity.getId());
List<MenuEntity> outlookBarList = menuService.findTreeMenu(userEntity, urls); // List<MenuEntity> outlookBarList = menuService.findTreeMenu(userEntity, urls);
String currUserName = userEntity.getRealName(); // String currUserName = userEntity.getRealName();
if (currUserName == null || currUserName.trim().length() == 0) { // if (currUserName == null || currUserName.trim().length() == 0) {
currUserName = "管理员"; // currUserName = "管理员";
} // }
userEntity.setLoginTime(System.currentTimeMillis()); // userEntity.setLoginTime(System.currentTimeMillis());
userEntity.setToken(IdUtil.fastSimpleUUID()); // userEntity.setToken(IdUtil.fastSimpleUUID());
userEntity.setExpireTime(DateUtils.addCurrDate(7).getTime()); // userEntity.setExpireTime(DateUtils.addCurrDate(7).getTime());
String token = authTokenService.createToken(userEntity); // String token = authTokenService.createToken(userEntity);
JSONObject data = new JSONObject(); // JSONObject data = new JSONObject();
data.put("token", token); // data.put("token", token);
data.put("currUserName", currUserName); // data.put("currUserName", currUserName);
data.put("barList", outlookBarList); // data.put("barList", outlookBarList);
data.put("id", userEntity.getId()); // data.put("id", userEntity.getId());
data.put("userType", userEntity.getUserType()); // data.put("userType", userEntity.getUserType());
//
//this.generateBlackCookie(request, response, loginName, urls); // //this.generateBlackCookie(request, response, loginName, urls);
ret.put(KEY_RESULT_DATA, data); // ret.put(KEY_RESULT_DATA, data);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS); // ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "用户登录系统成功!"); // ret.put(KEY_RESULT_MSG, "用户登录系统成功!");
ret.put("resources", urls); // ret.put("resources", urls);
//
return ret.toJSONString(); // return ret.toJSONString();
} catch (Exception e) { // } catch (Exception e) {
log.error("login error ", e); // log.error("login error ", e);
if (userEntity == null) { // if (userEntity == null) {
userEntity = new UserEntity(); // userEntity = new UserEntity();
userEntity.setLoginName(loginName); // userEntity.setLoginName(loginName);
} // }
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE); // ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e)); // ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString(); // return ret.toJSONString();
}*/ // }
} }
@RequestMapping("logout") @RequestMapping("logout")
......
...@@ -17,6 +17,14 @@ public class CatalogVO { ...@@ -17,6 +17,14 @@ public class CatalogVO {
* 目录编号 * 目录编号
*/ */
private String catalogCode; private String catalogCode;
/**
* 证照目录模板ID
*/
private Long templateId;
/**
* 证照模板名称
*/
private String templateName;
/** /**
* 证照模板表单内容 * 证照模板表单内容
*/ */
......
...@@ -9,10 +9,13 @@ import com.mortals.framework.web.BaseJsonBodyController; ...@@ -9,10 +9,13 @@ import com.mortals.framework.web.BaseJsonBodyController;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity; import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity;
import com.mortals.xhx.module.certificate.model.CertificateCatalogQuery; 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.ApplyLogPdu;
import com.mortals.xhx.module.certificate.pdu.PrintListPdu; import com.mortals.xhx.module.certificate.pdu.PrintListPdu;
import com.mortals.xhx.module.certificate.pdu.PrintLogPdu; import com.mortals.xhx.module.certificate.pdu.PrintLogPdu;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService; 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.PrintCatalogEntity;
import com.mortals.xhx.module.print.model.PrintCatalogQuery; import com.mortals.xhx.module.print.model.PrintCatalogQuery;
import com.mortals.xhx.module.print.model.PrintServiceEntity; import com.mortals.xhx.module.print.model.PrintServiceEntity;
...@@ -45,6 +48,8 @@ public class CertificateApi extends BaseJsonBodyController { ...@@ -45,6 +48,8 @@ public class CertificateApi extends BaseJsonBodyController {
private PrintCatalogService printCatalogService; private PrintCatalogService printCatalogService;
@Autowired @Autowired
private PrintWaitQueueService printWaitQueueService; private PrintWaitQueueService printWaitQueueService;
@Autowired
private CertificateCatalogTemplateService certificateCatalogTemplateService;
@PostMapping({"catalog/list"}) @PostMapping({"catalog/list"})
@UnAuth @UnAuth
...@@ -60,17 +65,27 @@ public class CertificateApi extends BaseJsonBodyController { ...@@ -60,17 +65,27 @@ public class CertificateApi extends BaseJsonBodyController {
if(CollectionUtils.isNotEmpty(list)){ if(CollectionUtils.isNotEmpty(list)){
List<CatalogVO> catalogList = new ArrayList<>(); List<CatalogVO> catalogList = new ArrayList<>();
for(CertificateCatalogEntity entity:list){ for(CertificateCatalogEntity entity:list){
CatalogVO catalogVO = new CatalogVO(entity.getId(),entity.getCatalogName(),entity.getCatalogCode());
JSONObject formContent = JSONObject.parseObject(entity.getFormContent()); List<CertificateCatalogTemplateEntity> templateEntityList = certificateCatalogTemplateService.find(new CertificateCatalogTemplateQuery().catalogId(entity.getId()));
JSONArray formList = formContent.getJSONArray("list"); if(CollectionUtils.isNotEmpty(templateEntityList)){
JSONObject json = new JSONObject();
for (int j = 0; j < formList.size(); j++) { for (CertificateCatalogTemplateEntity item:templateEntityList){
JSONObject jsonObject = formList.getJSONObject(j); CatalogVO catalogVO = new CatalogVO(entity.getId(),entity.getCatalogName(),entity.getCatalogCode());
json.put(jsonObject.getString("id"),""); 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++) {
JSONObject jsonObject = formList.getJSONObject(j);
json.put(jsonObject.getString("id"),"");
}
catalogVO.setFormContent(json.toJSONString());
catalogList.add(catalogVO);
}
} }
catalogVO.setFormContent(json.toJSONString());
catalogList.add(catalogVO);
} }
model.put("message_info", "获取证照目录成功"); model.put("message_info", "获取证照目录成功");
ret.put("data", catalogList); ret.put("data", catalogList);
...@@ -207,7 +222,7 @@ public class CertificateApi extends BaseJsonBodyController { ...@@ -207,7 +222,7 @@ public class CertificateApi extends BaseJsonBodyController {
if(CollectionUtils.isNotEmpty(list)){ if(CollectionUtils.isNotEmpty(list)){
List<PrintWaitQueueVO> waitQueueVOList = new ArrayList<>(); List<PrintWaitQueueVO> waitQueueVOList = new ArrayList<>();
for(PrintWaitQueueEntity printWaitQueueEntity:list){ 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 printWaitQueueVO = new PrintWaitQueueVO();
printWaitQueueVO.setCatalogId(printWaitQueueEntity.getCatalogId()); printWaitQueueVO.setCatalogId(printWaitQueueEntity.getCatalogId());
printWaitQueueVO.setCatalogCode(printWaitQueueEntity.getCatalogCode()); 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 { ...@@ -10,6 +10,8 @@ public class ApplyLogPdu {
* 证照目录ID * 证照目录ID
*/ */
private Long catalogId; 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; package com.mortals.xhx.module.certificate.service.impl;
import cn.hutool.core.text.StrSplitter; import com.mortals.framework.exception.AppException;
import cn.hutool.core.util.StrUtil; import com.mortals.framework.model.Context;
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.model.PageInfo; 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.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.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.model.CertificateClassifyEntity;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import com.mortals.xhx.module.certificate.service.CertificateClassifyService; import com.mortals.xhx.module.certificate.service.CertificateClassifyService;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; 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 ...@@ -71,11 +58,6 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
if(entity.getIndustryId()==null){ if(entity.getIndustryId()==null){
throw new AppException("所属行业不能为空"); 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 ...@@ -96,25 +78,9 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
if(entity.getIndustryId()==null){ if(entity.getIndustryId()==null){
throw new AppException("所属行业不能为空"); 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 @Override
protected CertificateCatalogEntity findBefore(CertificateCatalogEntity params, PageInfo pageInfo, Context context) throws AppException { protected CertificateCatalogEntity findBefore(CertificateCatalogEntity params, PageInfo pageInfo, Context context) throws AppException {
...@@ -138,108 +104,6 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi ...@@ -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){ public static void main(String[] args){
// String excelFilePath = "D:/mortals/app/data/cpm/" + "excel/test1.xls"; // String excelFilePath = "D:/mortals/app/data/cpm/" + "excel/test1.xls";
...@@ -255,12 +119,12 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi ...@@ -255,12 +119,12 @@ 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());
updata.setUpdateTime(new Date()); // updata.setUpdateTime(new Date());
dao.update(updata); // 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; ...@@ -7,19 +7,15 @@ import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.framework.web.BaseJsonBodyController; 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.common.pdu.mid.MidReq;
import com.mortals.xhx.feign.mid.IMidFeign; 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.pdu.ApplyLogPdu;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import com.mortals.xhx.module.mid.pdu.*; import com.mortals.xhx.module.mid.pdu.*;
import com.mortals.xhx.module.record.model.ApplyLogEntity; import com.mortals.xhx.module.record.model.ApplyLogEntity;
import com.mortals.xhx.module.record.model.ApplyLogQuery; import com.mortals.xhx.module.record.model.ApplyLogQuery;
import com.mortals.xhx.module.record.service.ApplyLogService; import com.mortals.xhx.module.record.service.ApplyLogService;
import org.apache.commons.collections4.CollectionUtils; 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.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
......
package com.mortals.xhx.module.print.model; package com.mortals.xhx.module.print.model;
import java.util.List; import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel; import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.print.model.vo.PrintCatalogVo; import com.mortals.xhx.module.print.model.vo.PrintCatalogVo;
import lombok.Data;
/** /**
* 证照目录打印配置实体对象 * 证照目录打印配置实体对象
* *
* @author zxfei * @author zxfei
* @date 2023-05-14 * @date 2023-05-24
*/ */
@Data
public class PrintCatalogEntity extends PrintCatalogVo { public class PrintCatalogEntity extends PrintCatalogVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 证照目录ID * 站点id
*/ */
private Long siteId;
/**
* 打印服务配置ID
*/
private Long serviceId;
/**
* 证照目录ID
*/
private Long catalogId; private Long catalogId;
/** /**
* 证照目录编号 * 证照目录编号
*/ */
private String catalogCode; private String catalogCode;
/** /**
* 目录名称 * 目录名称
*/ */
private String catalogName; private String catalogName;
/** /**
* 打印机名称 * 证照目录模板ID
*/ */
private Long templateId;
/**
* 证照模板名称
*/
private String templateName;
/**
* 打印机名称
*/
private String printerName; private String printerName;
/** /**
* 打印机网络地址 * 打印机网络地址
*/ */
private String printerIp; private String printerIp;
/** /**
* 打印机纸盒 * 打印机纸盒
*/ */
private String paperSource; 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 @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
...@@ -178,41 +66,32 @@ public class PrintCatalogEntity extends PrintCatalogVo { ...@@ -178,41 +66,32 @@ public class PrintCatalogEntity extends PrintCatalogVo {
if (obj instanceof PrintCatalogEntity) { if (obj instanceof PrintCatalogEntity) {
PrintCatalogEntity tmp = (PrintCatalogEntity) obj; PrintCatalogEntity tmp = (PrintCatalogEntity) obj;
if (this.getId() == tmp.getId()) { if (this.getId() == tmp.getId()) {
return true; return true;
} }
} }
return false; 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(){ public void initAttrValue(){
this.catalogId = null; this.siteId = -1L;
this.serviceId = -1L;
this.catalogId = -1L;
this.catalogCode = ""; this.catalogCode = "";
this.catalogName = ""; this.catalogName = "";
this.printerName = ""; this.templateId = -1L;
this.printerIp = ""; this.templateName = "";
this.paperSource = ""; this.printerName = "";
this.serviceId = null; this.printerIp = "";
this.siteId = null; this.paperSource = "";
} }
} }
\ No newline at end of file
...@@ -18,5 +18,5 @@ public interface PrintCatalogService extends ICRUDService<PrintCatalogEntity,Lon ...@@ -18,5 +18,5 @@ public interface PrintCatalogService extends ICRUDService<PrintCatalogEntity,Lon
* @param catalogId * @param catalogId
* @return * @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; package com.mortals.xhx.module.print.service.impl;
import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity; 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.CertificateCatalogService;
import com.mortals.xhx.module.certificate.service.CertificateCatalogTemplateService;
import com.mortals.xhx.module.print.model.PrintCatalogQuery; import com.mortals.xhx.module.print.model.PrintCatalogQuery;
import com.mortals.xhx.module.print.model.PrintServiceEntity; import com.mortals.xhx.module.print.model.PrintServiceEntity;
import com.mortals.xhx.module.print.service.PrintServiceService; import com.mortals.xhx.module.print.service.PrintServiceService;
...@@ -30,6 +32,8 @@ public class PrintCatalogServiceImpl extends AbstractCRUDServiceImpl<PrintCatalo ...@@ -30,6 +32,8 @@ public class PrintCatalogServiceImpl extends AbstractCRUDServiceImpl<PrintCatalo
private CertificateCatalogService certificateCatalogService; private CertificateCatalogService certificateCatalogService;
@Autowired @Autowired
private PrintServiceService printServiceService; private PrintServiceService printServiceService;
@Autowired
private CertificateCatalogTemplateService certificateCatalogTemplateService;
@Override @Override
protected void validData(PrintCatalogEntity entity, Context context) throws AppException { protected void validData(PrintCatalogEntity entity, Context context) throws AppException {
...@@ -53,7 +57,7 @@ public class PrintCatalogServiceImpl extends AbstractCRUDServiceImpl<PrintCatalo ...@@ -53,7 +57,7 @@ public class PrintCatalogServiceImpl extends AbstractCRUDServiceImpl<PrintCatalo
} }
@Override @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); PrintServiceEntity printServiceEntity = printServiceService.get(serviceId);
if(printServiceEntity == null){ if(printServiceEntity == null){
throw new AppException("打印服务id不正确"); throw new AppException("打印服务id不正确");
...@@ -71,14 +75,18 @@ public class PrintCatalogServiceImpl extends AbstractCRUDServiceImpl<PrintCatalo ...@@ -71,14 +75,18 @@ public class PrintCatalogServiceImpl extends AbstractCRUDServiceImpl<PrintCatalo
if(catalogEntity == null){ if(catalogEntity == null){
throw new AppException("证照目录id不正确"); throw new AppException("证照目录id不正确");
} }
CertificateCatalogTemplateEntity catalogTemplateEntity = certificateCatalogTemplateService.get(templateId);
if(catalogTemplateEntity == null){
throw new AppException("证照目录模板id不正确");
}
data = new PrintCatalogEntity(); data = new PrintCatalogEntity();
data.setServiceUrl(printServiceEntity.getServiceUrl()); data.setServiceUrl(printServiceEntity.getServiceUrl());
data.setCatalogCode(catalogEntity.getCatalogCode()); data.setCatalogCode(catalogEntity.getCatalogCode());
data.setCatalogName(catalogEntity.getCatalogName()); data.setCatalogName(catalogEntity.getCatalogName());
data.setCatalogId(catalogEntity.getId()); data.setCatalogId(catalogEntity.getId());
data.setPrinterIp(catalogEntity.getPrinterIp()); data.setPrinterIp(catalogTemplateEntity.getPrinterIp());
data.setPrinterName(catalogEntity.getPrinterName()); data.setPrinterName(catalogTemplateEntity.getPrinterName());
data.setPaperSource(catalogEntity.getPaperSource()); data.setPaperSource(catalogTemplateEntity.getPaperSource());
} }
return data; return data;
} }
......
...@@ -50,7 +50,7 @@ public interface ApplyLogService extends ICRUDService<ApplyLogEntity,Long>{ ...@@ -50,7 +50,7 @@ public interface ApplyLogService extends ICRUDService<ApplyLogEntity,Long>{
* @param context * @param context
* @return * @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接口提交数据 * api接口提交数据
......
...@@ -14,11 +14,4 @@ import com.mortals.xhx.module.record.model.RetainLogEntity; ...@@ -14,11 +14,4 @@ import com.mortals.xhx.module.record.model.RetainLogEntity;
*/ */
public interface RetainLogService extends ICRUDService<RetainLogEntity,Long>{ 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
package com.mortals.xhx.module.record.service.impl; 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.exception.AppException;
import com.mortals.framework.model.Context; 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.dao.PrintLogDao;
import com.mortals.xhx.module.record.model.PrintLogEntity; 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 com.mortals.xhx.module.record.service.PrintLogService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
......
package com.mortals.xhx.module.record.service.impl; package com.mortals.xhx.module.record.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.util.HttpUtil; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.*; import com.mortals.xhx.common.code.CertificateStatus;
import com.mortals.xhx.common.code.GenerateStatus;
import com.mortals.xhx.common.code.PrintStatus;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.ParamKey; import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity; import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity;
import com.mortals.xhx.module.certificate.model.CertificateClassifyEntity; import com.mortals.xhx.module.certificate.model.CertificateCatalogTemplateEntity;
import com.mortals.xhx.module.certificate.model.CertificateClassifyQuery; import com.mortals.xhx.module.certificate.model.CertificateClassifyQuery;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService; 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.certificate.service.CertificateClassifyService;
import com.mortals.xhx.module.print.model.PrintCatalogEntity; import com.mortals.xhx.module.print.model.PrintCatalogEntity;
import com.mortals.xhx.module.print.model.PrintCatalogQuery; import com.mortals.xhx.module.print.model.PrintCatalogQuery;
...@@ -16,23 +22,17 @@ import com.mortals.xhx.module.print.model.PrintServiceQuery; ...@@ -16,23 +22,17 @@ import com.mortals.xhx.module.print.model.PrintServiceQuery;
import com.mortals.xhx.module.print.service.PrintCatalogService; import com.mortals.xhx.module.print.service.PrintCatalogService;
import com.mortals.xhx.module.print.service.PrintServiceService; import com.mortals.xhx.module.print.service.PrintServiceService;
import com.mortals.xhx.module.record.dao.PrintLogDao; import com.mortals.xhx.module.record.dao.PrintLogDao;
import com.mortals.xhx.module.record.dao.PrintWaitQueueDao;
import com.mortals.xhx.module.record.dao.RetainLogDao; import com.mortals.xhx.module.record.dao.RetainLogDao;
import com.mortals.xhx.module.record.model.*; import com.mortals.xhx.module.record.model.*;
import com.mortals.xhx.module.record.service.PrintLogService; import com.mortals.xhx.module.record.service.PrintWaitQueueService;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; 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.PrintWaitQueueDao;
import com.mortals.xhx.module.record.service.PrintWaitQueueService;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* PrintWaitQueueService * PrintWaitQueueService
...@@ -68,6 +68,8 @@ public class PrintWaitQueueServiceImpl extends AbstractCRUDServiceImpl<PrintWait ...@@ -68,6 +68,8 @@ public class PrintWaitQueueServiceImpl extends AbstractCRUDServiceImpl<PrintWait
private PrintServiceService printServiceService; private PrintServiceService printServiceService;
@Autowired @Autowired
private PrintCatalogService printCatalogService; private PrintCatalogService printCatalogService;
@Autowired
private CertificateCatalogTemplateService certificateCatalogTemplateService;
@Override @Override
protected void findAfter(PrintWaitQueueEntity entity, Context context, List<PrintWaitQueueEntity> list) throws AppException { protected void findAfter(PrintWaitQueueEntity entity, Context context, List<PrintWaitQueueEntity> list) throws AppException {
...@@ -85,17 +87,19 @@ public class PrintWaitQueueServiceImpl extends AbstractCRUDServiceImpl<PrintWait ...@@ -85,17 +87,19 @@ public class PrintWaitQueueServiceImpl extends AbstractCRUDServiceImpl<PrintWait
printWaitQueueEntity.setPrinterIp(printCatalogEntity.getPrinterIp()); printWaitQueueEntity.setPrinterIp(printCatalogEntity.getPrinterIp());
printWaitQueueEntity.setPrinterName(printCatalogEntity.getPrinterName()); printWaitQueueEntity.setPrinterName(printCatalogEntity.getPrinterName());
}else { }else {
CertificateCatalogEntity catalogEntity = certificateCatalogService.get(printWaitQueueEntity.getCatalogId()); //CertificateCatalogEntity catalogEntity = certificateCatalogService.get(printWaitQueueEntity.getCatalogId());
printWaitQueueEntity.setPaperSource(catalogEntity.getPaperSource()); CertificateCatalogTemplateEntity templateEntity = certificateCatalogTemplateService.get(printWaitQueueEntity.getTemplateId());
printWaitQueueEntity.setPrinterIp(catalogEntity.getPrinterIp()); printWaitQueueEntity.setPaperSource(templateEntity.getPaperSource());
printWaitQueueEntity.setPrinterName(catalogEntity.getPrinterName()); printWaitQueueEntity.setPrinterIp(templateEntity.getPrinterIp());
printWaitQueueEntity.setPrinterName(templateEntity.getPrinterName());
} }
printWaitQueueEntity.setPrinterServiceUrl(printServiceEntity.getServiceUrl()); printWaitQueueEntity.setPrinterServiceUrl(printServiceEntity.getServiceUrl());
}else { }else {
CertificateCatalogEntity catalogEntity = certificateCatalogService.get(printWaitQueueEntity.getCatalogId()); //CertificateCatalogEntity catalogEntity = certificateCatalogService.get(printWaitQueueEntity.getCatalogId());
printWaitQueueEntity.setPaperSource(catalogEntity.getPaperSource()); CertificateCatalogTemplateEntity templateEntity = certificateCatalogTemplateService.get(printWaitQueueEntity.getTemplateId());
printWaitQueueEntity.setPrinterIp(catalogEntity.getPrinterIp()); printWaitQueueEntity.setPaperSource(templateEntity.getPaperSource());
printWaitQueueEntity.setPrinterName(catalogEntity.getPrinterName()); printWaitQueueEntity.setPrinterIp(templateEntity.getPrinterIp());
printWaitQueueEntity.setPrinterName(templateEntity.getPrinterName());
printWaitQueueEntity.setPrinterServiceUrl("http://127.0.0.1:8037"); printWaitQueueEntity.setPrinterServiceUrl("http://127.0.0.1:8037");
} }
} }
...@@ -122,6 +126,8 @@ public class PrintWaitQueueServiceImpl extends AbstractCRUDServiceImpl<PrintWait ...@@ -122,6 +126,8 @@ public class PrintWaitQueueServiceImpl extends AbstractCRUDServiceImpl<PrintWait
waitQueueEntity.setCatalogId(applyLogEntity.getCatalogId()); waitQueueEntity.setCatalogId(applyLogEntity.getCatalogId());
waitQueueEntity.setCatalogCode(applyLogEntity.getCatalogCode()); waitQueueEntity.setCatalogCode(applyLogEntity.getCatalogCode());
waitQueueEntity.setCatalogName(applyLogEntity.getCatalogName()); waitQueueEntity.setCatalogName(applyLogEntity.getCatalogName());
waitQueueEntity.setTemplateId(applyLogEntity.getTemplateId());
waitQueueEntity.setTemplateName(applyLogEntity.getTemplateName());
waitQueueEntity.setCertificateName(applyLogEntity.getCertificateName()); waitQueueEntity.setCertificateName(applyLogEntity.getCertificateName());
waitQueueEntity.setCertificateCode(applyLogEntity.getCertificateCode()); waitQueueEntity.setCertificateCode(applyLogEntity.getCertificateCode());
waitQueueEntity.setEnterpriseName(applyLogEntity.getEnterpriseName()); waitQueueEntity.setEnterpriseName(applyLogEntity.getEnterpriseName());
...@@ -170,6 +176,8 @@ public class PrintWaitQueueServiceImpl extends AbstractCRUDServiceImpl<PrintWait ...@@ -170,6 +176,8 @@ public class PrintWaitQueueServiceImpl extends AbstractCRUDServiceImpl<PrintWait
printLogEntity.setCatalogId(waitQueueEntity.getCatalogId()); printLogEntity.setCatalogId(waitQueueEntity.getCatalogId());
printLogEntity.setCatalogCode(waitQueueEntity.getCatalogCode()); printLogEntity.setCatalogCode(waitQueueEntity.getCatalogCode());
printLogEntity.setCatalogName(waitQueueEntity.getCatalogName()); printLogEntity.setCatalogName(waitQueueEntity.getCatalogName());
printLogEntity.setTemplateId(waitQueueEntity.getTemplateId());
printLogEntity.setTemplateName(waitQueueEntity.getTemplateName());
printLogEntity.setCertificateName(waitQueueEntity.getCertificateName()); printLogEntity.setCertificateName(waitQueueEntity.getCertificateName());
printLogEntity.setCertificateCode(waitQueueEntity.getCertificateCode()); printLogEntity.setCertificateCode(waitQueueEntity.getCertificateCode());
printLogEntity.setEnterpriseName(waitQueueEntity.getEnterpriseName()); printLogEntity.setEnterpriseName(waitQueueEntity.getEnterpriseName());
...@@ -193,6 +201,8 @@ public class PrintWaitQueueServiceImpl extends AbstractCRUDServiceImpl<PrintWait ...@@ -193,6 +201,8 @@ public class PrintWaitQueueServiceImpl extends AbstractCRUDServiceImpl<PrintWait
retainLogEntity.setCatalogId(waitQueueEntity.getCatalogId()); retainLogEntity.setCatalogId(waitQueueEntity.getCatalogId());
retainLogEntity.setCatalogCode(waitQueueEntity.getCatalogCode()); retainLogEntity.setCatalogCode(waitQueueEntity.getCatalogCode());
retainLogEntity.setCatalogName(waitQueueEntity.getCatalogName()); retainLogEntity.setCatalogName(waitQueueEntity.getCatalogName());
retainLogEntity.setTemplateId(waitQueueEntity.getTemplateId());
retainLogEntity.setTemplateName(waitQueueEntity.getTemplateName());
retainLogEntity.setCertificateName(waitQueueEntity.getCertificateName()); retainLogEntity.setCertificateName(waitQueueEntity.getCertificateName());
retainLogEntity.setCertificateCode(waitQueueEntity.getCertificateCode()); retainLogEntity.setCertificateCode(waitQueueEntity.getCertificateCode());
retainLogEntity.setEnterpriseName(waitQueueEntity.getEnterpriseName()); retainLogEntity.setEnterpriseName(waitQueueEntity.getEnterpriseName());
...@@ -207,6 +217,8 @@ public class PrintWaitQueueServiceImpl extends AbstractCRUDServiceImpl<PrintWait ...@@ -207,6 +217,8 @@ public class PrintWaitQueueServiceImpl extends AbstractCRUDServiceImpl<PrintWait
printLogEntity.setCatalogId(waitQueueEntity.getCatalogId()); printLogEntity.setCatalogId(waitQueueEntity.getCatalogId());
printLogEntity.setCatalogCode(waitQueueEntity.getCatalogCode()); printLogEntity.setCatalogCode(waitQueueEntity.getCatalogCode());
printLogEntity.setCatalogName(waitQueueEntity.getCatalogName()); printLogEntity.setCatalogName(waitQueueEntity.getCatalogName());
printLogEntity.setTemplateId(waitQueueEntity.getTemplateId());
printLogEntity.setTemplateName(waitQueueEntity.getTemplateName());
printLogEntity.setCertificateName(waitQueueEntity.getCertificateName()); printLogEntity.setCertificateName(waitQueueEntity.getCertificateName());
printLogEntity.setCertificateCode(waitQueueEntity.getCertificateCode()); printLogEntity.setCertificateCode(waitQueueEntity.getCertificateCode());
printLogEntity.setEnterpriseName(waitQueueEntity.getEnterpriseName()); printLogEntity.setEnterpriseName(waitQueueEntity.getEnterpriseName());
......
package com.mortals.xhx.module.record.service.impl; package com.mortals.xhx.module.record.service.impl;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; 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.dao.RecordDao;
import com.mortals.xhx.module.record.model.RecordEntity; import com.mortals.xhx.module.record.model.RecordEntity;
import com.mortals.xhx.module.record.service.RecordService; import com.mortals.xhx.module.record.service.RecordService;
import org.springframework.stereotype.Service;
/** /**
* RecordService * RecordService
* 证照申请 service实现 * 证照申请 service实现
......
...@@ -136,7 +136,7 @@ public class ApplyLogController extends BaseCRUDJsonBodyMappingController<ApplyL ...@@ -136,7 +136,7 @@ public class ApplyLogController extends BaseCRUDJsonBodyMappingController<ApplyL
} }
@PostMapping({"/import"}) @PostMapping({"/import"})
public String importFile(MultipartFile file, Long catalogId) { public String importFile(MultipartFile file, Long catalogId,Long templateId) {
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
Map<String, Object> model = new HashMap(); Map<String, Object> model = new HashMap();
Context context = this.getContext(); Context context = this.getContext();
...@@ -147,7 +147,7 @@ public class ApplyLogController extends BaseCRUDJsonBodyMappingController<ApplyL ...@@ -147,7 +147,7 @@ public class ApplyLogController extends BaseCRUDJsonBodyMappingController<ApplyL
List<Map<Integer, Object>> returnList = ImportExcelUtil.readExcelContent(fileName,file.getInputStream(),1,null,null); List<Map<Integer, Object>> returnList = ImportExcelUtil.readExcelContent(fileName,file.getInputStream(),1,null,null);
Map<String, PictureData> pictureDataMap = ReadExcelPictureUtil.readExcelPictureMap(file); Map<String, PictureData> pictureDataMap = ReadExcelPictureUtil.readExcelPictureMap(file);
Map<String,String> fileMap = ReadExcelPictureUtil.savePicture(this.filePath,pictureDataMap); 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); model.put("message_info", message);
this.recordSysLog(this.request, busiDesc + " 【成功】"); this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var13) { } catch (Exception var13) {
......
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