开发OTA备案工具
This commit is contained in:
+18
@@ -143,6 +143,24 @@ public class OtaBaSjSjxtbhController extends JeroController<OtaBaSjSjxtbh, IOtaB
|
||||
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
|
||||
*
|
||||
|
||||
+2
@@ -57,4 +57,6 @@ public interface IOtaBaSjSjxtbhService extends IService<OtaBaSjSjxtbh> {
|
||||
* @return
|
||||
*/
|
||||
List<OtaBaSjSjxtbh> queryList();
|
||||
|
||||
JSONObject queryByOtaId(String otaId, String otaIdT);
|
||||
}
|
||||
|
||||
+86
-54
@@ -1,102 +1,134 @@
|
||||
package com.jero.modules.ota.service.impl;
|
||||
|
||||
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.ota.entity.OtaBaCxKsjjsmccs;
|
||||
import com.jero.modules.ota.entity.OtaBaCxList;
|
||||
import com.jero.modules.ota.entity.OtaBaSjSjxtbh;
|
||||
import com.jero.modules.ota.mapper.OtaBaSjSjxtbhMapper;
|
||||
import com.jero.modules.ota.service.IOtaBaSjSjxtbhService;
|
||||
import com.jero.modules.system.util.StringUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
|
||||
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 {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@Override
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@Override
|
||||
public void add(JSONObject json) {
|
||||
Date now = new Date();
|
||||
String otaId = (String) json.get("otaId");
|
||||
List<OtaBaSjSjxtbh> newList = new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(otaId)) {
|
||||
JSONArray list = json.getJSONArray("list");
|
||||
for (Object obj : list) {
|
||||
OtaBaSjSjxtbh bh = JSONObject.parseObject(obj.toString(),OtaBaSjSjxtbh.class);
|
||||
bh.setOtaId(otaId);
|
||||
bh.setCreateTime(now);
|
||||
bh.setUpdateTime(now);
|
||||
newList.add(bh);
|
||||
}
|
||||
}
|
||||
saveOrUpdateBatch(newList);
|
||||
Date now = new Date();
|
||||
String otaId = (String) json.get("otaId");
|
||||
List<OtaBaSjSjxtbh> newList = new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(otaId)) {
|
||||
deleteByOtaId(otaId);
|
||||
JSONArray list = json.getJSONArray("list");
|
||||
for (Object obj : list) {
|
||||
OtaBaSjSjxtbh bh = JSONObject.parseObject(obj.toString(), OtaBaSjSjxtbh.class);
|
||||
bh.setOtaId(otaId);
|
||||
bh.setCreateTime(now);
|
||||
bh.setUpdateTime(now);
|
||||
newList.add(bh);
|
||||
}
|
||||
}
|
||||
saveOrUpdateBatch(newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param otaBaSjSjxtbh
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @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) {
|
||||
LambdaQueryWrapper<OtaBaSjSjxtbh> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OtaBaSjSjxtbh::getOtaId, otaId);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user