Merge remote-tracking branch 'origin/dev_2nd_LCYH' into dev_2nd_LCYH
This commit is contained in:
+18
@@ -143,6 +143,24 @@ public class OtaBaSjSjxtbhController extends JeroController<OtaBaSjSjxtbh, IOtaB
|
|||||||
return Result.OK(otaBaSjSjxtbh);
|
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
|
* 导出excel
|
||||||
*
|
*
|
||||||
|
|||||||
+2
@@ -57,4 +57,6 @@ public interface IOtaBaSjSjxtbhService extends IService<OtaBaSjSjxtbh> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<OtaBaSjSjxtbh> queryList();
|
List<OtaBaSjSjxtbh> queryList();
|
||||||
|
|
||||||
|
JSONObject queryByOtaId(String otaId, String otaIdT);
|
||||||
}
|
}
|
||||||
|
|||||||
+86
-54
@@ -1,102 +1,134 @@
|
|||||||
package com.jero.modules.ota.service.impl;
|
package com.jero.modules.ota.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
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.OtaBaCxKsjjsmccs;
|
||||||
|
import com.jero.modules.ota.entity.OtaBaCxList;
|
||||||
import com.jero.modules.ota.entity.OtaBaSjSjxtbh;
|
import com.jero.modules.ota.entity.OtaBaSjSjxtbh;
|
||||||
import com.jero.modules.ota.mapper.OtaBaSjSjxtbhMapper;
|
import com.jero.modules.ota.mapper.OtaBaSjSjxtbhMapper;
|
||||||
import com.jero.modules.ota.service.IOtaBaSjSjxtbhService;
|
import com.jero.modules.ota.service.IOtaBaSjSjxtbhService;
|
||||||
import com.jero.modules.system.util.StringUtils;
|
import com.jero.modules.system.util.StringUtils;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 升级备案-本次升级的系统名称与参数变化
|
* @Description: 升级备案-本次升级的系统名称与参数变化
|
||||||
* @Author: jero-boot
|
* @Author: jero-boot
|
||||||
* @Date: 2023-03-17
|
* @Date: 2023-03-17
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl<OtaBaSjSjxtbhMapper, OtaBaSjSjxtbh> implements IOtaBaSjSjxtbhService {
|
public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl<OtaBaSjSjxtbhMapper, OtaBaSjSjxtbh> implements IOtaBaSjSjxtbhService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存
|
* 保存
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void add(JSONObject json) {
|
public void add(JSONObject json) {
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
String otaId = (String) json.get("otaId");
|
String otaId = (String) json.get("otaId");
|
||||||
List<OtaBaSjSjxtbh> newList = new ArrayList<>();
|
List<OtaBaSjSjxtbh> newList = new ArrayList<>();
|
||||||
if (StringUtils.isNotEmpty(otaId)) {
|
if (StringUtils.isNotEmpty(otaId)) {
|
||||||
JSONArray list = json.getJSONArray("list");
|
deleteByOtaId(otaId);
|
||||||
for (Object obj : list) {
|
JSONArray list = json.getJSONArray("list");
|
||||||
OtaBaSjSjxtbh bh = JSONObject.parseObject(obj.toString(),OtaBaSjSjxtbh.class);
|
for (Object obj : list) {
|
||||||
bh.setOtaId(otaId);
|
OtaBaSjSjxtbh bh = JSONObject.parseObject(obj.toString(), OtaBaSjSjxtbh.class);
|
||||||
bh.setCreateTime(now);
|
bh.setOtaId(otaId);
|
||||||
bh.setUpdateTime(now);
|
bh.setCreateTime(now);
|
||||||
newList.add(bh);
|
bh.setUpdateTime(now);
|
||||||
}
|
newList.add(bh);
|
||||||
}
|
}
|
||||||
saveOrUpdateBatch(newList);
|
}
|
||||||
|
saveOrUpdateBatch(newList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新
|
* 更新
|
||||||
*
|
*
|
||||||
* @param otaBaSjSjxtbh
|
* @param otaBaSjSjxtbh
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void editById(OtaBaSjSjxtbh otaBaSjSjxtbh) {
|
public void editById(OtaBaSjSjxtbh otaBaSjSjxtbh) {
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
otaBaSjSjxtbh.setUpdateTime(now);
|
otaBaSjSjxtbh.setUpdateTime(now);
|
||||||
saveOrUpdate(otaBaSjSjxtbh);
|
saveOrUpdate(otaBaSjSjxtbh);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id删除
|
* 通过id删除
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deleteById(String id) {
|
public void deleteById(String id) {
|
||||||
removeById(id);
|
removeById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除
|
* 批量删除
|
||||||
*
|
*
|
||||||
* @param ids
|
* @param ids
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deleteByIds(List<String> ids) {
|
public void deleteByIds(List<String> ids) {
|
||||||
removeByIds(ids);
|
removeByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id查询
|
* 通过id查询
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public OtaBaSjSjxtbh queryById(String id) {
|
public OtaBaSjSjxtbh queryById(String id) {
|
||||||
return getById(id);
|
return getById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表查询
|
* 列表查询
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<OtaBaSjSjxtbh> queryList() {
|
public List<OtaBaSjSjxtbh> queryList() {
|
||||||
return list();
|
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