Commit a6ede68e authored by 廖旭伟's avatar 廖旭伟

同步宜宾版本功能,增加食品经营许可证同时生成正副本

parent e12461ed
...@@ -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,8 +65,15 @@ public class CertificateApi extends BaseJsonBodyController { ...@@ -60,8 +65,15 @@ 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){
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()); 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"); JSONArray formList = formContent.getJSONArray("list");
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
for (int j = 0; j < formList.size(); j++) { for (int j = 0; j < formList.size(); j++) {
...@@ -72,6 +84,9 @@ public class CertificateApi extends BaseJsonBodyController { ...@@ -72,6 +84,9 @@ public class CertificateApi extends BaseJsonBodyController {
catalogList.add(catalogVO); catalogList.add(catalogVO);
} }
}
}
model.put("message_info", "获取证照目录成功"); model.put("message_info", "获取证照目录成功");
ret.put("data", catalogList); ret.put("data", catalogList);
}else { }else {
...@@ -207,11 +222,13 @@ public class CertificateApi extends BaseJsonBodyController { ...@@ -207,11 +222,13 @@ 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());
printWaitQueueVO.setCatalogName(printWaitQueueEntity.getCatalogName()); printWaitQueueVO.setCatalogName(printWaitQueueEntity.getCatalogName());
printWaitQueueVO.setTemplateId(printWaitQueueEntity.getTemplateId());
printWaitQueueVO.setTemplateName(printWaitQueueEntity.getTemplateName());
printWaitQueueVO.setWaitQueueId(printWaitQueueEntity.getId()); printWaitQueueVO.setWaitQueueId(printWaitQueueEntity.getId());
printWaitQueueVO.setCertificateCode(printWaitQueueEntity.getCertificateCode()); printWaitQueueVO.setCertificateCode(printWaitQueueEntity.getCertificateCode());
printWaitQueueVO.setCertificateName(printWaitQueueEntity.getCertificateName()); printWaitQueueVO.setCertificateName(printWaitQueueEntity.getCertificateName());
...@@ -226,6 +243,7 @@ public class CertificateApi extends BaseJsonBodyController { ...@@ -226,6 +243,7 @@ public class CertificateApi extends BaseJsonBodyController {
printWaitQueueVO.setPrinterIp(printCatalogEntity.getPrinterIp()); printWaitQueueVO.setPrinterIp(printCatalogEntity.getPrinterIp());
printWaitQueueVO.setPrinterName(printCatalogEntity.getPrinterName()); printWaitQueueVO.setPrinterName(printCatalogEntity.getPrinterName());
printWaitQueueVO.setPaperSource(printCatalogEntity.getPaperSource()); printWaitQueueVO.setPaperSource(printCatalogEntity.getPaperSource());
printWaitQueueVO.setMobile(printWaitQueueEntity.getMobile());
waitQueueVOList.add(printWaitQueueVO); waitQueueVOList.add(printWaitQueueVO);
} }
model.put("data", waitQueueVOList); model.put("data", waitQueueVOList);
......
...@@ -18,6 +18,14 @@ public class PrintWaitQueueVO { ...@@ -18,6 +18,14 @@ public class PrintWaitQueueVO {
* 目录名称 * 目录名称
*/ */
private String catalogName; private String catalogName;
/**
* 证照目录模板ID
*/
private Long templateId;
/**
* 证照模板名称
*/
private String templateName;
/** /**
* 证照名称 * 证照名称
*/ */
...@@ -70,4 +78,9 @@ public class PrintWaitQueueVO { ...@@ -70,4 +78,9 @@ public class PrintWaitQueueVO {
* 打印机纸盒 * 打印机纸盒
*/ */
private String paperSource; private String paperSource;
/**
* 手机号码
*/
private String mobile;
} }
...@@ -10,7 +10,7 @@ import com.mortals.xhx.module.business.model.vo.BusinessLicenseVo; ...@@ -10,7 +10,7 @@ import com.mortals.xhx.module.business.model.vo.BusinessLicenseVo;
* 营业执照信息实体对象 * 营业执照信息实体对象
* *
* @author zxfei * @author zxfei
* @date 2022-12-13 * @date 2023-05-14
*/ */
public class BusinessLicenseEntity extends BusinessLicenseVo { public class BusinessLicenseEntity extends BusinessLicenseVo {
...@@ -92,6 +92,10 @@ public class BusinessLicenseEntity extends BusinessLicenseVo { ...@@ -92,6 +92,10 @@ public class BusinessLicenseEntity extends BusinessLicenseVo {
* 处理状态0未处理1已处理 * 处理状态0未处理1已处理
*/ */
private Integer status; private Integer status;
/**
* 站点id
*/
private Long siteId;
...@@ -362,6 +366,20 @@ public class BusinessLicenseEntity extends BusinessLicenseVo { ...@@ -362,6 +366,20 @@ public class BusinessLicenseEntity extends BusinessLicenseVo {
public void setStatus(Integer status){ public void setStatus(Integer status){
this.status = status; this.status = status;
} }
/**
* 获取 站点id
* @return Long
*/
public Long getSiteId(){
return siteId;
}
/**
* 设置 站点id
* @param siteId
*/
public void setSiteId(Long siteId){
this.siteId = siteId;
}
...@@ -403,6 +421,7 @@ public class BusinessLicenseEntity extends BusinessLicenseVo { ...@@ -403,6 +421,7 @@ public class BusinessLicenseEntity extends BusinessLicenseVo {
sb.append(",dyZb:").append(getDyZb()); sb.append(",dyZb:").append(getDyZb());
sb.append(",dyFb:").append(getDyFb()); sb.append(",dyFb:").append(getDyFb());
sb.append(",status:").append(getStatus()); sb.append(",status:").append(getStatus());
sb.append(",siteId:").append(getSiteId());
return sb.toString(); return sb.toString();
} }
...@@ -440,10 +459,12 @@ public class BusinessLicenseEntity extends BusinessLicenseVo { ...@@ -440,10 +459,12 @@ public class BusinessLicenseEntity extends BusinessLicenseVo {
this.EndDate = ""; this.EndDate = "";
this.dyZb = 2; this.dyZb = null;
this.dyFb = null;
this.dyFb = 2; this.status = null;
this.status = 0; this.siteId = null;
} }
} }
\ No newline at end of file
...@@ -61,7 +61,7 @@ public class BusinessLicenseController extends BaseCRUDJsonBodyMappingController ...@@ -61,7 +61,7 @@ public class BusinessLicenseController extends BaseCRUDJsonBodyMappingController
String busiDesc = "API接口存入营业执照信息"; String busiDesc = "API接口存入营业执照信息";
int code = 200; int code = 200;
try { try {
service.apiSave(businessLicense); service.doConversion(businessLicense);
model.put("message_info", "成功"); model.put("message_info", "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】"); this.recordSysLog(this.request, busiDesc + " 【成功】");
}catch (Exception e){ }catch (Exception e){
......
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;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.certificate.model.DeviceClassifyEntity;
import java.util.List;
/**
* 证照分类设备配置Dao
* 证照分类设备配置 DAO接口
*
* @author zxfei
* @date 2023-05-09
*/
public interface DeviceClassifyDao extends ICRUDDao<DeviceClassifyEntity,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.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.certificate.dao.DeviceClassifyDao;
import com.mortals.xhx.module.certificate.model.DeviceClassifyEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 证照分类设备配置DaoImpl DAO接口
*
* @author zxfei
* @date 2023-05-09
*/
@Repository("deviceClassifyDao")
public class DeviceClassifyDaoImpl extends BaseCRUDDaoMybatis<DeviceClassifyEntity,Long> implements DeviceClassifyDao {
}
package com.mortals.xhx.module.certificate.model; package com.mortals.xhx.module.certificate.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.certificate.model.vo.CertificateCatalogVo; import com.mortals.xhx.module.certificate.model.vo.CertificateCatalogVo;
import lombok.Data;
/** /**
* 证照目录实体对象 * 证照目录实体对象
* *
* @author zxfei * @author zxfei
* @date 2022-11-08 * @date 2023-05-24
*/ */
@Data
public class CertificateCatalogEntity extends CertificateCatalogVo { public class CertificateCatalogEntity extends CertificateCatalogVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* 站点id
*/
private Long siteId;
/** /**
* 目录名称 * 目录名称
*/ */
...@@ -48,313 +52,10 @@ public class CertificateCatalogEntity extends CertificateCatalogVo { ...@@ -48,313 +52,10 @@ public class CertificateCatalogEntity extends CertificateCatalogVo {
* 是否需要年检,0:否1:是 * 是否需要年检,0:否1:是
*/ */
private Integer inspect; private Integer inspect;
/**
* 证照模板文件名称
*/
private String templateName;
/**
* 证照模板文件地址
*/
private String templateUrl;
/**
* 证照模板表单内容
*/
private String formContent;
/**
* 证照示例图地址
*/
private String exampleUrl;
/** /**
* 证照状态,0:禁用1:启用 * 证照状态,0:禁用1:启用
*/ */
private Integer status; private Integer status;
/**
* 打印机名称
*/
private String printerName;
/**
* 打印机网络地址
*/
private String printerIp;
/**
* 打印机纸盒
*/
private String paperSource;
/**
* 打印设备Id
*/
private Long deviceId;
/**
* 批量导入模板文件地址
*/
private String excelFile;
private Integer isPdf;
public CertificateCatalogEntity(){}
/**
* 获取 目录名称
* @return String
*/
public String getCatalogName(){
return catalogName;
}
/**
* 设置 目录名称
* @param catalogName
*/
public void setCatalogName(String catalogName){
this.catalogName = catalogName;
}
/**
* 获取 目录编号
* @return String
*/
public String getCatalogCode(){
return catalogCode;
}
/**
* 设置 目录编号
* @param catalogCode
*/
public void setCatalogCode(String catalogCode){
this.catalogCode = catalogCode;
}
/**
* 获取 持有者类型,1:自然人;2:法人;3:自然人,法人
* @return Integer
*/
public Integer getHolderType(){
return holderType;
}
/**
* 设置 持有者类型,1:自然人;2:法人;3:自然人,法人
* @param holderType
*/
public void setHolderType(Integer holderType){
this.holderType = holderType;
}
/**
* 获取 所属行业
* @return Long
*/
public Long getIndustryId(){
return industryId;
}
/**
* 设置 所属行业
* @param industryId
*/
public void setIndustryId(Long industryId){
this.industryId = industryId;
}
/**
* 获取 所属分类
* @return Long
*/
public Long getClassifyId(){
return classifyId;
}
/**
* 设置 所属分类
* @param classifyId
*/
public void setClassifyId(Long classifyId){
this.classifyId = classifyId;
}
/**
* 获取 横向尺寸(单位mm)
* @return Integer
*/
public Integer getTransverse(){
return transverse;
}
/**
* 设置 横向尺寸(单位mm)
* @param transverse
*/
public void setTransverse(Integer transverse){
this.transverse = transverse;
}
/**
* 获取 纵向尺寸(单位mm)
* @return Integer
*/
public Integer getPortrait(){
return portrait;
}
/**
* 设置 纵向尺寸(单位mm)
* @param portrait
*/
public void setPortrait(Integer portrait){
this.portrait = portrait;
}
/**
* 获取 是否需要年检,0:否1:是
* @return Integer
*/
public Integer getInspect(){
return inspect;
}
/**
* 设置 是否需要年检,0:否1:是
* @param inspect
*/
public void setInspect(Integer inspect){
this.inspect = inspect;
}
/**
* 获取 证照模板文件名称
* @return String
*/
public String getTemplateName(){
return templateName;
}
/**
* 设置 证照模板文件名称
* @param templateName
*/
public void setTemplateName(String templateName){
this.templateName = templateName;
}
/**
* 获取 证照模板文件地址
* @return String
*/
public String getTemplateUrl(){
return templateUrl;
}
/**
* 设置 证照模板文件地址
* @param templateUrl
*/
public void setTemplateUrl(String templateUrl){
this.templateUrl = templateUrl;
}
/**
* 获取 证照模板表单内容
* @return String
*/
public String getFormContent(){
return formContent;
}
/**
* 设置 证照模板表单内容
* @param formContent
*/
public void setFormContent(String formContent){
this.formContent = formContent;
}
/**
* 获取 证照示例图地址
* @return String
*/
public String getExampleUrl(){
return exampleUrl;
}
/**
* 设置 证照示例图地址
* @param exampleUrl
*/
public void setExampleUrl(String exampleUrl){
this.exampleUrl = exampleUrl;
}
/**
* 获取 证照状态,0:禁用1:启用
* @return Integer
*/
public Integer getStatus(){
return status;
}
/**
* 设置 证照状态,0:禁用1:启用
* @param status
*/
public void setStatus(Integer status){
this.status = status;
}
/**
* 获取 打印机名称
* @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 getDeviceId(){
return deviceId;
}
/**
* 设置 打印设备Id
* @param deviceId
*/
public void setDeviceId(Long deviceId){
this.deviceId = deviceId;
}
/**
* 获取 批量导入模板文件地址
* @return String
*/
public String getExcelFile(){
return excelFile;
}
/**
* 设置 批量导入模板文件地址
* @param excelFile
*/
public void setExcelFile(String excelFile){
this.excelFile = excelFile;
}
public Integer getIsPdf() {
return isPdf;
}
public void setIsPdf(Integer isPdf) {
this.isPdf = isPdf;
}
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
...@@ -371,40 +72,19 @@ public class CertificateCatalogEntity extends CertificateCatalogVo { ...@@ -371,40 +72,19 @@ public class CertificateCatalogEntity extends CertificateCatalogVo {
return false; return false;
} }
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",catalogName:").append(getCatalogName());
sb.append(",catalogCode:").append(getCatalogCode());
sb.append(",holderType:").append(getHolderType());
sb.append(",industryId:").append(getIndustryId());
sb.append(",classifyId:").append(getClassifyId());
sb.append(",transverse:").append(getTransverse());
sb.append(",portrait:").append(getPortrait());
sb.append(",inspect:").append(getInspect());
sb.append(",templateName:").append(getTemplateName());
sb.append(",templateUrl:").append(getTemplateUrl());
sb.append(",formContent:").append(getFormContent());
sb.append(",exampleUrl:").append(getExampleUrl());
sb.append(",status:").append(getStatus());
sb.append(",printerName:").append(getPrinterName());
sb.append(",printerIp:").append(getPrinterIp());
sb.append(",paperSource:").append(getPaperSource());
sb.append(",deviceId:").append(getDeviceId());
sb.append(",excelFile:").append(getExcelFile());
return sb.toString();
}
public void initAttrValue(){ public void initAttrValue(){
this.siteId = -1L;
this.catalogName = ""; this.catalogName = "";
this.catalogCode = ""; this.catalogCode = "";
this.holderType = 1; this.holderType = 1;
this.industryId = null; this.industryId = -1L;
this.classifyId = null; this.classifyId = -1L;
this.transverse = 0; this.transverse = 0;
...@@ -412,24 +92,6 @@ public class CertificateCatalogEntity extends CertificateCatalogVo { ...@@ -412,24 +92,6 @@ public class CertificateCatalogEntity extends CertificateCatalogVo {
this.inspect = 0; this.inspect = 0;
this.templateName = "";
this.templateUrl = "";
this.formContent = "";
this.exampleUrl = "";
this.status = 1; this.status = 1;
this.printerName = "";
this.printerIp = "";
this.paperSource = "";
this.deviceId = null;
this.excelFile = "";
} }
} }
\ No newline at end of file
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
...@@ -7,11 +7,11 @@ import com.mortals.framework.annotation.Excel; ...@@ -7,11 +7,11 @@ import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.certificate.model.vo.CertificateClassifyVo; import com.mortals.xhx.module.certificate.model.vo.CertificateClassifyVo;
/** /**
* 证照分类实体对象 * 证照分类实体对象
* *
* @author zxfei * @author zxfei
* @date 2022-11-04 * @date 2023-05-14
*/ */
public class CertificateClassifyEntity extends CertificateClassifyVo { public class CertificateClassifyEntity extends CertificateClassifyVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -36,6 +36,10 @@ public class CertificateClassifyEntity extends CertificateClassifyVo { ...@@ -36,6 +36,10 @@ public class CertificateClassifyEntity extends CertificateClassifyVo {
* 证照类型,1:普通,2:正副本 * 证照类型,1:普通,2:正副本
*/ */
private Integer classifyType; private Integer classifyType;
/**
* 站点id
*/
private Long siteId;
...@@ -110,6 +114,20 @@ public class CertificateClassifyEntity extends CertificateClassifyVo { ...@@ -110,6 +114,20 @@ public class CertificateClassifyEntity extends CertificateClassifyVo {
public void setClassifyType(Integer classifyType){ public void setClassifyType(Integer classifyType){
this.classifyType = classifyType; this.classifyType = classifyType;
} }
/**
* 获取 站点id
* @return Long
*/
public Long getSiteId(){
return siteId;
}
/**
* 设置 站点id
* @param siteId
*/
public void setSiteId(Long siteId){
this.siteId = siteId;
}
...@@ -137,6 +155,7 @@ public class CertificateClassifyEntity extends CertificateClassifyVo { ...@@ -137,6 +155,7 @@ public class CertificateClassifyEntity extends CertificateClassifyVo {
sb.append(",total:").append(getTotal()); sb.append(",total:").append(getTotal());
sb.append(",showFront:").append(getShowFront()); sb.append(",showFront:").append(getShowFront());
sb.append(",classifyType:").append(getClassifyType()); sb.append(",classifyType:").append(getClassifyType());
sb.append(",siteId:").append(getSiteId());
return sb.toString(); return sb.toString();
} }
...@@ -151,5 +170,7 @@ public class CertificateClassifyEntity extends CertificateClassifyVo { ...@@ -151,5 +170,7 @@ public class CertificateClassifyEntity extends CertificateClassifyVo {
this.showFront = 0; this.showFront = 0;
this.classifyType = 1; this.classifyType = 1;
this.siteId = null;
} }
} }
\ No newline at end of file
...@@ -7,11 +7,11 @@ import com.mortals.framework.annotation.Excel; ...@@ -7,11 +7,11 @@ import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.certificate.model.vo.CertificateIndustryVo; import com.mortals.xhx.module.certificate.model.vo.CertificateIndustryVo;
/** /**
* 行业目录实体对象 * 行业目录实体对象
* *
* @author zxfei * @author zxfei
* @date 2022-11-04 * @date 2023-05-14
*/ */
public class CertificateIndustryEntity extends CertificateIndustryVo { public class CertificateIndustryEntity extends CertificateIndustryVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -24,6 +24,10 @@ public class CertificateIndustryEntity extends CertificateIndustryVo { ...@@ -24,6 +24,10 @@ public class CertificateIndustryEntity extends CertificateIndustryVo {
* 行业名称 * 行业名称
*/ */
private String industryName; private String industryName;
/**
* 站点id
*/
private Long siteId;
...@@ -56,6 +60,20 @@ public class CertificateIndustryEntity extends CertificateIndustryVo { ...@@ -56,6 +60,20 @@ public class CertificateIndustryEntity extends CertificateIndustryVo {
public void setIndustryName(String industryName){ public void setIndustryName(String industryName){
this.industryName = industryName; this.industryName = industryName;
} }
/**
* 获取 站点id
* @return Long
*/
public Long getSiteId(){
return siteId;
}
/**
* 设置 站点id
* @param siteId
*/
public void setSiteId(Long siteId){
this.siteId = siteId;
}
...@@ -80,6 +98,7 @@ public class CertificateIndustryEntity extends CertificateIndustryVo { ...@@ -80,6 +98,7 @@ public class CertificateIndustryEntity extends CertificateIndustryVo {
StringBuilder sb = new StringBuilder(""); StringBuilder sb = new StringBuilder("");
sb.append(",parentId:").append(getParentId()); sb.append(",parentId:").append(getParentId());
sb.append(",industryName:").append(getIndustryName()); sb.append(",industryName:").append(getIndustryName());
sb.append(",siteId:").append(getSiteId());
return sb.toString(); return sb.toString();
} }
...@@ -88,5 +107,7 @@ public class CertificateIndustryEntity extends CertificateIndustryVo { ...@@ -88,5 +107,7 @@ public class CertificateIndustryEntity extends CertificateIndustryVo {
this.parentId = null; this.parentId = null;
this.industryName = ""; this.industryName = "";
this.siteId = null;
} }
} }
\ No newline at end of file
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.DeviceClassifyVo;
/**
* 证照分类设备配置实体对象
*
* @author zxfei
* @date 2023-05-14
*/
public class DeviceClassifyEntity extends DeviceClassifyVo {
private static final long serialVersionUID = 1L;
/**
* 设备编码
*/
private String deviceCode;
/**
* 设备名称
*/
private String deviceName;
/**
* 设备允许显示的分类
*/
private String classifyIds;
/**
* 站点id
*/
private Long siteId;
public DeviceClassifyEntity(){}
/**
* 获取 设备编码
* @return String
*/
public String getDeviceCode(){
return deviceCode;
}
/**
* 设置 设备编码
* @param deviceCode
*/
public void setDeviceCode(String deviceCode){
this.deviceCode = deviceCode;
}
/**
* 获取 设备名称
* @return String
*/
public String getDeviceName(){
return deviceName;
}
/**
* 设置 设备名称
* @param deviceName
*/
public void setDeviceName(String deviceName){
this.deviceName = deviceName;
}
/**
* 获取 设备允许显示的分类
* @return String
*/
public String getClassifyIds(){
return classifyIds;
}
/**
* 设置 设备允许显示的分类
* @param classifyIds
*/
public void setClassifyIds(String classifyIds){
this.classifyIds = classifyIds;
}
/**
* 获取 站点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();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof DeviceClassifyEntity) {
DeviceClassifyEntity tmp = (DeviceClassifyEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",deviceCode:").append(getDeviceCode());
sb.append(",deviceName:").append(getDeviceName());
sb.append(",classifyIds:").append(getClassifyIds());
sb.append(",siteId:").append(getSiteId());
return sb.toString();
}
public void initAttrValue(){
this.deviceCode = "";
this.deviceName = "";
this.classifyIds = "";
this.siteId = null;
}
}
\ 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
package com.mortals.xhx.module.certificate.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.certificate.model.DeviceClassifyEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
/**
* 证照分类设备配置视图对象
*
* @author zxfei
* @date 2023-05-09
*/
@Data
public class DeviceClassifyVo extends BaseEntityLong {
private String classifyNames;
}
\ 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;
/** /**
* 证件编号 * 证件编号
*/ */
...@@ -58,4 +60,6 @@ public class ApplyLogPdu { ...@@ -58,4 +60,6 @@ public class ApplyLogPdu {
* 证照模板正本表单内容 * 证照模板正本表单内容
*/ */
private String formContent; private String formContent;
/** 站点id */
private Long siteId;
} }
...@@ -11,4 +11,6 @@ public class PrintListPdu { ...@@ -11,4 +11,6 @@ public class PrintListPdu {
/** 打印服务ID */ /** 打印服务ID */
private Long serviceId; private Long serviceId;
private Long siteId;
} }
...@@ -12,4 +12,6 @@ public class PrintSettingPdu { ...@@ -12,4 +12,6 @@ public class PrintSettingPdu {
private List<Long> hideList; private List<Long> hideList;
/** 允许打印最高次数 */ /** 允许打印最高次数 */
private Integer printMax; private Integer printMax;
private Long siteId;
} }
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;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.certificate.model.DeviceClassifyEntity;
import java.util.List;
/**
* DeviceClassifyService
*
* 证照分类设备配置 service接口
*
* @author zxfei
* @date 2023-05-09
*/
public interface DeviceClassifyService extends ICRUDService<DeviceClassifyEntity,Long>{
/**
* 获取设备允许打印目录分类
* @param deviceNum
* @return
*/
List<Long> getClassifyByDevice(String deviceNum);
}
\ 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.service.impl;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.module.certificate.model.CertificateClassifyEntity;
import com.mortals.xhx.module.certificate.model.CertificateClassifyQuery;
import com.mortals.xhx.module.certificate.service.CertificateClassifyService;
import org.apache.commons.collections4.CollectionUtils;
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.xhx.module.certificate.dao.DeviceClassifyDao;
import com.mortals.xhx.module.certificate.model.DeviceClassifyEntity;
import com.mortals.xhx.module.certificate.service.DeviceClassifyService;
import java.util.ArrayList;
import java.util.List;
/**
* DeviceClassifyService
* 证照分类设备配置 service实现
*
* @author zxfei
* @date 2023-05-09
*/
@Service("deviceClassifyService")
public class DeviceClassifyServiceImpl extends AbstractCRUDServiceImpl<DeviceClassifyDao, DeviceClassifyEntity, Long> implements DeviceClassifyService {
@Autowired
private CertificateClassifyService certificateClassifyService;
@Override
protected void findAfter(DeviceClassifyEntity params, Context context, List<DeviceClassifyEntity> list) throws AppException {
if(CollectionUtils.isNotEmpty(list)){
for (DeviceClassifyEntity item:list){
if(StringUtils.isNotEmpty(item.getClassifyIds())){
List<Long> longList = new ArrayList<>();
for(String id : item.getClassifyIds().split(",")){
longList.add(DataUtil.converStr2Long(id,0l));
}
List<CertificateClassifyEntity> classifyEntityList = certificateClassifyService.find(new CertificateClassifyQuery().idList(longList));
if(CollectionUtils.isNotEmpty(classifyEntityList)){
String classifyNames ="";
for(CertificateClassifyEntity classifyEntity:classifyEntityList){
classifyNames+=classifyEntity.getClassifyName()+",";
}
if(classifyNames.endsWith(",")){
classifyNames=classifyNames.substring(0,(classifyNames.length()-1));
}
item.setClassifyNames(classifyNames);
}
}
}
}
}
@Override
protected void findAfter(DeviceClassifyEntity params, PageInfo pageInfo, Context context, List<DeviceClassifyEntity> list) throws AppException {
if(CollectionUtils.isNotEmpty(list)){
for (DeviceClassifyEntity item:list){
if(StringUtils.isNotEmpty(item.getClassifyIds())){
List<Long> longList = new ArrayList<>();
for(String id : item.getClassifyIds().split(",")){
longList.add(DataUtil.converStr2Long(id,0l));
}
List<CertificateClassifyEntity> classifyEntityList = certificateClassifyService.find(new CertificateClassifyQuery().idList(longList));
if(CollectionUtils.isNotEmpty(classifyEntityList)){
String classifyNames ="";
for(CertificateClassifyEntity classifyEntity:classifyEntityList){
classifyNames+=classifyEntity.getClassifyName()+",";
}
if(classifyNames.endsWith(",")){
classifyNames=classifyNames.substring(0,(classifyNames.length()-1));
}
item.setClassifyNames(classifyNames);
}
}
}
}
}
@Override
public List<Long> getClassifyByDevice(String deviceNum) {
DeviceClassifyEntity query = new DeviceClassifyEntity();
query.setDeviceCode(deviceNum);
DeviceClassifyEntity deviceClassifyEntity = this.selectOne(query);
if(deviceClassifyEntity!=null){
if(StringUtils.isNotEmpty(deviceClassifyEntity.getClassifyIds())){
List<Long> classifyIdList = new ArrayList<>();
String[] ids = deviceClassifyEntity.getClassifyIds().split(",");
for (String id:ids){
classifyIdList.add(DataUtil.converStr2Long(id,0l));
}
return classifyIdList;
}
}
return null;
}
}
\ 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
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