开发OTA备案工具-车辆升级
This commit is contained in:
+22
-4
@@ -4,6 +4,8 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.ota.entity.OtaBaSjSjfzbh;
|
||||
@@ -74,14 +76,12 @@ public class OtaBaSjSjfzbhController extends JeroController<OtaBaSjSjfzbh, IOtaB
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param otaBaSjSjfzbh
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "升级备案-本次升级的驾驶辅助功能与参数变化-添加")
|
||||
@ApiOperation(value="升级备案-本次升级的驾驶辅助功能与参数变化-添加", notes="升级备案-本次升级的驾驶辅助功能与参数变化-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody OtaBaSjSjfzbh otaBaSjSjfzbh) {
|
||||
otaBaSjSjfzbhService.add(otaBaSjSjfzbh);
|
||||
public Result<?> add(@RequestBody JSONObject json) {
|
||||
otaBaSjSjfzbhService.add(json);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@@ -144,6 +144,24 @@ public class OtaBaSjSjfzbhController extends JeroController<OtaBaSjSjfzbh, IOtaB
|
||||
return Result.OK(otaBaSjSjfzbh);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过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,
|
||||
@RequestParam(name = "otaIdT", required = true) String otaIdT) {
|
||||
JSONObject json = otaBaSjSjfzbhService.queryByOtaId(otaId, otaIdT);
|
||||
if (json == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(json);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
|
||||
+141
-120
@@ -4,6 +4,8 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.ota.entity.OtaBaSjSjxtbh;
|
||||
@@ -22,146 +24,165 @@ import io.swagger.annotations.ApiOperation;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @Description: 升级备案-本次升级的系统名称与参数变化
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-03-17
|
||||
* @Date: 2023-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="升级备案-本次升级的系统名称与参数变化")
|
||||
@Api(tags = "升级备案-本次升级的系统名称与参数变化")
|
||||
@RestController
|
||||
@RequestMapping("/ota/otaBaSjSjxtbh")
|
||||
@Slf4j
|
||||
public class OtaBaSjSjxtbhController extends JeroController<OtaBaSjSjxtbh, IOtaBaSjSjxtbhService> {
|
||||
@Autowired
|
||||
private IOtaBaSjSjxtbhService otaBaSjSjxtbhService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param otaBaSjSjxtbh
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "升级备案-本次升级的系统名称与参数变化-分页列表查询")
|
||||
@ApiOperation(value="升级备案-本次升级的系统名称与参数变化-分页列表查询", notes="升级备案-本次升级的系统名称与参数变化-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(OtaBaSjSjxtbh otaBaSjSjxtbh,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<OtaBaSjSjxtbh> queryWrapper = QueryGenerator.initQueryWrapper(otaBaSjSjxtbh, req.getParameterMap());
|
||||
Page<OtaBaSjSjxtbh> page = new Page<OtaBaSjSjxtbh>(pageNo, pageSize);
|
||||
IPage<OtaBaSjSjxtbh> pageList = otaBaSjSjxtbhService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
@Autowired
|
||||
private IOtaBaSjSjxtbhService otaBaSjSjxtbhService;
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "升级备案-本次升级的系统名称与参数变化-列表查询")
|
||||
@ApiOperation(value="升级备案-本次升级的系统名称与参数变化-列表查询", notes="升级备案-本次升级的系统名称与参数变化-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<OtaBaSjSjxtbh>> queryList() {
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param otaBaSjSjxtbh
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "升级备案-本次升级的系统名称与参数变化-分页列表查询")
|
||||
@ApiOperation(value = "升级备案-本次升级的系统名称与参数变化-分页列表查询", notes = "升级备案-本次升级的系统名称与参数变化-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(OtaBaSjSjxtbh otaBaSjSjxtbh,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<OtaBaSjSjxtbh> queryWrapper = QueryGenerator.initQueryWrapper(otaBaSjSjxtbh, req.getParameterMap());
|
||||
Page<OtaBaSjSjxtbh> page = new Page<OtaBaSjSjxtbh>(pageNo, pageSize);
|
||||
IPage<OtaBaSjSjxtbh> pageList = otaBaSjSjxtbhService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "升级备案-本次升级的系统名称与参数变化-列表查询")
|
||||
@ApiOperation(value = "升级备案-本次升级的系统名称与参数变化-列表查询", notes = "升级备案-本次升级的系统名称与参数变化-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<OtaBaSjSjxtbh>> queryList() {
|
||||
List<OtaBaSjSjxtbh> list = otaBaSjSjxtbhService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param otaBaSjSjxtbh
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "升级备案-本次升级的系统名称与参数变化-添加")
|
||||
@ApiOperation(value="升级备案-本次升级的系统名称与参数变化-添加", notes="升级备案-本次升级的系统名称与参数变化-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody OtaBaSjSjxtbh otaBaSjSjxtbh) {
|
||||
otaBaSjSjxtbhService.add(otaBaSjSjxtbh);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param otaBaSjSjxtbh
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "升级备案-本次升级的系统名称与参数变化-编辑")
|
||||
@ApiOperation(value="升级备案-本次升级的系统名称与参数变化-编辑", notes="升级备案-本次升级的系统名称与参数变化-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody OtaBaSjSjxtbh otaBaSjSjxtbh) {
|
||||
otaBaSjSjxtbhService.editById(otaBaSjSjxtbh);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "升级备案-本次升级的系统名称与参数变化-通过id删除")
|
||||
@ApiOperation(value="升级备案-本次升级的系统名称与参数变化-通过id删除", notes="升级备案-本次升级的系统名称与参数变化-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
otaBaSjSjxtbhService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "升级备案-本次升级的系统名称与参数变化-批量删除")
|
||||
@ApiOperation(value="升级备案-本次升级的系统名称与参数变化-批量删除", notes="升级备案-本次升级的系统名称与参数变化-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.otaBaSjSjxtbhService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "升级备案-本次升级的系统名称与参数变化-通过id查询")
|
||||
@ApiOperation(value="升级备案-本次升级的系统名称与参数变化-通过id查询", notes="升级备案-本次升级的系统名称与参数变化-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
OtaBaSjSjxtbh otaBaSjSjxtbh = otaBaSjSjxtbhService.queryById(id);
|
||||
if(otaBaSjSjxtbh==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(otaBaSjSjxtbh);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param otaBaSjSjxtbh
|
||||
*/
|
||||
* 添加
|
||||
*
|
||||
* @param otaBaSjSjxtbh
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "升级备案-本次升级的系统名称与参数变化-添加")
|
||||
@ApiOperation(value = "升级备案-本次升级的系统名称与参数变化-添加", notes = "升级备案-本次升级的系统名称与参数变化-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@RequestBody JSONObject json) {
|
||||
otaBaSjSjxtbhService.add(json);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param otaBaSjSjxtbh
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "升级备案-本次升级的系统名称与参数变化-编辑")
|
||||
@ApiOperation(value = "升级备案-本次升级的系统名称与参数变化-编辑", notes = "升级备案-本次升级的系统名称与参数变化-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody OtaBaSjSjxtbh otaBaSjSjxtbh) {
|
||||
otaBaSjSjxtbhService.editById(otaBaSjSjxtbh);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "升级备案-本次升级的系统名称与参数变化-通过id删除")
|
||||
@ApiOperation(value = "升级备案-本次升级的系统名称与参数变化-通过id删除", notes = "升级备案-本次升级的系统名称与参数变化-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
otaBaSjSjxtbhService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "升级备案-本次升级的系统名称与参数变化-批量删除")
|
||||
@ApiOperation(value = "升级备案-本次升级的系统名称与参数变化-批量删除", notes = "升级备案-本次升级的系统名称与参数变化-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.otaBaSjSjxtbhService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "升级备案-本次升级的系统名称与参数变化-通过id查询")
|
||||
@ApiOperation(value = "升级备案-本次升级的系统名称与参数变化-通过id查询", notes = "升级备案-本次升级的系统名称与参数变化-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
OtaBaSjSjxtbh otaBaSjSjxtbh = otaBaSjSjxtbhService.queryById(id);
|
||||
if (otaBaSjSjxtbh == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(otaBaSjSjxtbh);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过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,
|
||||
@RequestParam(name = "otaIdT", required = true) String otaIdT) {
|
||||
JSONObject json = otaBaSjSjxtbhService.queryByOtaId(otaId, otaIdT);
|
||||
if (json == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(json);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param otaBaSjSjxtbh
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, OtaBaSjSjxtbh otaBaSjSjxtbh) {
|
||||
return super.exportXls(request, otaBaSjSjxtbh, OtaBaSjSjxtbh.class, "升级备案-本次升级的系统名称与参数变化");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, OtaBaSjSjxtbh.class);
|
||||
|
||||
@@ -115,6 +115,12 @@ public class OtaBaSjList implements Serializable {
|
||||
@ApiModelProperty(value = "备注")
|
||||
private java.lang.String bz;
|
||||
|
||||
/**升级驾驶附件*/
|
||||
@Excel(name = "升级驾驶附件", width = 15)
|
||||
@ApiModelProperty(value = "升级驾驶附件")
|
||||
private java.lang.String sjjsfj;
|
||||
|
||||
|
||||
public void updateData(OtaBaSjSjmbcx otaBaSjSjmbcx) {
|
||||
this.cpdjbh = otaBaSjSjmbcx.getBabh();
|
||||
this.ggpc = otaBaSjSjmbcx.getBapc();
|
||||
|
||||
+4
-1
@@ -1,5 +1,6 @@
|
||||
package com.jero.modules.ota.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jero.modules.ota.entity.OtaBaSjSjfzbh;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
@@ -18,7 +19,7 @@ public interface IOtaBaSjSjfzbhService extends IService<OtaBaSjSjfzbh> {
|
||||
* @param otaBaSjSjfzbh
|
||||
* @return
|
||||
*/
|
||||
void add(OtaBaSjSjfzbh otaBaSjSjfzbh);
|
||||
void add(JSONObject json);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
@@ -58,4 +59,6 @@ public interface IOtaBaSjSjfzbhService extends IService<OtaBaSjSjfzbh> {
|
||||
* @return
|
||||
*/
|
||||
List<OtaBaSjSjfzbh> queryList();
|
||||
|
||||
JSONObject queryByOtaId(String otaId, String otaIdT);
|
||||
}
|
||||
|
||||
+4
-3
@@ -1,5 +1,6 @@
|
||||
package com.jero.modules.ota.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jero.modules.ota.entity.OtaBaSjSjxtbh;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
@@ -15,10 +16,8 @@ public interface IOtaBaSjSjxtbhService extends IService<OtaBaSjSjxtbh> {
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param otaBaSjSjxtbh
|
||||
* @return
|
||||
*/
|
||||
void add(OtaBaSjSjxtbh otaBaSjSjxtbh);
|
||||
void add(JSONObject json);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
@@ -58,4 +57,6 @@ public interface IOtaBaSjSjxtbhService extends IService<OtaBaSjSjxtbh> {
|
||||
* @return
|
||||
*/
|
||||
List<OtaBaSjSjxtbh> queryList();
|
||||
|
||||
JSONObject queryByOtaId(String otaId, String otaIdT);
|
||||
}
|
||||
|
||||
+2
@@ -29,6 +29,8 @@ public class OtaBaSjListServiceImpl extends ServiceImpl<OtaBaSjListMapper, OtaBa
|
||||
@Autowired
|
||||
private IOtaBaSjLsjlService otaBaSjLsjlService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
|
||||
+152
-50
@@ -1,89 +1,191 @@
|
||||
package com.jero.modules.ota.service.impl;
|
||||
|
||||
import com.jero.modules.ota.entity.OtaBaSjSjfzbh;
|
||||
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.jero.modules.oss.service.IOSSFileService;
|
||||
import com.jero.modules.ota.entity.*;
|
||||
import com.jero.modules.ota.enums.OtaModuleEnum;
|
||||
import com.jero.modules.ota.enums.OtaTitleEnum;
|
||||
import com.jero.modules.ota.mapper.OtaBaSjSjfzbhMapper;
|
||||
import com.jero.modules.ota.service.IOtaBaCxTxjlService;
|
||||
import com.jero.modules.ota.service.IOtaBaSjListService;
|
||||
import com.jero.modules.ota.service.IOtaBaSjSjfzbhService;
|
||||
import com.jero.modules.ota.utils.ComparisonUtil;
|
||||
import com.jero.modules.system.service.ISysDictService;
|
||||
import com.jero.modules.system.util.StringUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @Description: 升级备案-本次升级的驾驶辅助功能与参数变化
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-03-17
|
||||
* @Date: 2023-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl<OtaBaSjSjfzbhMapper, OtaBaSjSjfzbh> implements IOtaBaSjSjfzbhService {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param otaBaSjSjfzbh
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(OtaBaSjSjfzbh otaBaSjSjfzbh) {
|
||||
@Autowired
|
||||
private IOtaBaSjListService otaBaSjListService;
|
||||
|
||||
@Autowired
|
||||
private IOtaBaCxTxjlService otaBaCxTxjlService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictService sysDictService;
|
||||
|
||||
@Autowired
|
||||
private IOSSFileService ossFileService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void add(JSONObject json) {
|
||||
List<OtaBaSjSjfzbh> newList = new ArrayList<>();
|
||||
List<OtaBaSjSjfzbh> oldList;
|
||||
Date now = new Date();
|
||||
otaBaSjSjfzbh.setCreateTime(now);
|
||||
otaBaSjSjfzbh.setUpdateTime(now);
|
||||
save(otaBaSjSjfzbh);
|
||||
String otaId = (String) json.get("otaId");
|
||||
if (StringUtils.isNotEmpty(otaId)) {
|
||||
oldList = getByOtaId(otaId);
|
||||
deleteByOtaId(otaId);
|
||||
JSONArray list = json.getJSONArray("list");
|
||||
for (Object obj : list) {
|
||||
Map<String, Object> objMap = (HashMap) obj;
|
||||
OtaBaSjSjfzbh otaBaSjSjfzbh = new OtaBaSjSjfzbh();
|
||||
Field[] fields = OtaBaSjSjfzbh.class.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
if (field.getName().equals("createTime") || field.getName().equals("updateTime")) {
|
||||
continue;
|
||||
}
|
||||
Object bjObj = objMap.get(field.getName());
|
||||
if (null != bjObj) {
|
||||
try {
|
||||
field.setAccessible(true);
|
||||
field.set(otaBaSjSjfzbh, bjObj.toString());
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
otaBaSjSjfzbh.setOtaId(otaId);
|
||||
otaBaSjSjfzbh.setCreateTime(now);
|
||||
otaBaSjSjfzbh.setUpdateTime(now);
|
||||
newList.add(otaBaSjSjfzbh);
|
||||
}
|
||||
if (ObjectUtils.isEmpty(oldList)) {
|
||||
oldList = new ArrayList<>();
|
||||
}
|
||||
ComparisonUtil cu = new ComparisonUtil();
|
||||
List<OtaBaCxTxjl> reList = cu.comparisonListRecord(otaId, OtaModuleEnum.SJ_SJJSMCBH, OtaTitleEnum.GNMC.getName(), oldList, newList, sysDictService);
|
||||
saveOrUpdateBatch(newList);
|
||||
otaBaCxTxjlService.saveBatch(reList);
|
||||
String fj = (String) json.get("fj");
|
||||
if (StringUtils.isNotEmpty(fj)) {
|
||||
OtaBaSjList otaBaSjList = otaBaSjListService.queryById(otaId);
|
||||
if (ObjectUtils.isNotEmpty(otaBaSjList)) {
|
||||
otaBaSjList.setSjjsfj(fj);
|
||||
otaBaSjListService.editById(otaBaSjList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param otaBaSjSjfzbh
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByOtaId(String otaId) {
|
||||
List<OtaBaSjSjfzbh> list = this.getByOtaId(otaId);
|
||||
List<String> ids = new ArrayList<>();
|
||||
for (OtaBaSjSjfzbh bh : list) {
|
||||
ids.add(bh.getId());
|
||||
}
|
||||
this.deleteByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param otaBaSjSjfzbh
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(OtaBaSjSjfzbh otaBaSjSjfzbh) {
|
||||
Date now = new Date();
|
||||
Date now = new Date();
|
||||
otaBaSjSjfzbh.setUpdateTime(now);
|
||||
saveOrUpdate(otaBaSjSjfzbh);
|
||||
saveOrUpdate(otaBaSjSjfzbh);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public OtaBaSjSjfzbh queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<OtaBaSjSjfzbh> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject queryByOtaId(String otaId, String otaIdT) {
|
||||
List<OtaBaSjSjfzbh> res = this.getByOtaId(otaId);
|
||||
if (ObjectUtil.isEmpty(res)) {
|
||||
res = getByOtaId(otaIdT);
|
||||
}
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("list", res);
|
||||
OtaBaSjList otaBaSjList = otaBaSjListService.queryById(otaId);
|
||||
if (ObjectUtils.isNotEmpty(otaBaSjList) && ObjectUtils.isNotEmpty(otaBaSjList.getSjjsfj())) {
|
||||
json.put("fj", otaBaSjList.getSjjsfj());
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
private List<OtaBaSjSjfzbh> getByOtaId(String otaId) {
|
||||
if (org.apache.commons.lang3.StringUtils.isEmpty(otaId)) {
|
||||
return null;
|
||||
}
|
||||
LambdaQueryWrapper<OtaBaSjSjfzbh> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OtaBaSjSjfzbh::getOtaId, otaId);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
+135
-50
@@ -1,89 +1,174 @@
|
||||
package com.jero.modules.ota.service.impl;
|
||||
|
||||
import com.jero.modules.ota.entity.OtaBaSjSjxtbh;
|
||||
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.jero.modules.oss.service.IOSSFileService;
|
||||
import com.jero.modules.ota.entity.*;
|
||||
import com.jero.modules.ota.enums.OtaModuleEnum;
|
||||
import com.jero.modules.ota.enums.OtaTitleEnum;
|
||||
import com.jero.modules.ota.mapper.OtaBaSjSjxtbhMapper;
|
||||
import com.jero.modules.ota.service.IOtaBaCxTxjlService;
|
||||
import com.jero.modules.ota.service.IOtaBaSjSjxtbhService;
|
||||
import com.jero.modules.ota.utils.ComparisonUtil;
|
||||
import com.jero.modules.system.service.ISysDictService;
|
||||
import com.jero.modules.system.util.StringUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @Description: 升级备案-本次升级的系统名称与参数变化
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-03-17
|
||||
* @Date: 2023-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl<OtaBaSjSjxtbhMapper, OtaBaSjSjxtbh> implements IOtaBaSjSjxtbhService {
|
||||
@Autowired
|
||||
private IOtaBaCxTxjlService otaBaCxTxjlService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param otaBaSjSjxtbh
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(OtaBaSjSjxtbh otaBaSjSjxtbh) {
|
||||
@Autowired
|
||||
private ISysDictService sysDictService;
|
||||
|
||||
@Autowired
|
||||
private IOSSFileService ossFileService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@Override
|
||||
public void add(JSONObject json) {
|
||||
List<OtaBaSjSjxtbh> newList = new ArrayList<>();
|
||||
List<OtaBaSjSjxtbh> oldList;
|
||||
Date now = new Date();
|
||||
otaBaSjSjxtbh.setCreateTime(now);
|
||||
otaBaSjSjxtbh.setUpdateTime(now);
|
||||
save(otaBaSjSjxtbh);
|
||||
String otaId = (String) json.get("otaId");
|
||||
if (StringUtils.isNotEmpty(otaId)) {
|
||||
oldList = getByOtaId(otaId);
|
||||
deleteByOtaId(otaId);
|
||||
JSONArray list = json.getJSONArray("list");
|
||||
for (Object obj : list) {
|
||||
Map<String, Object> objMap = (HashMap) obj;
|
||||
OtaBaSjSjxtbh otaBaSjSjxtbh = new OtaBaSjSjxtbh();
|
||||
Field[] fields = OtaBaSjSjxtbh.class.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
if (field.getName().equals("createTime") || field.getName().equals("updateTime")) {
|
||||
continue;
|
||||
}
|
||||
Object bjObj = objMap.get(field.getName());
|
||||
if (null != bjObj) {
|
||||
try {
|
||||
field.setAccessible(true);
|
||||
field.set(otaBaSjSjxtbh, bjObj.toString());
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
otaBaSjSjxtbh.setOtaId(otaId);
|
||||
otaBaSjSjxtbh.setCreateTime(now);
|
||||
otaBaSjSjxtbh.setUpdateTime(now);
|
||||
newList.add(otaBaSjSjxtbh);
|
||||
}
|
||||
if (ObjectUtils.isEmpty(oldList)) {
|
||||
oldList = new ArrayList<>();
|
||||
}
|
||||
ComparisonUtil cu = new ComparisonUtil();
|
||||
List<OtaBaCxTxjl> reList = cu.comparisonListRecord(otaId, OtaModuleEnum.SJ_SJXTMCBH, OtaTitleEnum.XTMC.getName(), oldList, newList, sysDictService);
|
||||
saveOrUpdateBatch(newList);
|
||||
otaBaCxTxjlService.saveBatch(reList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param otaBaSjSjxtbh
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByOtaId(String otaId) {
|
||||
List<OtaBaSjSjxtbh> list = this.getByOtaId(otaId);
|
||||
List<String> ids = new ArrayList<>();
|
||||
for (OtaBaSjSjxtbh bh : list) {
|
||||
ids.add(bh.getId());
|
||||
}
|
||||
this.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param otaBaSjSjxtbh
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(OtaBaSjSjxtbh otaBaSjSjxtbh) {
|
||||
Date now = new Date();
|
||||
Date now = new Date();
|
||||
otaBaSjSjxtbh.setUpdateTime(now);
|
||||
saveOrUpdate(otaBaSjSjxtbh);
|
||||
saveOrUpdate(otaBaSjSjxtbh);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public OtaBaSjSjxtbh queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<OtaBaSjSjxtbh> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject queryByOtaId(String otaId, String otaIdT) {
|
||||
List<OtaBaSjSjxtbh> res = this.getByOtaId(otaId);
|
||||
if (ObjectUtil.isEmpty(res)) {
|
||||
res = getByOtaId(otaIdT);
|
||||
}
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("list", res);
|
||||
return json;
|
||||
}
|
||||
|
||||
private List<OtaBaSjSjxtbh> getByOtaId(String otaId) {
|
||||
if (org.apache.commons.lang3.StringUtils.isEmpty(otaId)) {
|
||||
return null;
|
||||
}
|
||||
LambdaQueryWrapper<OtaBaSjSjxtbh> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OtaBaSjSjxtbh::getOtaId, otaId);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user