TemplateFormulaController.java 1.42 KB
Newer Older
1 2 3 4 5 6
package pwc.taxtech.atms.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
7 8 9 10 11
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.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
12
import pwc.taxtech.atms.dto.OperationResultDto;
13
import pwc.taxtech.atms.service.impl.TemplateFormulaServiceImpl;
14 15 16 17 18

@RestController
@RequestMapping(value = "api/v1/templateFormula")
public class TemplateFormulaController {
    @Autowired
19
    TemplateFormulaServiceImpl templateFormulaService;
20 21 22 23

    private static final Logger logger = LoggerFactory.getLogger(TemplateFormulaController.class);

    @RequestMapping(value = "validate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
24 25
    public @ResponseBody
    OperationResultDto validate(@RequestBody(required = false) String fromula) {
26
        try {
27
            return templateFormulaService.validate(fromula);
28 29 30 31 32 33 34 35 36
        } catch (Exception e) {
            logger.error("TemplateFormulaController Valdate", e);
            OperationResultDto result = new OperationResultDto();
            result.setResult(false);
            return result;
        }
    }

}