当前位置: 首页 > news >正文

南京网站优化多少钱天津百度推广

南京网站优化多少钱,天津百度推广,网站建设 淄博 兼职,中企动力官网登录目录 效果pom.xmlapplication.ymlcontrollerservice依赖类前台vue代码某个功能如果需要添加大量的数据,通过一条条的方式添加的方式,肯定不合理,本文通过excel导入的方式来实现该功能,100条数据导入成功85条,失败15条,肯定需要返回一个表格给前台或者返回1个错误excel给前…

目录

  • 效果
  • pom.xml
  • application.yml
  • controller
  • service
  • 依赖类
  • 前台
    • vue代码

某个功能如果需要添加大量的数据,通过一条条的方式添加的方式,肯定不合理,本文通过excel导入的方式来实现该功能,100条数据导入成功85条,失败15条,肯定需要返回一个表格给前台或者返回1个错误excel给前台,本文就实现这两个功能

效果

在这里插入图片描述

  • 模版 storeTemplate.xlsx
    在这里插入图片描述

在这里插入图片描述

  • 点击确定,会直接下载excel错误文件,打开如下图
    在这里插入图片描述
  • 删除第一行 第一列后,修正后,可再次导入,方便调整错误数据

pom.xml

<!-- easypoi-spring-boot-starter --><dependency><groupId>cn.afterturn</groupId><artifactId>easypoi-spring-boot-starter</artifactId><version>4.1.3</version></dependency>

application.yml

#####模板下载位置
downloadTemplate:storePath: storeTemplate.xlsx
  • 提供部分代码,主要是了解思路,可参考实现

controller

package com.zyee.iopace.web.controller;import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import com.zyee.iopace.web.config.annotation.Log;
import com.zyee.iopace.web.config.exception.BusinessException;
import com.zyee.iopace.web.dto.station.DeleteBatchPhotoDto;
import com.zyee.iopace.web.dto.station.StationStoreAddDto;
import com.zyee.iopace.web.dto.station.StationStoreDto;
import com.zyee.iopace.web.dto.store.DeleteStoreBatchPhotoDto;
import com.zyee.iopace.web.dto.store.StationStoreUpdateDto;
import com.zyee.iopace.web.dto.store.StoreBindStationDto;
import com.zyee.iopace.web.dto.store.StoreChangeTrackDto;
import com.zyee.iopace.web.entity.*;
import com.zyee.iopace.web.enums.BusinessType;
import com.zyee.iopace.web.enums.EcologyType;
import com.zyee.iopace.web.enums.StationStateEnum;
import com.zyee.iopace.web.enums.StoreStatusType;
import com.zyee.iopace.web.response.ResponseResult;
import com.zyee.iopace.web.service.*;
import com.zyee.iopace.web.utils.BeanCopyUtils;
import com.zyee.iopace.web.utils.PageUtils;
import com.zyee.iopace.web.vo.station.StationStoreDetailVo;
import com.zyee.iopace.web.vo.station.StationStoreVo;
import com.zyee.iopace.web.vo.store.StoreChangeTrackListVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.*;
import java.util.stream.Collectors;@Slf4j
@Api(tags = "库存管理")
@RestController
@RequestMapping("/stationStore")
public class StationStoreController {@Autowiredprivate StoreReviseRecordService storeReviseRecordService;@ApiOperation(value = "导入库存信息")@Log(title = "导入库存信息", businessType = BusinessType.IMPORT)@PostMapping("/importStore")public ResponseResult importStore(@RequestParam MultipartFile file, HttpServletResponse response) throws Exception {return ResponseResult.SUCCESS(stationStoreService.importStore(file,response));}
}

service

