| | |
| | | import cn.gistack.sm.sjztmd.entity.TbFileStorageLocation; |
| | | import cn.gistack.sm.sjztmd.entity.TbRelResUser; |
| | | import cn.gistack.sm.sjztmd.entity.TbResStagCapDisc; |
| | | import cn.gistack.sm.sjztmd.excel.TbRelResUserExcel; |
| | | import cn.gistack.sm.sjztmd.excel.TbResStagCapDiscImportExcel; |
| | | import cn.gistack.sm.sjztmd.mapper.TbRelResUserMapper; |
| | | import cn.gistack.sm.sjztmd.mapper.TbResStagCapDiscMapper; |
| | | import cn.gistack.sm.sjztmd.service.ITbAttResBaseService; |
| | | import cn.gistack.sm.sjztmd.service.ITbResStagCapDiscService; |
| | | import cn.gistack.sm.sjztmd.util.CalculateUtils; |
| | | import cn.gistack.system.user.feign.IUserClient; |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.context.AnalysisContext; |
| | | import com.alibaba.excel.event.AnalysisEventListener; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.ObjectUtil; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void importTbResStagCapDisc(List<TbResStagCapDiscImportExcel> data,String resGuid) { |
| | | |
| | | for (int i = 0; i < data.size(); i++) { |
| | | TbResStagCapDiscImportExcel excel = data.get(0); |
| | | TbResStagCapDisc tbResStagCapDisc = Objects.requireNonNull(BeanUtil.copy(excel, TbResStagCapDisc.class)); |
| | | tbResStagCapDisc.setResGuid(resGuid); |
| | | double order = (double) i + 1; |
| | | tbResStagCapDisc.setOrderId(order); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<TbResStagCapDisc> readExcel(MultipartFile file) { |
| | | List<TbResStagCapDiscImportExcel> excelList = new ArrayList<>(); |
| | | try (InputStream inputStream = file.getInputStream()) { |
| | | EasyExcel.read(inputStream, TbResStagCapDiscImportExcel.class, new AnalysisEventListener<TbResStagCapDiscImportExcel>() { |
| | | @Override |
| | | public void invoke(TbResStagCapDiscImportExcel excelData, AnalysisContext analysisContext) { |
| | | excelList.add(excelData); |
| | | } |
| | | @Override |
| | | public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
| | | // 所有数据解析完成后的回调 |
| | | } |
| | | }).sheet().doRead(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | // 处理异常,例如返回错误消息给前端 |
| | | } |
| | | |
| | | List<TbResStagCapDisc> resultList = new ArrayList<>(); |
| | | for (int i = 0; i < excelList.size(); i++) { |
| | | TbResStagCapDiscImportExcel excel = excelList.get(0); |
| | | TbResStagCapDisc tbResStagCapDisc = Objects.requireNonNull(BeanUtil.copy(excel, TbResStagCapDisc.class)); |
| | | double order = (double) i + 1; |
| | | tbResStagCapDisc.setOrderId(order); |
| | | resultList.add(tbResStagCapDisc); |
| | | } |
| | | |
| | | |
| | | return resultList; |
| | | } |
| | | |
| | | @Override |
| | | public List<TbResStagCapDisc> getAll(TbResStagCapDisc tbResStagCapDisc) { |
| | | List<TbResStagCapDisc> list = list(Condition.getQueryWrapper(tbResStagCapDisc) |
| | | .orderByAsc("order_id") |