Commit 8a9b7856 authored by neo's avatar neo

[DEV] project info impl

parent f84d9a66
...@@ -10,8 +10,8 @@ import org.springframework.web.bind.annotation.RequestMethod; ...@@ -10,8 +10,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.taxadmin.PeriodInfoDto;
import pwc.taxtech.atms.dto.vatdto.QueryImportType; import pwc.taxtech.atms.dto.vatdto.QueryImportType;
import pwc.taxtech.atms.entitiy.PeriodInfo;
import pwc.taxtech.atms.service.IdentityService; import pwc.taxtech.atms.service.IdentityService;
import pwc.taxtech.atms.service.ProjectInfoService; import pwc.taxtech.atms.service.ProjectInfoService;
...@@ -43,7 +43,7 @@ public class ProjectInfoController { ...@@ -43,7 +43,7 @@ public class ProjectInfoController {
@ApiOperation(value = "getProjectImportType", notes = "") @ApiOperation(value = "getProjectImportType", notes = "")
@RequestMapping(value = "getProjectImportType", method = RequestMethod.GET) @RequestMapping(value = "getProjectImportType", method = RequestMethod.GET)
public OperationResultDto<List<PeriodInfoDto>> getProjectImportType(@RequestBody QueryImportType queryImportType) { public OperationResultDto<List<PeriodInfo>> getProjectImportType(@RequestBody QueryImportType queryImportType) {
return projectInfoService.getProjectImportType(queryImportType.getProjectId(), queryImportType.getPeriods(), return projectInfoService.getProjectImportType(queryImportType.getProjectId(), queryImportType.getPeriods(),
queryImportType.getServiceTypeId() queryImportType.getServiceTypeId()
, identityService.getIdentityUser().getID()); , identityService.getIdentityUser().getID());
...@@ -53,6 +53,6 @@ public class ProjectInfoController { ...@@ -53,6 +53,6 @@ public class ProjectInfoController {
@RequestMapping(value = "getImportType/{projectID}/{periodID}/{serviceType}", method = RequestMethod.GET) @RequestMapping(value = "getImportType/{projectID}/{periodID}/{serviceType}", method = RequestMethod.GET)
public ResponseEntity getImportType(@PathVariable String projectID, @PathVariable Integer periodID, public ResponseEntity getImportType(@PathVariable String projectID, @PathVariable Integer periodID,
@PathVariable Integer serviceType) { @PathVariable Integer serviceType) {
return ResponseEntity.ok().body(projectInfoService.getImportType(projectID,periodID,identityService.getIdentityUser().getID(),serviceType)); return ResponseEntity.ok().body(projectInfoService.getImportType(projectID, periodID, identityService.getIdentityUser().getID(), serviceType));
} }
} }
\ No newline at end of file
package pwc.taxtech.atms.dto.taxadmin;
public class PeriodInfoDto {
private String iD;
private String projectID;
private Integer period;
private Integer status;
private String creatorID;
private String projectInfo;
private Integer importType;
private Integer serviceType;
public String getiD() {
return iD;
}
public void setiD(String iD) {
this.iD = iD;
}
public String getProjectID() {
return projectID;
}
public void setProjectID(String projectID) {
this.projectID = projectID;
}
public Integer getPeriod() {
return period;
}
public void setPeriod(Integer period) {
this.period = period;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getCreatorID() {
return creatorID;
}
public void setCreatorID(String creatorID) {
this.creatorID = creatorID;
}
public String getProjectInfo() {
return projectInfo;
}
public void setProjectInfo(String projectInfo) {
this.projectInfo = projectInfo;
}
public Integer getImportType() {
return importType;
}
public void setImportType(Integer importType) {
this.importType = importType;
}
public Integer getServiceType() {
return serviceType;
}
public void setServiceType(Integer serviceType) {
this.serviceType = serviceType;
}
}
package pwc.taxtech.atms.service; package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.taxadmin.PeriodInfoDto; import pwc.taxtech.atms.entitiy.PeriodInfo;
import java.util.List; import java.util.List;
...@@ -10,7 +10,7 @@ public interface ProjectInfoService { ...@@ -10,7 +10,7 @@ public interface ProjectInfoService {
OperationResultDto<Boolean> isProjectImportedData(String projectId, Integer importTypeId); OperationResultDto<Boolean> isProjectImportedData(String projectId, Integer importTypeId);
OperationResultDto<List<PeriodInfoDto>> getProjectImportType(String projectId, List<Integer> periods, Integer serviceTypeId, String id); OperationResultDto<List<PeriodInfo>> getProjectImportType(String projectId, List<Integer> periods, Integer serviceTypeId, String id);
Integer getImportType(String projectID, Integer periodID, String id, Integer serviceType); Integer getImportType(String projectID, Integer periodID, String id, Integer serviceType);
} }
...@@ -7,7 +7,6 @@ import org.springframework.stereotype.Service; ...@@ -7,7 +7,6 @@ import org.springframework.stereotype.Service;
import pwc.taxtech.atms.constant.enums.TbImportType; import pwc.taxtech.atms.constant.enums.TbImportType;
import pwc.taxtech.atms.dao.PeriodInfoMapper; import pwc.taxtech.atms.dao.PeriodInfoMapper;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.taxadmin.PeriodInfoDto;
import pwc.taxtech.atms.entitiy.PeriodInfo; import pwc.taxtech.atms.entitiy.PeriodInfo;
import pwc.taxtech.atms.entitiy.PeriodInfoExample; import pwc.taxtech.atms.entitiy.PeriodInfoExample;
import pwc.taxtech.atms.service.ProjectInfoService; import pwc.taxtech.atms.service.ProjectInfoService;
...@@ -52,8 +51,34 @@ public class ProjectInfoServiceImpl implements ProjectInfoService { ...@@ -52,8 +51,34 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
} }
@Override @Override
public OperationResultDto<List<PeriodInfoDto>> getProjectImportType(String projectId, List<Integer> periods, Integer serviceTypeId, String id) { public OperationResultDto<List<PeriodInfo>> getProjectImportType(String projectId, List<Integer> periods, Integer serviceTypeId, String id) {
return null; PeriodInfoExample example = new PeriodInfoExample();
example.createCriteria().andProjectIDEqualTo(projectId).andPeriodIn(periods);
List<PeriodInfo> existed = periodInfoMapper.selectByExample(example);
periods.forEach(m -> {
if (!existed.stream().anyMatch(n -> {
return n.getPeriod().intValue() == m.intValue();
})) {
PeriodInfo info = new PeriodInfo();
info.setID(UUID.randomUUID().toString());
info.setProjectID(projectId);
info.setPeriod(m);
info.setStatus(0);
info.setCreatorID(id);
info.setImportType(TbImportType.UnImported.getCode());
info.setServiceType(serviceTypeId);
info.setCreateTime(new Date());
info.setUpdateTime(new Date());
periodInfoMapper.insert(info);
}
});
example.createCriteria().andProjectIDEqualTo(projectId).andServiceTypeEqualTo(serviceTypeId);
OperationResultDto<List<PeriodInfo>> resultDto = new OperationResultDto();
resultDto.setResult(true);
resultDto.setResultMsg("");
resultDto.setData(periodInfoMapper.selectByExample(example));
return resultDto;
} }
@Override @Override
...@@ -61,8 +86,8 @@ public class ProjectInfoServiceImpl implements ProjectInfoService { ...@@ -61,8 +86,8 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
PeriodInfoExample example = new PeriodInfoExample(); PeriodInfoExample example = new PeriodInfoExample();
example.createCriteria().andProjectIDEqualTo(projectID).andProjectIDEqualTo(projectID).andServiceTypeEqualTo(serviceType); example.createCriteria().andProjectIDEqualTo(projectID).andProjectIDEqualTo(projectID).andServiceTypeEqualTo(serviceType);
List<PeriodInfo> periodInfoList =periodInfoMapper.selectByExample(example); List<PeriodInfo> periodInfoList = periodInfoMapper.selectByExample(example);
if(periodInfoList==null || periodInfoList.size()==0){ if (periodInfoList == null || periodInfoList.size() == 0) {
PeriodInfo periodInfo = new PeriodInfo(); PeriodInfo periodInfo = new PeriodInfo();
periodInfo.setID(UUID.randomUUID().toString()); periodInfo.setID(UUID.randomUUID().toString());
periodInfo.setProjectID(projectID); periodInfo.setProjectID(projectID);
...@@ -76,7 +101,7 @@ public class ProjectInfoServiceImpl implements ProjectInfoService { ...@@ -76,7 +101,7 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
periodInfoMapper.insert(periodInfo); periodInfoMapper.insert(periodInfo);
return TbImportType.UnImported.getCode(); return TbImportType.UnImported.getCode();
}else { } else {
return periodInfoList.get(FIRST_OR_DEFAULT).getImportType(); return periodInfoList.get(FIRST_OR_DEFAULT).getImportType();
} }
......
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