package com.product.face.controller;
|
|
import com.product.core.entity.FieldSetEntity;
|
import com.product.core.exception.BaseException;
|
import com.product.core.spring.context.SpringMVCContextHolder;
|
import com.product.face.config.ErrorCode;
|
import com.product.face.config.FaceConst;
|
import com.product.face.service.FaceApplyService;
|
import com.product.module.sys.version.ApiVersion;
|
import com.product.util.BaseUtil;
|
import com.product.util.support.AbstractBaseController;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.annotation.Resource;
|
import javax.servlet.http.HttpServletRequest;
|
|
/**
|
* @Author cheng
|
* @Date 2023/5/17 10:17
|
* @Desc 表单应用控制层
|
*/
|
@RestController
|
@RequestMapping("/api/face/apply")
|
public class FaceApplyController extends AbstractBaseController {
|
|
@Resource
|
private FaceApplyService faceApplyService;
|
|
/**
|
* 获取表格列配置
|
*
|
* @param request
|
* @return
|
*/
|
@PostMapping("/get-list-column/{version}")
|
@ApiVersion(1)
|
public String getListColumn(HttpServletRequest request) {
|
try {
|
FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, FaceConst.TABLE_FACE_CONFIG);
|
return success(faceApplyService.getFaceListConf(fse));
|
} catch (BaseException e) {
|
e.printStackTrace();
|
return error(e);
|
} catch (Exception e) {
|
e.printStackTrace();
|
SpringMVCContextHolder.getSystemLogger().error(e);
|
return error(ErrorCode.GET_FACE_COLUMN_FAIL, e);
|
}
|
}
|
|
/**
|
* 录入表单获取配置
|
*
|
* @param request
|
* @return
|
*/
|
@PostMapping("/get-form-conf/{version}")
|
@ApiVersion(1)
|
public String getFormConf(HttpServletRequest request) {
|
try {
|
FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, FaceConst.TABLE_FACE_CONFIG);
|
return faceApplyService.getFaceFormConfig(fse);
|
} catch (BaseException e) {
|
e.printStackTrace();
|
return error(e);
|
} catch (Exception e) {
|
e.printStackTrace();
|
SpringMVCContextHolder.getSystemLogger().error(e);
|
return error(ErrorCode.GET_FACE_CONFIG_FAIL, e);
|
}
|
}
|
|
/**
|
* 获取表单中使用的参照
|
*/
|
@PostMapping("/get-face-reference/{version}")
|
@ApiVersion(1)
|
public String getFaceReference(HttpServletRequest request) {
|
try {
|
FieldSetEntity fse = BaseUtil.getFieldSetEntity(request);
|
return BaseUtil.success(faceApplyService.getFaceReference(fse));
|
} catch (BaseException e) {
|
e.printStackTrace();
|
return error(e);
|
} catch (Exception e) {
|
e.printStackTrace();
|
SpringMVCContextHolder.getSystemLogger().error(e);
|
return error(ErrorCode.GET_FACE_CONFIG_FAIL, e);
|
}
|
}
|
}
|