1821349743@qq.com
2023-02-20 a387ff8978bd0e738e83e0277cfa38d7c3ab3080
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.product.data.sync.controller;
 
import com.product.core.config.CoreConst;
import com.product.core.controller.support.AbstractBaseController;
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.data.sync.config.CmnConst;
import com.product.data.sync.config.SystemCode;
import com.product.data.sync.service.FeDataDSService;
import com.product.data.sync.service.SyFeDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
 
 
@RestController
@RequestMapping("/api/syncfe")
public class SyFeDataController extends AbstractBaseController {
    @Autowired
    public SyFeDataService syFeDataService;
 
    @Autowired
    public FeDataDSService feDataDSService;
    @RequestMapping(value = "/sy-oracle-fun/{version}", method = RequestMethod.POST)
    public String saveSyncConfig(HttpServletRequest request) {
        try {
            //获取参数
            FieldSetEntity fse=null;
            Object bean=request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
            if(bean != null){
                RequestParameterEntity reqp=(RequestParameterEntity)bean;
                fse = reqp.getFormData();
            }
            //判断参数是否为空
            if(bean == null || fse == null) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
            //判断表名是否正常
            if (!CmnConst.PRODUCT_SYS_FUNCTIONS.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());
            }
            String uuid = syFeDataService.saveSyncFedata(fse);
                return OK();
        }catch(BaseException e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(e);
        }catch (Exception e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(SystemCode.SYSTEM_SAVE_SYNC_CONFIG_FAIL.getValue(), SystemCode.SYSTEM_SAVE_SYNC_CONFIG_FAIL.getText());
        }
    }
 
 
}