开发OTA备案工具

This commit is contained in:
高嵩
2023-03-25 19:26:06 +08:00
parent 8e5822a1c8
commit d8715bf0ec
32 changed files with 2079 additions and 1659 deletions
@@ -5703,7 +5703,6 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
}else{ }else{
throw new JeroBootException("Please upload a zip file or rar file"); throw new JeroBootException("Please upload a zip file or rar file");
} }
} }
String path = uploadpath + File.separator + "modal" + File.separator + filenameorg + System.currentTimeMillis(); String path = uploadpath + File.separator + "modal" + File.separator + filenameorg + System.currentTimeMillis();
File saveDirectory = new File(path); File saveDirectory = new File(path);
@@ -4,6 +4,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.ota.entity.OtaBaCxAqcs; import com.jero.modules.ota.entity.OtaBaCxAqcs;
@@ -153,8 +154,9 @@ public class OtaBaCxAqcsController extends JeroController<OtaBaCxAqcs, IOtaBaCxA
@AutoLog(value = "车型备案-安全措施-通过otaId查询") @AutoLog(value = "车型备案-安全措施-通过otaId查询")
@ApiOperation(value = "车型备案-安全措施-通过otaId查询", notes = "车型备案-安全措施-通过otaId查询") @ApiOperation(value = "车型备案-安全措施-通过otaId查询", notes = "车型备案-安全措施-通过otaId查询")
@GetMapping(value = "/queryByOtaId") @GetMapping(value = "/queryByOtaId")
public Result<?> queryByOtaId(@RequestParam(name="otaId",required=true) String otaId) { public Result<?> queryByOtaId(@RequestParam(name = "otaId", required = true) String otaId,
OtaBaCxAqcs otaBaCxAqcs = otaBaCxAqcsService.queryByOtaId(otaId); @RequestParam(name = "otaIdT", required = true) String otaIdT) {
OtaBaCxAqcs otaBaCxAqcs = otaBaCxAqcsService.queryByOtaId(otaId, otaIdT);
if (otaBaCxAqcs == null) { if (otaBaCxAqcs == null) {
return Result.error("未找到对应数据"); return Result.error("未找到对应数据");
} }
@@ -4,6 +4,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.ota.entity.OtaBaCxJbxx; import com.jero.modules.ota.entity.OtaBaCxJbxx;
@@ -11,6 +12,7 @@ import com.jero.modules.ota.service.IOtaBaCxJbxxService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.modules.system.util.StringUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import com.jero.common.system.base.controller.JeroController; import com.jero.common.system.base.controller.JeroController;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -146,16 +148,14 @@ public class OtaBaCxJbxxController extends JeroController<OtaBaCxJbxx, IOtaBaCxJ
/** /**
* 通过OtaId查询 * 通过OtaId查询
*
*/ */
@AutoLog(value = "车型备案-车型基本信息-通过otaId查询") @AutoLog(value = "车型备案-车型基本信息-通过otaId查询")
@ApiOperation(value = "车型备案-车型基本信息-通过otaId查询", notes = "车型备案-车型基本信息-通过otaId查询") @ApiOperation(value = "车型备案-车型基本信息-通过otaId查询", notes = "车型备案-车型基本信息-通过otaId查询")
@GetMapping(value = "/queryByOtaId") @GetMapping(value = "/queryByOtaId")
public Result<?> queryByOtaId(@RequestParam(name="otaId",required=true) String otaId) { public Result<?> queryByOtaId(@RequestParam(name = "otaId") String otaId,
OtaBaCxJbxx otaBaCxJbxx = otaBaCxJbxxService.queryByOtaId(otaId); @RequestParam(name = "otaIdT") String otaIdT) {
if(otaBaCxJbxx==null) { OtaBaCxJbxx otaBaCxJbxx = otaBaCxJbxxService.queryByOtaId(otaId, otaIdT);
return Result.error("未找到对应数据"); otaBaCxJbxx = otaBaCxJbxxService.queryByOtaId(otaId, otaIdT);
}
return Result.OK(otaBaCxJbxx); return Result.OK(otaBaCxJbxx);
} }
@@ -75,7 +75,6 @@ public class OtaBaCxJsfzbacsController extends JeroController<OtaBaCxJsfzbacs, I
/** /**
* 添加 * 添加
*
*/ */
@AutoLog(value = "车型备案-驾驶辅助系统基础备案参数-添加") @AutoLog(value = "车型备案-驾驶辅助系统基础备案参数-添加")
@ApiOperation(value = "车型备案-驾驶辅助系统基础备案参数-添加", notes = "车型备案-驾驶辅助系统基础备案参数-添加") @ApiOperation(value = "车型备案-驾驶辅助系统基础备案参数-添加", notes = "车型备案-驾驶辅助系统基础备案参数-添加")
@@ -144,6 +143,24 @@ public class OtaBaCxJsfzbacsController extends JeroController<OtaBaCxJsfzbacs, I
return Result.OK(otaBaCxJsfzbacs); return Result.OK(otaBaCxJsfzbacs);
} }
/**
* 通过otaId查询
*
* @param otaId
* @return
*/
@AutoLog(value = "车型备案-驾驶辅助系统基础备案参数-通过id查询")
@ApiOperation(value = "车型备案-驾驶辅助系统基础备案参数-通过id查询", notes = "车型备案-驾驶辅助系统基础备案参数-通过id查询")
@GetMapping(value = "/queryByOtaId")
public Result<?> queryByOtaId(@RequestParam(name = "otaId", required = true) String otaId,
@RequestParam(name = "otaIdT", required = true) String otaIdT) {
JSONObject res = otaBaCxJsfzbacsService.queryByOtaId(otaId, otaIdT);
if (res == null) {
return Result.error("未找到对应数据");
}
return Result.OK(res);
}
/** /**
* 导出excel * 导出excel
* *
@@ -4,6 +4,8 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.ota.entity.OtaBaCxKsjjsmccs; import com.jero.modules.ota.entity.OtaBaCxKsjjsmccs;
@@ -74,14 +76,13 @@ public class OtaBaCxKsjjsmccsController extends JeroController<OtaBaCxKsjjsmccs,
/** /**
* 添加 * 添加
* *
* @param otaBaCxKsjjsmccs
* @return * @return
*/ */
@AutoLog(value = "车型备案-可在线升级的驾驶辅助功能名称与参数-添加") @AutoLog(value = "车型备案-可在线升级的驾驶辅助功能名称与参数-添加")
@ApiOperation(value = "车型备案-可在线升级的驾驶辅助功能名称与参数-添加", notes = "车型备案-可在线升级的驾驶辅助功能名称与参数-添加") @ApiOperation(value = "车型备案-可在线升级的驾驶辅助功能名称与参数-添加", notes = "车型备案-可在线升级的驾驶辅助功能名称与参数-添加")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<?> add(@Validated @RequestBody OtaBaCxKsjjsmccs otaBaCxKsjjsmccs) { public Result<?> add(@RequestBody JSONObject json) {
otaBaCxKsjjsmccsService.add(otaBaCxKsjjsmccs); otaBaCxKsjjsmccsService.add(json);
return Result.OK("添加成功!"); return Result.OK("添加成功!");
} }
@@ -153,8 +154,9 @@ public class OtaBaCxKsjjsmccsController extends JeroController<OtaBaCxKsjjsmccs,
@AutoLog(value = "车型备案-可在线升级的驾驶辅助功能名称与参数-通过otaId查询") @AutoLog(value = "车型备案-可在线升级的驾驶辅助功能名称与参数-通过otaId查询")
@ApiOperation(value = "车型备案-可在线升级的驾驶辅助功能名称与参数-通过otaId查询", notes = "车型备案-可在线升级的驾驶辅助功能名称与参数-通过otaId查询") @ApiOperation(value = "车型备案-可在线升级的驾驶辅助功能名称与参数-通过otaId查询", notes = "车型备案-可在线升级的驾驶辅助功能名称与参数-通过otaId查询")
@GetMapping(value = "/queryByOtaId") @GetMapping(value = "/queryByOtaId")
public Result<?> queryByOtaId(@RequestParam(name="otaId",required=true) String otaId) { public Result<?> queryByOtaId(@RequestParam(name = "otaId", required = true) String otaId,
List<OtaBaCxKsjjsmccs> otaBaCxKsjjsmccsList = otaBaCxKsjjsmccsService.queryByOtaId(otaId); @RequestParam(name = "otaIdT", required = true) String otaIdT) {
List<OtaBaCxKsjjsmccs> otaBaCxKsjjsmccsList = otaBaCxKsjjsmccsService.queryByOtaId(otaId, otaIdT);
if (otaBaCxKsjjsmccsList == null) { if (otaBaCxKsjjsmccsList == null) {
return Result.error("未找到对应数据"); return Result.error("未找到对应数据");
} }
@@ -4,6 +4,8 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.ota.entity.OtaBaCxKsjxtmccs; import com.jero.modules.ota.entity.OtaBaCxKsjxtmccs;
@@ -74,14 +76,13 @@ public class OtaBaCxKsjxtmccsController extends JeroController<OtaBaCxKsjxtmccs,
/** /**
* 添加 * 添加
* *
* @param otaBaCxKsjxtmccs
* @return * @return
*/ */
@AutoLog(value = "车型备案-可升级的系统名称参数-添加") @AutoLog(value = "车型备案-可升级的系统名称参数-添加")
@ApiOperation(value = "车型备案-可升级的系统名称参数-添加", notes = "车型备案-可升级的系统名称参数-添加") @ApiOperation(value = "车型备案-可升级的系统名称参数-添加", notes = "车型备案-可升级的系统名称参数-添加")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<?> add(@Validated @RequestBody OtaBaCxKsjxtmccs otaBaCxKsjxtmccs) { public Result<?> add(@RequestBody JSONObject json) {
otaBaCxKsjxtmccsService.add(otaBaCxKsjxtmccs); otaBaCxKsjxtmccsService.add(json);
return Result.OK("添加成功!"); return Result.OK("添加成功!");
} }
@@ -153,8 +154,9 @@ public class OtaBaCxKsjxtmccsController extends JeroController<OtaBaCxKsjxtmccs,
@AutoLog(value = "车型备案-可升级的系统名称参数-通过iotaId查询") @AutoLog(value = "车型备案-可升级的系统名称参数-通过iotaId查询")
@ApiOperation(value = "车型备案-可升级的系统名称参数-通过otaId查询", notes = "车型备案-可升级的系统名称参数-通过otaId查询") @ApiOperation(value = "车型备案-可升级的系统名称参数-通过otaId查询", notes = "车型备案-可升级的系统名称参数-通过otaId查询")
@GetMapping(value = "/queryByOtaId") @GetMapping(value = "/queryByOtaId")
public Result<?> queryByOtaId(@RequestParam(name="otaId",required=true) String otaId) { public Result<?> queryByOtaId(@RequestParam(name = "otaId", required = true) String otaId,
List<OtaBaCxKsjxtmccs> otaBaCxKsjxtmccsList = otaBaCxKsjxtmccsService.queryByOtaId(otaId); @RequestParam(name = "otaIdT", required = true) String otaIdT) {
List<OtaBaCxKsjxtmccs> otaBaCxKsjxtmccsList = otaBaCxKsjxtmccsService.queryByOtaId(otaId, otaIdT);
if (otaBaCxKsjxtmccsList == null) { if (otaBaCxKsjxtmccsList == null) {
return Result.error("未找到对应数据"); return Result.error("未找到对应数据");
} }
@@ -13,15 +13,18 @@ import com.jero.modules.ota.service.IOtaBaCxListService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
@@ -172,7 +175,6 @@ public class OtaBaCxListController extends JeroController<OtaBaCxList, IOtaBaCxL
/** /**
* 备案维护 * 备案维护
*
*/ */
@AutoLog(value = "车型及功能备案列表-备案维护") @AutoLog(value = "车型及功能备案列表-备案维护")
@ApiOperation(value = "车型及功能备案列表-备案维护", notes = "车型及功能备案列表-备案维护") @ApiOperation(value = "车型及功能备案列表-备案维护", notes = "车型及功能备案列表-备案维护")
@@ -187,4 +189,35 @@ public class OtaBaCxListController extends JeroController<OtaBaCxList, IOtaBaCxL
return Result.OK("备案维护成功!"); return Result.OK("备案维护成功!");
} }
@AutoLog(value = "车型及功能备案列表-模板下载")
@ApiOperation(value = "车型及功能备案列表-模板下载")
@GetMapping(value = "/exportTemplate")
// @RequiresPermissions("otaBaCx:exportTemplate")
public void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception {
this.otaBaCxListService.exportTemplate(response, request);
}
@AutoLog(value = "车型及功能备案列表-数据导入")
@ApiOperation(value = "车型及功能备案列表-数据导入")
@PostMapping(value = "/importData")
// @RequiresPermissions("otaBaCx:importData")
public Result<?> importData(@RequestParam(value = "file", required = false) MultipartFile file,
@RequestParam(value = "cut", required = false) String cut) throws Exception {
try {
this.otaBaCxListService.importData(file, cut);
} catch (Exception e) {
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK("导入成功");
}
@AutoLog(value = "车型及功能备案列表-数据导出")
@ApiOperation(value = "车型及功能备案列表-数据导出")
@GetMapping(value = "/exportData")
// @RequiresPermissions("otaBaCx:exportTemplate")
public void exportData(@RequestParam(value = "otaId", required = false) String otaId, HttpServletResponse response, HttpServletRequest request) throws Exception {
this.otaBaCxListService.exportData(otaId, response, request);
}
} }
@@ -4,6 +4,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.ota.entity.OtaBaCxQt; import com.jero.modules.ota.entity.OtaBaCxQt;
@@ -146,15 +147,13 @@ public class OtaBaCxQtController extends JeroController<OtaBaCxQt, IOtaBaCxQtSer
/** /**
* 通过otaId查询 * 通过otaId查询
*
* @param otaId
* @return
*/ */
@AutoLog(value = "车型备案-其他升级信息-通过otaId查询") @AutoLog(value = "车型备案-其他升级信息-通过otaId查询")
@ApiOperation(value = "车型备案-其他升级信息-通过otaId查询", notes = "车型备案-其他升级信息-通过otaId查询") @ApiOperation(value = "车型备案-其他升级信息-通过otaId查询", notes = "车型备案-其他升级信息-通过otaId查询")
@GetMapping(value = "/queryByOtaId") @GetMapping(value = "/queryByOtaId")
public Result<?> queryByOtaId(@RequestParam(name="otaId",required=true) String otaId) { public Result<?> queryByOtaId(@RequestParam(name = "otaId", required = true) String otaId,
OtaBaCxQt otaBaCxQt = otaBaCxQtService.queryByOtaId(otaId); @RequestParam(name = "otaIdT", required = true) String otaIdT) {
OtaBaCxQt otaBaCxQt = otaBaCxQtService.queryByOtaId(otaId, otaIdT);
if (otaBaCxQt == null) { if (otaBaCxQt == null) {
return Result.error("未找到对应数据"); return Result.error("未找到对应数据");
} }
@@ -144,6 +144,23 @@ public class OtaBaCxTxjlController extends JeroController<OtaBaCxTxjl, IOtaBaCxT
return Result.OK(otaBaCxTxjl); return Result.OK(otaBaCxTxjl);
} }
/**
* 通过otaId查询
*
* @param otaId
* @return
*/
@AutoLog(value = "车型备案-填写记录表-通过otaId查询")
@ApiOperation(value="车型备案-填写记录表-通过otaId查询", notes="车型备案-填写记录表-通过otaId查询")
@GetMapping(value = "/queryByOtaId")
public Result<?> queryByOtaId(@RequestParam(name="otaId",required=true) String otaId) {
List<OtaBaCxTxjl> otaBaCxTxjlList = otaBaCxTxjlService.queryByOtaId(otaId);
if(otaBaCxTxjlList==null) {
return Result.error("未找到对应数据");
}
return Result.OK(otaBaCxTxjlList);
}
/** /**
* 导出excel * 导出excel
* *
@@ -4,6 +4,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.ota.entity.OtaBaCxZxsjyq; import com.jero.modules.ota.entity.OtaBaCxZxsjyq;
@@ -146,15 +147,13 @@ public class OtaBaCxZxsjyqController extends JeroController<OtaBaCxZxsjyq, IOtaB
/** /**
* 通过OtaId查询 * 通过OtaId查询
*
* @param OtaId
* @return
*/ */
@AutoLog(value = "车型备案-在线升级要求-通过otaId查询") @AutoLog(value = "车型备案-在线升级要求-通过otaId查询")
@ApiOperation(value = "车型备案-在线升级要求-通过otaId查询", notes = "车型备案-在线升级要求-通过otaId查询") @ApiOperation(value = "车型备案-在线升级要求-通过otaId查询", notes = "车型备案-在线升级要求-通过otaId查询")
@GetMapping(value = "/queryByOtaId") @GetMapping(value = "/queryByOtaId")
public Result<?> queryByOtaId(@RequestParam(name="otaId",required=true) String otaId) { public Result<?> queryByOtaId(@RequestParam(name = "otaId", required = true) String otaId,
OtaBaCxZxsjyq otaBaCxZxsjyq = otaBaCxZxsjyqService.queryByOtaId(otaId); @RequestParam(name = "otaIdT", required = true) String otaIdT) {
OtaBaCxZxsjyq otaBaCxZxsjyq = otaBaCxZxsjyqService.queryByOtaId(otaId, otaIdT);
if (otaBaCxZxsjyq == null) { if (otaBaCxZxsjyq == null) {
return Result.error("未找到对应数据"); return Result.error("未找到对应数据");
} }
@@ -94,6 +94,7 @@ public class OtaBaCxList implements Serializable {
/**备案状态*/ /**备案状态*/
@Excel(name = "备案状态", width = 15) @Excel(name = "备案状态", width = 15)
@ApiModelProperty(value = "备案状态") @ApiModelProperty(value = "备案状态")
@Dict(dicCode = "recordstatus")
private java.lang.String bazt; private java.lang.String bazt;
/**备案提交时间*/ /**备案提交时间*/
@@ -68,6 +68,7 @@ public class OtaBaCxLsjl implements Serializable {
/**数据状态*/ /**数据状态*/
@Excel(name = "数据状态", width = 15) @Excel(name = "数据状态", width = 15)
@Dict(dicCode = "recordstatus")
@ApiModelProperty(value = "数据状态") @ApiModelProperty(value = "数据状态")
private java.lang.String sjzt; private java.lang.String sjzt;
@@ -2,6 +2,7 @@ package com.jero.modules.ota.service;
import com.jero.modules.ota.entity.OtaBaCxAqcs; import com.jero.modules.ota.entity.OtaBaCxAqcs;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List; import java.util.List;
/** /**
@@ -59,5 +60,5 @@ public interface IOtaBaCxAqcsService extends IService<OtaBaCxAqcs> {
*/ */
List<OtaBaCxAqcs> queryList(); List<OtaBaCxAqcs> queryList();
OtaBaCxAqcs queryByOtaId(String otaId); OtaBaCxAqcs queryByOtaId(String otaId, String otaIdT);
} }
@@ -59,5 +59,5 @@ public interface IOtaBaCxJbxxService extends IService<OtaBaCxJbxx> {
*/ */
List<OtaBaCxJbxx> queryList(); List<OtaBaCxJbxx> queryList();
OtaBaCxJbxx queryByOtaId(String otaId); OtaBaCxJbxx queryByOtaId(String otaId, String otaIdT);
} }
@@ -3,6 +3,7 @@ package com.jero.modules.ota.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jero.modules.ota.entity.OtaBaCxJsfzbacs; import com.jero.modules.ota.entity.OtaBaCxJsfzbacs;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List; import java.util.List;
/** /**
@@ -58,4 +59,6 @@ public interface IOtaBaCxJsfzbacsService extends IService<OtaBaCxJsfzbacs> {
* @return * @return
*/ */
List<OtaBaCxJsfzbacs> queryList(); List<OtaBaCxJsfzbacs> queryList();
JSONObject queryByOtaId(String otaId, String otaIdT);
} }
@@ -1,7 +1,9 @@
package com.jero.modules.ota.service; package com.jero.modules.ota.service;
import com.alibaba.fastjson.JSONObject;
import com.jero.modules.ota.entity.OtaBaCxKsjjsmccs; import com.jero.modules.ota.entity.OtaBaCxKsjjsmccs;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List; import java.util.List;
/** /**
@@ -15,10 +17,9 @@ public interface IOtaBaCxKsjjsmccsService extends IService<OtaBaCxKsjjsmccs> {
/** /**
* 保存 * 保存
* *
* @param otaBaCxKsjjsmccs
* @return * @return
*/ */
void add(OtaBaCxKsjjsmccs otaBaCxKsjjsmccs); void add(JSONObject json);
/** /**
* 更新 * 更新
@@ -59,5 +60,5 @@ public interface IOtaBaCxKsjjsmccsService extends IService<OtaBaCxKsjjsmccs> {
*/ */
List<OtaBaCxKsjjsmccs> queryList(); List<OtaBaCxKsjjsmccs> queryList();
List<OtaBaCxKsjjsmccs> queryByOtaId(String otaId); List<OtaBaCxKsjjsmccs> queryByOtaId(String otaId, String otaIdT);
} }
@@ -1,7 +1,9 @@
package com.jero.modules.ota.service; package com.jero.modules.ota.service;
import com.alibaba.fastjson.JSONObject;
import com.jero.modules.ota.entity.OtaBaCxKsjxtmccs; import com.jero.modules.ota.entity.OtaBaCxKsjxtmccs;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List; import java.util.List;
/** /**
@@ -15,10 +17,9 @@ public interface IOtaBaCxKsjxtmccsService extends IService<OtaBaCxKsjxtmccs> {
/** /**
* 保存 * 保存
* *
* @param otaBaCxKsjxtmccs
* @return * @return
*/ */
void add(OtaBaCxKsjxtmccs otaBaCxKsjxtmccs); void add(JSONObject json);
/** /**
* 更新 * 更新
@@ -59,5 +60,5 @@ public interface IOtaBaCxKsjxtmccsService extends IService<OtaBaCxKsjxtmccs> {
*/ */
List<OtaBaCxKsjxtmccs> queryList(); List<OtaBaCxKsjxtmccs> queryList();
List<OtaBaCxKsjxtmccs> queryByOtaId(String otaId); List<OtaBaCxKsjxtmccs> queryByOtaId(String otaId, String otaIdT);
} }
@@ -2,7 +2,10 @@ package com.jero.modules.ota.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.ota.entity.OtaBaCxList; import com.jero.modules.ota.entity.OtaBaCxList;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
@@ -65,4 +68,10 @@ public interface IOtaBaCxListService extends IService<OtaBaCxList> {
* *
*/ */
void batchRecord(String ids, String bazt, String batjsj, String bz, String cut); void batchRecord(String ids, String bazt, String batjsj, String bz, String cut);
void exportTemplate(HttpServletResponse response, HttpServletRequest request);
void importData(MultipartFile file, String cut);
void exportData(String otaId, HttpServletResponse response, HttpServletRequest request);
} }
@@ -2,6 +2,7 @@ package com.jero.modules.ota.service;
import com.jero.modules.ota.entity.OtaBaCxQt; import com.jero.modules.ota.entity.OtaBaCxQt;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List; import java.util.List;
/** /**
@@ -59,5 +60,5 @@ public interface IOtaBaCxQtService extends IService<OtaBaCxQt> {
*/ */
List<OtaBaCxQt> queryList(); List<OtaBaCxQt> queryList();
OtaBaCxQt queryByOtaId(String otaId); OtaBaCxQt queryByOtaId(String otaId, String otaIdT);
} }
@@ -58,4 +58,6 @@ public interface IOtaBaCxTxjlService extends IService<OtaBaCxTxjl> {
* @return * @return
*/ */
List<OtaBaCxTxjl> queryList(); List<OtaBaCxTxjl> queryList();
List<OtaBaCxTxjl> queryByOtaId(String otaId);
} }
@@ -2,6 +2,7 @@ package com.jero.modules.ota.service;
import com.jero.modules.ota.entity.OtaBaCxZxsjyq; import com.jero.modules.ota.entity.OtaBaCxZxsjyq;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List; import java.util.List;
/** /**
@@ -59,5 +60,5 @@ public interface IOtaBaCxZxsjyqService extends IService<OtaBaCxZxsjyq> {
*/ */
List<OtaBaCxZxsjyq> queryList(); List<OtaBaCxZxsjyq> queryList();
OtaBaCxZxsjyq queryByOtaId(String otaId); OtaBaCxZxsjyq queryByOtaId(String otaId, String otaIdT);
} }
@@ -5,9 +5,12 @@ import com.jero.modules.ota.entity.OtaBaCxAqcs;
import com.jero.modules.ota.entity.OtaBaCxJbxx; import com.jero.modules.ota.entity.OtaBaCxJbxx;
import com.jero.modules.ota.mapper.OtaBaCxAqcsMapper; import com.jero.modules.ota.mapper.OtaBaCxAqcsMapper;
import com.jero.modules.ota.service.IOtaBaCxAqcsService; import com.jero.modules.ota.service.IOtaBaCxAqcsService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/** /**
@@ -28,9 +31,16 @@ public class OtaBaCxAqcsServiceImpl extends ServiceImpl<OtaBaCxAqcsMapper, OtaBa
@Override @Override
public void add(OtaBaCxAqcs otaBaCxAqcs) { public void add(OtaBaCxAqcs otaBaCxAqcs) {
Date now = new Date(); Date now = new Date();
if (null != otaBaCxAqcs) {
OtaBaCxAqcs otaBaCxAqcsOld = this.getByOtaId(otaBaCxAqcs.getOtaId());
if (null != otaBaCxAqcsOld) {
otaBaCxAqcs.setId(otaBaCxAqcsOld.getId());
} else {
otaBaCxAqcs.setCreateTime(now); otaBaCxAqcs.setCreateTime(now);
}
otaBaCxAqcs.setUpdateTime(now); otaBaCxAqcs.setUpdateTime(now);
save(otaBaCxAqcs); saveOrUpdate(otaBaCxAqcs);
}
} }
/** /**
@@ -90,10 +100,17 @@ public class OtaBaCxAqcsServiceImpl extends ServiceImpl<OtaBaCxAqcsMapper, OtaBa
} }
@Override @Override
public OtaBaCxAqcs queryByOtaId(String otaId) { public OtaBaCxAqcs queryByOtaId(String otaId, String otaIdT) {
LambdaQueryWrapper<OtaBaCxAqcs> queryWrapper = new LambdaQueryWrapper<>(); OtaBaCxAqcs res = getByOtaId(otaId);
queryWrapper.eq(OtaBaCxAqcs::getOtaId, otaId); if (ObjectUtils.isEmpty(res)) {
OtaBaCxAqcs res = this.getOne(queryWrapper); res = getByOtaId(otaIdT);
}
return res; return res;
} }
private OtaBaCxAqcs getByOtaId(String otaId) {
LambdaQueryWrapper<OtaBaCxAqcs> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaCxAqcs::getOtaId, otaId);
return this.getOne(queryWrapper, false);
}
} }
@@ -7,6 +7,7 @@ import com.jero.modules.ota.entity.OtaBaCxList;
import com.jero.modules.ota.mapper.OtaBaCxJbxxMapper; import com.jero.modules.ota.mapper.OtaBaCxJbxxMapper;
import com.jero.modules.ota.service.IOtaBaCxJbxxService; import com.jero.modules.ota.service.IOtaBaCxJbxxService;
import com.jero.modules.ota.service.IOtaBaCxListService; import com.jero.modules.ota.service.IOtaBaCxListService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -110,10 +111,18 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
} }
@Override @Override
public OtaBaCxJbxx queryByOtaId(String otaId){ public OtaBaCxJbxx queryByOtaId(String otaId, String otaIdT){
LambdaQueryWrapper<OtaBaCxJbxx> queryWrapper = new LambdaQueryWrapper<>(); //判断是否保存过,否则查询模版数据回显
queryWrapper.eq(OtaBaCxJbxx::getOtaId, otaId); OtaBaCxJbxx res = getByOtaId(otaId);
OtaBaCxJbxx res = this.getOne(queryWrapper); if(ObjectUtils.isEmpty(res)){
res = getByOtaId(otaIdT);
}
return res; return res;
} }
private OtaBaCxJbxx getByOtaId(String otaId) {
LambdaQueryWrapper<OtaBaCxJbxx> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaCxJbxx::getOtaId, otaId);
return this.getOne(queryWrapper,false);
}
} }
@@ -3,12 +3,16 @@ package com.jero.modules.ota.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.modules.ota.entity.OtaBaCxJsfzbacs; import com.jero.modules.ota.entity.OtaBaCxJsfzbacs;
import com.jero.modules.ota.entity.OtaBaCxKsjxtmccs;
import com.jero.modules.ota.entity.OtaBaCxLsjl;
import com.jero.modules.ota.entity.OtaBaCxSjmk; import com.jero.modules.ota.entity.OtaBaCxSjmk;
import com.jero.modules.ota.mapper.OtaBaCxJsfzbacsMapper; import com.jero.modules.ota.mapper.OtaBaCxJsfzbacsMapper;
import com.jero.modules.ota.service.IOtaBaCxJsfzbacsService; import com.jero.modules.ota.service.IOtaBaCxJsfzbacsService;
import com.jero.modules.ota.service.IOtaBaCxLsjlService; import com.jero.modules.ota.service.IOtaBaCxLsjlService;
import com.jero.modules.ota.service.IOtaBaCxSjmkService; import com.jero.modules.ota.service.IOtaBaCxSjmkService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -76,6 +80,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
} }
return sjmkList; return sjmkList;
} }
/** /**
* 解析部件数据 * 解析部件数据
*/ */
@@ -168,4 +173,27 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
public List<OtaBaCxJsfzbacs> queryList() { public List<OtaBaCxJsfzbacs> queryList() {
return list(); return list();
} }
@Override
public JSONObject queryByOtaId(String otaId, String otaIdT) {
JSONObject res = new JSONObject();
res.put("otaId", otaId);
OtaBaCxJsfzbacs otaBaCxJsfzbacs = getByOtaId(otaId);
List<OtaBaCxSjmk> kzqList = OtaBaCxSjmkService.queryByOtaId(otaId);
if (ObjectUtils.isEmpty(otaBaCxJsfzbacs)) {
otaBaCxJsfzbacs = getByOtaId(otaIdT);
kzqList = OtaBaCxSjmkService.queryByOtaId(otaIdT);
}
res.put("bj", otaBaCxJsfzbacs);
res.put("kzq", kzqList);
return res;
}
private OtaBaCxJsfzbacs getByOtaId(String otaId) {
LambdaQueryWrapper<OtaBaCxJsfzbacs> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaCxJsfzbacs::getOtaId, otaId);
return this.getOne(queryWrapper, false);
}
} }
@@ -1,14 +1,20 @@
package com.jero.modules.ota.service.impl; package com.jero.modules.ota.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.modules.ota.entity.OtaBaCxJsfzbacs;
import com.jero.modules.ota.entity.OtaBaCxKsjjsmccs; import com.jero.modules.ota.entity.OtaBaCxKsjjsmccs;
import com.jero.modules.ota.entity.OtaBaCxKsjxtmccs; import com.jero.modules.ota.entity.OtaBaCxKsjxtmccs;
import com.jero.modules.ota.entity.OtaBaCxSjmk;
import com.jero.modules.ota.mapper.OtaBaCxKsjjsmccsMapper; import com.jero.modules.ota.mapper.OtaBaCxKsjjsmccsMapper;
import com.jero.modules.ota.service.IOtaBaCxKsjjsmccsService; import com.jero.modules.ota.service.IOtaBaCxKsjjsmccsService;
import com.jero.modules.system.util.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.lang.reflect.Field;
import java.util.Date; import java.util.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -24,15 +30,36 @@ public class OtaBaCxKsjjsmccsServiceImpl extends ServiceImpl<OtaBaCxKsjjsmccsMap
/** /**
* 保存 * 保存
* *
* @param otaBaCxKsjjsmccs
* @return * @return
*/ */
@Override @Override
public void add(OtaBaCxKsjjsmccs otaBaCxKsjjsmccs) { public void add(JSONObject json) {
Date now = new Date(); Date now = new Date();
otaBaCxKsjjsmccs.setCreateTime(now); String otaId = (String) json.get("otaId");
otaBaCxKsjjsmccs.setUpdateTime(now); if (StringUtils.isNotEmpty(otaId)) {
save(otaBaCxKsjjsmccs); deleteByOtaId(otaId);
JSONArray list = json.getJSONArray("list");
for (Object obj : list) {
Map<String, Object> objMap = (HashMap) obj;
OtaBaCxKsjjsmccs otaBaCxJsfzbacs = new OtaBaCxKsjjsmccs();
Field[] fields = OtaBaCxKsjjsmccs.class.getDeclaredFields();
for (Field field : fields) {
Object bjObj = objMap.get(field.getName());
if (null != bjObj) {
try {
field.setAccessible(true);
field.set(otaBaCxJsfzbacs, bjObj.toString());
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
otaBaCxJsfzbacs.setOtaId(otaId);
otaBaCxJsfzbacs.setCreateTime(now);
otaBaCxJsfzbacs.setUpdateTime(now);
save(otaBaCxJsfzbacs);
}
}
} }
/** /**
@@ -92,10 +119,26 @@ public class OtaBaCxKsjjsmccsServiceImpl extends ServiceImpl<OtaBaCxKsjjsmccsMap
} }
@Override @Override
public List<OtaBaCxKsjjsmccs> queryByOtaId(String otaId) { public List<OtaBaCxKsjjsmccs> queryByOtaId(String otaId, String otaIdT) {
LambdaQueryWrapper<OtaBaCxKsjjsmccs> queryWrapper = new LambdaQueryWrapper<>(); List<OtaBaCxKsjjsmccs> res = this.getByOtaId(otaId);
queryWrapper.eq(OtaBaCxKsjjsmccs::getOtaId, otaId); if (ObjectUtil.isEmpty(res)) {
List<OtaBaCxKsjjsmccs> res = this.list(queryWrapper); res = getByOtaId(otaIdT);
}
return res; return res;
} }
private List<OtaBaCxKsjjsmccs> getByOtaId(String otaId) {
LambdaQueryWrapper<OtaBaCxKsjjsmccs> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaCxKsjjsmccs::getOtaId, otaId);
return this.list(queryWrapper);
}
public void deleteByOtaId(String otaId) {
List<OtaBaCxKsjjsmccs> list = this.getByOtaId(otaId);
List<String> ids = new ArrayList<>();
for (OtaBaCxKsjjsmccs mccs : list) {
ids.add(mccs.getId());
}
this.deleteByIds(ids);
}
} }
@@ -1,13 +1,20 @@
package com.jero.modules.ota.service.impl; package com.jero.modules.ota.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.modules.ota.entity.OtaBaCxJbxx; import com.jero.modules.ota.entity.OtaBaCxJbxx;
import com.jero.modules.ota.entity.OtaBaCxKsjjsmccs;
import com.jero.modules.ota.entity.OtaBaCxKsjxtmccs; import com.jero.modules.ota.entity.OtaBaCxKsjxtmccs;
import com.jero.modules.ota.mapper.OtaBaCxKsjxtmccsMapper; import com.jero.modules.ota.mapper.OtaBaCxKsjxtmccsMapper;
import com.jero.modules.ota.service.IOtaBaCxKsjxtmccsService; import com.jero.modules.ota.service.IOtaBaCxKsjxtmccsService;
import com.jero.modules.system.util.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Date; import java.lang.reflect.Field;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/** /**
@@ -22,16 +29,37 @@ public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMap
/** /**
* 保存 * 保存
* *
* @param otaBaCxKsjxtmccs
* @return * @return
*/ */
@Override @Override
public void add(OtaBaCxKsjxtmccs otaBaCxKsjxtmccs) { public void add(JSONObject json) {
Date now = new Date(); Date now = new Date();
String otaId = (String) json.get("otaId");
if (StringUtils.isNotEmpty(otaId)) {
deleteByOtaId(otaId);
JSONArray list = json.getJSONArray("list");
for (Object obj : list) {
Map<String, Object> objMap = (HashMap) obj;
OtaBaCxKsjxtmccs otaBaCxKsjxtmccs = new OtaBaCxKsjxtmccs();
Field[] fields = OtaBaCxKsjxtmccs.class.getDeclaredFields();
for (Field field : fields) {
Object bjObj = objMap.get(field.getName());
if (null != bjObj) {
try {
field.setAccessible(true);
field.set(otaBaCxKsjxtmccs, bjObj.toString());
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
otaBaCxKsjxtmccs.setOtaId(otaId);
otaBaCxKsjxtmccs.setCreateTime(now); otaBaCxKsjxtmccs.setCreateTime(now);
otaBaCxKsjxtmccs.setUpdateTime(now); otaBaCxKsjxtmccs.setUpdateTime(now);
save(otaBaCxKsjxtmccs); save(otaBaCxKsjxtmccs);
} }
}
}
/** /**
* 更新 * 更新
@@ -90,10 +118,26 @@ public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMap
} }
@Override @Override
public List<OtaBaCxKsjxtmccs> queryByOtaId(String otaId) { public List<OtaBaCxKsjxtmccs> queryByOtaId(String otaId, String otaIdT) {
LambdaQueryWrapper<OtaBaCxKsjxtmccs> queryWrapper = new LambdaQueryWrapper<>(); List<OtaBaCxKsjxtmccs> res = getByOtaId(otaId);
queryWrapper.eq(OtaBaCxKsjxtmccs::getOtaId, otaId); if (ObjectUtil.isEmpty(res)) {
List<OtaBaCxKsjxtmccs> res = this.list(queryWrapper); res = getByOtaId(otaIdT);
}
return res; return res;
} }
private List<OtaBaCxKsjxtmccs> getByOtaId(String otaId) {
LambdaQueryWrapper<OtaBaCxKsjxtmccs> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaCxKsjxtmccs::getOtaId, otaId);
return this.list(queryWrapper);
}
public void deleteByOtaId(String otaId) {
List<OtaBaCxKsjxtmccs> list = this.getByOtaId(otaId);
List<String> ids = new ArrayList<>();
for (OtaBaCxKsjxtmccs mccs : list) {
ids.add(mccs.getId());
}
this.deleteByIds(ids);
}
} }
@@ -1,17 +1,29 @@
package com.jero.modules.ota.service.impl; package com.jero.modules.ota.service.impl;
import com.aliyuncs.utils.IOUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.exception.JeroBootException; import com.jero.common.exception.JeroBootException;
import com.jero.modules.ota.entity.OtaBaCxList; import com.jero.modules.ota.entity.OtaBaCxList;
import com.jero.modules.ota.entity.OtaBaCxLsjl; import com.jero.modules.ota.entity.OtaBaCxLsjl;
import com.jero.modules.ota.mapper.OtaBaCxListMapper; import com.jero.modules.ota.mapper.OtaBaCxListMapper;
import com.jero.modules.ota.service.IOtaBaCxListService; import com.jero.modules.ota.service.IOtaBaCxListService;
import com.jero.modules.ota.service.IOtaBaCxLsjlService; import com.jero.modules.ota.service.IOtaBaCxLsjlService;
import com.jero.modules.split.common.FileUnZip;
import com.jero.modules.system.util.StringUtils; import com.jero.modules.system.util.StringUtils;
import org.apache.commons.io.FileUtils;
import org.apache.ibatis.logging.Log;
import org.apache.ibatis.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -24,11 +36,17 @@ import java.util.List;
@Service @Service
public class OtaBaCxListServiceImpl extends ServiceImpl<OtaBaCxListMapper, OtaBaCxList> implements IOtaBaCxListService { public class OtaBaCxListServiceImpl extends ServiceImpl<OtaBaCxListMapper, OtaBaCxList> implements IOtaBaCxListService {
protected Log log = LogFactory.getLog(this.getClass());
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@Autowired @Autowired
private IOtaBaCxLsjlService otaBaCxLsjlService; private IOtaBaCxLsjlService otaBaCxLsjlService;
@Value(value = "${jero.path.upload}")
private String uploadpath;
/** /**
* 保存 * 保存
* *
@@ -40,7 +58,7 @@ public class OtaBaCxListServiceImpl extends ServiceImpl<OtaBaCxListMapper, OtaBa
Date now = new Date(); Date now = new Date();
otaBaCxList.setCreateTime(now); otaBaCxList.setCreateTime(now);
otaBaCxList.setUpdateTime(now); otaBaCxList.setUpdateTime(now);
save(otaBaCxList); saveOrUpdate(otaBaCxList);
} }
/** /**
@@ -125,4 +143,127 @@ public class OtaBaCxListServiceImpl extends ServiceImpl<OtaBaCxListMapper, OtaBa
throw new JeroBootException(ex.getMessage()); throw new JeroBootException(ex.getMessage());
} }
} }
@Override
public void exportTemplate(HttpServletResponse response, HttpServletRequest request) {
File template = new File("D://opt//ota//车型及功能备案.zip");
BufferedOutputStream os = null;
InputStream in = null;
try {
in = new FileInputStream(template);
response.setHeader("Content-disposition", "attachment;filename=" + template.getName());
response.setContentType("application/octet-stream;charset=UTF-8");
os = new BufferedOutputStream(response.getOutputStream());
int len;
while ((len = in.read()) != -1) {
os.write(len);
os.flush();
}
in.close();
os.close();
} catch (Exception e) {
throw new JeroBootException("下载文件失败,请重试");
} finally {
IOUtils.closeQuietly(in);
IOUtils.closeQuietly(os);
}
}
@Override
public void importData(MultipartFile file, String cut) {
try {
int pos = file.getOriginalFilename().lastIndexOf(".");
String str = file.getOriginalFilename().substring(pos + 1).toLowerCase();
String filenameorg = file.getOriginalFilename().substring(0, pos);
//判断上传文件必须是zip
if (!str.equals("zip") && !str.equals("rar")) {
if (CutEnum.CN.getValue().equals(cut)) {
throw new JeroBootException("请上传zip格式的文件或rar格式的文件");
} else {
throw new JeroBootException("Please upload a zip file or rar file");
}
}
String path = uploadpath + File.separator + "modal" + File.separator + filenameorg + System.currentTimeMillis();
File saveDirectory = new File(path);
if (!saveDirectory.isDirectory()) {
saveDirectory.mkdir();
}
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(path + File.separator + file.getOriginalFilename()));
//解压缩
String zipEntryName = "";
if (str.equals("zip")) {
zipEntryName = FileUnZip.unZipFiles(path + File.separator + file.getOriginalFilename(), path);
} else {
// zipEntryName = FileRarUtils.rarUnCompress(path + File.separator + file.getOriginalFilename(), path);
}
//判断压缩包下是否只有一个文件夹
File fileTemp = new File(path);
int length = fileTemp.listFiles().length;
if (length > 2) {
//删除原上传文件
FileUnZip.deleteDir(saveDirectory);
if (CutEnum.CN.getValue().equals(cut)) {
throw new JeroBootException("压缩包中必须有且仅有一个文件夹,请重新上传");
} else {
throw new JeroBootException("There must be only one folder in the compressed package Please upload it again");
}
}
File fileNew = new File(zipEntryName);
List<File> fileList = new ArrayList<>();
for (File file1 : fileNew.listFiles()) {
log.error("压缩包中的文件:" + file1.getName());
if (file1.getName().contains(".xls") || file1.getName().contains(".xlsx")) {
fileList.add(file1);
}
}
if (fileList.size() == 0) {
//删除原上传文件
FileUnZip.deleteDir(saveDirectory);
if (CutEnum.CN.getValue().equals(cut)) {
throw new JeroBootException("压缩包根目录下没有excel作为导入数据,请重新上传");
} else {
throw new JeroBootException("Excel does not exist in the root directory of the compressed package Please upload it again");
}
} else if (fileList.size() > 1) {
//删除原上传文件
FileUnZip.deleteDir(saveDirectory);
if (CutEnum.CN.getValue().equals(cut)) {
throw new JeroBootException("压缩包根目录下仅能存在一个excel为导入数据,请重新上传");
} else {
throw new JeroBootException("Only one Excel file can be imported in the compressed package root directory. Please upload data again");
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void exportData(String otaId, HttpServletResponse response, HttpServletRequest request) {
log.error("otaId:" + otaId);
File template = new File("D://opt//ota//车型及功能备案.zip");
BufferedOutputStream os = null;
InputStream in = null;
try {
in = new FileInputStream(template);
response.setHeader("Content-disposition", "attachment;filename=" + template.getName());
response.setContentType("application/octet-stream;charset=UTF-8");
os = new BufferedOutputStream(response.getOutputStream());
int len;
while ((len = in.read()) != -1) {
os.write(len);
os.flush();
}
in.close();
os.close();
} catch (Exception e) {
throw new JeroBootException("下载文件失败,请重试");
} finally {
IOUtils.closeQuietly(in);
IOUtils.closeQuietly(os);
}
}
} }
@@ -30,7 +30,7 @@ public class OtaBaCxLsjlServiceImpl extends ServiceImpl<OtaBaCxLsjlMapper, OtaBa
Date now = new Date(); Date now = new Date();
otaBaCxLsjl.setCreateTime(now); otaBaCxLsjl.setCreateTime(now);
otaBaCxLsjl.setUpdateTime(now); otaBaCxLsjl.setUpdateTime(now);
save(otaBaCxLsjl); saveOrUpdate(otaBaCxLsjl);
} }
/** /**
@@ -5,9 +5,12 @@ import com.jero.modules.ota.entity.OtaBaCxAqcs;
import com.jero.modules.ota.entity.OtaBaCxQt; import com.jero.modules.ota.entity.OtaBaCxQt;
import com.jero.modules.ota.mapper.OtaBaCxQtMapper; import com.jero.modules.ota.mapper.OtaBaCxQtMapper;
import com.jero.modules.ota.service.IOtaBaCxQtService; import com.jero.modules.ota.service.IOtaBaCxQtService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/** /**
@@ -28,9 +31,16 @@ public class OtaBaCxQtServiceImpl extends ServiceImpl<OtaBaCxQtMapper, OtaBaCxQt
@Override @Override
public void add(OtaBaCxQt otaBaCxQt) { public void add(OtaBaCxQt otaBaCxQt) {
Date now = new Date(); Date now = new Date();
if (null != otaBaCxQt) {
OtaBaCxQt otaBaCxQtOld = this.getByOtaId(otaBaCxQt.getOtaId());
if (null != otaBaCxQtOld) {
otaBaCxQt.setId(otaBaCxQtOld.getId());
} else {
otaBaCxQt.setCreateTime(now); otaBaCxQt.setCreateTime(now);
}
otaBaCxQt.setUpdateTime(now); otaBaCxQt.setUpdateTime(now);
save(otaBaCxQt); saveOrUpdate(otaBaCxQt);
}
} }
/** /**
@@ -90,9 +100,18 @@ public class OtaBaCxQtServiceImpl extends ServiceImpl<OtaBaCxQtMapper, OtaBaCxQt
} }
@Override @Override
public OtaBaCxQt queryByOtaId(String otaId) { public OtaBaCxQt queryByOtaId(String otaId, String otaIdT) {
OtaBaCxQt res = getByOtaId(otaId);
if (ObjectUtils.isEmpty(res)) {
res = getByOtaId(otaIdT);
}
return res;
}
public OtaBaCxQt getByOtaId(String otaId) {
LambdaQueryWrapper<OtaBaCxQt> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OtaBaCxQt> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaCxQt::getOtaId, otaId); queryWrapper.eq(OtaBaCxQt::getOtaId, otaId);
OtaBaCxQt res = this.getOne(queryWrapper); return this.getOne(queryWrapper, false);
return res; } }
} }
@@ -31,7 +31,7 @@ public class OtaBaCxSjmkServiceImpl extends ServiceImpl<OtaBaCxSjmkMapper, OtaBa
Date now = new Date(); Date now = new Date();
otaBaCxSjmk.setCreateTime(now); otaBaCxSjmk.setCreateTime(now);
otaBaCxSjmk.setUpdateTime(now); otaBaCxSjmk.setUpdateTime(now);
save(otaBaCxSjmk); saveOrUpdate(otaBaCxSjmk);
} }
/** /**
@@ -1,12 +1,14 @@
package com.jero.modules.ota.service.impl; package com.jero.modules.ota.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.modules.ota.entity.OtaBaCxTxjl; import com.jero.modules.ota.entity.OtaBaCxTxjl;
import com.jero.modules.ota.mapper.OtaBaCxTxjlMapper; import com.jero.modules.ota.mapper.OtaBaCxTxjlMapper;
import com.jero.modules.ota.service.IOtaBaCxTxjlService; import com.jero.modules.ota.service.IOtaBaCxTxjlService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import java.util.List;
/** /**
* @Description: 车型备案-填写记录表 * @Description: 车型备案-填写记录表
@@ -28,7 +30,7 @@ public class OtaBaCxTxjlServiceImpl extends ServiceImpl<OtaBaCxTxjlMapper, OtaBa
Date now = new Date(); Date now = new Date();
otaBaCxTxjl.setCreateTime(now); otaBaCxTxjl.setCreateTime(now);
otaBaCxTxjl.setUpdateTime(now); otaBaCxTxjl.setUpdateTime(now);
save(otaBaCxTxjl); saveOrUpdate(otaBaCxTxjl);
} }
/** /**
@@ -86,4 +88,12 @@ public class OtaBaCxTxjlServiceImpl extends ServiceImpl<OtaBaCxTxjlMapper, OtaBa
public List<OtaBaCxTxjl> queryList() { public List<OtaBaCxTxjl> queryList() {
return list(); return list();
} }
@Override
public List<OtaBaCxTxjl> queryByOtaId(String otaId) {
LambdaQueryWrapper<OtaBaCxTxjl> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaCxTxjl::getOtaId, otaId);
List<OtaBaCxTxjl> res = this.list(queryWrapper);
return res;
}
} }
@@ -5,9 +5,12 @@ import com.jero.modules.ota.entity.OtaBaCxJbxx;
import com.jero.modules.ota.entity.OtaBaCxZxsjyq; import com.jero.modules.ota.entity.OtaBaCxZxsjyq;
import com.jero.modules.ota.mapper.OtaBaCxZxsjyqMapper; import com.jero.modules.ota.mapper.OtaBaCxZxsjyqMapper;
import com.jero.modules.ota.service.IOtaBaCxZxsjyqService; import com.jero.modules.ota.service.IOtaBaCxZxsjyqService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/** /**
@@ -28,9 +31,16 @@ public class OtaBaCxZxsjyqServiceImpl extends ServiceImpl<OtaBaCxZxsjyqMapper, O
@Override @Override
public void add(OtaBaCxZxsjyq otaBaCxZxsjyq) { public void add(OtaBaCxZxsjyq otaBaCxZxsjyq) {
Date now = new Date(); Date now = new Date();
if (otaBaCxZxsjyq.getOtaId() != null) {
OtaBaCxZxsjyq otaBaCxZxsjyqOld = getByOtaId(otaBaCxZxsjyq.getOtaId());
if (otaBaCxZxsjyqOld != null) {
otaBaCxZxsjyq.setId(otaBaCxZxsjyqOld.getId());
} else {
otaBaCxZxsjyq.setCreateTime(now); otaBaCxZxsjyq.setCreateTime(now);
}
}
otaBaCxZxsjyq.setUpdateTime(now); otaBaCxZxsjyq.setUpdateTime(now);
save(otaBaCxZxsjyq); saveOrUpdate(otaBaCxZxsjyq);
} }
/** /**
@@ -90,10 +100,18 @@ public class OtaBaCxZxsjyqServiceImpl extends ServiceImpl<OtaBaCxZxsjyqMapper, O
} }
@Override @Override
public OtaBaCxZxsjyq queryByOtaId(String otaId){ public OtaBaCxZxsjyq queryByOtaId(String otaId, String otaIdT) {
LambdaQueryWrapper<OtaBaCxZxsjyq> queryWrapper = new LambdaQueryWrapper<>(); //判断是否保存过,否则查询模版数据回显
queryWrapper.eq(OtaBaCxZxsjyq::getOtaId, otaId); OtaBaCxZxsjyq res = getByOtaId(otaId);
OtaBaCxZxsjyq res = this.getOne(queryWrapper); if (ObjectUtils.isEmpty(res)) {
res = getByOtaId(otaIdT);
}
return res; return res;
} }
private OtaBaCxZxsjyq getByOtaId(String otaId) {
LambdaQueryWrapper<OtaBaCxZxsjyq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaCxZxsjyq::getOtaId, otaId);
return this.getOne(queryWrapper, false);
}
} }