Commit 44f8a49e authored by frank.xa.zhang's avatar frank.xa.zhang

add controller delete template method

parent 0325154e
......@@ -8,10 +8,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.common.ApplicationException;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.TemplateDto;
import pwc.taxtech.atms.dto.TemplateUniqDto;
import pwc.taxtech.atms.dto.UpateNameParam;
import pwc.taxtech.atms.common.ftp.FTPClientPool;
import pwc.taxtech.atms.dto.*;
import pwc.taxtech.atms.service.TemplateService;
import javax.servlet.http.HttpServletResponse;
......@@ -27,6 +25,9 @@ public class TemplateController {
@Autowired
TemplateService templateService;
@Autowired
FTPClientPool ftpClientPool;
//todo:
//[Route("getTemplateJson")]
// [HttpGet]
......@@ -108,9 +109,22 @@ public class TemplateController {
return templateService.getTemplateUniqList(serviceTypeID, payTaxType, reportType, industryIDs);
}
@RequestMapping(value = "updateTemplateName",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
OperationResultDto<Object> updateTemplateName(@RequestBody UpateNameParam param){
@RequestMapping(value = "updateTemplateName", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
OperationResultDto<Object> updateTemplateName(@RequestBody UpateNameParam param) {
return templateService.updateTemplateName(param);
}
@RequestMapping(value = "deleteTemplate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
OperationResultDto<String> deleteTemplate(@RequestBody DeleteTemplateParam param) {
OperationResultDto<String> result = templateService.deleteTemplate(param);
if (result.getResult() && StringUtils.isNotBlank(result.getData())) {
try {
ftpClientPool.delete(result.getData());
} catch (Exception e) {
}
}
return result;
}
}
......@@ -53,9 +53,8 @@ public class TemplateGroupController {
List<String> pathList = (List<String>) result.getData();
if (pathList != null && pathList.size() > 0) {
for(String path:pathList){
String pathAndName = path;
try {
ftpClientPool.delete(pathAndName);
ftpClientPool.delete(path);
}
catch(Exception e){
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment