|
@@ -0,0 +1,57 @@
|
|
|
|
+package com.management.platform.service.impl;
|
|
|
|
+
|
|
|
|
+import com.alibaba.excel.support.ExcelTypeEnum;
|
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.management.platform.entity.ContractBonusDetail;
|
|
|
|
+import com.management.platform.entity.vo.ImportBonusTemplateVO;
|
|
|
|
+import com.management.platform.mapper.ContractBonusDetailMapper;
|
|
|
|
+import com.management.platform.mapper.ReportMapper;
|
|
|
|
+import com.management.platform.service.ContractBonusDetailService;
|
|
|
|
+import com.management.platform.util.HttpRespMsg;
|
|
|
|
+import com.management.platform.util.MessageUtils;
|
|
|
|
+import com.management.platform.util.converter.ExcelTemplateTransUtil;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.io.InputStream;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+@Service
|
|
|
|
+public class ContractBonusDetailServiceImpl extends ServiceImpl<ContractBonusDetailMapper, ContractBonusDetail> implements ContractBonusDetailService {
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private ContractBonusDetailMapper contractBonusDetailMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private ReportMapper reportMapper;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg transTemplateData(Integer startDate, Integer endDate, String bonusType, MultipartFile file) {
|
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
|
+ //解析文件
|
|
|
|
+ InputStream inputStream = null;
|
|
|
|
+ try {
|
|
|
|
+ inputStream = file.getInputStream();
|
|
|
|
+ List<ImportBonusTemplateVO> importDataList = ExcelTemplateTransUtil
|
|
|
|
+ .readExcelConverterObjectList(inputStream, ExcelTypeEnum.XLSX, ImportBonusTemplateVO.class);
|
|
|
|
+// System.out.println("=========in==========");
|
|
|
|
+// importDataList.forEach(System.out::println);
|
|
|
|
+
|
|
|
|
+ inputStream.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ httpRespMsg.setError(MessageUtils.message(""));
|
|
|
|
+ }finally {
|
|
|
|
+ if(null != inputStream){
|
|
|
|
+ try {
|
|
|
|
+ inputStream.close();
|
|
|
|
+ } catch (IOException ex) {
|
|
|
|
+ ex.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }
|
|
|
|
+}
|