开发OTA备案工具 添加备案历史接口

This commit is contained in:
高嵩
2023-03-22 21:59:43 +08:00
parent 956c2e3db5
commit cdbce3e10e
6 changed files with 38 additions and 56 deletions
@@ -175,9 +175,9 @@ public class OtaBaCxListController extends JeroController<OtaBaCxList, IOtaBaCxL
*/
@AutoLog(value = "车型及功能备案列表-备案维护")
@ApiOperation(value="车型及功能备案列表-备案维护", notes="车型及功能备案列表-备案维护")
@PutMapping(value = "/record")
public Result<?> record(@RequestBody Map<String,Object> map) {
otaBaCxListService.record(map);
@PutMapping(value = "/batchRecord")
public Result<?> batchRecord(@RequestBody List<OtaBaCxList> recordList) {
otaBaCxListService.batchRecord(recordList);
return Result.OK("备案维护成功!");
}
@@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.jero.common.api.vo.Result;
import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.ota.entity.OtaBaCxList;
import com.jero.modules.ota.entity.OtaBaSjList;
import com.jero.modules.ota.service.IOtaBaSjListService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -174,9 +175,9 @@ public class OtaBaSjListController extends JeroController<OtaBaSjList, IOtaBaSjL
*/
@AutoLog(value = "升级备案-备案维护")
@ApiOperation(value="升级备案-备案维护", notes="升级备案-备案维护")
@PutMapping(value = "/record")
public Result<?> record(@RequestBody Map<String,Object> map) {
otaBaSjListService.record(map);
@PutMapping(value = "/batchRecord")
public Result<?> batchRecord(@RequestBody List<OtaBaSjList> recordList) {
otaBaSjListService.batchRecord(recordList);
return Result.OK("备案维护成功!");
}
@@ -64,5 +64,5 @@ public interface IOtaBaCxListService extends IService<OtaBaCxList> {
* 备案维护
*
*/
void record(Map<String, Object> map);
void batchRecord(List<OtaBaCxList> recordList);
}
@@ -2,6 +2,8 @@ package com.jero.modules.ota.service;
import com.jero.modules.ota.entity.OtaBaSjList;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
import java.util.Map;
@@ -64,5 +66,5 @@ public interface IOtaBaSjListService extends IService<OtaBaSjList> {
* 备案维护
*
*/
void record(Map<String, Object> map);
void batchRecord(List<OtaBaSjList> recordList);
}
@@ -103,35 +103,24 @@ public class OtaBaCxListServiceImpl extends ServiceImpl<OtaBaCxListMapper, OtaBa
/**
* 备案维护
*
* @param map
*/
@Override
public void record(Map<String, Object> map) {
public void batchRecord(List<OtaBaCxList> recordList) {
try {
String id = (String) map.get("id");
OtaBaCxList otaBaCxList = this.queryById(id);
if (null != otaBaCxList) {
String bazt = (String) map.get("bazt");
otaBaCxList.setBazt(bazt);
Object batjsj = map.get("batjsj");
if (null != batjsj) {
Date batjsjDate = null;
batjsjDate = sdf.parse((String) batjsj);
otaBaCxList.setBatjsj(batjsjDate);
if (null != recordList && recordList.size() > 0) {
for (OtaBaCxList obc : recordList) {
String id = obc.getId();
OtaBaCxList otaBaCxList = this.queryById(id);
otaBaCxList.setBatjsj(obc.getBatjsj());
otaBaCxList.setBz(obc.getBz());
this.saveOrUpdate(otaBaCxList);
//添加历史记录数据
OtaBaCxLsjl lsjl = new OtaBaCxLsjl();
lsjl.setOtaId(id);
lsjl.setSjzt(obc.getBz());
otaBaCxLsjlService.add(lsjl);
}
String bz = (String) map.get("bz");
otaBaCxList.setBz(bz);
this.saveOrUpdate(otaBaCxList);
//添加历史记录数据
OtaBaCxLsjl lsjl = new OtaBaCxLsjl();
lsjl.setOtaId(otaBaCxList.getId());
lsjl.setSjzt(bazt);
otaBaCxLsjlService.add(lsjl);
}
} catch (ParseException e) {
e.printStackTrace();
throw new JeroBootException(e.getMessage());
} catch (Exception ex) {
ex.printStackTrace();
throw new JeroBootException(ex.getMessage());
@@ -2,6 +2,7 @@ package com.jero.modules.ota.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.exception.JeroBootException;
import com.jero.modules.ota.entity.OtaBaCxList;
import com.jero.modules.ota.entity.OtaBaCxLsjl;
import com.jero.modules.ota.entity.OtaBaSjList;
import com.jero.modules.ota.entity.OtaBaSjLsjl;
@@ -103,35 +104,24 @@ public class OtaBaSjListServiceImpl extends ServiceImpl<OtaBaSjListMapper, OtaBa
/**
* 备案维护
*
* @param map
*/
@Override
public void record(Map<String, Object> map) {
public void batchRecord(List<OtaBaSjList> recordList) {
try {
String id = (String) map.get("id");
OtaBaSjList otaBaSjList = this.queryById(id);
if (null != otaBaSjList) {
String bazt = (String) map.get("bazt");
otaBaSjList.setBazt(bazt);
Object batjsj = map.get("batjsj");
if (null != batjsj) {
Date batjsjDate = null;
batjsjDate = sdf.parse((String) batjsj);
otaBaSjList.setBatjsj(batjsjDate);
if (null != recordList && recordList.size() > 0) {
for (OtaBaSjList obs : recordList) {
String id = obs.getId();
OtaBaSjList otaBaSjList = this.queryById(id);
otaBaSjList.setBatjsj(obs.getBatjsj());
otaBaSjList.setBz(obs.getBz());
this.saveOrUpdate(otaBaSjList);
//添加历史记录数据
OtaBaSjLsjl lsjl = new OtaBaSjLsjl();
lsjl.setOtaId(id);
lsjl.setSjzt(obs.getBz());
otaBaSjLsjlService.add(lsjl);
}
String bz = (String) map.get("bz");
otaBaSjList.setBz(bz);
this.saveOrUpdate(otaBaSjList);
//添加历史记录数据
OtaBaSjLsjl lsjl = new OtaBaSjLsjl();
lsjl.setOtaId(otaBaSjList.getId());
lsjl.setSjzt(bazt);
otaBaSjLsjlService.add(lsjl);
}
} catch (ParseException e) {
e.printStackTrace();
throw new JeroBootException(e.getMessage());
} catch (Exception ex) {
ex.printStackTrace();
throw new JeroBootException(ex.getMessage());