Commit a90665b8 authored by neo's avatar neo

[DEV] ] add project info isProjectImportData impl

parent 88969d81
package pwc.taxtech.atms.controller;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
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;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.service.ProjectInfoService;
import java.util.List;
@RestController
@RequestMapping("/api/v1/ProjectInfo")
public class ProjectInfoController {
@Autowired
private ProjectInfoService projectInfoService;
@ApiOperation(value = "isProjectImportedData", notes = "")
@RequestMapping(value = "isProjectImportedData/{projectId}/{serviceType}/{importTypeId}", method = RequestMethod.GET)
public @ResponseBody
OperationResultDto<Boolean> isProjectImportedData(@PathVariable String projectId, @PathVariable Integer serviceType,
@PathVariable Integer importTypeId) {
return projectInfoService.isProjectImportedData(projectId, serviceType, importTypeId);
}
@ApiOperation(value = "isProjectImportedData", notes = "")
@RequestMapping(value = "isProjectImportedData/{projectId}/{importTypeId}", method = RequestMethod.GET)
public @ResponseBody
OperationResultDto<Boolean> isProjectImportedData(@PathVariable String projectId, @PathVariable Integer importTypeId) {
return projectInfoService.isProjectImportedData(projectId, importTypeId);
}
}
\ No newline at end of file
package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dto.OperationResultDto;
public interface ProjectInfoService {
OperationResultDto<Boolean> isProjectImportedData(String projectId, Integer serviceType, Integer importTypeId);
OperationResultDto<Boolean> isProjectImportedData(String projectId, Integer importTypeId);
}
package pwc.taxtech.atms.service.impl;
import org.apache.log4j.lf5.LogLevel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dao.PeriodInfoMapper;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.entitiy.PeriodInfo;
import pwc.taxtech.atms.entitiy.PeriodInfoExample;
import pwc.taxtech.atms.service.ProjectInfoService;
import sun.rmi.runtime.Log;
import java.util.List;
@Service
public class ProjectInfoServiceImpl implements ProjectInfoService {
private static final Logger LOGGER = LoggerFactory.getLogger(ProjectServiceImpl.class);
@Autowired
private PeriodInfoMapper periodInfoMapper;
@Override
public OperationResultDto<Boolean> isProjectImportedData(String projectId, Integer serviceType, Integer importTypeId) {
try {
PeriodInfoExample example = new PeriodInfoExample();
PeriodInfoExample.Criteria criteria = example.createCriteria().andProjectIDEqualTo(projectId).andImportTypeEqualTo(importTypeId);
if (serviceType != null) criteria.andServiceTypeEqualTo(serviceType);
List<PeriodInfo> piList = periodInfoMapper.selectByExample(example);
OperationResultDto<Boolean> ord = new OperationResultDto<>();
ord.setResult(piList != null & !piList.isEmpty());
ord.setData(ord.getResult());
return ord;
} catch (Exception e) {
LOGGER.warn("IsProjectImportedData method error", e);
OperationResultDto<Boolean> ord = new OperationResultDto<>();
ord.setResult(false);
ord.setData(false);
return ord;
}
}
@Override
public OperationResultDto<Boolean> isProjectImportedData(String projectId, Integer importTypeId) {
return isProjectImportedData(projectId,importTypeId);
}
}
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