Commit 3a1b91a3 authored by 廖旭伟's avatar 廖旭伟

终端接口增加参数

parent 104ee694
...@@ -690,6 +690,9 @@ data|object|数据对象 ...@@ -690,6 +690,9 @@ data|object|数据对象
  createTime|Date|创建时间   createTime|Date|创建时间
  updateUserId|Long|更新用户   updateUserId|Long|更新用户
  updateTime|Date|更新时间   updateTime|Date|更新时间
  printerName|String|打印机名称
  printerIp|String|打印机网络地址
  paperSource|String|打印机纸盒
dict|object|字典对象 dict|object|字典对象
**响应消息样例:** **响应消息样例:**
...@@ -749,6 +752,9 @@ data|object|数据对象 ...@@ -749,6 +752,9 @@ data|object|数据对象
 createTime|Date|创建时间  createTime|Date|创建时间
 updateUserId|Long|更新用户  updateUserId|Long|更新用户
 updateTime|Date|更新时间  updateTime|Date|更新时间
  printerName|String|打印机名称
  printerIp|String|打印机网络地址
  paperSource|String|打印机纸盒
dict|object|字典对象 dict|object|字典对象
**响应消息样例:** **响应消息样例:**
...@@ -776,7 +782,10 @@ dict|object|字典对象 ...@@ -776,7 +782,10 @@ dict|object|字典对象
"createUserId":31, "createUserId":31,
"createTime":"2022-10-14", "createTime":"2022-10-14",
"updateUserId":8897, "updateUserId":8897,
"updateTime":"2022-10-14" "updateTime":"2022-10-14",
"printerName":"aa0y0y",
"printerIp":"cqvvc9",
"paperSource":"55io9h"
} }
} }
``` ```
...@@ -808,6 +817,9 @@ createUserId|Long|否|创建用户 ...@@ -808,6 +817,9 @@ createUserId|Long|否|创建用户
createTime|Date|否|创建时间 createTime|Date|否|创建时间
updateUserId|Long|否|更新用户 updateUserId|Long|否|更新用户
updateTime|Date|否|更新时间 updateTime|Date|否|更新时间
printerName|String|否|打印机名称
printerIp|String|否|打印机网络地址
paperSource|String|否|打印机纸盒
**请求样例:** **请求样例:**
``` ```
...@@ -828,6 +840,9 @@ updateTime|Date|否|更新时间 ...@@ -828,6 +840,9 @@ updateTime|Date|否|更新时间
"dupFormContent":"ye4wm8", "dupFormContent":"ye4wm8",
"exampleUrl":"mgv8im", "exampleUrl":"mgv8im",
"status":1567, "status":1567,
"printerName":"q2bm5t",
"printerIp":"x8xb4l",
"paperSource":"4nccil"
} }
``` ```
...@@ -861,6 +876,9 @@ data|object|数据对象 ...@@ -861,6 +876,9 @@ data|object|数据对象
  createTime|Date|创建时间   createTime|Date|创建时间
  updateUserId|Long|更新用户   updateUserId|Long|更新用户
  updateTime|Date|更新时间   updateTime|Date|更新时间
  printerName|String|打印机名称
  printerIp|String|打印机网络地址
  paperSource|String|打印机纸盒
