Commit 41515c6b authored by kevin's avatar kevin

Merge branch 'dev_mysql' of https://gitee.com/Memorydoc/atms into dev_mysql

parents 96dd4241 64f0208c
......@@ -12,7 +12,7 @@ public class ErrorMessage {
public static final String NoSelectSheet = "NoSelectSheet";
public static final String DIDNOTSELECTPERIOD = "You should select period!";
public static final String ImportFailed = "ImportFailed!";
public static final String ImportFailed = "导入失败!";
public static final String ImportNotMatch = "导入文件与选择机构或期间不匹配!";
public static final String ExportFailed = "ExportFailed!";
public static final String NoData = "无数据!";
......
......@@ -307,7 +307,7 @@ public class AnalysisServiceImpl extends BaseService {
return null;
}
public Organization getOrg(String organizationId) {
public Organization getOrgById(String organizationId) {
OrganizationExample organizationExample = new OrganizationExample();
organizationExample.createCriteria().andIdEqualTo(organizationId);
List<Organization> organizations = organizationMapper.selectByExample(organizationExample);
......@@ -316,6 +316,15 @@ public class AnalysisServiceImpl extends BaseService {
return null;
}
public Organization getOrgByCompanyName(String companyName) {
OrganizationExample organizationExample = new OrganizationExample();
organizationExample.createCriteria().andNameEqualTo(companyName);
List<Organization> organizations = organizationMapper.selectByExample(organizationExample);
if (organizations.size() != 0)
return organizations.get(0);
return null;
}
private void importAnalysisReturnTaxExcelFile(MultipartFile file, String periodDate) {
try {
......@@ -401,6 +410,12 @@ public class AnalysisServiceImpl extends BaseService {
continue;
}
model.setCompanyName(getCellStringValue(sheet.getRow(j).getCell(0)));
try {
model.setSeqNo(getSeqNoByPeriod(getOrgByCompanyName(getCellStringValue(sheet.getRow(j).getCell(0))).getId(), selectedPer));
} catch (Exception e) {
logger.warn(getCellStringValue(sheet.getRow(j).getCell(0)) + "公司名称匹配不成功");
continue;
}
model.setFullTimeAmount(getCellBigDecimalValue(sheet.getRow(j).getCell(1)));
model.setInternAmount(getCellBigDecimalValue(sheet.getRow(j).getCell(2)));
model.setVendorAmount(getCellBigDecimalValue(sheet.getRow(j).getCell(3)));
......@@ -552,12 +567,12 @@ public class AnalysisServiceImpl extends BaseService {
model.setId(idService.nextId());
model.setPeriod(selectedPer);
model.setOrganizationId(organizationId);
model.setCompanyName(getOrg(organizationId).getName());
model.setCompanyName(getOrgById(organizationId).getName());
model.setCountry(country);
try {
model.setSeqNo(getSeqNoByPeriod(organizationId ,DateUtils.strToPeriod(periodDate)));
}catch (Exception e){
model.setSeqNo(getSeqNoByPeriod(organizationId, DateUtils.strToPeriod(periodDate)));
} catch (Exception e) {
continue;
}
model.setTaxCategory(getCellStringValue(sheet.getRow(j).getCell(0)));
......@@ -605,8 +620,8 @@ public class AnalysisServiceImpl extends BaseService {
model.setCountry(country);
Cell cell1 = sheet.getRow(j).getCell(0);
try {
model.setSeqNo(getSeqNoByPeriod(organizationId ,DateUtils.strToPeriod(periodDate)));
}catch (Exception e){
model.setSeqNo(getSeqNoByPeriod(organizationId, DateUtils.strToPeriod(periodDate)));
} catch (Exception e) {
continue;
}
model.setGmv(getCellBigDecimalValue(cell1));
......
......@@ -962,10 +962,13 @@ public class DataImportService extends BaseService {
rlits.stream().collect(Collectors.groupingBy(RedLetterInfoTable::getSubjectNum));
atsGroupRes.forEach((k, v) -> processRlits(k, v, orgIds, tmsPeriod, importType, dataImportLogs));
}
if(dataImportLogs.size() == 0)
return OperationResultDto.error(ErrorMessage.NoData);
addDataImportLog(dataImportLogs);
int isSuccess = (int) dataImportLogs.stream().filter(di -> Boolean.TRUE.equals(di.getImportResult())).count();
if (isSuccess < 1) {
return OperationResultDto.error(ErrorMessage.NoData);
return OperationResultDto.error(ErrorMessage.ImportNotMatch);
}
return operationResultDto.success();
} catch (Exception e) {
......@@ -1068,6 +1071,8 @@ public class DataImportService extends BaseService {
atsGroupRes.forEach((k, v) -> processAts(k, v, orgIds, tmsPeriod, importType, dataImportLogs));
}
addDataImportLog(dataImportLogs);
if(dataImportLogs.size() == 0)
return OperationResultDto.error(ErrorMessage.NoData);
int isSuccess = (int) dataImportLogs.stream().filter(di -> Boolean.TRUE.equals(di.getImportResult())).count();
if (isSuccess < 1) {
return OperationResultDto.error(ErrorMessage.ImportNotMatch);
......@@ -1172,9 +1177,12 @@ public class DataImportService extends BaseService {
atsGroupRes.forEach((k, v) -> processCprs(k, v, orgIds, tmsPeriod, importType, dataImportLogs));
}
int isSuccess = (int) dataImportLogs.stream().filter(di -> Boolean.TRUE.equals(di.getImportResult())).count();
if(dataImportLogs.size() == 0)
return OperationResultDto.error(ErrorMessage.NoData);
addDataImportLog(dataImportLogs);
if (isSuccess < 1) {
return OperationResultDto.error(ErrorMessage.NoData);
return OperationResultDto.error(ErrorMessage.ImportNotMatch);
}
return OperationResultDto.success();
} catch (ServiceException e) {
......@@ -1458,10 +1466,13 @@ public class DataImportService extends BaseService {
irs.stream().collect(Collectors.groupingBy(InvoiceRecord::getBillingBody));
atsGroupRes.forEach((k, v) -> processIrs(k, v, orgIds, tmsPeriod, importType, dataImportLogs));
}
if(dataImportLogs.size() == 0)
return OperationResultDto.error(ErrorMessage.NoData);
int isSuccess = (int) dataImportLogs.stream().filter(di -> Boolean.TRUE.equals(di.getImportResult())).count();
addDataImportLog(dataImportLogs);
if (isSuccess < 1) {
return OperationResultDto.error(ErrorMessage.NoData);
return OperationResultDto.error(ErrorMessage.ImportNotMatch);
}
return OperationResultDto.success();
} catch (ServiceException 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