Commit 57ad68e9 authored by tangwei's avatar tangwei

动态表单

parent 165d4afb
......@@ -42,5 +42,8 @@ public class AlertFrom extends BaseEntity {
@ApiModelProperty(value = "操作人名称")
private String recUserName;
@ApiModelProperty(value = "字段值字典code")
private String fieldValueCode;
}
......@@ -29,7 +29,7 @@ public class AlertFromValue extends BaseEntity {
@ApiModelProperty(value = "表单id")
private Integer alertFromId;
private Long alertFromId;
@ApiModelProperty(value = "警情id")
private Long alertCalledId;
......@@ -52,4 +52,19 @@ public class AlertFromValue extends BaseEntity {
@ApiModelProperty(value = "操作人名称")
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;
import com.baomidou.mybatisplus.annotation.TableName;
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.ApiModelProperty;
import lombok.Data;
......@@ -33,19 +35,21 @@ public class AlertFromVo{
@ApiModelProperty(value = "表单类型")
private String type;
@ApiModelProperty(value = "表单初始化值")
private String data;
@ApiModelProperty(value = "表单值")
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();
this.key = key;
this.label = label;
this.type = type;
this.data = data;
}
public AlertFromVo() {
super();
this.formItemDescr = formItemDescr;
}
......
......@@ -5,7 +5,8 @@ package com.yeejoin.amos.boot.module.jcs.api.vo;
* */
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class AlertListvalue {
@ApiModelProperty(value = "key")
......@@ -17,14 +18,21 @@ public class AlertListvalue {
@ApiModelProperty(value = "值")
private String value;
@ApiModelProperty(value = "表单id")
private Long alertFromId;
@ApiModelProperty(value = "英文名称")
private String fieldCode;
@ApiModelProperty(value = "字段值字典code")
private String fieldValueCode;
public AlertListvalue(String key, String text, String value) {
super();
this.key = key;
this.text = text;
this.value = value;
}
@Override
public String toString() {
return "AlertListvalue []";
}
}
package com.yeejoin.amos.boot.module.jcs.api.vo;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
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.stereotype.Component;
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;
@Component
public class FromList {
/**
* 数据字典
*
* */
/**
* 数据字典
*
*/
@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>();
// 组装数据
for (AlertFrom alertFrom : list) {
switch (alertFrom.getFieldType()) {
case "select":
if(alertFrom.getFieldType().equals("string")||alertFrom.getFieldType().equals("date")||alertFrom.getFieldType().equals("textarea")) {
AlertFromVo vo = new AlertFromVo(alertFrom.getFieldCode(), alertFrom.getFieldName(), alertFrom.getFieldType(), null,
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);
}
}
AlertFromVo vo = new AlertFromVo(null, null, null, null);
break;
case "date":
break;
case "radio":
break;
return listfrom;
}
default:
break;
}
public List<AlertListvalue> getdata(Collection<DataDictionary> list) {
List<AlertListvalue> listAlertListvalue = new ArrayList<AlertListvalue>();
for (DataDictionary dataDictionary : list) {
listAlertListvalue.add(new AlertListvalue(dataDictionary.getSequenceNbr().toString(),
dataDictionary.getCode(), dataDictionary.getName()));
}
return null;
return listAlertListvalue;
}
}
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;
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.vo.AlertFromVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.FromList;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
......@@ -16,8 +17,10 @@ import org.springframework.web.bind.annotation.*;
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.AlertFromValue;
import com.yeejoin.amos.boot.biz.common.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
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 java.util.Arrays;
import java.util.List;
......@@ -36,7 +39,8 @@ public class AlertFromController extends BaseController {
@Autowired
IAlertFromService iAlertFromService;
@Autowired
FromList fromList;
/**
* 新增警情表单
* @return
......@@ -97,25 +101,18 @@ public class AlertFromController extends BaseController {
* @return
*/
@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查询")
public AlertFrom selectFromdItem(HttpServletRequest request, @PathVariable String code){
public ResponseModel selectFromdItem(HttpServletRequest request, @PathVariable String code){
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_type_code", code);
//警情动态表单数据
List<AlertFrom> alertFromValue = iAlertFromService.list(queryWrapper);
List<AlertFromVo> list= fromList.getFromlist(alertFromValue);
return null;
return CommonResponseUtil.success(list);
}
......
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