Commit 037a27d2 authored by 廖旭伟's avatar 廖旭伟

增加API调用接口

parent bd6e7ac0
...@@ -1461,219 +1461,7 @@ msg|String|消息|- ...@@ -1461,219 +1461,7 @@ msg|String|消息|-
} }
``` ```
## 证照申请
### 查询证照申请列表
**请求URL:** record/list
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**简要描述:** 查询证照申请
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:------
page|Integer|否|当前页
size|Integer|否|每页条数,值为-1,查询所有记录
**请求样例:**
```
{
"page":1,
"size":10
}
```
**响应参数:**
参数名称|参数类型|描述
:---|:---|:------
code|Integer|结果码(-1.失败,1.成功)
msg|String|消息
data|object|数据对象
 per_page|Integer|每页条数
 total|Integer|总条数
 last_page|Integer|总页数
 current_page|Integer|当前页
 data|array|结果集列表|数组
  id|Long|序号,主键,自增长
  catalogId|Long|证照目录ID
  catalogName|String|目录名称
  catalogCode|String|目录编号
  recordStatus|Integer|档案状态
  createUserId|Long|创建用户
  createTime|Date|创建时间
  updateUserId|Long|更新用户
  updateTime|Date|更新时间
dict|object|字典对象
**响应消息样例:**
```
{
"code":1,
"data":{
}
}
```
### 查看证照申请
**请求URL:** record/info
**请求方式:** GET
**内容类型:** application/json;charset=utf-8
**简要描述:** 查看证照申请,返回实例详细信息
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:------
id|Long|是|ID
**请求样例:**
```
http://localhost/record/info?id=549
```
**响应参数:**
参数名称 |参数类型|描述
:---|:---|:-------
code|Integer|结果码(-1.失败,1.成功)
msg|String|消息
data|object|数据对象
 id|Long|序号,主键,自增长
 catalogId|Long|证照目录ID
 catalogName|String|目录名称
 catalogCode|String|目录编号
 recordStatus|Integer|档案状态
 createUserId|Long|创建用户
 createTime|Date|创建时间
 updateUserId|Long|更新用户
 updateTime|Date|更新时间
dict|object|字典对象
**响应消息样例:**
```
{
"code": 1,
"data": {
"id":173,
"catalogId":3710,
"catalogName":"uiufi9",
"catalogCode":"rp723v",
"recordStatus":7804,
"createUserId":6469,
"createTime":"2022-11-04",
"updateUserId":9812,
"updateTime":"2022-11-04"
}
}
```
### 保存更新证照申请
**请求URL:** record/save
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**简要描述:** 保存或更新证照申请:id为空时为新增保存,否则为更新提交
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:-------
id|Long|否|序号,主键,自增长
catalogName|String|是|目录名称
catalogCode|String|是|目录编号
recordStatus|Integer|是|档案状态
createUserId|Long|否|创建用户
createTime|Date|否|创建时间
updateUserId|Long|否|更新用户
updateTime|Date|否|更新时间
**请求样例:**
```
{
"catalogId":5208,
"catalogName":"azrqck",
"catalogCode":"t32v0y",
"recordStatus":1385,
}
```
**响应参数:**
参数名称 |参数类型|描述
:---|:---|:------
code|Integer|结果码(-1.失败,1.成功)
msg|String|消息
data|object|数据对象
 id|Long|保存后主键id
 entity|object|保存更新实体
  id|Long|序号,主键,自增长
  catalogId|Long|证照目录ID
  catalogName|String|目录名称
  catalogCode|String|目录编号
  recordStatus|Integer|档案状态
  createUserId|Long|创建用户
  createTime|Date|创建时间
  updateUserId|Long|更新用户
  updateTime|Date|更新时间
