2025年05月20日 1.0.6 增加批量导入模板下载、批量导入功能,主键冲突时执行更新操作(只更新开始时间和结束时间)

main
gaoshuguang 6 months ago
parent 6b5df7bc3d
commit e4a4a04507

@ -0,0 +1,365 @@
package com.nmgs.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.nmgs.config.Constant;
import com.nmgs.entity.ATtypeText;
import com.nmgs.entity.FreeTypeText;
import com.nmgs.entity.TypeText;
import com.nmgs.entity.WxPreTimesInfo;
import com.nmgs.entity.WxVehicleBind;
import com.nmgs.entity.WxVehicleBindTemplate;
import com.nmgs.mapper.ATtypeTextMapper;
import com.nmgs.mapper.FreeTypeTextMapper;
import com.nmgs.mapper.TypeTextMapper;
import com.nmgs.mapper.WxPreTimesInfoMapper;
import com.nmgs.mapper.WxVehicleBindMapper;
import com.nmgs.util.DateTimeUtil;
import com.nmgs.util.PathUtil;
import com.nmgs.util.UuidUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author shuguang
*/
@RestController
@RequestMapping("/WxVehicleBind")
@Slf4j
public class ImportController {
@Resource
private WxVehicleBindMapper wxVehicleBindMapper;
@Resource
private WxPreTimesInfoMapper wxPreTimesInfoMapper;
@Resource
private ATtypeTextMapper attypeTextMapper;
@Resource
private TypeTextMapper typeTextMapper;
@Resource
private FreeTypeTextMapper freeTypeTextMapper;
@RequestMapping(value = "/exportTemplate", method = RequestMethod.POST)
public void exportTemplate(HttpServletResponse response) {
String uuid = UuidUtil.getUuid();
log.info("[uuid:{}]-开始下载设备车牌绑定管理导入模板", uuid);
try {
// 设置响应头
String fileName = "设备车牌绑定管理导入模板";
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "utf-8"));
// 获取文件路径
String filePath = PathUtil.templatePath + fileName + ".xlsx";
// 写入到输出流
try (InputStream inputStream = new FileInputStream(filePath)) {
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
response.getOutputStream().write(buffer, 0, bytesRead);
}
}
log.info("[uuid:{}]-设备车牌绑定管理导入模板下载成功", uuid);
} catch (IOException e) {
log.error("[uuid:{}]-设备车牌绑定管理导入模板下载失败{}", uuid, e.getMessage());
throw new RuntimeException("下载模板失败");
}
}
@PostMapping("/importVehicleBind")
public String uploadFile(@RequestParam("file") MultipartFile file,@RequestParam("manno") String manno,@RequestParam("man") String man) {
String uuid = UuidUtil.getUuid();
System.out.println(manno);
System.out.println(man);
try {
// 创建临时文件
Path tempFilePath = Files.createTempFile("tempExcel", ".xlsx");
File tempFile = tempFilePath.toFile();
// 将上传的文件保存到临时文件
file.transferTo(tempFile);
// 检查文件是否存在
if (!tempFile.exists()) {
throw new IOException("文件未成功写入磁盘");
}
// 读取 Excel 文件并转换为 WxVehicleBindTemplate 对象列表
List<WxVehicleBindTemplate> templates = readExcel(uuid, tempFile,manno,man);
// 查询字典表并转换为 WxVehicleBind 对象
List<WxVehicleBind> binds = convertToWxVehicleBind(uuid, templates);
// 导入数据到数据库
importData(uuid, binds, templates);
// 删除临时文件
tempFile.delete();
return "导入成功";
} catch (IOException e) {
log.error("导入失败: {}", e.getMessage());
return "导入失败:" + e.getMessage();
}
}
private List<WxVehicleBindTemplate> readExcel(String uuid, File file,String manno,String man) throws IOException {
List<WxVehicleBindTemplate> result = new ArrayList<>();
try (FileInputStream fis = new FileInputStream(file);
Workbook workbook = new XSSFWorkbook(fis)) {
// 指定 Sheet 名称
Sheet sheet = workbook.getSheet("导入模板");
if (sheet != null) {
for (Row row : sheet) {
// 跳过标题行
if (row.getRowNum() == 0) {
continue;
}
// 获取第0列和第1列的值
String vehicleId = getStringCellValue(row.getCell(0)).toString();
String plateColorName = getStringCellValue(row.getCell(1)).toString();
// 如果第0列或第1列的值为null或空串则不再继续循环
if (StringUtils.isBlank(vehicleId) || StringUtils.isBlank(plateColorName)) {
log.info("[uuid:{}]-第 {} 行的车牌或车牌颜色为空,停止读取数据", uuid, row.getRowNum() + 1);
break;
}
WxVehicleBindTemplate template = new WxVehicleBindTemplate();
template.setVehicleid(vehicleId);
template.setPlatecolorname(plateColorName);
template.setTypename(getStringCellValue(row.getCell(2)).toString());
template.setPhoneNumber(getStringCellValue(row.getCell(3)).toString());
template.setFreetypename(getStringCellValue(row.getCell(4)).toString());
template.setFreeStartTime((Date) getStringCellValue(row.getCell(5)));
template.setFreeEndTime((Date) getStringCellValue(row.getCell(6)));
template.setFreeTimes(getStringCellValue(row.getCell(7)).toString());
template.setAdduserid(manno);
template.setAdduser(man);
template.setFreesta(getStringCellValue(row.getCell(8)).toString());
template.setAdvancefee(getStringCellValue(row.getCell(9)).toString());
result.add(template);
}
}
} catch (IOException e) {
log.error("[uuid:{}]-解析 Excel 文件时发生异常", uuid, e);
}
if (result.isEmpty()) {
log.info("[uuid:{}]-Excel 文件中没有读取到任何数据", uuid);
}
return result;
}
private Object getStringCellValue(Cell cell) {
if (cell == null) {
return "";
}
switch (cell.getCellType()) {
case 1:
return cell.getStringCellValue();
case 0:
if (DateUtil.isCellDateFormatted(cell)) {
return cell.getDateCellValue();
} else {
// 检查是否为整数
double numericValue = cell.getNumericCellValue();
long longValue = (long) numericValue;
if (numericValue == longValue) {
// 如果没有小数部分,返回长整型字符串
return String.valueOf(longValue);
} else {
// 否则,返回双精度浮点型字符串
return String.valueOf(numericValue);
}
}
case 4:
return String.valueOf(cell.getBooleanCellValue());
case 2:
return cell.getCellFormula();
case 5:
return "Error";
case 3:
default:
return "";
}
}
private List<WxVehicleBind> convertToWxVehicleBind(String uuid, List<WxVehicleBindTemplate> templates) {
Map<String, Integer> plateColorMap = getPlateColorMap();
Map<String, Integer> vehicleTypeMap = getVehicleTypeMap();
Map<String, Integer> freeTypeMap = getFreeTypeMap();
List<WxVehicleBind> binds = new ArrayList<>();
if (templates.size() > 0) {
for (WxVehicleBindTemplate template : templates) {
WxVehicleBind bind = new WxVehicleBind();
bind.setVehicleid(template.getVehicleid());
bind.setVehiclecolor(plateColorMap.getOrDefault(template.getPlatecolorname(), 0));
bind.setVehicletype(vehicleTypeMap.getOrDefault(template.getTypename(), 0));
bind.setPhoneNumber(template.getPhoneNumber());
bind.setFreetype(freeTypeMap.getOrDefault(template.getFreetypename(), 1));
//bind.setFreeStartTime(DateTimeUtil.getFormatDate(template.getFreeStartTime(), Constant.YYYY_MM_DD_HH_MM_SS));
//bind.setFreeEndTime(DateTimeUtil.getFormatDate(template.getFreeEndTime(), Constant.YYYY_MM_DD_HH_MM_SS));
bind.setFreeStartTime(template.getFreeStartTime());
bind.setFreeEndTime(template.getFreeEndTime());
bind.setAdduserid(template.getAdduserid());
bind.setAdduser(template.getAdduser());
bind.setFreesta(template.getFreesta());
bind.setImagesID("");
if(5==bind.getFreetype()){
bind.setAdvancefee(0L);
}else {
bind.setAdvancefee(Long.parseLong(StringUtils.isNotBlank(template.getAdvancefee()) ? template.getAdvancefee() : "0"));
}
// 默认未审核状态
bind.setIscomplete(0);
binds.add(bind);
}
}
log.info("[uuid:{}]-转换后的数据条数为:{}", uuid, binds.size());
return binds;
}
private void importData(String uuid, List<WxVehicleBind> binds, List<WxVehicleBindTemplate> templates) {
int count = 0;
int infoCount = 0;
if (binds.size() > 0) {
for (WxVehicleBind bind : binds) {
// 检查是否存在主键冲突
QueryWrapper<WxVehicleBind> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("vehicleid", bind.getVehicleid())
.eq("vehiclecolor", bind.getVehiclecolor());
boolean exists = wxVehicleBindMapper.exists(queryWrapper);
if (exists) {
// 更新操作---只更新开始时间和结束时间
UpdateWrapper<WxVehicleBind> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("vehicleid", bind.getVehicleid())
.eq("vehiclecolor", bind.getVehiclecolor())
.set("freeStartTime", bind.getFreeStartTime())
.set("freeEndTime", bind.getFreeEndTime())
;
wxVehicleBindMapper.update(null, updateWrapper);
log.info("[uuid:{}]-wx_vehiclebind表中主键冲突,车牌号码为{},车牌颜色为{},执行更新操作,只更新开始时间{}和结束时间{}", uuid, bind.getVehicleid(), bind.getVehiclecolor(), DateTimeUtil.getFormateString(bind.getFreeStartTime(), Constant.YYYY_MM_DD_HH_MM_SS),DateTimeUtil.getFormateString(bind.getFreeEndTime(), Constant.YYYY_MM_DD_HH_MM_SS));
} else {
log.info("[uuid:{}]-wx_vehiclebind表中车牌号码为{},车牌颜色为{},数据不存在执行插入操作{}", uuid, bind.getVehicleid(), bind.getVehiclecolor(),bind);
// 插入操作
wxVehicleBindMapper.insert(bind);
}
count++;
// 如果 freeType = 5插入到 wx_pretimesinfo 表
if (bind.getFreetype() == 5 && !exists) {
// 获取对应的 WxVehicleBindTemplate 对象中的 freeTimes
WxVehicleBindTemplate template = getTemplateByVehicleIdAndColor(templates, bind.getVehicleid(), bind.getVehiclecolor());
if (template == null ) {
log.info("[uuid:{}]-未找到对应的车牌号码为{},车牌颜色为{}的WxVehicleBindTemplate对象", uuid, bind.getVehicleid(), bind.getVehiclecolor());
continue;
}
Integer freeTimes = Integer.parseInt(StringUtils.isNotBlank(template.getFreeTimes()) ? template.getFreeTimes() : "0");
long advancefee = Long.parseLong(StringUtils.isNotBlank(template.getAdvancefee()) ? template.getAdvancefee() : "0");
WxPreTimesInfo preTimesInfo = new WxPreTimesInfo();
preTimesInfo.setVehicleid(bind.getVehicleid());
preTimesInfo.setVehiclecolor(bind.getVehiclecolor());
preTimesInfo.setVehicletype(bind.getVehicletype());
preTimesInfo.setFreetype(bind.getFreetype());
preTimesInfo.setFreeStartTime(bind.getFreeStartTime());
preTimesInfo.setFreeEndTime(bind.getFreeEndTime());
// 使用元数据中的免费次数如果没有则默认为0
preTimesInfo.setFreeTimes(freeTimes);
preTimesInfo.setAdduserid(bind.getAdduserid());
preTimesInfo.setAdduser(bind.getAdduser());
preTimesInfo.setFreesta(bind.getFreesta());
preTimesInfo.setAdvancefee(advancefee);
preTimesInfo.setInsertTime(new Date());
// 默认未审核状态
preTimesInfo.setIscomplete(0);
wxPreTimesInfoMapper.insert(preTimesInfo);
infoCount++;
}
}
}
log.info("[uuid:{}]-批量导入wx_vehiclebind,条数:{}", uuid, count);
log.info("[uuid:{}]-批量导入wx_pretimesinfo,条数:{}", uuid, infoCount);
}
private WxVehicleBindTemplate getTemplateByVehicleIdAndColor(List<WxVehicleBindTemplate> templates, String vehicleid, Integer vehiclecolor) {
for (WxVehicleBindTemplate template : templates) {
if (template.getVehicleid().equals(vehicleid) && template.getPlatecolorname().equals(getPlateColorText(vehiclecolor)) && "预存通行车".equals(template.getFreetypename())) {
return template;
}
}
return null;
}
private String getPlateColorText(Integer value) {
ATtypeText attypeText = attypeTextMapper.selectById(value);
return attypeText != null ? attypeText.getText() : null;
}
private Map<String, Integer> getPlateColorMap() {
List<ATtypeText> list = attypeTextMapper.selectList(null);
Map<String, Integer> map = new HashMap<>();
for (ATtypeText item : list) {
map.put(item.getText(), item.getValue());
}
return map;
}
private Map<String, Integer> getVehicleTypeMap() {
List<TypeText> list = typeTextMapper.selectList(null);
Map<String, Integer> map = new HashMap<>();
for (TypeText item : list) {
map.put(item.getText(), item.getValue());
}
return map;
}
private Map<String, Integer> getFreeTypeMap() {
List<FreeTypeText> list = freeTypeTextMapper.selectList(null);
Map<String, Integer> map = new HashMap<>();
for (FreeTypeText item : list) {
map.put(item.getText(), item.getValue());
}
return map;
}
}

