Commit 57ad68e9 authored by tangwei's avatar tangwei

动态表单

parent 165d4afb
...@@ -42,5 +42,8 @@ public class AlertFrom extends BaseEntity { ...@@ -42,5 +42,8 @@ public class AlertFrom extends BaseEntity {
@ApiModelProperty(value = "操作人名称") @ApiModelProperty(value = "操作人名称")
private String recUserName; private String recUserName;
@ApiModelProperty(value = "字段值字典code")
private String fieldValueCode;
} }
...@@ -29,7 +29,7 @@ public class AlertFromValue extends BaseEntity { ...@@ -29,7 +29,7 @@ public class AlertFromValue extends BaseEntity {
@ApiModelProperty(value = "表单id") @ApiModelProperty(value = "表单id")
private Integer alertFromId; private Long alertFromId;
@ApiModelProperty(value = "警情id") @ApiModelProperty(value = "警情id")
private Long alertCalledId; private Long alertCalledId;
...@@ -52,4 +52,19 @@ public class AlertFromValue extends BaseEntity { ...@@ -52,4 +52,19 @@ public class AlertFromValue extends BaseEntity {
@ApiModelProperty(value = "操作人名称") @ApiModelProperty(value = "操作人名称")
private String recUserName; private String recUserName;
public AlertFromValue() {
super();
}
public AlertFromValue(Long alertFromId, String fieldName, String fieldCode) {
super();
this.alertFromId = alertFromId;
this.fieldName = fieldName;
this.fieldCode = fieldCode;
}
} }
...@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.jcs.api.vo; ...@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.jcs.api.vo;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFromValue;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -33,19 +35,21 @@ public class AlertFromVo{ ...@@ -33,19 +35,21 @@ public class AlertFromVo{
@ApiModelProperty(value = "表单类型") @ApiModelProperty(value = "表单类型")
private String type; private String type;
@ApiModelProperty(value = "表单初始化值") @ApiModelProperty(value = "表单值")
private String data; private Items data;
public AlertFromVo(String key, String label, String type, String data) { @ApiModelProperty(value = "提交表单附加字段")
private AlertFromValue formItemDescr;
public AlertFromVo() {
super();
}
public AlertFromVo(String key, String label, String type, Items data, AlertFromValue formItemDescr) {
super(); super();
this.key = key; this.key = key;
this.label = label; this.label = label;
this.type = type; this.type = type;
this.data = data; this.data = data;
} this.formItemDescr = formItemDescr;
public AlertFromVo() {
super();
} }
......
...@@ -5,7 +5,8 @@ package com.yeejoin.amos.boot.module.jcs.api.vo; ...@@ -5,7 +5,8 @@ package com.yeejoin.amos.boot.module.jcs.api.vo;
* */ * */
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class AlertListvalue { public class AlertListvalue {
@ApiModelProperty(value = "key") @ApiModelProperty(value = "key")
...@@ -17,14 +18,21 @@ public class AlertListvalue { ...@@ -17,14 +18,21 @@ public class AlertListvalue {
@ApiModelProperty(value = "值") @ApiModelProperty(value = "值")
private String value; private String value;
@ApiModelProperty(value = "表单id")
private Long alertFromId;
@ApiModelProperty(value = "英文名称")
private String fieldCode; public AlertListvalue(String key, String text, String value) {
super();
@ApiModelProperty(value = "字段值字典code") this.key = key;
private String fieldValueCode; this.text = text;
this.value = value;
}
@Override
public String toString() {
return "AlertListvalue []";
}
} }
package com.yeejoin.amos.boot.module.jcs.api.vo; package com.yeejoin.amos.boot.module.jcs.api.vo;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.apache.velocity.runtime.directive.Foreach;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFrom; import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFrom;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFromValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.DataDictionary;
import com.yeejoin.amos.boot.module.jcs.api.service.IDataDictionaryService;
import com.yeejoin.amos.boot.module.jcs.api.service.IFireTeamService; import com.yeejoin.amos.boot.module.jcs.api.service.IFireTeamService;
@Component @Component
public class FromList { public class FromList {
/** /**
* 数据字典 * 数据字典
* *
* */ */
@Autowired @Autowired
IFireTeamService iFireTeamService; IDataDictionaryService iDataDictionaryService;
public static List<AlertFromVo> getFromlist(List<AlertFrom> list) { public List<AlertFromVo> getFromlist(List<AlertFrom> list) {
List<AlertFromVo> listfrom = new ArrayList<AlertFromVo>(); List<AlertFromVo> listfrom = new ArrayList<AlertFromVo>();
// 组装数据 // 组装数据
for (AlertFrom alertFrom : list) { for (AlertFrom alertFrom : list) {
if(alertFrom.getFieldType().equals("string")||alertFrom.getFieldType().equals("date")||alertFrom.getFieldType().equals("textarea")) {
switch (alertFrom.getFieldType()) { AlertFromVo vo = new AlertFromVo(alertFrom.getFieldCode(), alertFrom.getFieldName(), alertFrom.getFieldType(), null,
case "select": new AlertFromValue(alertFrom.getSequenceNbr(),alertFrom.getFieldName(), alertFrom.getFieldCode()));
listfrom.add(vo);
}else {
// 查询数据项 // 查询数据项
Map<String, Object> columnMap = new HashMap<>();
columnMap.put("type", alertFrom.getFieldValueCode());
Collection<DataDictionary> listDataDictionary = iDataDictionaryService.listByMap(columnMap);
AlertFromVo vo = new AlertFromVo(alertFrom.getFieldCode(), alertFrom.getFieldName(), alertFrom.getFieldType(),
new Items(getdata(listDataDictionary)), new AlertFromValue(alertFrom.getSequenceNbr(),alertFrom.getFieldName(), alertFrom.getFieldCode()));
listfrom.add(vo);
}
}
return listfrom;
}
AlertFromVo vo = new AlertFromVo(null, null, null, null);
break;
case "date":
break;
case "radio":
break;
default: public List<AlertListvalue> getdata(Collection<DataDictionary> list) {
break; List<AlertListvalue> listAlertListvalue = new ArrayList<AlertListvalue>();
} for (DataDictionary dataDictionary : list) {
listAlertListvalue.add(new AlertListvalue(dataDictionary.getSequenceNbr().toString(),
dataDictionary.getCode(), dataDictionary.getName()));
} }
return listAlertListvalue;
return null;
} }
} }
package com.yeejoin.amos.boot.module.jcs.api.vo;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 动态表单值
*
**/
@Data
public class Items {
@ApiModelProperty(value = "初始化值")
private List<AlertListvalue> items;
public Items() {
super();
}
public Items(List<AlertListvalue> items) {
super();
this.items = items;
}
}
...@@ -7,7 +7,8 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -7,7 +7,8 @@ import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertFromService; import com.yeejoin.amos.boot.module.jcs.api.service.IAlertFromService;
import com.yeejoin.amos.boot.module.jcs.api.vo.AlertFromVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.FromList;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -16,8 +17,10 @@ import org.springframework.web.bind.annotation.*; ...@@ -16,8 +17,10 @@ import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFrom; import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFrom;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFromValue; import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFromValue;
import com.yeejoin.amos.boot.biz.common.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils; import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
...@@ -36,7 +39,8 @@ public class AlertFromController extends BaseController { ...@@ -36,7 +39,8 @@ public class AlertFromController extends BaseController {
@Autowired @Autowired
IAlertFromService iAlertFromService; IAlertFromService iAlertFromService;
@Autowired
FromList fromList;
/** /**
* 新增警情表单 * 新增警情表单
* @return * @return
...@@ -97,25 +101,18 @@ public class AlertFromController extends BaseController { ...@@ -97,25 +101,18 @@ public class AlertFromController extends BaseController {
* @return * @return
*/ */
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{code}", method = RequestMethod.GET) @RequestMapping(value = "/from/{code}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询") @ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public AlertFrom selectFromdItem(HttpServletRequest request, @PathVariable String code){ public ResponseModel selectFromdItem(HttpServletRequest request, @PathVariable String code){
QueryWrapper queryWrapper = new QueryWrapper<>(); QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_type_code", code); queryWrapper.eq("alert_type_code", code);
//警情动态表单数据 //警情动态表单数据
List<AlertFrom> alertFromValue = iAlertFromService.list(queryWrapper); List<AlertFrom> alertFromValue = iAlertFromService.list(queryWrapper);
List<AlertFromVo> list= fromList.getFromlist(alertFromValue);
return CommonResponseUtil.success(list);
return null;
} }
......
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