**响应消息样例:**
```
{
"msg":"新增模块成功",
"code":1,
"data":{}
}
}
```
### 删除证照申请
**请求URL:** record/delete
**请求方式:** GET
**内容类型:** application/json;charset=utf-8
**简要描述:** 删除证照申请
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:------
id|String|是|数组
**请求样例:**
```
http://localhost:8080/record/delete?id=1&id=2'
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|-
msg|String|消息|-
**响应消息样例:**
```
{
"code":1,
"msg":"成功"
}
```
## 证照申请 ## 证照申请
### 查询证照申请列表 ### 查询证照申请列表
...@@ -2253,6 +2041,49 @@ dict|object|字典对象 ...@@ -2253,6 +2041,49 @@ dict|object|字典对象
} }
``` ```
### excel导入
**请求URL:** apply/log/import
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**简要描述:** 预览正本
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:-------
catalogId|Long|否|目录Id
file|file|是|证件编号
**请求样例:**
```
{
"catalogId": 1,
"file": "cxuyh4.xls"
}
```
**响应参数:**
参数名称 |参数类型|描述
:---|:---|:------
code|Integer|结果码(-1.失败,1.成功)
msg|String|消息
data|object|数据对象
**响应消息样例:**
```
{
"msg":"生成成功",
"code":1,
"data":{}
}
```
## 证照打印记录 ## 证照打印记录
### 查询证照打印记录列表 ### 查询证照打印记录列表
...@@ -3243,4 +3074,110 @@ dict|object|字典对象 ...@@ -3243,4 +3074,110 @@ dict|object|字典对象
"dict": null "dict": null
} }
``` ```
## API接口
### 查询证照目录
**请求URL:** api/catalog/list
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**简要描述:** 查询证照目录
**请求样例:**
```
{
}
```
**响应参数:**
参数名称|参数类型|描述
:---|:---|:------
code|Integer|结果码(-1.失败,1.成功)
msg|String|消息
 data|array|结果集列表|数组
  id|Long|序号,主键,自增长
  catalogName|String|目录名称
  catalogCode|String|目录编号
  formContent|String|证照模板表单内容
**响应消息样例:**
```
{
"data": {},
"code": 1,
"msg": "查询证照目录成功",
"dict": null
}
```
### 生成证照
**请求URL:** api/certificate/submit
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**简要描述:** 查询证照目录
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:-------
catalogId|Long|否|目录Id
certificateCode|String|是|证件编号
certificateName|String|是|证件名称
issueTime|Date|是|颁发时间yyyy-mm-dd HH:MM:SS
pickerName|String|是|取件人姓名
pickerIDCardNo|String|是|取件人证件号码
holderType|Integer|是|持有者类型,1:自然人,2:法人,3:自然人法人
holderIdType|Integer|是|持有者证件类型,1:身份证,2:组织机构代码等
holderName|String|是|持有者名称
holderIDCardNo|String|是|持有者证件号码
enterpriseName|String|是|企业名称
privateID|String|是|专网ID
formContent|String|是|证照模板正本表单内容
**请求样例:**
```
{
"catalogId": 1,
"certificateCode": "cxuyh4",
"certificateName": "卫生许可证",
"issueTime": "2022-10-14 12:11:11",
"pickerName": "张三",
"pickerIDCardNo": "12345678",
"holderType": 1,
"holderIdType": 1,
"holderName": "张三",
"holderIDCardNo": "12334569086765",
"enterpriseName": "成都壹糖文化传播有限公司",
"privateID": "f45vg6",
"formContent": "{'i_1_卫':'川','i_2_字':'2022', 'i_3_号':'10','i_4_单位名称':'成都壹糖文化传播有限公司','i_5_法定代表人':'廖至敬','i_6_地址':'成都市武侯区晋吉南路98号','i_7_许可项目':'奶油蛋糕、生日蛋糕、水果蛋糕、奶茶、鲜切水果','i_8_年始':'2021','i_9_月始':'01','i_10_日始':'01','i_11_年止':'2023','i_12_月止':'12','i_13_日止':'31','i_14_年':'2020','i_15_月':'12','i_16_日':'30'}"
}
```
**响应参数:**
参数名称|参数类型|描述
:---|:---|:------
code|Integer|结果码(-1.失败,1.成功)
msg|String|消息
 data|array|结果集列表|数组
**响应消息样例:**
```
{
"data": {},
"code": 1,
"msg": "证照生成成功",
"dict": null
}
```
## 字典附录 ## 字典附录
...@@ -22,6 +22,15 @@ public enum HolderIdType implements IBaseEnum { ...@@ -22,6 +22,15 @@ public enum HolderIdType implements IBaseEnum {
this.style = style; this.style = style;
} }
public static HolderIdType getByDesc(String desc) {
for (HolderIdType e : HolderIdType.values()) {
if (e.getDesc().equals(desc)) {
return e;
}
}
return null;
}
@Override @Override
public int getValue() { public int getValue() {
return this.value; return this.value;
......
...@@ -49,6 +49,15 @@ public enum HolderType implements IBaseEnum { ...@@ -49,6 +49,15 @@ public enum HolderType implements IBaseEnum {
return null; return null;
} }
public static HolderType getByDesc(String desc) {
for (HolderType e : HolderType.values()) {
if (e.getDesc().equals(desc)) {
return e;
}
}
return null;
}
public static Map<String,String> getEnumMap(int... eItem) { public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>(); Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (HolderType item : HolderType.values()) { for (HolderType item : HolderType.values()) {
......
package com.mortals.xhx.module.certificate.pdu;
import lombok.Data;
import java.util.Date;
@Data
public class ApplyLogPdu {
/**
* 证照目录ID
*/
private Long catalogId;
/**
* 证件编号
*/
private String certificateCode;
/**
* 证件名称
*/
private String certificateName;
/**
* 颁发时间
*/
private Date issueTime;
/**
* 取件人姓名
*/
private String pickerName;
/**
* 取件人证件号码
*/
private String pickerIDCardNo;
/**
* 持有者类型,1:自然人,2:法人,3:自然人法人
*/
private Integer holderType;
/**
* 持有者证件类型,1:身份证,2:组织机构代码等
*/
private Integer holderIdType;
/**
* 持有者名称
*/
private String holderName;
/**
* 持有者证件号码
*/
private String holderIDCardNo;
/**
* 企业名称
*/
private String enterpriseName;
/**
* 专网ID
*/
private String privateID;
/**
* 证照模板正本表单内容
*/
private String formContent;
}
package com.mortals.xhx.module.certificate.pdu;
import lombok.Data;
@Data
public class CatalogVO {
/**
* 主键
*/
private Long id;
/**
* 目录名称
*/
private String catalogName;
/**
* 目录编号
*/
private String catalogCode;
/**
* 证照模板表单内容
*/
private String formContent;
public CatalogVO(Long id, String catalogName, String catalogCode) {
this.id = id;
this.catalogName = catalogName;
this.catalogCode = catalogCode;
}
public CatalogVO() {
}
}
...@@ -125,15 +125,15 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi ...@@ -125,15 +125,15 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
List<ListItem> collect = new ArrayList<>(); List<ListItem> collect = new ArrayList<>();
HashSet<String> hs = new HashSet<>(); //去除重复标签 HashSet<String> hs = new HashSet<>(); //去除重复标签
List<String> excelList = new ArrayList<>(); //Excel模板 List<String> excelList = new ArrayList<>(); //Excel模板
excelList.add("证照目录ID"); // excelList.add("证照目录ID");
excelList.add("证照编号"); // excelList.add("证照编号");
excelList.add("证照名称"); // excelList.add("证照名称");
excelList.add("颁发时间"); // excelList.add("颁发时间");
excelList.add("取件人姓名"); // excelList.add("取件人姓名");
excelList.add("取件人证件号码"); // excelList.add("取件人证件号码");
excelList.add("持有者名称"); // excelList.add("持有者名称");
excelList.add("持有者证件号码"); // excelList.add("持有者证件号码");
excelList.add("企业名称"); // excelList.add("企业名称");
for (MetaTemplate item : template.getElementTemplates()) { for (MetaTemplate item : template.getElementTemplates()) {
if(hs.contains(item.variable())){ if(hs.contains(item.variable())){
continue; continue;
...@@ -195,9 +195,7 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi ...@@ -195,9 +195,7 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
root.setList(collect); root.setList(collect);
String fileName = "file/uploadfile/excel/"+entity.getCatalogName()+"_批量导入模板.xls"; String fileName = "file/uploadfile/excel/"+entity.getCatalogName()+"_批量导入模板.xls";
String excelFilePath = rootPath + fileName; String excelFilePath = rootPath + fileName;
List<String[]> downData = new ArrayList(); ExcelUtil.createCatalogTemplate(excelFilePath, excelList);
String [] downRows = {};
ExcelUtil.createExcelTemplate(excelFilePath, excelList.toArray(new String[excelList.size()]), downData, downRows);
entity.setExcelFile(fileName); entity.setExcelFile(fileName);
if(!onlyExcel) { if(!onlyExcel) {
entity.setFormContent(JSON.toJSONString(root)); entity.setFormContent(JSON.toJSONString(root));
...@@ -205,16 +203,15 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi ...@@ -205,16 +203,15 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
} }
public static void main(String[] args){ public static void main(String[] args){
String excelFilePath = "D:/mortals/app/data/cpm/" + "excel/test.xls"; String excelFilePath = "D:/mortals/app/data/cpm/" + "excel/test1.xls";
List<String> excelList = new ArrayList<>(); List<String> excelList = new ArrayList<>();
excelList.add("i_1_姓名"); excelList.add("i_1_姓名");
excelList.add("i_2_性别"); excelList.add("i_2_性别");
excelList.add("i_3_年龄"); excelList.add("i_3_年龄");
excelList.add("i_4_证件编号"); excelList.add("i_4_证件编号");
excelList.add("i_5_证件名称"); excelList.add("i_5_证件名称");
List<String[]> downData = new ArrayList();
String [] downRows = {}; ExcelUtil.createCatalogTemplate(excelFilePath,excelList);
ExcelUtil.createExcelTemplate(excelFilePath, excelList.toArray(new String[excelList.size()]), downData, downRows);
} }
@Override @Override
......
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();
}
}
...@@ -72,7 +72,7 @@ public class CertificateCatalogController extends BaseCRUDJsonBodyMappingControl ...@@ -72,7 +72,7 @@ public class CertificateCatalogController extends BaseCRUDJsonBodyMappingControl
Object msg = model.get("message_info"); Object msg = model.get("message_info");
return this.createFailJsonResp(msg == null ? "系统异常" : msg.toString()); return this.createFailJsonResp(msg == null ? "系统异常" : msg.toString());
} }
this.init(model, context); //this.init(model, context);
ret.put("data", model); ret.put("data", model);
ret.put("code", 1); ret.put("code", 1);
ret.put("msg", model.remove("message_info")); ret.put("msg", model.remove("message_info"));
......
...@@ -3,9 +3,11 @@ package com.mortals.xhx.module.record.service; ...@@ -3,9 +3,11 @@ package com.mortals.xhx.module.record.service;
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.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.certificate.pdu.ApplyLogPdu;
import com.mortals.xhx.module.record.model.ApplyLogEntity; import com.mortals.xhx.module.record.model.ApplyLogEntity;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* ApplyLogService * ApplyLogService
...@@ -39,4 +41,20 @@ public interface ApplyLogService extends ICRUDService<ApplyLogEntity,Long>{ ...@@ -39,4 +41,20 @@ public interface ApplyLogService extends ICRUDService<ApplyLogEntity,Long>{
* @throws AppException * @throws AppException
*/ */
List<ApplyLogEntity> ApplyRecord(Long applyId) throws AppException; List<ApplyLogEntity> ApplyRecord(Long applyId) throws AppException;
/**
* 批量导入
* @param dataList
* @param catalogId
* @param context
* @return
*/
String importData(List<Map<Integer, Object>> dataList,Long catalogId,Context context) throws AppException;
/**
* api接口提交数据
* @param pdu
* @throws AppException
*/
void apiSaveApplyLog(ApplyLogPdu pdu) throws AppException;
} }
\ No newline at end of file
...@@ -2,10 +2,13 @@ package com.mortals.xhx.module.record.web; ...@@ -2,10 +2,13 @@ package com.mortals.xhx.module.record.web;
import com.mortals.framework.annotation.UnAuth; import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.IBaseEnum; import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.utils.ReflectUtils;
import com.mortals.framework.utils.poi.ExcelUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.upload.service.UploadService; import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.common.code.*; import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.utils.ImportExcelUtil;
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.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -125,4 +128,26 @@ public class ApplyLogController extends BaseCRUDJsonBodyMappingController<ApplyL ...@@ -125,4 +128,26 @@ public class ApplyLogController extends BaseCRUDJsonBodyMappingController<ApplyL
return ret; return ret;
} }
@PostMapping({"/import"})
public String importFile(MultipartFile file, Long catalogId) {
JSONObject ret = new JSONObject();
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "导入" + this.getModuleDesc();
byte code = 1;
try {
String fileName = file.getOriginalFilename();
List<Map<Integer, Object>> returnList = ImportExcelUtil.readExcelContent(fileName,file.getInputStream(),1,null,null);
String message = this.service.importData(returnList, catalogId, context);
model.put("message_info", message);
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var13) {
code = -1;
this.doException(this.request, busiDesc, model, var13);
}
ret.put("code", Integer.valueOf(code));
ret.put("msg", model.remove("message_info"));
return ret.toJSONString();
}
} }
\ 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