Commit 72852fec authored by 廖旭伟's avatar 廖旭伟

打印服务配置功能,API新加接口

parent b4a28fa7
This diff is collapsed.
package com.mortals.xhx.module.api;
import lombok.Data;
@Data
public class PrintCatalogVO {
/**
* 打印机名称
*/
private String printerName;
/**
* 打印机网络地址
*/
private String printerIp;
/**
* 打印机纸盒
*/
private String paperSource;
public PrintCatalogVO(String printerName, String printerIp, String paperSource) {
this.printerName = printerName;
this.printerIp = printerIp;
this.paperSource = paperSource;
}
}
package com.mortals.xhx.module.api;
import lombok.Data;
@Data
public class PrintServicePdu {
/**
* 证照目录ID
*/
private Long catalogId;
/**
* 打印服务配置ID
*/
private Long serviceId;
}
package com.mortals.xhx.module.api;
import lombok.Data;
@Data
public class PrintServiceVO {
/**
* 主键
*/
private Long id;
/**
* 配置名称
*/
private String serviceName;
/**
* 服务访问地址
*/
private String serviceUrl;
public PrintServiceVO(Long id, String serviceName, String serviceUrl) {
this.id = id;
this.serviceName = serviceName;
this.serviceUrl = serviceUrl;
}
}
package com.mortals.xhx.module.api;
import lombok.Data;
@Data
public class PrintWaitQueueVO {
/** 打印队列id */
private Long waitQueueId;
/**
* 证照目录ID
*/
private Long catalogId;
/**
* 证照目录编号
*/
private String catalogCode;
/**
* 目录名称
*/
private String catalogName;
/**
* 证照名称
*/
private String certificateName;
/**
* 证照编号
*/
private String certificateCode;
/**
* 企业名称
*/
private String enterpriseName;
/**
* 持有者姓名
*/
private String holderName;
/**
* 持有者证件号码
*/
private String holderIDCardNo;
/**
* 取件人姓名
*/
private String pickerName;
/**
* 取件人证件号码
*/
private String pickerIDCardNo;
/**
* 证件预览地址
*/
private String previewUrl;
/**
* 证件附件地址
*/
private String certificateUrl;
/**
* 打印服务访问地址
*/
private String serviceUrl;
/**
* 打印机名称
*/
private String printerName;
/**
* 打印机网络地址
*/
private String printerIp;
/**
* 打印机纸盒
*/
private String paperSource;
}
......@@ -8,5 +8,7 @@ public class PrintListPdu {
private String idCard;
/** 证件分类 */
private Long classifyId;
/** 打印服务ID */
private Long serviceId;
}
package com.mortals.xhx.module.certificate.web;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.exception.AppException;
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.CatalogVO;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import com.mortals.xhx.module.record.service.ApplyLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("api")
public class CertificateApi {
@Autowired
private CertificateCatalogService certificateCatalogService;
@Autowired
private ApplyLogService applyLogService;
@PostMapping({"catalog/list"})
@UnAuth
public String getCatalogList(){
JSONObject ret = new JSONObject();
Map<String, Object> model = new HashMap();
byte code = 1;
try {
List<CertificateCatalogEntity> list = certificateCatalogService.find(new CertificateCatalogQuery());
List<CatalogVO> catalogList = new ArrayList<>();
for(CertificateCatalogEntity entity:list){
CatalogVO catalogVO = new CatalogVO(entity.getId(),entity.getCatalogName(),entity.getCatalogCode());
JSONObject formContent = JSONObject.parseObject(entity.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);
}
model.put("message_info", "获取证照目录成功");
ret.put("data", catalogList);
}catch (Exception e){
code = -1;
model.put("message_info", "系统发生异常,请稍后再试");
}
ret.put("code", Integer.valueOf(code));
ret.put("msg", model.remove("message_info"));
return ret.toJSONString();
}
@PostMapping({"certificate/submit"})
@UnAuth
public String postA(@RequestBody ApplyLogPdu applyLogPdu){
JSONObject ret = new JSONObject();
Map<String, Object> model = new HashMap();
byte code = 1;
try {
applyLogService.apiSaveApplyLog(applyLogPdu);
model.put("message_info", "生成证照成功");
}catch (Exception e){
code = -1;
model.put("message_info", "生成证照发生异常");
if(e instanceof AppException){
model.put("message_info", e.getMessage());
}
}
ret.put("code", Integer.valueOf(code));
ret.put("msg", model.remove("message_info"));
return ret.toJSONString();
}
}
package com.mortals.xhx.module.print.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.print.model.PrintCatalogEntity;
import java.util.List;
/**
* 证照目录打印配置Dao
* 证照目录打印配置 DAO接口
*
* @author zxfei
* @date 2022-11-21
*/
public interface PrintCatalogDao extends ICRUDDao<PrintCatalogEntity,Long>{
}
package com.mortals.xhx.module.print.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.print.model.PrintServiceEntity;
import java.util.List;
/**
* 证照打印服务配置Dao
* 证照打印服务配置 DAO接口
*
* @author zxfei
* @date 2022-11-21
*/
public interface PrintServiceDao extends ICRUDDao<PrintServiceEntity,Long>{
}
package com.mortals.xhx.module.print.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.print.dao.PrintCatalogDao;
import com.mortals.xhx.module.print.model.PrintCatalogEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 证照目录打印配置DaoImpl DAO接口
*
* @author zxfei
* @date 2022-11-21
*/
@Repository("printCatalogDao")
public class PrintCatalogDaoImpl extends BaseCRUDDaoMybatis<PrintCatalogEntity,Long> implements PrintCatalogDao {
}
package com.mortals.xhx.module.print.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.print.dao.PrintServiceDao;
import com.mortals.xhx.module.print.model.PrintServiceEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 证照打印服务配置DaoImpl DAO接口
*
* @author zxfei
* @date 2022-11-21
*/
@Repository("printServiceDao")
public class PrintServiceDaoImpl extends BaseCRUDDaoMybatis<PrintServiceEntity,Long> implements PrintServiceDao {
}
package com.mortals.xhx.module.print.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.print.model.vo.PrintCatalogVo;
/**
* 证照目录打印配置实体对象
*
* @author zxfei
* @date 2022-11-21
*/
public class PrintCatalogEntity extends PrintCatalogVo {
private static final long serialVersionUID = 1L;
/**
* 证照目录ID
*/
private Long catalogId;
/**
* 证照目录编号
*/
private String catalogCode;
/**
* 目录名称
*/
private String catalogName;
/**
* 打印机名称
*/
private String printerName;
/**
* 打印机网络地址
*/
private String printerIp;
/**
* 打印机纸盒
*/
private String paperSource;
/**
* 打印服务配置ID
*/
private Long serviceId;
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;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof PrintCatalogEntity) {
PrintCatalogEntity tmp = (PrintCatalogEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
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());
return sb.toString();
}
public void initAttrValue(){
this.catalogId = null;
this.catalogCode = "";
this.catalogName = "";
this.printerName = "";
this.printerIp = "";
this.paperSource = "";
this.serviceId = null;
}
}
\ No newline at end of file
package com.mortals.xhx.module.print.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.print.model.vo.PrintServiceVo;
/**
* 证照打印服务配置实体对象
*
* @author zxfei
* @date 2022-11-21
*/
public class PrintServiceEntity extends PrintServiceVo {
private static final long serialVersionUID = 1L;
/**
* 配置名称
*/
private String serviceName;
/**
* 服务访问地址
*/
private String serviceUrl;
public PrintServiceEntity(){}
/**
* 获取 配置名称
* @return String
*/
public String getServiceName(){
return serviceName;
}
/**
* 设置 配置名称
* @param serviceName
*/
public void setServiceName(String serviceName){
this.serviceName = serviceName;
}
/**
* 获取 服务访问地址
* @return String
*/
public String getServiceUrl(){
return serviceUrl;
}
/**
* 设置 服务访问地址
* @param serviceUrl
*/
public void setServiceUrl(String serviceUrl){
this.serviceUrl = serviceUrl;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof PrintServiceEntity) {
PrintServiceEntity tmp = (PrintServiceEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",serviceName:").append(getServiceName());
sb.append(",serviceUrl:").append(getServiceUrl());
return sb.toString();
}
public void initAttrValue(){
this.serviceName = "";
this.serviceUrl = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.print.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.print.model.PrintCatalogEntity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 证照目录打印配置视图对象
*
* @author zxfei
* @date 2022-11-21
*/
@Data
public class PrintCatalogVo extends BaseEntityLong {
/**
* 服务访问地址
*/
private String serviceUrl;
}
\ No newline at end of file
package com.mortals.xhx.module.print.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.print.model.PrintServiceEntity;
import java.util.ArrayList;
import java.util.List;
/**
* 证照打印服务配置视图对象
*
* @author zxfei
* @date 2022-11-21
*/
public class PrintServiceVo extends BaseEntityLong {
}
\ No newline at end of file
package com.mortals.xhx.module.print.service;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.print.model.PrintCatalogEntity;
/**
* PrintCatalogService
*
* 证照目录打印配置 service接口
*
* @author zxfei
* @date 2022-11-21
*/
public interface PrintCatalogService extends ICRUDService<PrintCatalogEntity,Long>{
/**
* 根据打印服务id和目录id获取打印相关配置
* @param serviceId
* @param catalogId
* @return
*/
PrintCatalogEntity getPrintCatalogByService(Long serviceId,Long catalogId) throws AppException;
}
\ No newline at end of file
package com.mortals.xhx.module.print.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.print.model.PrintServiceEntity;
/**
* PrintServiceService
*
* 证照打印服务配置 service接口
*
* @author zxfei
* @date 2022-11-21
*/
public interface PrintServiceService extends ICRUDService<PrintServiceEntity,Long>{
}
\ No newline at end of file
package com.mortals.xhx.module.print.service.impl;
import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import com.mortals.xhx.module.print.model.PrintCatalogQuery;
import com.mortals.xhx.module.print.model.PrintServiceEntity;
import com.mortals.xhx.module.print.service.PrintServiceService;
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.print.dao.PrintCatalogDao;
import com.mortals.xhx.module.print.model.PrintCatalogEntity;
import com.mortals.xhx.module.print.service.PrintCatalogService;
import java.util.List;
/**
* PrintCatalogService
* 证照目录打印配置 service实现
*
* @author zxfei
* @date 2022-11-21
*/
@Service("printCatalogService")
public class PrintCatalogServiceImpl extends AbstractCRUDServiceImpl<PrintCatalogDao, PrintCatalogEntity, Long> implements PrintCatalogService {
@Autowired
private CertificateCatalogService certificateCatalogService;
@Autowired
private PrintServiceService printServiceService;
@Override
protected void validData(PrintCatalogEntity entity, Context context) throws AppException {
if(entity.getServiceId()==null){
throw new AppException("打印服务id不能为空");
}
if(entity.getCatalogId()==null){
throw new AppException("证照目录id不能为空");
}
}
@Override
protected void saveBefore(PrintCatalogEntity entity, Context context) throws AppException {
super.saveBefore(entity,context);
CertificateCatalogEntity catalogEntity = certificateCatalogService.get(entity.getCatalogId());
if(catalogEntity == null){
throw new AppException("证照目录id不正确");
}
entity.setCatalogCode(catalogEntity.getCatalogCode());
entity.setCatalogName(catalogEntity.getCatalogName());
}
@Override
public PrintCatalogEntity getPrintCatalogByService(Long serviceId, Long catalogId) throws AppException {
PrintServiceEntity printServiceEntity = printServiceService.get(serviceId);
if(printServiceEntity == null){
throw new AppException("打印服务id不正确");
}
PrintCatalogEntity data = null;
PrintCatalogQuery query = new PrintCatalogQuery();
query.setCatalogId(catalogId);
query.setServiceId(serviceId);
List<PrintCatalogEntity> printCatalogEntityList = this.find(query);
if(CollectionUtils.isNotEmpty(printCatalogEntityList)){
data = printCatalogEntityList.get(0);
data.setServiceUrl(printServiceEntity.getServiceUrl());
}else {
CertificateCatalogEntity catalogEntity = certificateCatalogService.get(catalogId);
if(catalogEntity == null){
throw new AppException("证照目录id不正确");
}
data = new PrintCatalogEntity();
data.setServiceUrl(printServiceEntity.getServiceUrl());
data.setCatalogCode(catalogEntity.getCatalogCode());
data.setCatalogName(catalogEntity.getCatalogName());
data.setCatalogId(catalogEntity.getId());
data.setPrinterIp(catalogEntity.getPrinterIp());
data.setPrinterName(catalogEntity.getPrinterName());
data.setPaperSource(catalogEntity.getPaperSource());
}
return data;
}
}
\ No newline at end of file
package com.mortals.xhx.module.print.service.impl;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.print.dao.PrintServiceDao;
import com.mortals.xhx.module.print.model.PrintServiceEntity;
import com.mortals.xhx.module.print.service.PrintServiceService;
/**
* PrintServiceService
* 证照打印服务配置 service实现
*
* @author zxfei
* @date 2022-11-21
*/
@Service("printServiceService")
public class PrintServiceServiceImpl extends AbstractCRUDServiceImpl<PrintServiceDao, PrintServiceEntity, Long> implements PrintServiceService {
}
\ No newline at end of file
package com.mortals.xhx.module.print.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.print.model.PrintCatalogEntity;
import com.mortals.xhx.module.print.service.PrintCatalogService;
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 2022-11-21
*/
@RestController
@RequestMapping("print/catalog")
public class PrintCatalogController extends BaseCRUDJsonBodyMappingController<PrintCatalogService,PrintCatalogEntity,Long> {
@Autowired
private ParamService paramService;
public PrintCatalogController(){
super.setModuleDesc( "证照目录打印配置");
}
@Override
protected void init(Map<String, Object> model, Context context) {
super.init(model, context);
}
}
\ No newline at end of file
package com.mortals.xhx.module.print.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.print.model.PrintServiceEntity;
import com.mortals.xhx.module.print.service.PrintServiceService;
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 2022-11-21
*/
@RestController
@RequestMapping("print/service")
public class PrintServiceController extends BaseCRUDJsonBodyMappingController<PrintServiceService,PrintServiceEntity,Long> {
@Autowired
private ParamService paramService;
public PrintServiceController(){
super.setModuleDesc( "证照打印服务配置");
}
@Override
protected void init(Map<String, Object> model, Context context) {
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