package com.zyee.iopace.web.service;import com.zyee.iopace.web.dto.dept.DeptSearchDto;
import com.zyee.iopace.web.dto.station.StationStoreAddDto;
import com.zyee.iopace.web.dto.station.StationStoreDto;
import com.zyee.iopace.web.dto.store.StationStoreUpdateDto;
import com.zyee.iopace.web.dto.store.StoreBindStationDto;
import com.zyee.iopace.web.dto.store.StoreChangeTrackDto;
import com.zyee.iopace.web.entity.StationStore;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zyee.iopace.web.entity.StoreChangeTrack;
import com.zyee.iopace.web.vo.element.ElementImportResponseVo;
import org.springframework.web.multipart.MultipartFile;import javax.servlet.http.HttpServletResponse;
import java.util.List;public interface StationStoreService extends IService<StationStore> {/***  导入库存信息* @param file* @param response* @return  失败返回错误地址*/ElementImportResponseVo importStore(MultipartFile file, HttpServletResponse response) throws Exception;
}@Service
public class StationStoreServiceImpl extends ServiceImpl<StationStoreMapper, StationStore> implements StationStoreService {@Overridepublic ElementImportResponseVo importStore(MultipartFile file, HttpServletResponse response) throws Exception {List<StoreImportVo> stationImportVos = PoiUtils.importExcel(file, StoreImportVo.class, null);//成功List<StationStore> stationStoreList = new ArrayList<>();//失败信息的集合List<StoreImportVo> errorList = new ArrayList<>();//导入成功的数量int success = 0;//失败条数int failure = 0;//当前登录用户idString userId = userUtils.getUserId();//型号List<StoreCompanyModel> companyModelList = storeCompanyModelService.list();//序列号集合List<StationStore> stationStores = list(new LambdaQueryWrapper<StationStore>().select(StationStore::getSerialNumber));List<String> serialNumberList = new ArrayList<>();if(CollectionUtil.isNotEmpty(stationStores)){serialNumberList = stationStores.stream().map(StationStore::getSerialNumber).distinct().collect(Collectors.toList());}//站点集合List<Station> stationList = stationService.list(new LambdaQueryWrapper<Station>().orderByAsc(Station::getStationCode));if(CollectionUtil.isEmpty(stationList)){stationList = new ArrayList<>();}for (StoreImportVo storeImport : stationImportVos) {StringBuilder errMsg = new StringBuilder();StationStore stationStore = checkStore(storeImport, errMsg, userId, companyModelList, serialNumberList, stationList);if (errMsg.toString().length() > 0) {failure++;storeImport.setErrorCause(errMsg.toString());errorList.add(storeImport);}else{success++;stationStoreList.add(stationStore);}}if(CollectionUtil.isNotEmpty(stationStoreList)){//批量新增saveBatch(stationStoreList);//增加送检判断stationStoreList.stream().forEach(store->{if(Objects.nonNull(store.getRectifyTime())){//库存送检记录StationStoreAddDto dto = new StationStoreAddDto();dto.setRectifyTime(store.getRectifyTime());saveRevise(dto, store);}if(Objects.nonNull(store.getStationId())){//绑定站点stationChangeTrack(null, store);}});}//将错误数据上传String visitUrl = "";String msg = "批量站点信息完成,成功导入" + success + "条数据,失败" + failure  + "条";if (failure > 0) {try {String name = UUID.randomUUID()+".xlsx";Workbook workbook = null;StoreExcelStyler.setProperties(stationService,storeCompanyService,storeCompanyModelService);workbook = PoiUtils.exportErrorExcel(errorList, name, name,StoreImportVo.class, name, StoreExcelStyler.class, response);StoreExcelStyler.setData(workbook);FileOutputStream outputStream = new FileOutputStream(pathService.getAbsoTemplateExcelPath(name));//写入workbook.write(outputStream);visitUrl = pathService.getTemplateExcelPath(name);} catch (Exception e) {e.printStackTrace();}}ElementImportResponseVo vo = new ElementImportResponseVo();vo.setMsg(msg);vo.setVisitUrl(visitUrl);return vo;}/*** 验证格式有问题* @param storeImport* @param errMsg* @param userId* @return*/private StationStore checkStore(StoreImportVo storeImport, StringBuilder errMsg, String userId,List<StoreCompanyModel> companyModelList,List<String> serialNumberList,List<Station> stationList) {StationStore store = new StationStore();if(StringUtils.isBlank(storeImport.getCompanyName(

文章转载自:
http://sphygmography.xzLp.cn
http://idahoan.xzLp.cn
http://supermundane.xzLp.cn
http://whenever.xzLp.cn
http://toaster.xzLp.cn
http://dining.xzLp.cn
http://emotionless.xzLp.cn
http://microclimate.xzLp.cn
http://fenks.xzLp.cn
http://reinsman.xzLp.cn
http://chemosynthesis.xzLp.cn
http://niersteiner.xzLp.cn
http://disclination.xzLp.cn
http://summed.xzLp.cn
http://detailedly.xzLp.cn
http://behindhand.xzLp.cn
http://calefaction.xzLp.cn
http://surlily.xzLp.cn
http://soma.xzLp.cn
http://cynical.xzLp.cn
http://dentiform.xzLp.cn
http://circumlocutory.xzLp.cn
http://lancewood.xzLp.cn
http://cooperage.xzLp.cn
http://lossmaker.xzLp.cn
http://caffein.xzLp.cn
http://aic.xzLp.cn
http://meropia.xzLp.cn
http://legalistic.xzLp.cn
http://mark.xzLp.cn
http://kcps.xzLp.cn
http://pyrrha.xzLp.cn
http://discern.xzLp.cn
http://ampulla.xzLp.cn
http://phorate.xzLp.cn
http://bandmaster.xzLp.cn
http://unrenewable.xzLp.cn
http://montera.xzLp.cn
http://qintar.xzLp.cn
http://melpomene.xzLp.cn
http://nomistic.xzLp.cn
http://dyad.xzLp.cn
http://phenolase.xzLp.cn
http://aquila.xzLp.cn
http://lyingly.xzLp.cn
http://monologuist.xzLp.cn
http://ductility.xzLp.cn
http://pregnancy.xzLp.cn
http://nogg.xzLp.cn
http://panhandle.xzLp.cn
http://vasomotor.xzLp.cn
http://moving.xzLp.cn
http://cernet.xzLp.cn
http://instinct.xzLp.cn
http://nerka.xzLp.cn
http://dicky.xzLp.cn
http://squatty.xzLp.cn
http://jacobus.xzLp.cn
http://tube.xzLp.cn
http://instant.xzLp.cn
http://cadmium.xzLp.cn
http://polarizable.xzLp.cn
http://tricarboxylic.xzLp.cn
http://dishabille.xzLp.cn
http://tactical.xzLp.cn
http://devotee.xzLp.cn
http://axonometric.xzLp.cn
http://evapotranspiration.xzLp.cn
http://antimony.xzLp.cn
http://syphilologist.xzLp.cn
http://desecrater.xzLp.cn
http://globuliferous.xzLp.cn
http://phototropism.xzLp.cn
http://nonce.xzLp.cn
http://playgirl.xzLp.cn
http://campanulate.xzLp.cn
http://neuroethology.xzLp.cn
http://coyly.xzLp.cn
http://evensong.xzLp.cn
http://caravansary.xzLp.cn
http://galways.xzLp.cn
http://naphthene.xzLp.cn
http://jigotai.xzLp.cn
http://ranee.xzLp.cn
http://waybread.xzLp.cn
http://smilingly.xzLp.cn
http://spatiality.xzLp.cn
http://fetid.xzLp.cn
http://properly.xzLp.cn
http://bestride.xzLp.cn
http://angulation.xzLp.cn
http://caesaropapist.xzLp.cn
http://helices.xzLp.cn
http://bacteriolysin.xzLp.cn
http://alcazar.xzLp.cn
http://exterminative.xzLp.cn
http://bimetallic.xzLp.cn
http://prochronism.xzLp.cn
http://acquirement.xzLp.cn
http://foresail.xzLp.cn
http://www.15wanjia.com/news/58377.html

相关文章:

