Commit 97d8641c authored by hongguangwu's avatar hongguangwu

MVP1.6.2-工资原表识别-主逻辑提交

parent ea09b65b
......@@ -17,7 +17,6 @@
package com.yifu.cloud.plus.v1.yifu.salary.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
......@@ -34,25 +33,16 @@ import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandardOriginalDetail;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryStandardOriginalDetailService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryStandardOriginalService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelSheetVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryOriginalVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryUploadOriginalParamVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItem;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
......@@ -134,7 +124,7 @@ public class TSalaryStandardOriginalController {
if (Common.isNotNull(tSalaryStandardOriginal.getId())
&& Common.isNotNull(tSalaryStandardOriginal.getDeptId())
&& Common.isNotNull(tSalaryStandardOriginal.getSetName())){
&& Common.isNotNull(tSalaryStandardOriginal.getSetName())) {
List<TSalaryStandardOriginalDetail> detailList = tSalaryStandardOriginal.getDetailList();
if (detailList == null || detailList.isEmpty()) {
return R.failed("请传配置表头list");
......
......@@ -17,7 +17,6 @@
package com.yifu.cloud.plus.v1.yifu.salary.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -32,7 +31,10 @@ import com.yifu.cloud.plus.v1.yifu.salary.service.SalaryUploadService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryStandardOriginalDetailService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryStandardOriginalService;
import com.yifu.cloud.plus.v1.yifu.salary.util.SalaryConstants;
import com.yifu.cloud.plus.v1.yifu.salary.vo.*;
import com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelColumnVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelSheetVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryUploadOriginalParamVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryUploadParamVo;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.apache.poi.hssf.usermodel.*;
......@@ -80,6 +82,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
public IPage<TSalaryStandardOriginal> getTSalaryStandardOriginalPage(Page<TSalaryStandardOriginal> page, TSalaryStandardOriginal tSalaryStandardOriginal) {
return baseMapper.getTSalaryStandardOriginalPage(page, tSalaryStandardOriginal);
}
/**
* @Description: 分页查询
* @Author: hgw
......@@ -210,7 +213,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
cellValue = row.getCell(cellNum).getStringCellValue();
}
} catch (Exception e) {
sheetVo.setErrorInfo("请注意单元格格式,第"+(i+1) +"个sheet,第"+(rowNum+1)+"行第"+(cellNum+1)+"列。"+e.getMessage());
sheetVo.setErrorInfo("请注意单元格格式,第" + (i + 1) + "个sheet,第" + (rowNum + 1) + "行第" + (cellNum + 1) + "列。" + e.getMessage());
return sheetVo;
}
if (Common.isNotNull(cellValue)) {
......@@ -333,7 +336,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
cellValue = row.getCell(cellNum).getStringCellValue();
}
} catch (Exception e) {
sheetVo.setErrorInfo("请注意单元格格式,第"+(i+1) +"个sheet,第"+(rowNum+1)+"行第"+(cellNum+1)+"列。"+e.getMessage());
sheetVo.setErrorInfo("请注意单元格格式,第" + (i + 1) + "个sheet,第" + (rowNum + 1) + "行第" + (cellNum + 1) + "列。" + e.getMessage());
return sheetVo;
}
if (Common.isNotNull(cellValue)) {
......@@ -503,7 +506,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
Map<String, String> newRowMap;
String value;
String oldValue;
int i=0;
int i = 0;
for (Map<String, String> rowMap : vo.getContentList()) {
i++;
newRowMap = new HashMap<>();
......@@ -521,7 +524,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
.setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP));
}
} catch (NumberFormatException e) {
return R.failed("第 "+ i + " 行,第 "+ (Integer.parseInt(column.getKey())+1) +" 列 不是金额,不可以进行加减计算!" );
return R.failed("第 " + i + " 行,第 " + (Integer.parseInt(column.getKey()) + 1) + " 列 不是金额,不可以进行加减计算!");
}
newRowMap.put(detail.getModelName(), value);
}
......
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