**响应消息样例:** **响应消息样例:**
``` ```
...@@ -2654,5 +2672,49 @@ dict|object|字典对象 ...@@ -2654,5 +2672,49 @@ dict|object|字典对象
"dict": null "dict": null
} }
``` ```
### 终端提交打印结果
**请求URL:** print/log
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**简要描述:** 保存打印结果
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:-------
waitQueueId|Long|是|打印列表id
printStatus|Integer|是|打印结果1成功-1失败
statusRemark|String|否|结果描述
**请求样例:**
```
{
"waitQueueId": 1,
"printStatus": -1,
"statusRemark":"错误测试"
}
```
**响应参数:**
参数名称|参数类型|描述
:---|:---|:------
code|Integer|结果码(-1.失败,1.成功)
msg|String|消息
data|object|数据对象
dict|object|字典对象
**响应消息样例:**
```
{
"data": {},
"code": 1,
"msg": "保存打印记录成功",
"dict": null
}
```
## 字典附录 ## 字典附录
package com.mortals.xhx.module.certificate.pdu;
import lombok.Data;
@Data
public class PrintLogPdu {
/** 打印队列id */
private Long waitQueueId;
/** 打印结果 */
private Integer printStatus;
/** 结果描述 */
private String statusRemark;
}
...@@ -16,6 +16,7 @@ import com.mortals.xhx.common.key.ParamKey; ...@@ -16,6 +16,7 @@ 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.CertificateClassifyEntity;
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.PrintSettingPdu; import com.mortals.xhx.module.certificate.pdu.PrintSettingPdu;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService; import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import com.mortals.xhx.module.certificate.service.CertificateClassifyService; import com.mortals.xhx.module.certificate.service.CertificateClassifyService;
...@@ -112,22 +113,15 @@ public class CertificatePrintController extends BaseJsonBodyController { ...@@ -112,22 +113,15 @@ public class CertificatePrintController extends BaseJsonBodyController {
/** /**
* 打印文件 * 打印文件
*/ */
@RequestMapping(value = {"do"},method = {RequestMethod.POST, RequestMethod.GET}) @RequestMapping(value = {"log"},method = {RequestMethod.POST, RequestMethod.GET})
@UnAuth @UnAuth
public Rest<Object> print(Long id) { public Rest<Object> print(@RequestBody PrintLogPdu printLogPdu) {
Rest<Object> ret = new Rest(); Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap(); Map<String, Object> model = new HashMap();
String busiDesc = "打印证件"; String busiDesc = "保存打印记录";
int code=1; int code=1;
try { try {
String rsp = printWaitQueueService.doPrint(id); printWaitQueueService.doPrint(printLogPdu.getWaitQueueId(),printLogPdu.getPrintStatus(),printLogPdu.getStatusRemark());
JSONObject jsonObject = JSONObject.parseObject(rsp);
if(jsonObject.getString("status").equals("1")){
model.put("message_info", busiDesc + "成功");
}else {
code = -1;
model.put("message_info", jsonObject.getString("message"));
}
model.put("message_info", busiDesc + "成功"); model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】"); this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) { } catch (Exception var9) {
......
package com.mortals.xhx.module.record.model.vo; package com.mortals.xhx.module.record.model.vo;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.record.model.PrintWaitQueueEntity; import com.mortals.xhx.module.record.model.PrintWaitQueueEntity;
import lombok.Data;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -9,6 +11,18 @@ import java.util.List; ...@@ -9,6 +11,18 @@ import java.util.List;
* @author zxfei * @author zxfei
* @date 2022-10-22 * @date 2022-10-22
*/ */
@Data
public class PrintWaitQueueVo extends BaseEntityLong { public class PrintWaitQueueVo extends BaseEntityLong {
/**
* 打印机名称
*/
private String printerName;
/**
* 打印机网络地址
*/
private String printerIp;
/**
* 打印机纸盒
*/
private String paperSource;
} }
\ No newline at end of file
...@@ -27,5 +27,5 @@ public interface PrintWaitQueueService extends ICRUDService<PrintWaitQueueEntity ...@@ -27,5 +27,5 @@ public interface PrintWaitQueueService extends ICRUDService<PrintWaitQueueEntity
* 打印文件 * 打印文件
* @param id * @param id
*/ */
String doPrint(Long id); void doPrint(Long id,int printStatus,String statusRemark);
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ import com.mortals.framework.util.HttpUtil; ...@@ -4,6 +4,7 @@ import com.mortals.framework.util.HttpUtil;
import com.mortals.xhx.common.code.*; import com.mortals.xhx.common.code.*;
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.CertificateClassifyEntity;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import com.mortals.xhx.module.record.dao.PrintLogDao; import com.mortals.xhx.module.record.dao.PrintLogDao;
import com.mortals.xhx.module.record.dao.RetainLogDao; import com.mortals.xhx.module.record.dao.RetainLogDao;
import com.mortals.xhx.module.record.model.ApplyLogEntity; import com.mortals.xhx.module.record.model.ApplyLogEntity;
...@@ -22,6 +23,7 @@ import com.mortals.xhx.module.record.service.PrintWaitQueueService; ...@@ -22,6 +23,7 @@ import com.mortals.xhx.module.record.service.PrintWaitQueueService;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -48,7 +50,18 @@ public class PrintWaitQueueServiceImpl extends AbstractCRUDServiceImpl<PrintWait ...@@ -48,7 +50,18 @@ public class PrintWaitQueueServiceImpl extends AbstractCRUDServiceImpl<PrintWait
private PrintLogDao printLogDao; private PrintLogDao printLogDao;
@Autowired @Autowired
private RetainLogDao retainLogDao; private RetainLogDao retainLogDao;
@Autowired
private CertificateCatalogService certificateCatalogService;
@Override
protected void findAfter(PrintWaitQueueEntity entity, Context context, List<PrintWaitQueueEntity> list) throws AppException {
for(PrintWaitQueueEntity printWaitQueueEntity:list){
CertificateCatalogEntity catalogEntity = certificateCatalogService.get(printWaitQueueEntity.getCatalogId());
printWaitQueueEntity.setPaperSource(catalogEntity.getPaperSource());
printWaitQueueEntity.setPrinterIp(catalogEntity.getPrinterIp());
printWaitQueueEntity.setPrinterName(catalogEntity.getPrinterName());
}
}
@Override @Override
public void creatWaitQueueByApply(ApplyLogEntity applyLogEntity, int generateType, Context context) throws AppException { public void creatWaitQueueByApply(ApplyLogEntity applyLogEntity, int generateType, Context context) throws AppException {
...@@ -92,44 +105,55 @@ public class PrintWaitQueueServiceImpl extends AbstractCRUDServiceImpl<PrintWait ...@@ -92,44 +105,55 @@ public class PrintWaitQueueServiceImpl extends AbstractCRUDServiceImpl<PrintWait
} }
@Override @Override
public String doPrint(Long id) { public void doPrint(Long id,int printStatus,String statusRemark) {
PrintWaitQueueEntity waitQueueEntity = this.dao.get(id); PrintWaitQueueEntity waitQueueEntity = this.dao.get(id);
if(waitQueueEntity==null){ if(waitQueueEntity==null){
throw new AppException("数据不存在或已修改"); throw new AppException("数据不存在或已修改");
} }
String rootPath = this.ip.endsWith("/") ? this.ip : this.ip + "/"; PrintWaitQueueEntity data = new PrintWaitQueueEntity();
String filePath = rootPath+waitQueueEntity.getCertificateUrl(); data.setId(id);
Map<String,String> printParameter = new HashMap<>(); data.setPrintStatus(YesNoEnum.YES.getValue());
printParameter.put("printername","测试打印机");//打印机名称 if(printStatus==PrintStatus.SUCCESS.getValue()){
printParameter.put("printerip",printIp);//打印机网络地址 doPrintSuccess(waitQueueEntity);
printParameter.put("printerpapersource","1");//打印机纸盒
printParameter.put("printerfile",filePath);//打印文件网络地址格式为doc文件或pdf文件
try {
//String rsp = HttpUtil.doPost(printApi, printParameter);
String rsp = "{\n" +
" \"status\": \"1\",\n" +
" \"message\": \"打印成功\",\n" +
" }";
JSONObject jsonObject = JSONObject.parseObject(rsp);
if(jsonObject.getString("status").equals("1")){
doPrintAfter(waitQueueEntity,1);
}else {
doPrintAfter(waitQueueEntity,-1);
//throw new AppException(jsonObject.getString("message"));
}
PrintWaitQueueEntity data = new PrintWaitQueueEntity();
data.setId(id);
data.setPrintStatus(YesNoEnum.YES.getValue()); data.setPrintStatus(YesNoEnum.YES.getValue());
data.setUpdateTime(new Date()); }else {
dao.update(data); doPrintFail(waitQueueEntity,statusRemark);
return rsp; data.setPrintStatus(-1);
}catch (Throwable e){
log.error("调用远程打印api接口出错",e);
throw new AppException("调用远程打印api接口出错");
} }
data.setUpdateTime(new Date());
dao.update(data);
} }
private void doPrintAfter(PrintWaitQueueEntity waitQueueEntity,int printResult){ private void doPrintFail(PrintWaitQueueEntity waitQueueEntity,String statusRemark){
Date now = new Date();
PrintLogEntity printLogEntity = new PrintLogEntity();
printLogEntity.setCatalogId(waitQueueEntity.getCatalogId());
printLogEntity.setCatalogCode(waitQueueEntity.getCatalogCode());
if(waitQueueEntity.getCertificateType()==CertificateType.ORIGINAL.getValue()){
printLogEntity.setOriginalCount(1);
printLogEntity.setDuplicateCount(0);
}else {
printLogEntity.setOriginalCount(0);
printLogEntity.setDuplicateCount(1);
}
printLogEntity.setCertificateName(waitQueueEntity.getCertificateName());
printLogEntity.setCertificateCode(waitQueueEntity.getCertificateCode());
printLogEntity.setEnterpriseName(waitQueueEntity.getEnterpriseName());
printLogEntity.setHolderName(waitQueueEntity.getHolderName());
printLogEntity.setHolderIDCardNo(waitQueueEntity.getHolderIDCardNo());
printLogEntity.setPickerName(waitQueueEntity.getPickerName());
printLogEntity.setPickerIDCardNo(waitQueueEntity.getPickerIDCardNo());
printLogEntity.setPrintDate(now);
printLogEntity.setCreateUserId(waitQueueEntity.getCreateUserId());
printLogEntity.setCreateTime(now);
printLogEntity.setPrintStatus(PrintStatus.FAIL.getValue());
printLogEntity.setStatusRemark(statusRemark);
printLogDao.insert(printLogEntity);
}
private void doPrintSuccess(PrintWaitQueueEntity waitQueueEntity){
RetainLogEntity retainLogEntity = new RetainLogEntity(); RetainLogEntity retainLogEntity = new RetainLogEntity();
Date now = new Date(); Date now = new Date();
retainLogEntity.setCatalogId(waitQueueEntity.getCatalogId()); retainLogEntity.setCatalogId(waitQueueEntity.getCatalogId());
...@@ -172,13 +196,8 @@ public class PrintWaitQueueServiceImpl extends AbstractCRUDServiceImpl<PrintWait ...@@ -172,13 +196,8 @@ public class PrintWaitQueueServiceImpl extends AbstractCRUDServiceImpl<PrintWait
printLogEntity.setPrintDate(now); printLogEntity.setPrintDate(now);
printLogEntity.setCreateUserId(waitQueueEntity.getCreateUserId()); printLogEntity.setCreateUserId(waitQueueEntity.getCreateUserId());
printLogEntity.setCreateTime(now); printLogEntity.setCreateTime(now);
if(printResult==1){ printLogEntity.setPrintStatus(PrintStatus.SUCCESS.getValue());
//打印成功 retainLogDao.insert(retainLogEntity);
printLogEntity.setPrintStatus(PrintStatus.SUCCESS.getValue());
retainLogDao.insert(retainLogEntity);
}else {
printLogEntity.setPrintStatus(PrintStatus.FAIL.getValue());
}
printLogDao.insert(printLogEntity); printLogDao.insert(printLogEntity);
} }
} }
\ 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