Commit 7255b4fb authored by 赵啸非's avatar 赵啸非

添加解析表单参数数据

parent 85479673
Pipeline #2781 failed with stages
......@@ -12,13 +12,41 @@ ALTER TABLE mortals_xhx_matter_datum_print ADD COLUMN `idName` varchar(64) defau
ALTER TABLE mortals_xhx_matter_datum_print ADD COLUMN `mobile` varchar(64) default '' COMMENT '手机号码' AFTER idName;
-- ----------------------------
2024-04-24
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_datum_info_field`;
CREATE TABLE `mortals_xhx_datum_info_field` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '序号,主键,自增长',
`datum_print_id` bigint(20) DEFAULT NULL COMMENT '填单打印id',
`idCard` varchar(64) DEFAULT '' COMMENT '身份证号',
`fieldCode` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '字段编码',
`fieldName` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '字段名称',
`fieldType` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '字段类型(input.单行输入框,textarea.多行输入框,SELECT.下拉选项框,date.日期选择框,checkbox.多项选择框)',
`fieldTypeValue` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '字段类型值,当字段类型为多选,单选时候,预设复选值',
`dataType` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '数据类型(number.数字,string.字符串,arrays.数组,obj.对象)',
`fieldValue` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '字段值',
`defaultValue` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '字段默认值',
`fieldLen` int(9) DEFAULT NULL COMMENT '数据长度,默认128',
`fieldNull` tinyint(2) DEFAULT NULL COMMENT '是否允许为空,(0.否,1.是)',
`isList` tinyint(2) DEFAULT NULL COMMENT '字段是否列表显示(0.否,1.是)',
`fieldOrderNo` int(9) DEFAULT NULL COMMENT '排序号',
`remark` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '备注',
`createTime` datetime DEFAULT NULL COMMENT '创建时间',
`createUserId` bigint(20) DEFAULT NULL COMMENT '创建用户',
`updateTime` datetime DEFAULT NULL COMMENT '修改时间',
`updateUserId` bigint(20) DEFAULT NULL COMMENT '修改用户',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='填单用户信息字段';
-- ----------------------------
2023-03-22
-- ----------------------------
INSERT INTO `mortals_xhx_task` (`id`, `name`, `taskKey`, `status`, `excuteService`, `excuteParam`, `excuteHost`, `excuteStrategy`, `excuteDate`, `excuteTime`, `remark`, `lastExcuteHost`, `lastExcuteTime`, `interimExcuteStatus`, `createTime`, `createUserId`, `createUserName`) VALUES ('4', '同步设备', 'SyncSiteDeviceTask', '0', 'SyncSiteDeviceTask', NULL, NULL, '4', '120', '00:00', NULL, '127.0.1.1', '2023-02-26 22:15:59', '0', '2023-02-25 14:34:12', '1', NULL);
-- ----------------------------
-- ----------------------------
2023-06-21
-- ----------------------------
ALTER TABLE mortals_xhx_device
......
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 数据类型(number.数字,string.字符串,arrays.数组,obj.对象)枚举类
*
* @author zxfei
*/
public enum DataTypeEnum {
数字("数字", "number"),
字符串("字符串", "string"),
数组("数组", "arrays"),
对象("对象", "obj");
private String value;
private String desc;
DataTypeEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static DataTypeEnum getByValue(String value) {
for (DataTypeEnum dataTypeEnum : DataTypeEnum.values()) {
if (dataTypeEnum.getValue() == value) {
return dataTypeEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(String... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (DataTypeEnum item : DataTypeEnum.values()) {
try {
boolean hasE = false;
for (String e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 字段类型(input.单行输入框,textarea.多行输入框,SELECT.下拉选项框,date.日期选择框,checkbox.多项选择框)枚举类
*
* @author zxfei
*/
public enum FieldTypeEnum {
单行输入框("单行输入框", "input"),
多行输入框("多行输入框", "textarea"),
下拉选项框("下拉选项框", "SELECT"),
单项选择框("单项选择框", "radio"),
日期选择框("日期选择框", "date"),
多项选择框("多项选择框", "checkbox"),
横向列表("横向列表", "list"),
表格("表格", "table");
private String value;
private String desc;
FieldTypeEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static FieldTypeEnum getByValue(String value) {
for (FieldTypeEnum fieldTypeEnum : FieldTypeEnum.values()) {
if (fieldTypeEnum.getValue() == value) {
return fieldTypeEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(String... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (FieldTypeEnum item : FieldTypeEnum.values()) {
try {
boolean hasE = false;
for (String e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
package com.mortals.xhx.module.datum.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.datum.model.DatumInfoFieldEntity;
import java.util.List;
/**
* 填单用户信息字段Dao
* 填单用户信息字段 DAO接口
*
* @author zxfei
* @date 2024-04-23
*/
public interface DatumInfoFieldDao extends ICRUDDao<DatumInfoFieldEntity,Long>{
}
package com.mortals.xhx.module.datum.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.datum.dao.DatumInfoFieldDao;
import com.mortals.xhx.module.datum.model.DatumInfoFieldEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 填单用户信息字段DaoImpl DAO接口
*
* @author zxfei
* @date 2024-04-23
*/
@Repository("datumInfoFieldDao")
public class DatumInfoFieldDaoImpl extends BaseCRUDDaoMybatis<DatumInfoFieldEntity,Long> implements DatumInfoFieldDao {
}
package com.mortals.xhx.module.datum.model;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;
import cn.hutool.core.date.DateUtil;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.datum.model.vo.DatumInfoFieldVo;
import lombok.Data;
/**
* 填单用户信息字段实体对象
*
* @author zxfei
* @date 2024-04-23
*/
@Data
public class DatumInfoFieldEntity extends DatumInfoFieldVo {
private static final long serialVersionUID = 1L;
/**
* 填单打印id
*/
private Long datumPrintId;
/**
* 字段编码
*/
private String fieldCode;
/**
* 字段名称
*/
private String fieldName;
/**
* 字段类型(input.单行输入框,textarea.多行输入框,SELECT.下拉选项框,date.日期选择框,checkbox.多项选择框)
*/
private String fieldType;
/**
* 字段类型值,当字段类型为多选,单选时候,预设复选值
*/
private String fieldTypeValue;
/**
* 数据类型(number.数字,string.字符串,arrays.数组,obj.对象)
*/
private String dataType;
/**
* 字段值
*/
private String fieldValue;
/**
* 字段默认值
*/
private String defaultValue;
/**
* 数据长度,默认128
*/
private Integer fieldLen;
/**
* 是否允许为空,(0.否,1.是)
*/
private Integer fieldNull;
/**
* 字段是否列表显示(0.否,1.是)
*/
private Integer isList;
/**
* 排序号
*/
private Integer fieldOrderNo;
/**
* 备注
*/
private String remark;
/**
* 身份证号
*/
private String idCard;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof DatumInfoFieldEntity) {
DatumInfoFieldEntity tmp = (DatumInfoFieldEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.datumPrintId = null;
this.fieldCode = "";
this.fieldName = "";
this.fieldType = "";
this.fieldTypeValue = "";
this.dataType = "";
this.fieldValue = "";
this.defaultValue = "";
this.fieldLen = 0;
this.fieldNull = 0;
this.isList = 0;
this.fieldOrderNo = 0;
this.remark = "";
this.idCard = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.datum.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.datum.model.DatumInfoFieldEntity;
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 2024-04-23
*/
@Data
public class DatumInfoFieldVo extends BaseEntityLong {
/** 序号,主键,自增长列表 */
private List <Long> idList;
}
\ No newline at end of file
package com.mortals.xhx.module.datum.service;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.datum.model.DatumInfoFieldEntity;
import com.mortals.xhx.module.datum.dao.DatumInfoFieldDao;
import com.mortals.xhx.module.datum.model.DatumInfoFieldQuery;
import com.mortals.xhx.module.matter.model.MatterDatumPrintEntity;
import com.mortals.xhx.module.matter.model.MatterDatumPrintQuery;
import java.util.List;
/**
* DatumInfoFieldService
* <p>
* 填单用户信息字段 service接口
*
* @author zxfei
* @date 2024-04-23
*/
public interface DatumInfoFieldService extends ICRUDService<DatumInfoFieldEntity, Long> {
DatumInfoFieldDao getDao();
/**
* 解析保存表单字段
*
* @param matterDatumPrintEntity
* @param context
* @return
*/
Rest<List<DatumInfoFieldEntity>> parseFormContent(MatterDatumPrintEntity matterDatumPrintEntity, Context context);
/**
* 去除重复列表
*
* @param datumInfoFieldQuery
* @param context
* @return
*/
Rest<List<DatumInfoFieldEntity>> distinctList(DatumInfoFieldQuery datumInfoFieldQuery, Context context);
}
\ No newline at end of file
package com.mortals.xhx.module.datum.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.OrderCol;
import com.mortals.xhx.common.code.ComponentEnum;
import com.mortals.xhx.common.code.DataTypeEnum;
import com.mortals.xhx.common.code.FieldTypeEnum;
import com.mortals.xhx.module.datum.model.DatumInfoFieldQuery;
import com.mortals.xhx.module.matter.model.MatterDatumPrintEntity;
import com.mortals.xhx.module.matter.model.MatterDatumPrintQuery;
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.datum.dao.DatumInfoFieldDao;
import com.mortals.xhx.module.datum.model.DatumInfoFieldEntity;
import com.mortals.xhx.module.datum.service.DatumInfoFieldService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* DatumInfoFieldService
* 填单用户信息字段 service实现
*
* @author zxfei
* @date 2024-04-23
*/
@Service("datumInfoFieldService")
@Slf4j
public class DatumInfoFieldServiceImpl extends AbstractCRUDServiceImpl<DatumInfoFieldDao, DatumInfoFieldEntity, Long> implements DatumInfoFieldService {
@Override
public Rest<List<DatumInfoFieldEntity>> parseFormContent(MatterDatumPrintEntity matterDatumPrintEntity, Context context) {
JSONObject json = JSON.parseObject(matterDatumPrintEntity.getFormContent());
List<DatumInfoFieldEntity> infoFieldlist = new ArrayList<DatumInfoFieldEntity>();
for (String key : json.keySet()) {
DatumInfoFieldEntity infoField = new DatumInfoFieldEntity();
infoField.setDatumPrintId(matterDatumPrintEntity.getId());
infoField.setIdCard(matterDatumPrintEntity.getIdCard());
//通过key类型判断属性类型
List<String> split = StrUtil.split(key, "_");
String value = json.getString(key);
//单行输入框
boolean input = StrUtil.startWith(key, ComponentEnum.INPUT.getValue());
if (input && split.size() > 2) {
infoField.setFieldCode(split.get(2));
infoField.setFieldName(split.get(2));
infoField.setFieldType(FieldTypeEnum.单行输入框.getDesc());
infoField.setFieldValue(value);
infoField.setDataType(DataTypeEnum.字符串.getDesc());
}
//文本输入框
boolean texxarea = StrUtil.startWith(key, ComponentEnum.TEXTAREA.getValue());
if (texxarea && split.size() > 2) {
infoField.setFieldCode(split.get(2));
infoField.setFieldName(split.get(2));
infoField.setFieldType(FieldTypeEnum.多项选择框.getDesc());
infoField.setFieldValue(value);
infoField.setDataType(DataTypeEnum.字符串.getDesc());
}
//单选框
boolean radio = StrUtil.startWith(key, ComponentEnum.RADIO.getValue());
if (radio && split.size() > 2) {
infoField.setFieldCode(split.get(2));
infoField.setFieldName(split.get(2));
infoField.setFieldType(FieldTypeEnum.单项选择框.getDesc());
infoField.setFieldValue(value);
infoField.setDataType(DataTypeEnum.字符串.getDesc());
}
//下拉选项框
boolean select = StrUtil.startWith(key, ComponentEnum.SELECT.getValue());
if (select && split.size() > 2) {
infoField.setFieldCode(split.get(2));
infoField.setFieldName(split.get(2));
infoField.setFieldType(FieldTypeEnum.单项选择框.getDesc());
infoField.setFieldValue(value);
infoField.setDataType(DataTypeEnum.字符串.getDesc());
}
//复选框
boolean checkBok = StrUtil.startWith(key, ComponentEnum.CHECKBOX.getValue());
if (checkBok && split.size() > 2) {
infoField.setFieldCode(split.get(2));
infoField.setFieldName(split.get(2));
infoField.setFieldType(FieldTypeEnum.多项选择框.getDesc());
infoField.setFieldValue(value);
infoField.setDataType(DataTypeEnum.数组.getDesc());
}
//时间
boolean date = StrUtil.startWith(key, ComponentEnum.DATE.getValue());
if (date && split.size() > 2) {
infoField.setFieldCode(split.get(2));
infoField.setFieldName(split.get(2));
infoField.setFieldType(FieldTypeEnum.日期选择框.getDesc());
infoField.setFieldValue(value);
infoField.setDataType(DataTypeEnum.字符串.getDesc());
}
//横向列表
boolean list = StrUtil.startWith(key, ComponentEnum.LIST.getValue());
if (list && split.size() > 2) {
infoField.setFieldCode(split.get(2));
infoField.setFieldName(split.get(2));
infoField.setFieldType(FieldTypeEnum.横向列表.getDesc());
infoField.setFieldValue(value);
infoField.setDataType(DataTypeEnum.数组.getDesc());
}
//表格
boolean table = StrUtil.startWith(key, ComponentEnum.DYNAMIC_TABLE.getValue());
if (table && split.size() > 2) {
infoField.setFieldCode(split.get(2));
infoField.setFieldName(split.get(2));
infoField.setFieldType(FieldTypeEnum.表格.getDesc());
infoField.setFieldValue(value);
infoField.setDataType(DataTypeEnum.数组.getDesc());
}
infoFieldlist.add(infoField);
}
return Rest.ok("解析保存成功!", infoFieldlist);
}
@Override
public Rest<List<DatumInfoFieldEntity>> distinctList(DatumInfoFieldQuery datumInfoFieldQuery, Context context) {
datumInfoFieldQuery.setOrderColList(Arrays.asList(new OrderCol("createTime", OrderCol.DESCENDING)));
Map<String, List<DatumInfoFieldEntity>> collect = this.find(datumInfoFieldQuery, context).stream().collect(Collectors.groupingBy(x -> x.getFieldName()));
List<DatumInfoFieldEntity> distiinctList = collect.entrySet().stream().map(item -> {
List<DatumInfoFieldEntity> value = item.getValue();
if (!ObjectUtils.isEmpty(value)) {
return value.get(0);
} else {
return null;
}
}).filter(f -> f != null).collect(Collectors.toList());
return Rest.ok("获取列表成功!",distiinctList);
}
public static void main(String[] args) {
String json = "{\n" +
" \"ck_1_类别_<新参保登记-暂停登记-注销登记-拆分-合并-分立>\": [\n" +
" \"新参保登记\"\n" +
" ],\n" +
" \"i_2_单位名称\": \"蜻蜓和\",\n" +
" \"i_3_现统一社会信用代码\": \"34534543\",\n" +
" \"i_4_姓名\": \"hjs\",\n" +
" \"i_5_联系电话\": \"18282787877\",\n" +
" \"i_6_身份证号码\": \"51192319991118605X\",\n" +
" \"i_7_开户行\": \"1234213123\",\n" +
" \"i_8_户名\": \"hjg\",\n" +
" \"i_9_银行账号\": \"6745645645\",\n" +
" \"i_10_姓名\": \"hjs\",\n" +
" \"i_11_手机号码\": \"16434534534543\",\n" +
" \"i_12_联系电话\": \"23423423432\",\n" +
" \"ck_13_参保险种_<职工基本医疗保险-生育保险-补充医疗保险->其他(___________)\": [\n" +
" \"职工基本医疗保险\"\n" +
" ],\n" +
" \"date_14_参保起始时间\": \"2023 年 02 月 22 日\",\n" +
" \"date_15_日期\": \"2023 年 02 月 14 日\"\n" +
"}";
JSONObject jsonObject = JSON.parseObject(json);
String string = jsonObject.getString("ck_13_参保险种_<职工基本医疗保险-生育保险-补充医疗保险->其他(___________)");
System.out.println(string);
}
}
\ No newline at end of file
package com.mortals.xhx.module.datum.web;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.datum.model.DatumInfoFieldQuery;
import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.matter.model.MatterDatumPrintEntity;
import com.mortals.xhx.module.matter.model.MatterDatumPrintQuery;
import com.mortals.xhx.module.matter.service.MatterDatumPrintService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
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.datum.model.DatumInfoFieldEntity;
import com.mortals.xhx.module.datum.service.DatumInfoFieldService;
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.*;
import com.mortals.xhx.common.code.*;
/**
* 填单用户信息字段
*
* @author zxfei
* @date 2024-04-23
*/
@RestController
@RequestMapping("datum/info/field")
public class DatumInfoFieldController extends BaseCRUDJsonBodyMappingController<DatumInfoFieldService, DatumInfoFieldEntity, Long> {
@Autowired
private ParamService paramService;
@Autowired
private MatterDatumPrintService datumPrintService;
public DatumInfoFieldController() {
super.setModuleDesc("填单用户信息字段");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "fieldType", FieldTypeEnum.getEnumMap());
this.addDict(model, "dataType", DataTypeEnum.getEnumMap());
this.addDict(model, "fieldNull", FieldNullEnum.getEnumMap());
this.addDict(model, "isList", IsListEnum.getEnumMap());
super.init(model, context);
}
/**
* 解析保存用户所有表单
*
* @param query
* @return
*/
@PostMapping(value = "parseForm")
@UnAuth
public Rest<Object> parseForm(@RequestBody DatumInfoFieldEntity query) {
Map<String, Object> model = new HashMap<>();
Context context = this.getContext();
String busiDesc = "解析保存" + this.getModuleDesc();
try {
List<MatterDatumPrintEntity> datumPrintEntities = datumPrintService.find(new MatterDatumPrintQuery());
for (MatterDatumPrintEntity datumPrintEntity : datumPrintEntities) {
if (!ObjectUtils.isEmpty(datumPrintEntity.getFormContent())) {
Rest<List<DatumInfoFieldEntity>> rest = this.service.parseFormContent(datumPrintEntity, context);
if (rest.getCode() == YesNoEnum.YES.getValue() && !ObjectUtils.isEmpty(rest.getData())) {
this.service.save(rest.getData());
}
}
}
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
this.doException(request, busiDesc, model, e);
return Rest.fail(e.getMessage());
}
return Rest.ok(model);
}
/**
* 去重列表
*
* @param query
* @return
*/
@PostMapping(value = "distinctList")
@UnAuth
public Rest<Object> distinctList(@RequestBody DatumInfoFieldQuery query) {
Map<String, Object> model = new HashMap<>();
Context context = this.getContext();
String busiDesc = "查询" + this.getModuleDesc();
try {
Rest<List<DatumInfoFieldEntity>> rest = this.service.distinctList(query, context);
model.put(KEY_RESULT_DATA, rest.getData());
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
this.doException(request, busiDesc, model, e);
return Rest.fail(e.getMessage());
}
this.init(model, context);
return Rest.ok(model);
}
}
\ No newline at end of file
package com.mortals.xhx.module.matter.service.impl;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.common.code.DataTypeEnum;
import com.mortals.xhx.common.code.FieldTypeEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.utils.WordUtil;
import com.mortals.xhx.module.datum.model.DatumInfoFieldEntity;
import com.mortals.xhx.module.datum.service.DatumInfoFieldService;
import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.model.DeviceQuery;
import com.mortals.xhx.module.device.service.DeviceService;
......@@ -22,6 +31,7 @@ import com.mortals.xhx.module.matter.model.MatterDatumPrintEntity;
import com.mortals.xhx.module.matter.service.MatterDatumPrintService;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -40,7 +50,8 @@ public class MatterDatumPrintServiceImpl extends AbstractCRUDServiceImpl<MatterD
private MatterService matterService;
@Autowired
private DeviceService deviceService;
@Autowired
private DatumInfoFieldService datumInfoFieldService;
@Value("${upload.path}")
private String filePath;
......@@ -62,8 +73,8 @@ public class MatterDatumPrintServiceImpl extends AbstractCRUDServiceImpl<MatterD
}
entity.setOrderId(IdUtil.simpleUUID());
String rootPath = this.filePath.endsWith("/") ? this.filePath : this.filePath + "/";
Integer pageByDoc = WordUtil.getPageByDoc(rootPath + entity.getDocPath());
entity.setPrintPage(pageByDoc);
// Integer pageByDoc = WordUtil.getPageByDoc(rootPath + entity.getDocPath());
entity.setPrintPage(1);
if (!ObjectUtils.isEmpty(entity.getDeviceCode())) {
DeviceEntity deviceEntity = deviceService.selectOne(new DeviceQuery().deviceCode(entity.getDeviceCode()));
......@@ -88,4 +99,27 @@ public class MatterDatumPrintServiceImpl extends AbstractCRUDServiceImpl<MatterD
});
}
@Override
protected void saveAfter(MatterDatumPrintEntity entity, Context context) throws AppException {
super.saveAfter(entity, context);
//拆解数据
if (!ObjectUtils.isEmpty(entity.getFormContent())) {
Rest<List<DatumInfoFieldEntity>> rest = datumInfoFieldService.parseFormContent(entity, context);
if (rest.getCode() == YesNoEnum.YES.getValue() && !ObjectUtils.isEmpty(rest.getData())) {
datumInfoFieldService.save(rest.getData());
}
}
}
public static void main(String[] args) {
String key="ck_1_类别_<新参保登记-暂停登记-注销登记-拆分-合并-分立>";
List<String> split = StrUtil.split(key, "_");
System.out.println(split.size());
System.out.println(split.get(0));
}
}
\ No newline at end of file
......@@ -11,6 +11,11 @@
"baseUrl": "http://192.168.0.98:11078/fm",
"baseLogin": "http://192.168.0.98:11078/fm"
},
"test-remote": {
"baseUrl": "http://8.136.255.30:11078/fm",
"baseLogin": "http://8.136.255.30:11078/fm"
},
"portal": {
"baseUrl": "http://192.168.0.98:11072/zwfw",
"baseLogin": "http://192.168.0.98:11078/base"
......
......@@ -54,15 +54,16 @@ Content-Type: application/json
}
###通知列表
POST {{baseUrl}}/param/list
###解析
POST {{baseUrl}}/datum/info/field/parseForm
Content-Type: application/json
{
"page": 1,
"size": 10
}
###通知详细
GET {{baseUrl}}/home/notice/info?id=14
Authorization: {{authToken}}
......
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