@ -1,6 +1,7 @@
package com.nmgs.entity; package com.nmgs.entity;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
@ -12,7 +13,7 @@ import lombok.Data;
@Data @Data
@TableName("atype_text") @TableName("atype_text")
public class ATtypeText { public class ATtypeText {
@TableField("VALUE") @TableId("VALUE")
private Integer value; private Integer value;
@TableField("TEXT") @TableField("TEXT")
private String text; private String text;

@ -0,0 +1,51 @@
package com.nmgs.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import java.util.Date;
@Data
public class WxVehicleBindTemplate {
@ExcelProperty("车牌")
private String vehicleid;
@ExcelProperty("车牌颜色")
private String platecolorname;
@ExcelProperty("车型")
private String typename;
@ExcelProperty("手机号")
private String phoneNumber;
@ExcelProperty("免费类型")
private String freetypename;
@ExcelProperty(value = "免费开始时间", format = "yyyy-MM-dd")
private Date freeStartTime;
@ExcelProperty(value = "免费结束时间", format = "yyyy-MM-dd")
private Date freeEndTime;
//@ExcelProperty("免费开始时间")
//private String freeStartTime;
//
//@ExcelProperty("免费结束时间")
//private String freeEndTime;
@ExcelProperty("免费次数")
private String freeTimes;
@ExcelProperty("添加人ID")
private String adduserid;
@ExcelProperty("添加人")
private String adduser;
@ExcelProperty("免费站")
private String freesta;
@ExcelProperty("预缴金额")
private String advancefee;
}

@ -19,4 +19,5 @@ import java.util.Map;
public interface WxVehicleBindMapper extends MPJBaseMapper<WxVehicleBind> { public interface WxVehicleBindMapper extends MPJBaseMapper<WxVehicleBind> {
Page<Map<String, Object>> selectMyPage(Page<Map<String, Object>> page, String vehicleid, @Param("vehiclecolor") Integer vehiclecolor); Page<Map<String, Object>> selectMyPage(Page<Map<String, Object>> page, String vehicleid, @Param("vehiclecolor") Integer vehiclecolor);
List<WxVehicleBindExcel> queryList(String whereSql); List<WxVehicleBindExcel> queryList(String whereSql);
} }

@ -18,17 +18,20 @@ public class PathUtil {
public static String noVNCPath = ""; public static String noVNCPath = "";
public static boolean isWin = false; public static boolean isWin = false;
public static String versionPath; public static String versionPath;
public static String templatePath;
static { static {
try { try {
projectApplicationPath = URLDecoder.decode(ClassUtils.getDefaultClassLoader().getResource("").getPath(), "UTF-8") + "static/application.properties"; projectApplicationPath = URLDecoder.decode(ClassUtils.getDefaultClassLoader().getResource("").getPath(), "UTF-8") + "static/application.properties";
versionPath = URLDecoder.decode(ClassUtils.getDefaultClassLoader().getResource("").getPath(), "UTF-8") + "version/"; versionPath = URLDecoder.decode(ClassUtils.getDefaultClassLoader().getResource("").getPath(), "UTF-8") + "version/";
templatePath = URLDecoder.decode(ClassUtils.getDefaultClassLoader().getResource("").getPath(), "UTF-8") + "template/";
websockifyPath = URLDecoder.decode(ClassUtils.getDefaultClassLoader().getResource("").getPath(), "UTF-8") + "static/websockify"; websockifyPath = URLDecoder.decode(ClassUtils.getDefaultClassLoader().getResource("").getPath(), "UTF-8") + "static/websockify";
noVNCPath = URLDecoder.decode(ClassUtils.getDefaultClassLoader().getResource("").getPath(), "UTF-8") + "static/noVNC"; noVNCPath = URLDecoder.decode(ClassUtils.getDefaultClassLoader().getResource("").getPath(), "UTF-8") + "static/noVNC";
webPath = URLDecoder.decode(ClassUtils.getDefaultClassLoader().getResource("").getPath(), "UTF-8") + "static"; webPath = URLDecoder.decode(ClassUtils.getDefaultClassLoader().getResource("").getPath(), "UTF-8") + "static";
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
projectApplicationPath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "static/application.properties"; projectApplicationPath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "static/application.properties";
versionPath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "version/"; versionPath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "version/";
templatePath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "template/";
webPath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "static"; webPath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "static";
websockifyPath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "static/websockify"; websockifyPath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "static/websockify";
noVNCPath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "static/noVNC"; noVNCPath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "static/noVNC";
@ -41,7 +44,7 @@ public class PathUtil {
public static String hostAddress; public static String hostAddress;
public static String WebServiceWarPath; public static String WebServiceWarPath;
public static String tomcatUserXMLPath; public static String tomcatUserXMLPath;
public static String webName = "/noVNC"; public static String webName = "/FreeCarRegistration";
static { static {

@ -5,3 +5,4 @@
4 2024年07月02日 1.0.3 优化查询语句 4 2024年07月02日 1.0.3 优化查询语句
5 2024年10月10日 1.0.4 增加解除绑定页面 5 2024年10月10日 1.0.4 增加解除绑定页面
6 2025年03月03日 1.0.5 增加预存明细,预存剩余次数不从流水中查询,增加预存追加,优化相关逻辑等 6 2025年03月03日 1.0.5 增加预存明细,预存剩余次数不从流水中查询,增加预存追加,优化相关逻辑等
7 2025年05月20日 1.0.6 增加批量导入模板下载、批量导入功能,主键冲突时执行更新操作(只更新开始时间和结束时间)

@ -5,3 +5,4 @@
4 2024年07月02日 1.0.3 优化查询语句 4 2024年07月02日 1.0.3 优化查询语句
5 2024年10月10日 1.0.4 增加解除绑定页面 5 2024年10月10日 1.0.4 增加解除绑定页面
6 2025年03月03日 1.0.5 增加预存明细,预存剩余次数不从流水中查询,增加预存追加,优化相关逻辑等 6 2025年03月03日 1.0.5 增加预存明细,预存剩余次数不从流水中查询,增加预存追加,优化相关逻辑等
7 2025年05月20日 1.0.6 增加批量导入模板下载、批量导入功能,主键冲突时执行更新操作(只更新开始时间和结束时间)

@ -5,3 +5,4 @@
4 2024年07月02日 1.0.3 优化查询语句 4 2024年07月02日 1.0.3 优化查询语句
5 2024年10月10日 1.0.4 增加解除绑定页面 5 2024年10月10日 1.0.4 增加解除绑定页面
6 2025年03月03日 1.0.5 增加预存明细,预存剩余次数不从流水中查询,增加预存追加,优化相关逻辑等 6 2025年03月03日 1.0.5 增加预存明细,预存剩余次数不从流水中查询,增加预存追加,优化相关逻辑等
7 2025年05月20日 1.0.6 增加批量导入模板下载、批量导入功能,主键冲突时执行更新操作(只更新开始时间和结束时间)

@ -1,3 +0,0 @@
version=0.0.1-SNAPSHOT
groupId=com.nmgs
artifactId=FreeCarRegistration

@ -1,51 +0,0 @@
com\nmgs\config\Constant.class
com\nmgs\util\CRCUtil.class
com\nmgs\service\impl\WxVehicleBindServiceImpl.class
com\nmgs\MyEnvironmentPostProcessor.class
com\nmgs\controller\WxVehicleBindController.class
com\nmgs\mapper\WxVehicleBindMapper.class
com\nmgs\entity\WxVehicleBindExcel.class
com\nmgs\entity\WxUnBindApply.class
com\nmgs\config\ErrorConfig.class
com\nmgs\util\PathUtil.class
com\nmgs\mapper\VehicleWxBindMapper.class
com\nmgs\entity\WxChatCarUser.class
com\nmgs\controller\UnBindController.class
com\nmgs\entity\WxPreTimesInfo.class
com\nmgs\util\PagesUtils.class
com\nmgs\mapper\WxPreTimesInfoMapper.class
com\nmgs\mapper\FreeTypeTextMapper.class
com\nmgs\entity\WxCrossNum.class
com\nmgs\config\FilterConfig.class
com\nmgs\util\DateTimeUtil.class
com\nmgs\entity\WxVehicleBind.class
com\nmgs\mapper\ATtypeTextMapper.class
com\nmgs\config\ThreadPoolConfig.class
com\nmgs\mapper\WxOutPortMapper.class
com\nmgs\entity\VehicleImages.class
com\nmgs\mapper\UnBindMapper.class
com\nmgs\util\TokenUtil.class
com\nmgs\FreeCarRegistrationApplication.class
com\nmgs\mapper\WxVehicleWxDataMapper.class
com\nmgs\util\PropertiesUtil.class
com\nmgs\mapper\VehicleImagesMapper.class
com\nmgs\util\ExcelUtil.class
com\nmgs\util\main.class
com\nmgs\entity\ATtypeText.class
com\nmgs\mapper\TypeTextMapper.class
com\nmgs\util\DateUtils.class
com\nmgs\config\MybatisConfig.class
com\nmgs\entity\VehicleWxBind.class
com\nmgs\mapper\WxUnBindApplyMapper.class
com\nmgs\util\UuidUtil.class
com\nmgs\service\WxVehicleBindService.class
com\nmgs\entity\WxOutPort.class
com\nmgs\config\CorsConfig.class
com\nmgs\controller\ExportController.class
com\nmgs\entity\TypeText.class
com\nmgs\util\PlateRegexutil.class
com\nmgs\entity\FreeTypeText.class
com\nmgs\config\RedisSessionConfig.class
com\nmgs\entity\WxVehicleWxData.class
com\nmgs\mapper\WxCrossNumMapper.class
com\nmgs\util\DESUtil.class

@ -1,51 +0,0 @@
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\entity\WxChatCarUser.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\entity\WxVehicleBind.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\FreeCarRegistrationApplication.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\service\WxVehicleBindService.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\config\ErrorConfig.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\MyEnvironmentPostProcessor.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\mapper\VehicleImagesMapper.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\entity\WxVehicleWxData.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\util\DateTimeUtil.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\util\DESUtil.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\service\impl\WxVehicleBindServiceImpl.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\util\PropertiesUtil.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\mapper\ATtypeTextMapper.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\config\MybatisConfig.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\mapper\WxUnBindApplyMapper.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\entity\WxVehicleBindExcel.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\entity\VehicleImages.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\entity\WxOutPort.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\util\CRCUtil.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\mapper\WxVehicleBindMapper.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\util\PathUtil.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\mapper\WxOutPortMapper.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\config\Constant.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\config\RedisSessionConfig.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\util\main.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\util\PlateRegexutil.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\entity\WxUnBindApply.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\controller\ExportController.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\mapper\FreeTypeTextMapper.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\util\UuidUtil.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\config\CorsConfig.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\entity\VehicleWxBind.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\mapper\WxCrossNumMapper.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\mapper\UnBindMapper.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\entity\WxPreTimesInfo.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\config\ThreadPoolConfig.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\entity\FreeTypeText.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\controller\WxVehicleBindController.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\mapper\VehicleWxBindMapper.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\mapper\WxVehicleWxDataMapper.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\entity\TypeText.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\util\TokenUtil.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\util\ExcelUtil.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\util\DateUtils.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\entity\WxCrossNum.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\entity\ATtypeText.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\config\FilterConfig.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\mapper\WxPreTimesInfoMapper.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\util\PagesUtils.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\controller\UnBindController.java
D:\myproject\git\GLT-FreeCarRegistration\FreeCarRegistration\src\main\java\com\nmgs\mapper\TypeTextMapper.java

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,32 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<link rel="icon" href="/favicon.ico"/>
<title></title>
<script type="module" crossorigin src="./assets/index.1305944d.js"></script>
<link rel="stylesheet" href="./assets/index.c4ceb410.css">
</head>
<body>
<div id="app">
<div class="loading">
<div class="loading-wrap">
<div class="loading-dots">
<span class="dot dot-spin">
<i></i>
<i></i>
<i></i>
<i></i>
</span>
</div>
<div class="loading-title">
正在缓冲...
</div>
</div>
</div>
</div>
<script type="text/javascript" src="../static/bmapOffline/map_load.js"></script>
</body>
</html>

@ -29,3 +29,5 @@ export const commitPreTimes = data => post("/FreeCarRegistration/WxVehicleBind/c
export const queryDepositDetails = data => post("/FreeCarRegistration/WxVehicleBind/queryDepositDetails", data) export const queryDepositDetails = data => post("/FreeCarRegistration/WxVehicleBind/queryDepositDetails", data)
export const completeDetailsInfo = data => post("/FreeCarRegistration/WxVehicleBind/completeDetailsInfo", data) export const completeDetailsInfo = data => post("/FreeCarRegistration/WxVehicleBind/completeDetailsInfo", data)
export const deleteDetailsInfo = data => post("/FreeCarRegistration/WxVehicleBind/deleteDetailsInfo", data) export const deleteDetailsInfo = data => post("/FreeCarRegistration/WxVehicleBind/deleteDetailsInfo", data)
export const exportTemplate = data => downLoad("/FreeCarRegistration/WxVehicleBind/exportTemplate", data)

@ -49,12 +49,35 @@
<span style="vertical-align: middle;"> 删除 </span> <span style="vertical-align: middle;"> 删除 </span>
</el-button> </el-button>
<el-button type="success" style="margin-top: 5px;margin-top: 0px;" @click="exportExcel"> <el-button type="success" style="margin-top: 5px;margin-top: 0px;" @click="exportExcel">
<span style="vertical-align: middle;"> 导出 </span>
<el-icon> <el-icon>
<Download/> <Download/>
</el-icon> </el-icon>
<span style="vertical-align: middle;"> 导出 </span>
</el-button>
<el-button type="primary" style="margin-top: 5px;margin-top: 0px;" @click="downloadTemplate">
<el-icon>
<Download/>
</el-icon>
<span style="vertical-align: middle;"> 下载导入模板 </span>
</el-button> </el-button>
<el-upload
class="upload-demo"
action=""
:before-upload="handleUpload"
:on-success="handleSuccess"
:on-error="handleError"
:limit="1"
accept=".xlsx,.xls"
style="display: inline-block; margin-left: 10px;">
<el-button type="primary">
<el-icon><Upload /></el-icon>
<span style="vertical-align: middle;"> 上传批量导入文件 </span>
</el-button>
</el-upload>
</div> </div>
<el-table :data="tableData" border <el-table :data="tableData" border
highlight-current-row="true" highlight-current-row="true"
@ -564,7 +587,7 @@
<script> <script>
import zhCn from 'element-plus/lib/locale/lang/zh-cn' import zhCn from 'element-plus/lib/locale/lang/zh-cn'
import {getPage, getCarColorList, commitVehicleBind, deleteVehicleBind,commitPreTimes,queryDepositDetails,completeDetailsInfo,deleteDetailsInfo} from "../../util/api/api.js"; import {getPage, getCarColorList, commitVehicleBind, deleteVehicleBind,commitPreTimes,queryDepositDetails,completeDetailsInfo,deleteDetailsInfo,exportTemplate} from "../../util/api/api.js";
import pro from '../../util/tool.js'; import pro from '../../util/tool.js';
import {Delete, Edit, Reading, ZoomIn, Select, CloseBold, Switch} from '@element-plus/icons-vue' import {Delete, Edit, Reading, ZoomIn, Select, CloseBold, Switch} from '@element-plus/icons-vue'
import {ElMessage} from "element-plus/es"; import {ElMessage} from "element-plus/es";
@ -579,7 +602,7 @@ import {
} from "../../util/api/api"; } from "../../util/api/api";
import gpy from './gpy.vue'; import gpy from './gpy.vue';
import moment from "moment"; import moment from "moment";
import axios from "../../util/axios/axios";
export default { export default {
name: "WxVehicleBind", name: "WxVehicleBind",
components: {gpy}, components: {gpy},
@ -709,6 +732,85 @@ export default {
}, },
downloadTemplate() {
exportTemplate().then((res) => {
const fileName = '设备车牌绑定管理导入模板.xlsx';
//
if (res.data.type === 'application/json') {
let reader = new FileReader();
// load
reader.onload = e => {
if (typeof e.target.result === "string") {
res = JSON.parse(e.target.result);
}
this.$message.error(res.msg); //
};
reader.readAsText(res.data);
} else {
// console.log(res)
//
const blob = new Blob([res.data], {
type: 'blob'
})
//
let link = document.createElement('a')
link.download = fileName
link.style.display = 'none'
link.href = URL.createObjectURL(blob)
document.body.appendChild(link)
link.setAttribute('download', fileName)
link.click()
URL.revokeObjectURL(link.href);
document.body.removeChild(link);
link = null
}
}).catch(
ElMessage({
type: 'info',
message: '后台正在下载中....请稍后',
})
)
},
handleUpload(file) {
const formData = new FormData();
formData.append('file', file);
formData.append('manno', this.mannoDe);
formData.append('man', this.man);
this.uploadFile(formData);
return false; //
},
handleSuccess(response, file) {
ElMessage.success('文件上传成功');
this.network(); //
},
handleError(err, file) {
ElMessage.error('文件上传失败');
},
uploadFile(formData) {
const uploadUrl = '/FreeCarRegistration/WxVehicleBind/importVehicleBind'; //
// axios.post(uploadUrl, formData, {
// headers: {
// 'Content-Type': 'multipart/form-data'
// }
// }).then(response => {
axios.post(uploadUrl, formData, {
headers: {'Content-Type': 'multipart/form-data'},//,
timeout: 200000,
}).then(response => {
// console.log(response);
if (response.includes('成功')) {
ElMessage.success('批量导入成功');
this.network(); //
} else {
ElMessage.error(response);
}
}).catch(error => {
ElMessage.error('文件上传失败');
console.error(error);
});
},
deleteDetails(row){ deleteDetails(row){
ElMessageBox.confirm( ElMessageBox.confirm(
'是否删除数据?', '是否删除数据?',

Loading…
Cancel
Save