6c
6 天以前 5e9dda8b7daf484c658b1040de6515bae5fb7646
src/main/java/com/product/contract/controller/ProjectInfoController.java
@@ -1,5 +1,7 @@
package com.product.contract.controller;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.product.common.lang.StringUtils;
import com.product.contract.config.CmnConst;
import com.product.contract.config.SystemCode;
@@ -7,12 +9,14 @@
import com.product.contract.service.ide.IProjectInfoService;
import com.product.core.config.CoreConst;
import com.product.core.controller.support.AbstractBaseController;
import com.product.core.dao.BaseDao;
import com.product.core.entity.DataTableEntity;
import com.product.core.entity.FieldSetEntity;
import com.product.core.entity.RequestParameterEntity;
import com.product.core.exception.BaseException;
import com.product.core.spring.context.SpringMVCContextHolder;
import com.product.module.sys.version.ApiVersion;
import com.product.util.BaseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -35,6 +39,7 @@
    @Autowired
    public ProjectInfoService projectInfoService;
    /**
     * 根据uuid获取项目详情
     * @param request
@@ -58,7 +63,7 @@
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
            // 判断表名是否正常
            if (!CmnConst.LX_PROJECT_INFO.equals(fse.getTableName())) {
            if (!CmnConst.PRODUCT_PROJECT_BUSINESS.equals(fse.getTableName())) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(),
                        SystemCode.SYSTEM_TABLE_NODATA.getText());
                return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
@@ -105,7 +110,7 @@
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
            //判断表名是否正常
            if (!CmnConst.LX_PROJECT_INFO.equals(fse.getTableName())) {
            if (!CmnConst.PRODUCT_PROJECT_BUSINESS.equals(fse.getTableName())) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
                return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
            }
@@ -147,7 +152,7 @@
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
            //判断表名是否正常
            if (!CmnConst.LX_PROJECT_INFO.equals(fse.getTableName())) {
            if (!CmnConst.PRODUCT_PROJECT_BUSINESS.equals(fse.getTableName())) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
                return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
            }
@@ -195,7 +200,7 @@
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
            // 判断表名是否正常
            if (!CmnConst.LX_PROJECT_INFO.equals(fse.getTableName())) {
            if (!CmnConst.PRODUCT_PROJECT_BUSINESS.equals(fse.getTableName())) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(),
                        SystemCode.SYSTEM_TABLE_NODATA.getText());
                return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
@@ -221,7 +226,33 @@
    @RequestMapping(value = "/add-update-data-list/{version}", method = RequestMethod.POST)
    @ApiVersion(1)
    public String addUpdateDataList(HttpServletRequest request){
        FieldSetEntity fse = BaseUtil.getFieldSetEntity(request);
        if(ObjectUtil.isNotEmpty(fse)){
            projectInfoService.saveOrUpdate(fse);
        }
        return  OK();
    }
    @RequestMapping(value = "/get-data-list/{version}", method = RequestMethod.POST)
    @ApiVersion(1)
    public String getDataList(HttpServletRequest request){
        FieldSetEntity fse = BaseUtil.getFieldSetEntity(request);
        if(ObjectUtil.isNotEmpty(fse.getValues().get("dict_name"))){
            String dic_name = fse.getValues().get("dict_name").toString();
            JSONObject dataList = projectInfoService.getDataList(dic_name);
            return  OK(dataList);
        }else {
            return null;
        }
    }