Commit 355c5d38 authored by zhkwei's avatar zhkwei

CIT数据导入功能模块改bug

parent f09cd069
...@@ -31,7 +31,7 @@ public class CitImportExcelController { ...@@ -31,7 +31,7 @@ public class CitImportExcelController {
@RequestMapping(value = "/citImportExcel", method = RequestMethod.POST) @RequestMapping(value = "/citImportExcel", method = RequestMethod.POST)
public @ResponseBody public @ResponseBody
OperationResultDto citImportExcel(@RequestParam MultipartFile file, @RequestParam String orgIds, OperationResultDto citImportExcel(@RequestParam MultipartFile file, @RequestParam(required = false) String orgIds,
@RequestParam String periodDate, @RequestParam String periodDate,
@RequestParam Integer importType, @RequestParam Integer importType,
@RequestParam Integer importFileType){ @RequestParam Integer importFileType){
......
...@@ -25,6 +25,7 @@ import java.math.BigDecimal; ...@@ -25,6 +25,7 @@ import java.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@Service @Service
public class CitImportExcelServiceImpl extends BaseService { public class CitImportExcelServiceImpl extends BaseService {
...@@ -537,7 +538,7 @@ public class CitImportExcelServiceImpl extends BaseService { ...@@ -537,7 +538,7 @@ public class CitImportExcelServiceImpl extends BaseService {
List<CitDataImportLog> citDataImportLogList = new ArrayList<>(); List<CitDataImportLog> citDataImportLogList = new ArrayList<>();
// Integer period = CitCommonUtil.getPeriod(); // Integer period = CitCommonUtil.getPeriod();
String companyName = CitCommonUtil.getValue(sheet.getRow(5).getCell(1)).toString(); String companyName = CitCommonUtil.getValue(sheet.getRow(5).getCell(1)).toString();
List<Organization> organizations = getOrganizationByName(companyName); List<Organization> organizations = getOrganizationByName(companyName).stream().filter(r->r.getCode()!=null&&!("".equals(r.getCode()))).collect(Collectors.toList());
String companyCode = ""; String companyCode = "";
String orgId = ""; String orgId = "";
String taxPayerId = ""; String taxPayerId = "";
...@@ -547,6 +548,7 @@ public class CitImportExcelServiceImpl extends BaseService { ...@@ -547,6 +548,7 @@ public class CitImportExcelServiceImpl extends BaseService {
if(!orgList.contains(orgId)){ if(!orgList.contains(orgId)){
saveResult.setResult(false); saveResult.setResult(false);
saveResult.setData(false);
saveResult.setResultMsg(ErrorMessageCN.DoNotSelectCompany); saveResult.setResultMsg(ErrorMessageCN.DoNotSelectCompany);
return saveResult; return saveResult;
} }
...@@ -556,6 +558,7 @@ public class CitImportExcelServiceImpl extends BaseService { ...@@ -556,6 +558,7 @@ public class CitImportExcelServiceImpl extends BaseService {
}else{ }else{
saveResult.setResult(false); saveResult.setResult(false);
saveResult.setData(false);
saveResult.setResultMsg(ErrorMessageCN.NoCompanyError); saveResult.setResultMsg(ErrorMessageCN.NoCompanyError);
return saveResult; return saveResult;
} }
...@@ -592,7 +595,6 @@ public class CitImportExcelServiceImpl extends BaseService { ...@@ -592,7 +595,6 @@ public class CitImportExcelServiceImpl extends BaseService {
citDataImportLogList.add(citDataImportLogError); citDataImportLogList.add(citDataImportLogError);
continue; continue;
} }
System.out.println(cellValue);
citBSPrcAdjust.setBegBal(new BigDecimal(cellValue.toString().replace(",",""))); citBSPrcAdjust.setBegBal(new BigDecimal(cellValue.toString().replace(",","")));
...@@ -888,7 +890,7 @@ public class CitImportExcelServiceImpl extends BaseService { ...@@ -888,7 +890,7 @@ public class CitImportExcelServiceImpl extends BaseService {
citDataImportLogList.add(citDataImportLogError); citDataImportLogList.add(citDataImportLogError);
continue; continue;
} }
String companyCode = cellValueCode.toString(); String companyCode = cellValueCode.toString().replace(".0","");
//根据code(主体)获取机构相关信息 //根据code(主体)获取机构相关信息
List<Organization> organizations = getOrganizationByCode(companyCode); List<Organization> organizations = getOrganizationByCode(companyCode);
String companyName = ""; String companyName = "";
...@@ -969,7 +971,9 @@ public class CitImportExcelServiceImpl extends BaseService { ...@@ -969,7 +971,9 @@ public class CitImportExcelServiceImpl extends BaseService {
citSalaryAdvanceMapper.deleteByExample(example); citSalaryAdvanceMapper.deleteByExample(example);
updateImportLog(EnumCitImportType.SalaryAdvance.getCode()); updateImportLog(EnumCitImportType.SalaryAdvance.getCode());
} }
int insertBatchNum = citSalaryAdvanceMapper.insertBatch(citSalaryAdvanceList); if(citSalaryAdvanceList.size()>0){
int insertBatchNum = citSalaryAdvanceMapper.insertBatch(citSalaryAdvanceList);
}
//循环遍历成功导入的数据,组装日志记录实体并放入集合 //循环遍历成功导入的数据,组装日志记录实体并放入集合
for (Map.Entry<String, Integer> entry : companySuccessMap.entrySet()) { for (Map.Entry<String, Integer> entry : companySuccessMap.entrySet()) {
......
...@@ -106,5 +106,5 @@ public interface CitSalaryAdvanceMapper extends MyMapper { ...@@ -106,5 +106,5 @@ public interface CitSalaryAdvanceMapper extends MyMapper {
*/ */
int updateByPrimaryKey(CitSalaryAdvance record); int updateByPrimaryKey(CitSalaryAdvance record);
int insertBatch(List<CitSalaryAdvance> citSalaryAdvanceList); int insertBatch(List<CitSalaryAdvance> list);
} }
\ No newline at end of file
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<otherwise>0,</otherwise> <otherwise>0,</otherwise>
</choose> </choose>
<choose> <choose>
<when test="item.createBy != null">#{item.createdBy,jdbcType=VARCHAR},</when> <when test="item.createBy != null">#{item.createBy,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise> <otherwise>'',</otherwise>
</choose> </choose>
<choose> <choose>
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<otherwise>0,</otherwise> <otherwise>0,</otherwise>
</choose> </choose>
<choose> <choose>
<when test="item.createBy != null">#{item.createdBy,jdbcType=VARCHAR},</when> <when test="item.createBy != null">#{item.createBy,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise> <otherwise>'',</otherwise>
</choose> </choose>
<choose> <choose>
......
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
<otherwise>'',</otherwise> <otherwise>'',</otherwise>
</choose> </choose>
<choose> <choose>
<when test="item.poNo != null">#{item.poNo,jdbcType=INTEGER},</when> <when test="item.poNo != null">#{item.poNo,jdbcType=VARCHAR},</when>
<otherwise>0,</otherwise> <otherwise>'',</otherwise>
</choose> </choose>
<choose> <choose>
<when test="item.poSubjectCode != null">#{item.poSubjectCode,jdbcType=VARCHAR},</when> <when test="item.poSubjectCode != null">#{item.poSubjectCode,jdbcType=VARCHAR},</when>
......
...@@ -170,16 +170,22 @@ ...@@ -170,16 +170,22 @@
}).then(function (resp) { }).then(function (resp) {
$('#busy-indicator-container').hide(); $('#busy-indicator-container').hide();
deferred.resolve(); deferred.resolve();
if (resp.data) { if (resp.data || resp.result) {
logDto.UpdateState = $translate.instant('ImportSuccess'); logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto); vatOperationLogService.addOperationLog(logDto);
SweetAlert.success($translate.instant('ImportSuccess')); SweetAlert.success($translate.instant('ImportSuccess'));
} else { } else {
if (resp.message && resp.message.length > 0) { if (resp.message && resp.message.length > 0) {
SweetAlert.warning($translate.instant(resp.message));
} else {
SweetAlert.error($translate.instant('ImportFailed'));
}
if (resp.resultMsg && resp.resultMsg.length > 0) {
SweetAlert.warning($translate.instant(resp.resultMsg)); SweetAlert.warning($translate.instant(resp.resultMsg));
} else { } else {
SweetAlert.error($translate.instant('ImportFailed')); SweetAlert.error($translate.instant('ImportFailed'));
} }
logDto.UpdateState = $translate.instant('ImportFail'); logDto.UpdateState = $translate.instant('ImportFail');
vatOperationLogService.addOperationLog(logDto); vatOperationLogService.addOperationLog(logDto);
} }
...@@ -395,7 +401,7 @@ ...@@ -395,7 +401,7 @@
ele1.datepicker("setDate", $scope.selectedDate); ele1.datepicker("setDate", $scope.selectedDate);
}; };
$scope.initCompanyList = function () { var initCompanyList = function () {
orgService.getOrgListByUserId().success(function (data) { orgService.getOrgListByUserId().success(function (data) {
if (data) { if (data) {
$scope.companyList = data; $scope.companyList = data;
...@@ -494,6 +500,7 @@ ...@@ -494,6 +500,7 @@
$scope.setGridStyle = setGridStyle; $scope.setGridStyle = setGridStyle;
getUserPermission(); getUserPermission();
initCompanyList();
loadImportInfoDataGrid(); loadImportInfoDataGrid();
initDatePicker(); initDatePicker();
......
...@@ -162,7 +162,7 @@ ...@@ -162,7 +162,7 @@
}).then(function(resp) { }).then(function(resp) {
$('#busy-indicator-container').hide(); $('#busy-indicator-container').hide();
deferred.resolve(); deferred.resolve();
if (resp.data) { if (resp.data || resp.result) {
logDto.UpdateState = $translate.instant('ImportSuccess'); logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto); vatOperationLogService.addOperationLog(logDto);
SweetAlert.success($translate.instant('ImportSuccess')); SweetAlert.success($translate.instant('ImportSuccess'));
......
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
}).then(function(resp) { }).then(function(resp) {
$('#busy-indicator-container').hide(); $('#busy-indicator-container').hide();
deferred.resolve(); deferred.resolve();
if (resp.data) { if (resp.data || resp.result) {
logDto.UpdateState = $translate.instant('ImportSuccess'); logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto); vatOperationLogService.addOperationLog(logDto);
SweetAlert.success($translate.instant('ImportSuccess')); SweetAlert.success($translate.instant('ImportSuccess'));
......
...@@ -170,7 +170,7 @@ ...@@ -170,7 +170,7 @@
}).then(function(resp) { }).then(function(resp) {
$('#busy-indicator-container').hide(); $('#busy-indicator-container').hide();
deferred.resolve(); deferred.resolve();
if (resp.data) { if (resp.data || resp.result) {
logDto.UpdateState = $translate.instant('ImportSuccess'); logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto); vatOperationLogService.addOperationLog(logDto);
SweetAlert.success($translate.instant('ImportSuccess')); SweetAlert.success($translate.instant('ImportSuccess'));
......
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
}).then(function(resp) { }).then(function(resp) {
$('#busy-indicator-container').hide(); $('#busy-indicator-container').hide();
deferred.resolve(); deferred.resolve();
if (resp.data) { if (resp.data || resp.result) {
logDto.UpdateState = $translate.instant('ImportSuccess'); logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto); vatOperationLogService.addOperationLog(logDto);
SweetAlert.success($translate.instant('ImportSuccess')); SweetAlert.success($translate.instant('ImportSuccess'));
......
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
}).then(function(resp) { }).then(function(resp) {
$('#busy-indicator-container').hide(); $('#busy-indicator-container').hide();
deferred.resolve(); deferred.resolve();
if (resp.data) { if (resp.data || resp.result) {
logDto.UpdateState = $translate.instant('ImportSuccess'); logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto); vatOperationLogService.addOperationLog(logDto);
SweetAlert.success($translate.instant('ImportSuccess')); SweetAlert.success($translate.instant('ImportSuccess'));
......
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