6 changed files with 283 additions and 2 deletions
@ -1,5 +1,63 @@ |
|||
package com.ccsens.form.api; |
|||
|
|||
import com.ccsens.cloudutil.annotation.MustLogin; |
|||
import com.ccsens.form.bean.dto.FormDto; |
|||
import com.ccsens.form.bean.vo.FormVo; |
|||
import com.ccsens.form.service.IFormService; |
|||
import com.ccsens.util.JsonResponse; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Slf4j |
|||
@Api(tags = "组件相关api" , description = "") |
|||
@RestController |
|||
@RequestMapping("/form") |
|||
public class FormController { |
|||
@Resource |
|||
private IFormService formService; |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "查找表单详细信息", notes = "zy:查询表单的基本信息,组件信息,及当前用户填写的信息") |
|||
@RequestMapping(value = "/get", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<FormVo.GetFormInfo> getFormInfo(@ApiParam @Validated @RequestBody QueryDto<FormDto.GetFormInfo> params) { |
|||
log.info("查找表单详细信息:{}",params); |
|||
FormVo.GetFormInfo getFormInfo = formService.getFormInfo(params); |
|||
log.info("查找表单详细信息"); |
|||
return JsonResponse.newInstance().ok(getFormInfo); |
|||
} |
|||
|
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "查找表单详细信息", notes = "zy:查询该表单所有填写人的姓名和头像") |
|||
@RequestMapping(value = "/list", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<FormVo.FormList>> getFormList(@ApiParam @Validated @RequestBody QueryDto<FormDto.GetFormInfo> params) { |
|||
log.info("查找表单详细信息:{}",params); |
|||
List<FormVo.FormList> formLists = formService.getFormList(params.getParam()); |
|||
log.info("查找表单详细信息"); |
|||
return JsonResponse.newInstance().ok(formLists); |
|||
} |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "统计提交的信息", notes = "zy:查询该表单填写的人数,和需要统计的组件内的统计信息") |
|||
@RequestMapping(value = "/statistics", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<FormVo.StatisticsForm> statisticsForm(@ApiParam @Validated @RequestBody QueryDto<FormDto.GetFormInfo> params) { |
|||
log.info("统计提交的信息:{}",params); |
|||
FormVo.StatisticsForm formLists = formService.statisticsForm(params.getParam()); |
|||
log.info("统计提交的信息"); |
|||
return JsonResponse.newInstance().ok(formLists); |
|||
} |
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.ccsens.form.bean.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class FormDto { |
|||
@Data |
|||
@ApiModel("查找表单的详细信息") |
|||
public static class GetFormInfo{ |
|||
@NotNull |
|||
@ApiModelProperty("表单id") |
|||
private Long formId; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,122 @@ |
|||
package com.ccsens.form.bean.vo; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class FormVo { |
|||
|
|||
@Data |
|||
@ApiModel("查找表单的详细信息") |
|||
public static class GetFormInfo{ |
|||
@ApiModelProperty("表单id") |
|||
private Long formId; |
|||
@ApiModelProperty("标题") |
|||
private Long title; |
|||
@ApiModelProperty("描述") |
|||
private Long description; |
|||
@ApiModelProperty("封面图片") |
|||
private Long coverImage; |
|||
@ApiModelProperty("组件信息") |
|||
private List<FormModuleVo> moduleList; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("表单内组件的详细信息") |
|||
public static class FormModuleVo{ |
|||
@ApiModelProperty("组件id") |
|||
private Long id; |
|||
@ApiModelProperty("组件类型 (单选:radio)(多选:CheckBox)(下拉菜单:pullDown)(文本:text)(多行文本:textarea)(富文本:richText)") |
|||
private byte type; |
|||
@ApiModelProperty("图标") |
|||
private String logo; |
|||
@ApiModelProperty("名称") |
|||
private String name; |
|||
@ApiModelProperty("是否有选项 0否 1是") |
|||
private byte option; |
|||
@ApiModelProperty("关联层级数") |
|||
private byte hierarchy; |
|||
@ApiModelProperty("当前用户已填写的答案") |
|||
private String answer; |
|||
@ApiModelProperty("组件配置") |
|||
private List<FormModuleConfigVo> moduleConfigList; |
|||
@ApiModelProperty("选项信息") |
|||
private List<FormOptionVo> optionList; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("表单内组件的配置信息") |
|||
public static class FormModuleConfigVo{ |
|||
@ApiModelProperty("组件配置的id") |
|||
private Long configId; |
|||
@ApiModelProperty("类型 0显示 1校验") |
|||
private byte type; |
|||
@ApiModelProperty("配置类型code") |
|||
private String configKey; |
|||
@ApiModelProperty("内容") |
|||
private String configValue; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("表单内组件的选项信息") |
|||
public static class FormOptionVo{ |
|||
@ApiModelProperty("选项id") |
|||
private Long id; |
|||
@ApiModelProperty("选项key") |
|||
private String optionKey; |
|||
@ApiModelProperty("选项value") |
|||
private String optionValue; |
|||
@ApiModelProperty("排序") |
|||
private int sequence; |
|||
@ApiModelProperty("是否被选中 0否 1是") |
|||
private byte choose; |
|||
@ApiModelProperty("子选项") |
|||
private List<FormOptionVo> subOption; |
|||
} |
|||
|
|||
|
|||
@Data |
|||
@ApiModel("表单提交的列表") |
|||
public static class FormList{ |
|||
@ApiModelProperty("用户填写表单记录id") |
|||
private Long formUserId; |
|||
@ApiModelProperty("填写人姓名") |
|||
private String name; |
|||
@ApiModelProperty("头像") |
|||
private String avatarUrl; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("统计表单填写信息") |
|||
public static class StatisticsForm{ |
|||
@ApiModelProperty("填写的总人数") |
|||
private int nums; |
|||
@ApiModelProperty("填写人姓名") |
|||
private List<StatisticsModule> moduleList; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("需要统计的组件") |
|||
public static class StatisticsModule{ |
|||
@ApiModelProperty("组件名") |
|||
private String title; |
|||
@ApiModelProperty("填写人姓名") |
|||
private List<StatisticsVo> statisticsList; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("需要统计的组件") |
|||
public static class StatisticsVo{ |
|||
@ApiModelProperty("统计项") |
|||
private String key; |
|||
@ApiModelProperty("数量") |
|||
private int nums; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,48 @@ |
|||
package com.ccsens.form.service; |
|||
|
|||
import com.ccsens.form.bean.dto.FormDto; |
|||
import com.ccsens.form.bean.po.FormBasic; |
|||
import com.ccsens.form.bean.vo.FormVo; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Propagation; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
|||
public class FormService implements IFormService{ |
|||
|
|||
|
|||
/** |
|||
* 查看表单详细信息 |
|||
*/ |
|||
@Override |
|||
public FormVo.GetFormInfo getFormInfo(QueryDto<FormDto.GetFormInfo> params) { |
|||
return null; |
|||
} |
|||
|
|||
/** |
|||
* 获取表单的填写人列表 |
|||
*/ |
|||
@Override |
|||
public List<FormVo.FormList> getFormList(FormDto.GetFormInfo param) { |
|||
|
|||
return null; |
|||
} |
|||
|
|||
/** |
|||
* 统计表单填写信息 |
|||
*/ |
|||
@Override |
|||
public FormVo.StatisticsForm statisticsForm(FormDto.GetFormInfo param) { |
|||
return null; |
|||
} |
|||
} |
@ -0,0 +1,33 @@ |
|||
package com.ccsens.form.service; |
|||
|
|||
import com.ccsens.form.bean.dto.FormDto; |
|||
import com.ccsens.form.bean.vo.FormVo; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
public interface IFormService { |
|||
/** |
|||
* 查询表单的详细信息 |
|||
* @param params 表单id 和用户的id姓名头像等信息 |
|||
* @return 返回表单基本信息,组价信息,选项信息,和当前用户填写的信息 |
|||
*/ |
|||
FormVo.GetFormInfo getFormInfo(QueryDto<FormDto.GetFormInfo> params); |
|||
|
|||
/** |
|||
* 查询表单填写人列表 |
|||
* @param param 表单id |
|||
* @return 返回填写人的姓名和头像列表 |
|||
*/ |
|||
List<FormVo.FormList> getFormList(FormDto.GetFormInfo param); |
|||
|
|||
/** |
|||
* 统计表单内填写的信息 |
|||
* @param param 表单id |
|||
* @return 返回填写总人数,和需要被统计的组件的统计信息 |
|||
*/ |
|||
FormVo.StatisticsForm statisticsForm(FormDto.GetFormInfo param); |
|||
} |
Loading…
Reference in new issue