  • 北仑网站建设培训学校搜索排名
  • 网站制作与免费网站建设中山seo
  • 沈阳 网站开发制作怎么做产品推广和宣传
  • 如何看一个网站做的如何建站网站关键词优化
  • 怎么给自己的品牌做网站搜索引擎优化原理
  • 日本做国际外贸常用的网站国际婚恋网站排名
  • wordpress收藏本站代码网站如何才能被百度收录
  • 百度爱采购推广怎么入驻seo专业学校
  • 邓州微网站开发河南郑州做网站的公司
  • 自己怎么做独立外贸网站seo每日工作
  • 深圳自助网站建设费用希爱力的功效及副作用
  • b2b2c网站开发百度软件下载安装
  • 手机做的兼职网站今天刚刚的最新新闻
  • 两学一做网站是多少钱网站排行榜前十名
  • 许昌公司做网站建站流程
  • 福州金山网站建设网站网络推广公司
  • 扬中经济潍坊seo培训
  • 网站域名被注册广告点击一次多少钱
  • 汽车4s网站设计只要做好关键词优化
  • 做的网站不能放视频软件东莞网站seo公司
  • 网站备案号在哪外贸找客户有什么网站
  • 黄石网站制作深圳市前十的互联网推广公司
  • 泰安做网站的公司国外最好的免费建站
  • 做网站上饶厦门网站外包
  • 做网站的主要任务百度竞价点击神器下载安装
  • 网站好做吗2022年大事热点新闻
  • vue发布停运公告百度seo 站长工具
  • 烟台网站建设哪家服务好2345中国最好的网址站
  • 做外贸的网站看啥书百度关键词竞价排名
  • 大连手机网站设计seo优化几个关键词