开发OTA备案工具 修改备案历史接口

This commit is contained in:
高嵩
2023-03-23 23:47:39 +08:00
parent 7cf1f441b4
commit 99f276f2c9
6 changed files with 38 additions and 24 deletions
@@ -174,10 +174,14 @@ public class OtaBaCxListController extends JeroController<OtaBaCxList, IOtaBaCxL
* *
*/ */
@AutoLog(value = "车型及功能备案列表-备案维护") @AutoLog(value = "车型及功能备案列表-备案维护")
@ApiOperation(value="车型及功能备案列表-备案维护", notes="车型及功能备案列表-备案维护") @ApiOperation(value = "车型及功能备案列表-备案维护", notes = "车型及功能备案列表-备案维护")
@PutMapping(value = "/batchRecord") @PostMapping(value = "/batchRecord")
public Result<?> batchRecord(@RequestBody List<OtaBaCxList> recordList) { public Result<?> batchRecord(@RequestParam(name = "ids", required = true) String ids,
otaBaCxListService.batchRecord(recordList); @RequestParam(name = "bazt", required = true) String bazt,
@RequestParam(name = "batjsj", required = true) String batjsj,
@RequestParam(name = "bz", required = true) String bz,
@RequestParam(name = "cut") String cut) {
otaBaCxListService.batchRecord(ids, bazt, batjsj, bz, cut);
return Result.OK("备案维护成功!"); return Result.OK("备案维护成功!");
} }
@@ -173,10 +173,14 @@ public class OtaBaSjListController extends JeroController<OtaBaSjList, IOtaBaSjL
* *
*/ */
@AutoLog(value = "升级备案-备案维护") @AutoLog(value = "升级备案-备案维护")
@ApiOperation(value="升级备案-备案维护", notes="升级备案-备案维护") @ApiOperation(value = "升级备案-备案维护", notes = "升级备案-备案维护")
@PutMapping(value = "/batchRecord") @PostMapping(value = "/batchRecord")
public Result<?> batchRecord(@RequestBody List<OtaBaSjList> recordList) { public Result<?> batchRecord(@RequestParam(name = "ids", required = true) String ids,
otaBaSjListService.batchRecord(recordList); @RequestParam(name = "bazt", required = true) String bazt,
@RequestParam(name = "batjsj", required = true) String batjsj,
@RequestParam(name = "bz", required = true) String bz,
@RequestParam(name = "cut") String cut) {
otaBaSjListService.batchRecord(ids, bazt, batjsj, bz, cut);
return Result.OK("备案维护成功!"); return Result.OK("备案维护成功!");
} }
@@ -64,5 +64,5 @@ public interface IOtaBaCxListService extends IService<OtaBaCxList> {
* 备案维护 * 备案维护
* *
*/ */
void batchRecord(List<OtaBaCxList> recordList); void batchRecord(String ids, String bazt, String batjsj, String bz, String cut);
} }
@@ -64,5 +64,5 @@ public interface IOtaBaSjListService extends IService<OtaBaSjList> {
* 备案维护 * 备案维护
* *
*/ */
void batchRecord(List<OtaBaSjList> recordList); void batchRecord(String ids, String bazt, String batjsj, String bz, String cut);
} }
@@ -7,6 +7,7 @@ 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.system.util.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;
@@ -102,19 +103,20 @@ public class OtaBaCxListServiceImpl extends ServiceImpl<OtaBaCxListMapper, OtaBa
* 备案维护 * 备案维护
*/ */
@Override @Override
public void batchRecord(List<OtaBaCxList> recordList) { public void batchRecord(String ids, String bazt, String batjsj, String bz, String cut) {
try { try {
if (null != recordList && recordList.size() > 0) { if (StringUtils.isNotEmpty(ids)) {
for (OtaBaCxList obc : recordList) { String[] idList = ids.split(",");
String id = obc.getId(); for (String id : idList) {
OtaBaCxList otaBaCxList = this.queryById(id); OtaBaCxList otaBaCxList = this.queryById(id);
otaBaCxList.setBatjsj(obc.getBatjsj()); otaBaCxList.setBazt(bazt);
otaBaCxList.setBz(obc.getBz()); otaBaCxList.setBatjsj(sdf.parse(batjsj));
otaBaCxList.setBz(bz);
this.saveOrUpdate(otaBaCxList); this.saveOrUpdate(otaBaCxList);
//添加历史记录数据 //添加历史记录数据
OtaBaCxLsjl lsjl = new OtaBaCxLsjl(); OtaBaCxLsjl lsjl = new OtaBaCxLsjl();
lsjl.setOtaId(id); lsjl.setOtaId(id);
lsjl.setSjzt(obc.getBz()); lsjl.setSjzt(bazt);
otaBaCxLsjlService.add(lsjl); otaBaCxLsjlService.add(lsjl);
} }
} }
@@ -2,11 +2,14 @@ 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.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.mapper.OtaBaSjListMapper; import com.jero.modules.ota.mapper.OtaBaSjListMapper;
import com.jero.modules.ota.service.IOtaBaSjListService; 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.system.util.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;
@@ -102,19 +105,20 @@ public class OtaBaSjListServiceImpl extends ServiceImpl<OtaBaSjListMapper, OtaBa
* 备案维护 * 备案维护
*/ */
@Override @Override
public void batchRecord(List<OtaBaSjList> recordList) { public void batchRecord(String ids, String bazt, String batjsj, String bz, String cut) {
try { try {
if (null != recordList && recordList.size() > 0) { if (StringUtils.isNotEmpty(ids)) {
for (OtaBaSjList obs : recordList) { String[] idList = ids.split(",");
String id = obs.getId(); for (String id : idList) {
OtaBaSjList otaBaSjList = this.queryById(id); OtaBaSjList otaBaSjList = this.queryById(id);
otaBaSjList.setBatjsj(obs.getBatjsj()); otaBaSjList.setBazt(bazt);
otaBaSjList.setBz(obs.getBz()); otaBaSjList.setBatjsj(sdf.parse(batjsj));
otaBaSjList.setBz(bz);
this.saveOrUpdate(otaBaSjList); this.saveOrUpdate(otaBaSjList);
//添加历史记录数据 //添加历史记录数据
OtaBaSjLsjl lsjl = new OtaBaSjLsjl(); OtaBaSjLsjl lsjl = new OtaBaSjLsjl();
lsjl.setOtaId(id); lsjl.setOtaId(id);
lsjl.setSjzt(obs.getBz()); lsjl.setSjzt(bazt);
otaBaSjLsjlService.add(lsjl); otaBaSjLsjlService.add(lsjl);
} }
} }