Commit 191131b4 by 翁国栋 Committed by 284718418@qq.com

8小时运营后台--

批量导入员工
更改日志排序
parent f6a6f656
...@@ -14,9 +14,11 @@ import java.util.Map; ...@@ -14,9 +14,11 @@ import java.util.Map;
import cn.timer.api.bean.insure.InsureLog; import cn.timer.api.bean.insure.InsureLog;
import cn.timer.api.bean.insure.InsureProduct; import cn.timer.api.bean.insure.InsureProduct;
import cn.timer.api.bean.qyzx.QyzxEntInfoM;
import cn.timer.api.config.annotation.CurrentUser; import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean; import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.dao.insure.InsureLogMapper; import cn.timer.api.dao.insure.InsureLogMapper;
import cn.timer.api.dto.insure.InsureDto;
import cn.timer.api.dto.insure.PolicyLogDto; import cn.timer.api.dto.insure.PolicyLogDto;
import cn.timer.api.utils.Page; import cn.timer.api.utils.Page;
import cn.timer.api.utils.Result; import cn.timer.api.utils.Result;
...@@ -27,11 +29,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -27,11 +29,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -114,4 +118,5 @@ public class InsureLogController { ...@@ -114,4 +118,5 @@ public class InsureLogController {
return ResultUtil.data(map); return ResultUtil.data(map);
} }
} }
...@@ -4,6 +4,7 @@ import lombok.AllArgsConstructor; ...@@ -4,6 +4,7 @@ import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
...@@ -19,7 +20,7 @@ import java.util.List; ...@@ -19,7 +20,7 @@ import java.util.List;
@AllArgsConstructor @AllArgsConstructor
public class InsureDto { public class InsureDto {
private String id; private String id;
private String orgCode;/*劳动合同*/ private String orgCode;/*企业id*/
private String companyName;/*用工单位实际工作单位*/ private String companyName;/*用工单位实际工作单位*/
private String policyDateStart; private String policyDateStart;
private String policyDateEnd; private String policyDateEnd;
...@@ -32,6 +33,7 @@ public class InsureDto { ...@@ -32,6 +33,7 @@ public class InsureDto {
private String[] oldIds; private String[] oldIds;
private String[] userIds; private String[] userIds;
private Double totalPrice; private Double totalPrice;
private MultipartFile file;
// private String // private String
} }
...@@ -41,27 +41,25 @@ public class ExcelUtils { ...@@ -41,27 +41,25 @@ public class ExcelUtils {
* @param sheetNum 开始解析的sheet序号,如果不指定,默认传值为-1,则会解析所有sheet * @param sheetNum 开始解析的sheet序号,如果不指定,默认传值为-1,则会解析所有sheet
* @return * @return
*/ */
public static List<List<Map<String, Object>>> importExcel(String filePath, int startRow, int startCol, int sheetNum) { public static List<List<Map<String, Object>>> importExcel(XSSFWorkbook workbook, int startRow, int startCol, int sheetNum) {
logger.info("========================= ExcelUtils.java ->> importExcel()从Excel表格中获取数据 ->> 开始 ========================="); logger.info("========================= ExcelUtils.java ->> importExcel()从Excel表格中获取数据 ->> 开始 =========================");
// 用于存储最终整个Excel表格的数据 // // 用于存储最终整个Excel表格的数据
List<List<Map<String, Object>>> resultList = new ArrayList<>(); List<List<Map<String, Object>>> resultList = new ArrayList<>();
//
// 得到指定路径的文件File对象 // // 得到指定路径的文件File对象
File file = new File(filePath); // File file = new File(filePath);
// 如果不存在 // // 如果不存在
if (!file.exists()) { // if (!file.exists()) {
logger.info("ExcelUtils.java ->> importExcel() ->> 错误操作:要读取Excel文件在指定路径(" + filePath + ")下找不到"); // logger.info("ExcelUtils.java ->> importExcel() ->> 错误操作:要读取Excel文件在指定路径(" + filePath + ")下找不到");
throw new RuntimeException("错误操作:要读取Excel文件在指定路径(" + filePath + ")下找不到"); // throw new RuntimeException("错误操作:要读取Excel文件在指定路径(" + filePath + ")下找不到");
} // }
InputStream input = null; InputStream input = null;
Workbook workbook = null;
try { try {
// 得到文件的资源输入流 // 得到文件的资源输入流
input = new FileInputStream(file); // input = new FileInputStream(file);
// 得到处理excel的Workbook对象 // 得到处理excel的Workbook对象
workbook = ExcelUtils.getWorkbookByExtensionName(input, filePath);
// 创建一个公式计算器,用于计算并得到Excel中的公式结果 // 创建一个公式计算器,用于计算并得到Excel中的公式结果
FormulaEvaluator formulaEvaluator = workbook.getCreationHelper().createFormulaEvaluator(); FormulaEvaluator formulaEvaluator = workbook.getCreationHelper().createFormulaEvaluator();
...@@ -491,6 +489,23 @@ public class ExcelUtils { ...@@ -491,6 +489,23 @@ public class ExcelUtils {
// 设置垂直对齐的样式为居中对齐 // 设置垂直对齐的样式为居中对齐
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
} }
/**
* 把单元格的内容转为字符串
*
* @param xssfCell 单元格
* @return String
*/
public static String getString(XSSFCell xssfCell) {
if (xssfCell == null) {
return "";
}
if (xssfCell.getCellTypeEnum() == CellType.NUMERIC) {
return String.valueOf(xssfCell.getNumericCellValue());
} else if (xssfCell.getCellTypeEnum() == CellType.BOOLEAN) {
return String.valueOf(xssfCell.getBooleanCellValue());
} else {
return xssfCell.getStringCellValue();
}
}
} }
...@@ -187,7 +187,8 @@ ...@@ -187,7 +187,8 @@
<select id="selectLogListByOrgCode" resultType="cn.timer.api.dto.insure.PolicyLogDto"> <select id="selectLogListByOrgCode" resultType="cn.timer.api.dto.insure.PolicyLogDto">
select ip.policy_no as policyNo,il.return_code as returnCode,il.return_msg as returnMsg,il.type as type,il.create_time as createTime from insure_log il select ip.policy_no as policyNo,il.return_code as returnCode,il.return_msg as returnMsg,il.type as type,il.create_time as createTime from insure_log il
LEFT JOIN insure_policy ip on ip.id=il.policy_id LEFT JOIN insure_policy ip on ip.id=il.policy_id
WHERE ip.org_code = #{orgCode} WHERE ip.org_code = #{orgCode
order by ip.create_time
<if test="page.currentPage != null and page.totalPage != null"> <if test="page.currentPage != null and page.totalPage != null">
limit #{page.offset}, #{page.totalPage} limit #{page.offset}, #{page.totalPage}
</if> </if>
......
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