开发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 = "车型及功能备案列表-备案维护") @AutoLog(value = "车型及功能备案列表-备案维护")
@ApiOperation(value="车型及功能备案列表-备案维护", notes="车型及功能备案列表-备案维护") @ApiOperation(value="车型及功能备案列表-备案维护", notes="车型及功能备案列表-备案维护")
@PutMapping(value = "/record") @PutMapping(value = "/batchRecord")
public Result<?> record(@RequestBody Map<String,Object> map) { public Result<?> batchRecord(@RequestBody List<OtaBaCxList> recordList) {
otaBaCxListService.record(map); otaBaCxListService.batchRecord(recordList);
return Result.OK("备案维护成功!"); return Result.OK("备案维护成功!");
} }
@@ -7,6 +7,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.OtaBaCxList;
import com.jero.modules.ota.entity.OtaBaSjList; import com.jero.modules.ota.entity.OtaBaSjList;
import com.jero.modules.ota.service.IOtaBaSjListService; import com.jero.modules.ota.service.IOtaBaSjListService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -174,9 +175,9 @@ public class OtaBaSjListController extends JeroController<OtaBaSjList, IOtaBaSjL
*/ */
@AutoLog(value = "升级备案-备案维护") @AutoLog(value = "升级备案-备案维护")
@ApiOperation(value="升级备案-备案维护", notes="升级备案-备案维护") @ApiOperation(value="升级备案-备案维护", notes="升级备案-备案维护")
@PutMapping(value = "/record") @PutMapping(value = "/batchRecord")
public Result<?> record(@RequestBody Map<String,Object> map) { public Result<?> batchRecord(@RequestBody List<OtaBaSjList> recordList) {
otaBaSjListService.record(map); otaBaSjListService.batchRecord(recordList);
return Result.OK("备案维护成功!"); 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.jero.modules.ota.entity.OtaBaSjList;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List; import java.util.List;
import java.util.Map; 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 @Override
public void record(Map<String, Object> map) { public void batchRecord(List<OtaBaCxList> recordList) {
try { try {
String id = (String) map.get("id"); if (null != recordList && recordList.size() > 0) {
OtaBaCxList otaBaCxList = this.queryById(id); for (OtaBaCxList obc : recordList) {
if (null != otaBaCxList) { String id = obc.getId();
String bazt = (String) map.get("bazt"); OtaBaCxList otaBaCxList = this.queryById(id);
otaBaCxList.setBazt(bazt); otaBaCxList.setBatjsj(obc.getBatjsj());
Object batjsj = map.get("batjsj"); otaBaCxList.setBz(obc.getBz());
if (null != batjsj) { this.saveOrUpdate(otaBaCxList);
Date batjsjDate = null; //添加历史记录数据
batjsjDate = sdf.parse((String) batjsj); OtaBaCxLsjl lsjl = new OtaBaCxLsjl();
otaBaCxList.setBatjsj(batjsjDate); 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) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
throw new JeroBootException(ex.getMessage()); 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.OtaBaCxLsjl; import com.jero.modules.ota.entity.OtaBaCxLsjl;
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;
@@ -103,35 +104,24 @@ public class OtaBaSjListServiceImpl extends ServiceImpl<OtaBaSjListMapper, OtaBa
/** /**
* 备案维护 * 备案维护
*
* @param map
*/ */
@Override @Override
public void record(Map<String, Object> map) { public void batchRecord(List<OtaBaSjList> recordList) {
try { try {
String id = (String) map.get("id"); if (null != recordList && recordList.size() > 0) {
OtaBaSjList otaBaSjList = this.queryById(id); for (OtaBaSjList obs : recordList) {
if (null != otaBaSjList) { String id = obs.getId();
String bazt = (String) map.get("bazt"); OtaBaSjList otaBaSjList = this.queryById(id);
otaBaSjList.setBazt(bazt); otaBaSjList.setBatjsj(obs.getBatjsj());
Object batjsj = map.get("batjsj"); otaBaSjList.setBz(obs.getBz());
if (null != batjsj) { this.saveOrUpdate(otaBaSjList);
Date batjsjDate = null; //添加历史记录数据
batjsjDate = sdf.parse((String) batjsj); OtaBaSjLsjl lsjl = new OtaBaSjLsjl();
otaBaSjList.setBatjsj(batjsjDate); 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) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
throw new JeroBootException(ex.getMessage()); throw new JeroBootException(ex.getMessage());