开发OTA备案工具-车辆升级

This commit is contained in:
高嵩
2023-03-29 00:37:49 +08:00
parent 5843bd2a1e
commit 2e59c45189
14 changed files with 977 additions and 557 deletions
@@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
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;
@@ -29,7 +30,7 @@ import java.util.List;
* @Date: 2023-03-17 * @Date: 2023-03-17
* @Version: V1.0 * @Version: V1.0
*/ */
@Api(tags="升级备案-升级活动备案列表") @Api(tags = "升级备案-升级活动备案列表")
@RestController @RestController
@RequestMapping("/ota/otaBaSjList") @RequestMapping("/ota/otaBaSjList")
@Slf4j @Slf4j
@@ -47,11 +48,11 @@ public class OtaBaSjListController extends JeroController<OtaBaSjList, IOtaBaSjL
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级活动备案列表-分页列表查询") @AutoLog(value = "升级备案-升级活动备案列表-分页列表查询")
@ApiOperation(value="升级备案-升级活动备案列表-分页列表查询", notes="升级备案-升级活动备案列表-分页列表查询") @ApiOperation(value = "升级备案-升级活动备案列表-分页列表查询", notes = "升级备案-升级活动备案列表-分页列表查询")
@GetMapping(value = "/page") @GetMapping(value = "/page")
public Result<?> queryPageList(OtaBaSjList otaBaSjList, public Result<?> queryPageList(OtaBaSjList otaBaSjList,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) { HttpServletRequest req) {
QueryWrapper<OtaBaSjList> queryWrapper = QueryGenerator.initQueryWrapper(otaBaSjList, req.getParameterMap()); QueryWrapper<OtaBaSjList> queryWrapper = QueryGenerator.initQueryWrapper(otaBaSjList, req.getParameterMap());
queryWrapper.orderByDesc("create_time"); queryWrapper.orderByDesc("create_time");
@@ -66,7 +67,7 @@ public class OtaBaSjListController extends JeroController<OtaBaSjList, IOtaBaSjL
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级活动备案列表-列表查询") @AutoLog(value = "升级备案-升级活动备案列表-列表查询")
@ApiOperation(value="升级备案-升级活动备案列表-列表查询", notes="升级备案-升级活动备案列表-列表查询") @ApiOperation(value = "升级备案-升级活动备案列表-列表查询", notes = "升级备案-升级活动备案列表-列表查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public Result<List<OtaBaSjList>> queryList() { public Result<List<OtaBaSjList>> queryList() {
List<OtaBaSjList> list = otaBaSjListService.queryList(); List<OtaBaSjList> list = otaBaSjListService.queryList();
@@ -80,7 +81,7 @@ public class OtaBaSjListController extends JeroController<OtaBaSjList, IOtaBaSjL
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级活动备案列表-添加") @AutoLog(value = "升级备案-升级活动备案列表-添加")
@ApiOperation(value="升级备案-升级活动备案列表-添加", notes="升级备案-升级活动备案列表-添加") @ApiOperation(value = "升级备案-升级活动备案列表-添加", notes = "升级备案-升级活动备案列表-添加")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<?> add(@Validated @RequestBody OtaBaSjList otaBaSjList) { public Result<?> add(@Validated @RequestBody OtaBaSjList otaBaSjList) {
otaBaSjListService.add(otaBaSjList); otaBaSjListService.add(otaBaSjList);
@@ -94,7 +95,7 @@ public class OtaBaSjListController extends JeroController<OtaBaSjList, IOtaBaSjL
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级活动备案列表-编辑") @AutoLog(value = "升级备案-升级活动备案列表-编辑")
@ApiOperation(value="升级备案-升级活动备案列表-编辑", notes="升级备案-升级活动备案列表-编辑") @ApiOperation(value = "升级备案-升级活动备案列表-编辑", notes = "升级备案-升级活动备案列表-编辑")
@PutMapping(value = "/edit") @PutMapping(value = "/edit")
public Result<?> edit(@Validated @RequestBody OtaBaSjList otaBaSjList) { public Result<?> edit(@Validated @RequestBody OtaBaSjList otaBaSjList) {
otaBaSjListService.editById(otaBaSjList); otaBaSjListService.editById(otaBaSjList);
@@ -108,9 +109,9 @@ public class OtaBaSjListController extends JeroController<OtaBaSjList, IOtaBaSjL
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级活动备案列表-通过id删除") @AutoLog(value = "升级备案-升级活动备案列表-通过id删除")
@ApiOperation(value="升级备案-升级活动备案列表-通过id删除", notes="升级备案-升级活动备案列表-通过id删除") @ApiOperation(value = "升级备案-升级活动备案列表-通过id删除", notes = "升级备案-升级活动备案列表-通过id删除")
@DeleteMapping(value = "/delete") @DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) { public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
otaBaSjListService.deleteById(id); otaBaSjListService.deleteById(id);
return Result.OK("删除成功!"); return Result.OK("删除成功!");
} }
@@ -122,9 +123,9 @@ public class OtaBaSjListController extends JeroController<OtaBaSjList, IOtaBaSjL
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级活动备案列表-批量删除") @AutoLog(value = "升级备案-升级活动备案列表-批量删除")
@ApiOperation(value="升级备案-升级活动备案列表-批量删除", notes="升级备案-升级活动备案列表-批量删除") @ApiOperation(value = "升级备案-升级活动备案列表-批量删除", notes = "升级备案-升级活动备案列表-批量删除")
@DeleteMapping(value = "/deleteBatch") @DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.otaBaSjListService.deleteByIds(Arrays.asList(ids.split(","))); this.otaBaSjListService.deleteByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!"); return Result.OK("批量删除成功!");
} }
@@ -136,11 +137,11 @@ public class OtaBaSjListController extends JeroController<OtaBaSjList, IOtaBaSjL
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级活动备案列表-通过id查询") @AutoLog(value = "升级备案-升级活动备案列表-通过id查询")
@ApiOperation(value="升级备案-升级活动备案列表-通过id查询", notes="升级备案-升级活动备案列表-通过id查询") @ApiOperation(value = "升级备案-升级活动备案列表-通过id查询", notes = "升级备案-升级活动备案列表-通过id查询")
@GetMapping(value = "/queryById") @GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) { public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
OtaBaSjList otaBaSjList = otaBaSjListService.queryById(id); OtaBaSjList otaBaSjList = otaBaSjListService.queryById(id);
if(otaBaSjList==null) { if (otaBaSjList == null) {
return Result.error("未找到对应数据"); return Result.error("未找到对应数据");
} }
return Result.OK(otaBaSjList); return Result.OK(otaBaSjList);
@@ -171,7 +172,6 @@ public class OtaBaSjListController extends JeroController<OtaBaSjList, IOtaBaSjL
/** /**
* 备案维护 * 备案维护
*
*/ */
@AutoLog(value = "升级备案-备案维护") @AutoLog(value = "升级备案-备案维护")
@ApiOperation(value = "升级备案-备案维护", notes = "升级备案-备案维护") @ApiOperation(value = "升级备案-备案维护", notes = "升级备案-备案维护")
@@ -185,4 +185,37 @@ public class OtaBaSjListController extends JeroController<OtaBaSjList, IOtaBaSjL
return Result.OK("备案维护成功!"); return Result.OK("备案维护成功!");
} }
@ApiOperation(value = "升级备案-模板下载")
@GetMapping(value = "/exportTemplate")
// @RequiresPermissions("otaBaCx:exportTemplate")
public void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception {
this.otaBaSjListService.exportTemplate(response, request);
}
@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.otaBaSjListService.importData(file, cut);
} catch (Exception e) {
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK("导入成功");
}
@ApiOperation(value = "升级备案-数据导出")
@GetMapping(value = "/exportData")
// @RequiresPermissions("otaBaCx:exportTemplate")
public void exportData(@RequestParam(value = "otaId", required = false) String otaId, HttpServletResponse response, HttpServletRequest request) {
try {
this.otaBaSjListService.exportData(otaId, response, request);
} catch (Exception e) {
e.printStackTrace();
}
}
} }
@@ -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;
@@ -17,19 +18,20 @@ import com.jero.common.system.base.controller.JeroController;
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 io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import com.jero.common.aspect.annotation.AutoLog; import com.jero.common.aspect.annotation.AutoLog;
/** /**
* @Description: 升级备案-升级目标车辆 * @Description: 升级备案-升级目标车辆
* @Author: jero-boot * @Author: jero-boot
* @Date: 2023-03-17 * @Date: 2023-03-17
* @Version: V1.0 * @Version: V1.0
*/ */
@Api(tags="升级备案-升级目标车辆") @Api(tags = "升级备案-升级目标车辆")
@RestController @RestController
@RequestMapping("/ota/otaBaSjSjmbcl") @RequestMapping("/ota/otaBaSjSjmbcl")
@Slf4j @Slf4j
@@ -47,11 +49,11 @@ public class OtaBaSjSjmbclController extends JeroController<OtaBaSjSjmbcl, IOtaB
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级目标车辆-分页列表查询") @AutoLog(value = "升级备案-升级目标车辆-分页列表查询")
@ApiOperation(value="升级备案-升级目标车辆-分页列表查询", notes="升级备案-升级目标车辆-分页列表查询") @ApiOperation(value = "升级备案-升级目标车辆-分页列表查询", notes = "升级备案-升级目标车辆-分页列表查询")
@GetMapping(value = "/page") @GetMapping(value = "/page")
public Result<?> queryPageList(OtaBaSjSjmbcl otaBaSjSjmbcl, public Result<?> queryPageList(OtaBaSjSjmbcl otaBaSjSjmbcl,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) { HttpServletRequest req) {
QueryWrapper<OtaBaSjSjmbcl> queryWrapper = QueryGenerator.initQueryWrapper(otaBaSjSjmbcl, req.getParameterMap()); QueryWrapper<OtaBaSjSjmbcl> queryWrapper = QueryGenerator.initQueryWrapper(otaBaSjSjmbcl, req.getParameterMap());
Page<OtaBaSjSjmbcl> page = new Page<OtaBaSjSjmbcl>(pageNo, pageSize); Page<OtaBaSjSjmbcl> page = new Page<OtaBaSjSjmbcl>(pageNo, pageSize);
@@ -65,7 +67,7 @@ public class OtaBaSjSjmbclController extends JeroController<OtaBaSjSjmbcl, IOtaB
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级目标车辆-列表查询") @AutoLog(value = "升级备案-升级目标车辆-列表查询")
@ApiOperation(value="升级备案-升级目标车辆-列表查询", notes="升级备案-升级目标车辆-列表查询") @ApiOperation(value = "升级备案-升级目标车辆-列表查询", notes = "升级备案-升级目标车辆-列表查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public Result<List<OtaBaSjSjmbcl>> queryList() { public Result<List<OtaBaSjSjmbcl>> queryList() {
List<OtaBaSjSjmbcl> list = otaBaSjSjmbclService.queryList(); List<OtaBaSjSjmbcl> list = otaBaSjSjmbclService.queryList();
@@ -79,7 +81,7 @@ public class OtaBaSjSjmbclController extends JeroController<OtaBaSjSjmbcl, IOtaB
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级目标车辆-添加") @AutoLog(value = "升级备案-升级目标车辆-添加")
@ApiOperation(value="升级备案-升级目标车辆-添加", notes="升级备案-升级目标车辆-添加") @ApiOperation(value = "升级备案-升级目标车辆-添加", notes = "升级备案-升级目标车辆-添加")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<?> add(@Validated @RequestBody OtaBaSjSjmbcl otaBaSjSjmbcl) { public Result<?> add(@Validated @RequestBody OtaBaSjSjmbcl otaBaSjSjmbcl) {
otaBaSjSjmbclService.add(otaBaSjSjmbcl); otaBaSjSjmbclService.add(otaBaSjSjmbcl);
@@ -93,7 +95,7 @@ public class OtaBaSjSjmbclController extends JeroController<OtaBaSjSjmbcl, IOtaB
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级目标车辆-编辑") @AutoLog(value = "升级备案-升级目标车辆-编辑")
@ApiOperation(value="升级备案-升级目标车辆-编辑", notes="升级备案-升级目标车辆-编辑") @ApiOperation(value = "升级备案-升级目标车辆-编辑", notes = "升级备案-升级目标车辆-编辑")
@PutMapping(value = "/edit") @PutMapping(value = "/edit")
public Result<?> edit(@Validated @RequestBody OtaBaSjSjmbcl otaBaSjSjmbcl) { public Result<?> edit(@Validated @RequestBody OtaBaSjSjmbcl otaBaSjSjmbcl) {
otaBaSjSjmbclService.editById(otaBaSjSjmbcl); otaBaSjSjmbclService.editById(otaBaSjSjmbcl);
@@ -107,9 +109,9 @@ public class OtaBaSjSjmbclController extends JeroController<OtaBaSjSjmbcl, IOtaB
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级目标车辆-通过id删除") @AutoLog(value = "升级备案-升级目标车辆-通过id删除")
@ApiOperation(value="升级备案-升级目标车辆-通过id删除", notes="升级备案-升级目标车辆-通过id删除") @ApiOperation(value = "升级备案-升级目标车辆-通过id删除", notes = "升级备案-升级目标车辆-通过id删除")
@DeleteMapping(value = "/delete") @DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) { public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
otaBaSjSjmbclService.deleteById(id); otaBaSjSjmbclService.deleteById(id);
return Result.OK("删除成功!"); return Result.OK("删除成功!");
} }
@@ -121,9 +123,9 @@ public class OtaBaSjSjmbclController extends JeroController<OtaBaSjSjmbcl, IOtaB
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级目标车辆-批量删除") @AutoLog(value = "升级备案-升级目标车辆-批量删除")
@ApiOperation(value="升级备案-升级目标车辆-批量删除", notes="升级备案-升级目标车辆-批量删除") @ApiOperation(value = "升级备案-升级目标车辆-批量删除", notes = "升级备案-升级目标车辆-批量删除")
@DeleteMapping(value = "/deleteBatch") @DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.otaBaSjSjmbclService.deleteByIds(Arrays.asList(ids.split(","))); this.otaBaSjSjmbclService.deleteByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!"); return Result.OK("批量删除成功!");
} }
@@ -135,11 +137,11 @@ public class OtaBaSjSjmbclController extends JeroController<OtaBaSjSjmbcl, IOtaB
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级目标车辆-通过id查询") @AutoLog(value = "升级备案-升级目标车辆-通过id查询")
@ApiOperation(value="升级备案-升级目标车辆-通过id查询", notes="升级备案-升级目标车辆-通过id查询") @ApiOperation(value = "升级备案-升级目标车辆-通过id查询", notes = "升级备案-升级目标车辆-通过id查询")
@GetMapping(value = "/queryById") @GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) { public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
OtaBaSjSjmbcl otaBaSjSjmbcl = otaBaSjSjmbclService.queryById(id); OtaBaSjSjmbcl otaBaSjSjmbcl = otaBaSjSjmbclService.queryById(id);
if(otaBaSjSjmbcl==null) { if (otaBaSjSjmbcl == null) {
return Result.error("未找到对应数据"); return Result.error("未找到对应数据");
} }
return Result.OK(otaBaSjSjmbcl); return Result.OK(otaBaSjSjmbcl);
@@ -180,4 +182,29 @@ public class OtaBaSjSjmbclController extends JeroController<OtaBaSjSjmbcl, IOtaB
return super.importExcel(request, response, OtaBaSjSjmbcl.class); return super.importExcel(request, response, OtaBaSjSjmbcl.class);
} }
@ApiOperation(value = "升级备案-升级目标车辆-模板下载")
@GetMapping(value = "/exportTemplate")
// @RequiresPermissions("otaBaCx:exportTemplate")
public void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception {
this.otaBaSjSjmbclService.exportTemplate(response, request);
}
@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,
@RequestParam(value = "otaId", required = false) String otaId) throws Exception {
OtaBaSjSjmbcl res;
try {
String[] params = otaId.split("\\?");
otaId = params[0].equals("null") ? "" : params[0];
cut = params[1].replace("cut=", "");
res = this.otaBaSjSjmbclService.importData(file, otaId, cut);
} catch (Exception e) {
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK(res);
}
} }
@@ -6,6 +6,7 @@ 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.OtaBaSjSjmbcl; import com.jero.modules.ota.entity.OtaBaSjSjmbcl;
import com.jero.modules.ota.entity.OtaBaSjSjmbcx; import com.jero.modules.ota.entity.OtaBaSjSjmbcx;
import com.jero.modules.ota.service.IOtaBaSjSjmbcxService; import com.jero.modules.ota.service.IOtaBaSjSjmbcxService;
@@ -17,6 +18,7 @@ import com.jero.common.system.base.controller.JeroController;
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 io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@@ -180,4 +182,31 @@ public class OtaBaSjSjmbcxController extends JeroController<OtaBaSjSjmbcx, IOtaB
return super.importExcel(request, response, OtaBaSjSjmbcx.class); return super.importExcel(request, response, OtaBaSjSjmbcx.class);
} }
@ApiOperation(value = "升级备案-升级目标车型-模板下载")
@GetMapping(value = "/exportTemplate")
// @RequiresPermissions("otaBaCx:exportTemplate")
public void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception {
this.otaBaSjSjmbcxService.exportTemplate(response, request);
}
@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,
@RequestParam(value = "otaId", required = false) String otaId) throws Exception {
OtaBaSjSjmbcx res;
try {
String[] params = otaId.split("\\?");
otaId = params[0].equals("null") ? "" : params[0];
cut = params[1].replace("cut=", "");
res = this.otaBaSjSjmbcxService.importData(file, otaId, cut);
} catch (Exception e) {
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK(res);
}
} }
@@ -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;
@@ -17,19 +18,20 @@ import com.jero.common.system.base.controller.JeroController;
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 io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import com.jero.common.aspect.annotation.AutoLog; import com.jero.common.aspect.annotation.AutoLog;
/** /**
* @Description: 升级备案-升级影响评估 * @Description: 升级备案-升级影响评估
* @Author: jero-boot * @Author: jero-boot
* @Date: 2023-03-17 * @Date: 2023-03-17
* @Version: V1.0 * @Version: V1.0
*/ */
@Api(tags="升级备案-升级影响评估") @Api(tags = "升级备案-升级影响评估")
@RestController @RestController
@RequestMapping("/ota/otaBaSjSjyxpg") @RequestMapping("/ota/otaBaSjSjyxpg")
@Slf4j @Slf4j
@@ -47,11 +49,11 @@ public class OtaBaSjSjyxpgController extends JeroController<OtaBaSjSjyxpg, IOtaB
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级影响评估-分页列表查询") @AutoLog(value = "升级备案-升级影响评估-分页列表查询")
@ApiOperation(value="升级备案-升级影响评估-分页列表查询", notes="升级备案-升级影响评估-分页列表查询") @ApiOperation(value = "升级备案-升级影响评估-分页列表查询", notes = "升级备案-升级影响评估-分页列表查询")
@GetMapping(value = "/page") @GetMapping(value = "/page")
public Result<?> queryPageList(OtaBaSjSjyxpg otaBaSjSjyxpg, public Result<?> queryPageList(OtaBaSjSjyxpg otaBaSjSjyxpg,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) { HttpServletRequest req) {
QueryWrapper<OtaBaSjSjyxpg> queryWrapper = QueryGenerator.initQueryWrapper(otaBaSjSjyxpg, req.getParameterMap()); QueryWrapper<OtaBaSjSjyxpg> queryWrapper = QueryGenerator.initQueryWrapper(otaBaSjSjyxpg, req.getParameterMap());
Page<OtaBaSjSjyxpg> page = new Page<OtaBaSjSjyxpg>(pageNo, pageSize); Page<OtaBaSjSjyxpg> page = new Page<OtaBaSjSjyxpg>(pageNo, pageSize);
@@ -65,7 +67,7 @@ public class OtaBaSjSjyxpgController extends JeroController<OtaBaSjSjyxpg, IOtaB
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级影响评估-列表查询") @AutoLog(value = "升级备案-升级影响评估-列表查询")
@ApiOperation(value="升级备案-升级影响评估-列表查询", notes="升级备案-升级影响评估-列表查询") @ApiOperation(value = "升级备案-升级影响评估-列表查询", notes = "升级备案-升级影响评估-列表查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public Result<List<OtaBaSjSjyxpg>> queryList() { public Result<List<OtaBaSjSjyxpg>> queryList() {
List<OtaBaSjSjyxpg> list = otaBaSjSjyxpgService.queryList(); List<OtaBaSjSjyxpg> list = otaBaSjSjyxpgService.queryList();
@@ -79,7 +81,7 @@ public class OtaBaSjSjyxpgController extends JeroController<OtaBaSjSjyxpg, IOtaB
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级影响评估-添加") @AutoLog(value = "升级备案-升级影响评估-添加")
@ApiOperation(value="升级备案-升级影响评估-添加", notes="升级备案-升级影响评估-添加") @ApiOperation(value = "升级备案-升级影响评估-添加", notes = "升级备案-升级影响评估-添加")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<?> add(@Validated @RequestBody OtaBaSjSjyxpg otaBaSjSjyxpg) { public Result<?> add(@Validated @RequestBody OtaBaSjSjyxpg otaBaSjSjyxpg) {
otaBaSjSjyxpgService.add(otaBaSjSjyxpg); otaBaSjSjyxpgService.add(otaBaSjSjyxpg);
@@ -93,7 +95,7 @@ public class OtaBaSjSjyxpgController extends JeroController<OtaBaSjSjyxpg, IOtaB
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级影响评估-编辑") @AutoLog(value = "升级备案-升级影响评估-编辑")
@ApiOperation(value="升级备案-升级影响评估-编辑", notes="升级备案-升级影响评估-编辑") @ApiOperation(value = "升级备案-升级影响评估-编辑", notes = "升级备案-升级影响评估-编辑")
@PutMapping(value = "/edit") @PutMapping(value = "/edit")
public Result<?> edit(@Validated @RequestBody OtaBaSjSjyxpg otaBaSjSjyxpg) { public Result<?> edit(@Validated @RequestBody OtaBaSjSjyxpg otaBaSjSjyxpg) {
otaBaSjSjyxpgService.editById(otaBaSjSjyxpg); otaBaSjSjyxpgService.editById(otaBaSjSjyxpg);
@@ -107,9 +109,9 @@ public class OtaBaSjSjyxpgController extends JeroController<OtaBaSjSjyxpg, IOtaB
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级影响评估-通过id删除") @AutoLog(value = "升级备案-升级影响评估-通过id删除")
@ApiOperation(value="升级备案-升级影响评估-通过id删除", notes="升级备案-升级影响评估-通过id删除") @ApiOperation(value = "升级备案-升级影响评估-通过id删除", notes = "升级备案-升级影响评估-通过id删除")
@DeleteMapping(value = "/delete") @DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) { public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
otaBaSjSjyxpgService.deleteById(id); otaBaSjSjyxpgService.deleteById(id);
return Result.OK("删除成功!"); return Result.OK("删除成功!");
} }
@@ -121,9 +123,9 @@ public class OtaBaSjSjyxpgController extends JeroController<OtaBaSjSjyxpg, IOtaB
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级影响评估-批量删除") @AutoLog(value = "升级备案-升级影响评估-批量删除")
@ApiOperation(value="升级备案-升级影响评估-批量删除", notes="升级备案-升级影响评估-批量删除") @ApiOperation(value = "升级备案-升级影响评估-批量删除", notes = "升级备案-升级影响评估-批量删除")
@DeleteMapping(value = "/deleteBatch") @DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.otaBaSjSjyxpgService.deleteByIds(Arrays.asList(ids.split(","))); this.otaBaSjSjyxpgService.deleteByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!"); return Result.OK("批量删除成功!");
} }
@@ -135,11 +137,11 @@ public class OtaBaSjSjyxpgController extends JeroController<OtaBaSjSjyxpg, IOtaB
* @return * @return
*/ */
@AutoLog(value = "升级备案-升级影响评估-通过id查询") @AutoLog(value = "升级备案-升级影响评估-通过id查询")
@ApiOperation(value="升级备案-升级影响评估-通过id查询", notes="升级备案-升级影响评估-通过id查询") @ApiOperation(value = "升级备案-升级影响评估-通过id查询", notes = "升级备案-升级影响评估-通过id查询")
@GetMapping(value = "/queryById") @GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) { public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
OtaBaSjSjyxpg otaBaSjSjyxpg = otaBaSjSjyxpgService.queryById(id); OtaBaSjSjyxpg otaBaSjSjyxpg = otaBaSjSjyxpgService.queryById(id);
if(otaBaSjSjyxpg==null) { if (otaBaSjSjyxpg == null) {
return Result.error("未找到对应数据"); return Result.error("未找到对应数据");
} }
return Result.OK(otaBaSjSjyxpg); return Result.OK(otaBaSjSjyxpg);
@@ -186,4 +188,30 @@ public class OtaBaSjSjyxpgController extends JeroController<OtaBaSjSjyxpg, IOtaB
return super.importExcel(request, response, OtaBaSjSjyxpg.class); return super.importExcel(request, response, OtaBaSjSjyxpg.class);
} }
@ApiOperation(value = "车型备案-安全措施-模板下载")
@GetMapping(value = "/exportTemplate")
// @RequiresPermissions("otaBaCx:exportTemplate")
public void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception {
this.otaBaSjSjyxpgService.exportTemplate(response, request);
}
@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,
@RequestParam(value = "otaId", required = false) String otaId) throws Exception {
OtaBaSjSjyxpg res;
try {
String[] params = otaId.split("\\?");
otaId = params[0].equals("null") ? "" : params[0];
cut = params[1].replace("cut=", "");
res = this.otaBaSjSjyxpgService.importData(file, params[0], cut);
} catch (Exception e) {
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK(res);
}
} }
@@ -37,7 +37,7 @@ public interface IOtaBaSjJssjyyService extends IService<OtaBaSjJssjyy> {
*/ */
void deleteById(String id); void deleteById(String id);
void deleteByOtaId(String otaId) void deleteByOtaId(String otaId);
/** /**
* 批量删除 * 批量删除
@@ -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.OtaBaSjList; import com.jero.modules.ota.entity.OtaBaSjList;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
@@ -62,7 +65,12 @@ public interface IOtaBaSjListService extends IService<OtaBaSjList> {
/** /**
* 备案维护 * 备案维护
*
*/ */
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) throws Exception;
void importData(MultipartFile file, String cut) throws Exception;
void exportData(String otaId, HttpServletResponse response, HttpServletRequest request) throws Exception;
} }
@@ -1,7 +1,13 @@
package com.jero.modules.ota.service; package com.jero.modules.ota.service;
import com.jero.modules.ota.entity.OtaBaCxJbxx;
import com.jero.modules.ota.entity.OtaBaSjSjmbcl; import com.jero.modules.ota.entity.OtaBaSjSjmbcl;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.List; import java.util.List;
/** /**
@@ -60,4 +66,12 @@ public interface IOtaBaSjSjmbclService extends IService<OtaBaSjSjmbcl> {
List<OtaBaSjSjmbcl> queryList(); List<OtaBaSjSjmbcl> queryList();
OtaBaSjSjmbcl queryByOtaId(String otaId, String otaIdT); OtaBaSjSjmbcl queryByOtaId(String otaId, String otaIdT);
void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception;
OtaBaSjSjmbcl parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception;
OtaBaSjSjmbcl importData(MultipartFile file, String otaId, String cut) throws Exception;
void exportData(File file, String otaId, String cut) throws Exception;
} }
@@ -1,7 +1,13 @@
package com.jero.modules.ota.service; package com.jero.modules.ota.service;
import com.jero.modules.ota.entity.OtaBaCxJbxx;
import com.jero.modules.ota.entity.OtaBaSjSjmbcx; import com.jero.modules.ota.entity.OtaBaSjSjmbcx;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.List; import java.util.List;
/** /**
@@ -60,4 +66,13 @@ public interface IOtaBaSjSjmbcxService extends IService<OtaBaSjSjmbcx> {
List<OtaBaSjSjmbcx> queryList(); List<OtaBaSjSjmbcx> queryList();
OtaBaSjSjmbcx queryByOtaId(String otaId, String otaIdT); OtaBaSjSjmbcx queryByOtaId(String otaId, String otaIdT);
void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception;
OtaBaSjSjmbcx importData(MultipartFile file, String otaId, String cut) throws Exception;
OtaBaSjSjmbcx parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception;
void exportData(File file, String otaId, String cut) throws Exception;
} }
@@ -1,7 +1,13 @@
package com.jero.modules.ota.service; package com.jero.modules.ota.service;
import com.jero.modules.ota.entity.OtaBaSjSjmbcx;
import com.jero.modules.ota.entity.OtaBaSjSjyxpg; import com.jero.modules.ota.entity.OtaBaSjSjyxpg;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.List; import java.util.List;
/** /**
@@ -60,4 +66,12 @@ public interface IOtaBaSjSjyxpgService extends IService<OtaBaSjSjyxpg> {
List<OtaBaSjSjyxpg> queryList(); List<OtaBaSjSjyxpg> queryList();
OtaBaSjSjyxpg queryByOtaId(String otaId, String otaIdT); OtaBaSjSjyxpg queryByOtaId(String otaId, String otaIdT);
void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception;
OtaBaSjSjyxpg importData(MultipartFile file, String otaId, String cut) throws Exception;
OtaBaSjSjyxpg parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception;
void exportData(File file, String otaId, String cut) throws Exception;
} }
@@ -216,7 +216,12 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
jbxx.setCplb(ImportFileUtil.getCellValue(cell, wb)); jbxx.setCplb(ImportFileUtil.getCellValue(cell, wb));
row = s.getRow(4); row = s.getRow(4);
cell = row.getCell(1); cell = row.getCell(1);
String ggpc = ImportFileUtil.getCellValue(cell, wb);
if (StringUtils.isEmpty(cpbh)) {
throw new JeroBootException("公告批次不能为空");
}
jbxx.setGgpc(ImportFileUtil.getCellValue(cell, wb)); jbxx.setGgpc(ImportFileUtil.getCellValue(cell, wb));
row = s.getRow(5); row = s.getRow(5);
cell = row.getCell(1); cell = row.getCell(1);
jbxx.setCpsb(ImportFileUtil.getCellValue(cell, wb)); jbxx.setCpsb(ImportFileUtil.getCellValue(cell, wb));
@@ -2,15 +2,22 @@ package com.jero.modules.ota.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.exception.JeroBootException; import com.jero.common.exception.JeroBootException;
import com.jero.modules.ota.entity.OtaBaCxJbxx;
import com.jero.modules.ota.entity.OtaBaSjList; import com.jero.modules.ota.entity.OtaBaSjList;
import com.jero.modules.ota.entity.OtaBaSjLsjl; import com.jero.modules.ota.entity.OtaBaSjLsjl;
import com.jero.modules.ota.entity.OtaBaSjSjmbcx;
import com.jero.modules.ota.mapper.OtaBaSjListMapper; import com.jero.modules.ota.mapper.OtaBaSjListMapper;
import com.jero.modules.ota.service.IOtaBaSjListService; import com.jero.modules.ota.service.*;
import com.jero.modules.ota.service.IOtaBaSjLsjlService; import com.jero.modules.ota.utils.ImportFileUtil;
import com.jero.modules.system.util.StringUtils; import com.jero.modules.system.util.StringUtils;
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.File;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -24,11 +31,25 @@ import java.util.List;
@Service @Service
public class OtaBaSjListServiceImpl extends ServiceImpl<OtaBaSjListMapper, OtaBaSjList> implements IOtaBaSjListService { public class OtaBaSjListServiceImpl extends ServiceImpl<OtaBaSjListMapper, OtaBaSjList> implements IOtaBaSjListService {
@Value(value = "${ota.templatePath}")
private String templatePath;
@Value(value = "${ota.uploadPath}")
private String uploadPath;
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@Autowired @Autowired
private IOtaBaSjLsjlService otaBaSjLsjlService; private IOtaBaSjLsjlService otaBaSjLsjlService;
@Autowired
private IOtaBaSjSjmbcxService otaBaSjSjmbcxService;
@Autowired
private IOtaBaSjSjmbclService otaBaSjSjmbclService;
@Autowired
private IOtaBaCxAqcsService otaBaCxAqcsService;
/** /**
@@ -127,4 +148,30 @@ public class OtaBaSjListServiceImpl extends ServiceImpl<OtaBaSjListMapper, OtaBa
throw new JeroBootException(ex.getMessage()); throw new JeroBootException(ex.getMessage());
} }
} }
@Override
public void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception {
ImportFileUtil.exportTemplate(response, templatePath + "在线升级活动备案.zip");
}
@Override
public void importData(MultipartFile file, String cut) throws Exception {
List<File> fileList = ImportFileUtil.importZip(file, cut, uploadPath);
OtaBaSjSjmbcx mbcx = otaBaSjSjmbcxService.parseFileList(fileList, "", cut);
String otaId = mbcx.getOtaId();
if (StringUtils.isNotEmpty(otaId)) {
otaBaSjSjmbclService.parseFileList(fileList, otaId, cut);
otaBaCxAqcsService.parseFileList(fileList, otaId, cut);
} else {
throw new JeroBootException("导入失败");
}
}
@Override
public void exportData(String otaId, HttpServletResponse response, HttpServletRequest request) throws Exception {
}
} }
@@ -1,6 +1,7 @@
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.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.exception.JeroBootException;
import com.jero.modules.ota.entity.*; import com.jero.modules.ota.entity.*;
import com.jero.modules.ota.enums.OtaModuleEnum; import com.jero.modules.ota.enums.OtaModuleEnum;
import com.jero.modules.ota.mapper.OtaBaSjSjmbclMapper; import com.jero.modules.ota.mapper.OtaBaSjSjmbclMapper;
@@ -9,17 +10,28 @@ import com.jero.modules.ota.service.IOtaBaSjListService;
import com.jero.modules.ota.service.IOtaBaSjLsjlService; import com.jero.modules.ota.service.IOtaBaSjLsjlService;
import com.jero.modules.ota.service.IOtaBaSjSjmbclService; import com.jero.modules.ota.service.IOtaBaSjSjmbclService;
import com.jero.modules.ota.utils.ComparisonUtil; import com.jero.modules.ota.utils.ComparisonUtil;
import com.jero.modules.ota.utils.ImportFileUtil;
import com.jero.modules.system.service.ISysDictService; import com.jero.modules.system.service.ISysDictService;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
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 java.io.File;
import java.util.List; import java.util.List;
import java.util.Date; import java.util.Date;
import java.util.UUID; import java.util.UUID;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/** /**
* @Description: 升级备案-升级目标车辆 * @Description: 升级备案-升级目标车辆
@@ -30,6 +42,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service @Service
public class OtaBaSjSjmbclServiceImpl extends ServiceImpl<OtaBaSjSjmbclMapper, OtaBaSjSjmbcl> implements IOtaBaSjSjmbclService { public class OtaBaSjSjmbclServiceImpl extends ServiceImpl<OtaBaSjSjmbclMapper, OtaBaSjSjmbcl> implements IOtaBaSjSjmbclService {
@Value(value = "${ota.templatePath}")
private String templatePath;
@Value(value = "${ota.uploadPath}")
private String uploadPath;
@Autowired @Autowired
private ISysDictService sysDictService; private ISysDictService sysDictService;
@@ -59,7 +76,7 @@ public class OtaBaSjSjmbclServiceImpl extends ServiceImpl<OtaBaSjSjmbclMapper, O
if (ObjectUtils.isEmpty(otaBaSjSjmbclOld)) { if (ObjectUtils.isEmpty(otaBaSjSjmbclOld)) {
otaBaSjSjmbclOld = new OtaBaSjSjmbcl(); otaBaSjSjmbclOld = new OtaBaSjSjmbcl();
} }
List<OtaBaCxTxjl> reList = cu.comparisonRecord(otaBaSjSjmbcl.getOtaId(), OtaModuleEnum.CX_AQCS, otaBaSjSjmbclOld, otaBaSjSjmbcl, sysDictService); List<OtaBaCxTxjl> reList = cu.comparisonRecord(otaBaSjSjmbcl.getOtaId(), OtaModuleEnum.SJ_SJMBCL, otaBaSjSjmbclOld, otaBaSjSjmbcl, sysDictService);
otaBaCxTxjlService.saveBatch(reList); otaBaCxTxjlService.saveBatch(reList);
} }
} }
@@ -131,11 +148,50 @@ public class OtaBaSjSjmbclServiceImpl extends ServiceImpl<OtaBaSjSjmbclMapper, O
} }
private OtaBaSjSjmbcl getByOtaId(String otaId) { private OtaBaSjSjmbcl getByOtaId(String otaId) {
if(StringUtils.isEmpty(otaId)){ if (StringUtils.isEmpty(otaId)) {
return null; return null;
} }
LambdaQueryWrapper<OtaBaSjSjmbcl> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OtaBaSjSjmbcl> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaSjSjmbcl::getOtaId, otaId); queryWrapper.eq(OtaBaSjSjmbcl::getOtaId, otaId);
return this.getOne(queryWrapper, false); return this.getOne(queryWrapper, false);
} }
@Override
public void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception {
ImportFileUtil.exportTemplate(response, templatePath + "本次升级涉及的目标车辆.zip");
}
@Override
public OtaBaSjSjmbcl parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception {
File upFile = null;
for (File f : upLoadFiles) {
if (f.getName().equals("本次升级涉及的目标车辆.xlsx")) {
upFile = f;
}
}
if (null == upFile) {
throw new JeroBootException("请上传正确的文件");
}
OtaBaSjSjmbcl mbcl = parseFile(upFile, cut);
mbcl.setOtaId(otaId);
add(mbcl);
return mbcl;
}
private OtaBaSjSjmbcl parseFile(File upFile, String cut) {
OtaBaSjSjmbcl mbcl = new OtaBaSjSjmbcl();
return mbcl;
}
@Override
public OtaBaSjSjmbcl importData(MultipartFile file, String otaId, String cut) throws Exception {
List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath);
OtaBaSjSjmbcl mbcl = parseFileList(upLoadFiles, otaId, cut);
return mbcl;
}
@Override
public void exportData(File file, String otaId, String cut) throws Exception {
}
} }
@@ -1,24 +1,37 @@
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.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.exception.JeroBootException;
import com.jero.modules.ota.entity.*; import com.jero.modules.ota.entity.*;
import com.jero.modules.ota.enums.OtaModuleEnum; import com.jero.modules.ota.enums.OtaModuleEnum;
import com.jero.modules.ota.mapper.OtaBaSjSjmbcxMapper; import com.jero.modules.ota.mapper.OtaBaSjSjmbcxMapper;
import com.jero.modules.ota.service.IOtaBaCxJbxxService;
import com.jero.modules.ota.service.IOtaBaCxTxjlService; import com.jero.modules.ota.service.IOtaBaCxTxjlService;
import com.jero.modules.ota.service.IOtaBaSjListService; import com.jero.modules.ota.service.IOtaBaSjListService;
import com.jero.modules.ota.service.IOtaBaSjSjmbcxService; import com.jero.modules.ota.service.IOtaBaSjSjmbcxService;
import com.jero.modules.ota.utils.ComparisonUtil; import com.jero.modules.ota.utils.ComparisonUtil;
import com.jero.modules.ota.utils.ImportFileUtil;
import com.jero.modules.system.service.ISysDictService; import com.jero.modules.system.service.ISysDictService;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
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 java.io.File;
import java.util.List; import java.util.List;
import java.util.Date; import java.util.Date;
import java.util.UUID; import java.util.UUID;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/** /**
* @Description: 升级备案-升级目标车型 * @Description: 升级备案-升级目标车型
@@ -38,6 +51,16 @@ public class OtaBaSjSjmbcxServiceImpl extends ServiceImpl<OtaBaSjSjmbcxMapper, O
@Autowired @Autowired
private IOtaBaCxTxjlService otaBaCxTxjlService; private IOtaBaCxTxjlService otaBaCxTxjlService;
@Autowired
private IOtaBaCxJbxxService otaBaCxJbxxService;
@Value(value = "${ota.templatePath}")
private String templatePath;
@Value(value = "${ota.uploadPath}")
private String uploadPath;
/** /**
* 保存 * 保存
* *
@@ -140,11 +163,79 @@ public class OtaBaSjSjmbcxServiceImpl extends ServiceImpl<OtaBaSjSjmbcxMapper, O
} }
private OtaBaSjSjmbcx getByOtaId(String otaId) { private OtaBaSjSjmbcx getByOtaId(String otaId) {
if(org.apache.commons.lang3.StringUtils.isEmpty(otaId)){ if (org.apache.commons.lang3.StringUtils.isEmpty(otaId)) {
return null; return null;
} }
LambdaQueryWrapper<OtaBaSjSjmbcx> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OtaBaSjSjmbcx> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaSjSjmbcx::getOtaId, otaId); queryWrapper.eq(OtaBaSjSjmbcx::getOtaId, otaId);
return this.getOne(queryWrapper, false); return this.getOne(queryWrapper, false);
} }
@Override
public void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception {
ImportFileUtil.exportTemplate(response, templatePath + "升级目标车型.zip");
}
@Override
public OtaBaSjSjmbcx importData(MultipartFile file, String otaId, String cut) throws Exception {
List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath);
OtaBaSjSjmbcx mbcx = parseFileList(upLoadFiles, otaId, cut);
return mbcx;
}
@Override
public OtaBaSjSjmbcx parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception {
File upFile = null;
for (File f : upLoadFiles) {
if (f.getName().equals("车型基本信息.xlsx")) {
upFile = f;
}
}
if (null == upFile) {
throw new JeroBootException("请上传正确的文件");
}
OtaBaSjSjmbcx mbcx = parseFile(upFile, cut);
mbcx.setOtaId(otaId);
add(mbcx);
return mbcx;
}
private OtaBaSjSjmbcx parseFile(File upFile, String cut) throws Exception {
OtaBaSjSjmbcx mbcx = new OtaBaSjSjmbcx();
Workbook wb = ImportFileUtil.readExcel(upFile);
Sheet s = wb.getSheetAt(0);
Row row = s.getRow(1);
Cell cell = row.getCell(2);
mbcx.setBabh(ImportFileUtil.getCellValue(cell, wb));
row = s.getRow(2);
cell = row.getCell(2);
mbcx.setQymc(ImportFileUtil.getCellValue(cell, wb));
row = s.getRow(3);
cell = row.getCell(2);
String pc = ImportFileUtil.getCellValue(cell, wb);
if (StringUtils.isEmpty(pc)) {
throw new JeroBootException("车型及功能备案《公告》批次不能为空");
}
//查找车型备案的同批次数据
LambdaQueryWrapper<OtaBaCxJbxx> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaCxJbxx::getGgpc, pc);
OtaBaCxJbxx jbxx = otaBaCxJbxxService.getOne(queryWrapper, false);
if (ObjectUtils.isEmpty(jbxx)) {
throw new JeroBootException("车型及功能备案《公告》批次:" + jbxx + " 无法找到车型备案数据");
}
mbcx.setBapc(pc);
mbcx.setCpsb(jbxx.getCpsb());
mbcx.setCpmc(jbxx.getCpmc());
mbcx.setCpxh(jbxx.getCpxh());
mbcx.setDllx1(jbxx.getDllx1());
mbcx.setDllx2(jbxx.getDllx2());
return mbcx;
}
@Override
public void exportData(File file, String otaId, String cut) throws Exception {
}
} }
@@ -2,22 +2,30 @@ package com.jero.modules.ota.service.impl;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.exception.JeroBootException;
import com.jero.modules.ota.entity.*; import com.jero.modules.ota.entity.*;
import com.jero.modules.ota.enums.OtaModuleEnum; import com.jero.modules.ota.enums.OtaModuleEnum;
import com.jero.modules.ota.mapper.OtaBaSjSjyxpgMapper; import com.jero.modules.ota.mapper.OtaBaSjSjyxpgMapper;
import com.jero.modules.ota.service.IOtaBaCxTxjlService; import com.jero.modules.ota.service.IOtaBaCxTxjlService;
import com.jero.modules.ota.service.IOtaBaSjSjyxpgService; import com.jero.modules.ota.service.IOtaBaSjSjyxpgService;
import com.jero.modules.ota.utils.ComparisonUtil; import com.jero.modules.ota.utils.ComparisonUtil;
import com.jero.modules.ota.utils.ImportFileUtil;
import com.jero.modules.system.service.ISysDictService; import com.jero.modules.system.service.ISysDictService;
import org.apache.commons.lang3.ObjectUtils; 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.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.File;
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;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/** /**
* @Description: 升级备案-升级影响评估 * @Description: 升级备案-升级影响评估
@@ -35,6 +43,12 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
@Autowired @Autowired
private IOtaBaCxTxjlService otaBaCxTxjlService; private IOtaBaCxTxjlService otaBaCxTxjlService;
@Value(value = "${ota.templatePath}")
private String templatePath;
@Value(value = "${ota.uploadPath}")
private String uploadPath;
/** /**
* 保存 * 保存
* *
@@ -128,11 +142,50 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
} }
private OtaBaSjSjyxpg getByOtaId(String otaId) { private OtaBaSjSjyxpg getByOtaId(String otaId) {
if(org.apache.commons.lang3.StringUtils.isEmpty(otaId)){ if (org.apache.commons.lang3.StringUtils.isEmpty(otaId)) {
return null; return null;
} }
LambdaQueryWrapper<OtaBaSjSjyxpg> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OtaBaSjSjyxpg> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaSjSjyxpg::getOtaId, otaId); queryWrapper.eq(OtaBaSjSjyxpg::getOtaId, otaId);
return this.getOne(queryWrapper, false); return this.getOne(queryWrapper, false);
} }
@Override
public void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception {
ImportFileUtil.exportTemplate(response, templatePath + "升级影响评估.zip");
}
@Override
public OtaBaSjSjyxpg importData(MultipartFile file, String otaId, String cut) throws Exception {
List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath);
OtaBaSjSjyxpg sjyxpg = parseFileList(upLoadFiles, otaId, cut);
return sjyxpg;
}
private OtaBaSjSjyxpg parseFile(File upFile, String cut) {
OtaBaSjSjyxpg sjyxpg = new OtaBaSjSjyxpg();
return sjyxpg;
}
@Override
public OtaBaSjSjyxpg parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception {
File upFile = null;
for (File f : upLoadFiles) {
if (f.getName().equals("车型基本信息.xlsx")) {
upFile = f;
}
}
if (null == upFile) {
throw new JeroBootException("请上传正确的文件");
}
OtaBaSjSjyxpg sjyxpg = parseFile(upFile, cut);
sjyxpg.setOtaId(otaId);
add(sjyxpg);
return sjyxpg;
}
@Override
public void exportData(File file, String otaId, String cut) throws Exception {
}
} }