开发OTA备案工具

This commit is contained in:
高嵩
2023-03-25 21:05:23 +08:00
parent 297144bf86
commit ba41f840e1
15 changed files with 153 additions and 22 deletions
@@ -156,11 +156,11 @@ public class OtaBaCxKsjjsmccsController extends JeroController<OtaBaCxKsjjsmccs,
@GetMapping(value = "/queryByOtaId")
public Result<?> queryByOtaId(@RequestParam(name = "otaId", required = true) String otaId,
@RequestParam(name = "otaIdT", required = true) String otaIdT) {
List<OtaBaCxKsjjsmccs> otaBaCxKsjjsmccsList = otaBaCxKsjjsmccsService.queryByOtaId(otaId, otaIdT);
if (otaBaCxKsjjsmccsList == null) {
JSONObject json = otaBaCxKsjjsmccsService.queryByOtaId(otaId, otaIdT);
if (json == null) {
return Result.error("未找到对应数据");
}
return Result.OK(otaBaCxKsjjsmccsList);
return Result.OK(json);
}
/**
@@ -156,11 +156,11 @@ public class OtaBaCxKsjxtmccsController extends JeroController<OtaBaCxKsjxtmccs,
@GetMapping(value = "/queryByOtaId")
public Result<?> queryByOtaId(@RequestParam(name = "otaId", required = true) String otaId,
@RequestParam(name = "otaIdT", required = true) String otaIdT) {
List<OtaBaCxKsjxtmccs> otaBaCxKsjxtmccsList = otaBaCxKsjxtmccsService.queryByOtaId(otaId, otaIdT);
if (otaBaCxKsjxtmccsList == null) {
JSONObject json = otaBaCxKsjxtmccsService.queryByOtaId(otaId, otaIdT);
if (json == null) {
return Result.error("未找到对应数据");
}
return Result.OK(otaBaCxKsjxtmccsList);
return Result.OK(json);
}
/**
@@ -0,0 +1,39 @@
package com.jero.modules.ota.entity;
public class AttachmentEO {
private String id;
private String fileName;
public AttachmentEO() {
}
public AttachmentEO(String id, String fileName) {
this.id = id;
this.fileName = fileName;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
@Override
public String toString() {
return "{" +
"id='" + id + '\'' +
", fileName='" + fileName + '\'' +
'}';
}
}
@@ -3,7 +3,10 @@ package com.jero.modules.ota.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@@ -91,4 +94,7 @@ public class OtaBaCxAqcs implements Serializable {
@ApiModelProperty(value = "证明材料")
private java.lang.String zmcl;
@TableField(exist = false)
private List<AttachmentEO> zmclList;
}
@@ -116,7 +116,17 @@ public class OtaBaCxList implements Serializable {
@ApiModelProperty(value = "备注")
private java.lang.String bz;
public void upadteData(OtaBaCxJbxx otaBaCxJbxx){
/**在线升级系统附件*/
@Excel(name = "在线升级系统附件", width = 15)
@ApiModelProperty(value = "在线升级系统附件")
private java.lang.String zxsjxtfj;
/**在线升级驾驶附件*/
@Excel(name = "在线升级驾驶附件", width = 15)
@ApiModelProperty(value = "在线升级驾驶附件")
private java.lang.String zxsjjsfj;
public void updateData(OtaBaCxJbxx otaBaCxJbxx){
this.cpdjbh = otaBaCxJbxx.getDjbh();
this.ggpc = otaBaCxJbxx.getGgpc();
this.cpsb = otaBaCxJbxx.getCpsb();
@@ -3,7 +3,10 @@ package com.jero.modules.ota.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@@ -121,4 +124,7 @@ public class OtaBaCxZxsjyq implements Serializable {
@ApiModelProperty(value = "证明材料")
private java.lang.String zmcl;
@TableField(exist = false)
private List<AttachmentEO> zmclList;
}
@@ -18,5 +18,7 @@
<result column="batjsj" property="batjsj" />
<result column="cjsj" property="cjsj" />
<result column="bz" property="bz" />
<result column="zxsjxtfj" property="zxsjxtfj" />
<result column="zxsjjsfj" property="zxsjjsfj" />
</resultMap>
</mapper>
@@ -60,5 +60,5 @@ public interface IOtaBaCxKsjjsmccsService extends IService<OtaBaCxKsjjsmccs> {
*/
List<OtaBaCxKsjjsmccs> queryList();
List<OtaBaCxKsjjsmccs> queryByOtaId(String otaId, String otaIdT);
JSONObject queryByOtaId(String otaId, String otaIdT);
}
@@ -60,5 +60,5 @@ public interface IOtaBaCxKsjxtmccsService extends IService<OtaBaCxKsjxtmccs> {
*/
List<OtaBaCxKsjxtmccs> queryList();
List<OtaBaCxKsjxtmccs> queryByOtaId(String otaId, String otaIdT);
JSONObject queryByOtaId(String otaId, String otaIdT);
}
@@ -58,14 +58,11 @@ public interface IOtaBaCxListService extends IService<OtaBaCxList> {
/**
* 列表查询
*
* @return
*/
List<OtaBaCxList> queryList();
/**
* 备案维护
*
*/
void batchRecord(String ids, String bazt, String batjsj, String bz, String cut);
@@ -74,4 +71,5 @@ public interface IOtaBaCxListService extends IService<OtaBaCxList> {
void importData(MultipartFile file, String cut);
void exportData(String otaId, HttpServletResponse response, HttpServletRequest request);
}
@@ -1,11 +1,14 @@
package com.jero.modules.ota.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.modules.ota.entity.AttachmentEO;
import com.jero.modules.ota.entity.OtaBaCxAqcs;
import com.jero.modules.ota.entity.OtaBaCxJbxx;
import com.jero.modules.ota.mapper.OtaBaCxAqcsMapper;
import com.jero.modules.ota.service.IOtaBaCxAqcsService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -39,6 +42,13 @@ public class OtaBaCxAqcsServiceImpl extends ServiceImpl<OtaBaCxAqcsMapper, OtaBa
otaBaCxAqcs.setCreateTime(now);
}
otaBaCxAqcs.setUpdateTime(now);
if (null != otaBaCxAqcs.getZmclList() && otaBaCxAqcs.getZmclList().size() > 0) {
JSONArray obj = new JSONArray();
for (AttachmentEO aeo : otaBaCxAqcs.getZmclList()) {
obj.add(aeo);
}
otaBaCxAqcs.setZmcl(obj.toString());
}
saveOrUpdate(otaBaCxAqcs);
}
}
@@ -105,6 +115,10 @@ public class OtaBaCxAqcsServiceImpl extends ServiceImpl<OtaBaCxAqcsMapper, OtaBa
if (ObjectUtils.isEmpty(res)) {
res = getByOtaId(otaIdT);
}
if (ObjectUtils.isNotEmpty(res) && StringUtils.isNotEmpty(res.getZmcl())) {
List<AttachmentEO> aeoList = JSONArray.parseArray(res.getZmcl(), AttachmentEO.class);
res.setZmclList(aeoList);
}
return res;
}
@@ -40,13 +40,13 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
//在保存的时候设置一个id 并返回前端 下次保存的时候判断是否为更新
otaBaCxList = new OtaBaCxList();
otaBaCxList.setId(UUID.randomUUID().toString().replace("-", ""));
otaBaCxList.upadteData(otaBaCxJbxx);
otaBaCxList.updateData(otaBaCxJbxx);
otaBaCxListService.add(otaBaCxList);
otaBaCxJbxx.setOtaId(otaBaCxList.getId());
otaBaCxJbxx.setCreateTime(now);
}else{
otaBaCxList = otaBaCxListService.queryById(otaBaCxJbxx.getOtaId());
otaBaCxList.upadteData(otaBaCxJbxx);
otaBaCxList.updateData(otaBaCxJbxx);
otaBaCxListService.editById(otaBaCxList);
}
otaBaCxJbxx.setUpdateTime(now);
@@ -4,13 +4,13 @@ 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.OtaBaCxJsfzbacs;
import com.jero.modules.ota.entity.OtaBaCxKsjjsmccs;
import com.jero.modules.ota.entity.OtaBaCxKsjxtmccs;
import com.jero.modules.ota.entity.OtaBaCxSjmk;
import com.jero.modules.ota.entity.*;
import com.jero.modules.ota.mapper.OtaBaCxKsjjsmccsMapper;
import com.jero.modules.ota.service.IOtaBaCxKsjjsmccsService;
import com.jero.modules.ota.service.IOtaBaCxListService;
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.lang.reflect.Field;
@@ -18,6 +18,7 @@ import java.util.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 车型备案-可在线升级的驾驶辅助功能名称与参数
* @Author: jero-boot
@@ -27,6 +28,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
public class OtaBaCxKsjjsmccsServiceImpl extends ServiceImpl<OtaBaCxKsjjsmccsMapper, OtaBaCxKsjjsmccs> implements IOtaBaCxKsjjsmccsService {
@Autowired
private IOtaBaCxListService otaBaCxListService;
/**
* 保存
*
@@ -59,6 +63,14 @@ public class OtaBaCxKsjjsmccsServiceImpl extends ServiceImpl<OtaBaCxKsjjsmccsMap
otaBaCxJsfzbacs.setUpdateTime(now);
save(otaBaCxJsfzbacs);
}
String fj = (String) json.get("fj");
if (StringUtils.isNotEmpty(fj)) {
OtaBaCxList otaBaCxList = otaBaCxListService.queryById(otaId);
if (ObjectUtils.isNotEmpty(otaBaCxList)) {
otaBaCxList.setZxsjjsfj(fj);
otaBaCxListService.editById(otaBaCxList);
}
}
}
}
@@ -119,12 +131,18 @@ public class OtaBaCxKsjjsmccsServiceImpl extends ServiceImpl<OtaBaCxKsjjsmccsMap
}
@Override
public List<OtaBaCxKsjjsmccs> queryByOtaId(String otaId, String otaIdT) {
public JSONObject queryByOtaId(String otaId, String otaIdT) {
List<OtaBaCxKsjjsmccs> res = this.getByOtaId(otaId);
if (ObjectUtil.isEmpty(res)) {
res = getByOtaId(otaIdT);
}
return res;
JSONObject json = new JSONObject();
json.put("list", res);
OtaBaCxList otaBaCxList = otaBaCxListService.queryById(otaId);
if (ObjectUtils.isNotEmpty(otaBaCxList) && ObjectUtils.isNotEmpty(otaBaCxList.getZxsjjsfj())) {
json.put("fj", otaBaCxList.getZxsjjsfj());
}
return json;
}
private List<OtaBaCxKsjjsmccs> getByOtaId(String otaId) {
@@ -7,9 +7,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.modules.ota.entity.OtaBaCxJbxx;
import com.jero.modules.ota.entity.OtaBaCxKsjjsmccs;
import com.jero.modules.ota.entity.OtaBaCxKsjxtmccs;
import com.jero.modules.ota.entity.OtaBaCxList;
import com.jero.modules.ota.mapper.OtaBaCxKsjxtmccsMapper;
import com.jero.modules.ota.service.IOtaBaCxKsjxtmccsService;
import com.jero.modules.ota.service.IOtaBaCxListService;
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.lang.reflect.Field;
@@ -26,6 +30,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMapper, OtaBaCxKsjxtmccs> implements IOtaBaCxKsjxtmccsService {
@Autowired
private IOtaBaCxListService otaBaCxListService;
/**
* 保存
*
@@ -58,7 +65,17 @@ public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMap
otaBaCxKsjxtmccs.setUpdateTime(now);
save(otaBaCxKsjxtmccs);
}
String fj = (String) json.get("fj");
if (StringUtils.isNotEmpty(fj)) {
OtaBaCxList otaBaCxList = otaBaCxListService.queryById(otaId);
if (ObjectUtils.isNotEmpty(otaBaCxList)) {
otaBaCxList.setZxsjxtfj(fj);
otaBaCxListService.editById(otaBaCxList);
}
}
}
}
/**
@@ -118,12 +135,18 @@ public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMap
}
@Override
public List<OtaBaCxKsjxtmccs> queryByOtaId(String otaId, String otaIdT) {
public JSONObject queryByOtaId(String otaId, String otaIdT) {
List<OtaBaCxKsjxtmccs> res = getByOtaId(otaId);
if (ObjectUtil.isEmpty(res)) {
res = getByOtaId(otaIdT);
}
return res;
JSONObject json = new JSONObject();
json.put("list", res);
OtaBaCxList otaBaCxList = otaBaCxListService.queryById(otaId);
if (ObjectUtils.isNotEmpty(otaBaCxList) && ObjectUtils.isNotEmpty(otaBaCxList.getZxsjxtfj())) {
json.put("fj", otaBaCxList.getZxsjxtfj());
}
return json;
}
private List<OtaBaCxKsjxtmccs> getByOtaId(String otaId) {
@@ -1,11 +1,15 @@
package com.jero.modules.ota.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.modules.ota.entity.AttachmentEO;
import com.jero.modules.ota.entity.OtaBaCxJbxx;
import com.jero.modules.ota.entity.OtaBaCxZxsjyq;
import com.jero.modules.ota.mapper.OtaBaCxZxsjyqMapper;
import com.jero.modules.ota.service.IOtaBaCxZxsjyqService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -40,6 +44,13 @@ public class OtaBaCxZxsjyqServiceImpl extends ServiceImpl<OtaBaCxZxsjyqMapper, O
}
}
otaBaCxZxsjyq.setUpdateTime(now);
if (null != otaBaCxZxsjyq.getZmclList() && otaBaCxZxsjyq.getZmclList().size() > 0) {
JSONArray obj = new JSONArray();
for (AttachmentEO aeo : otaBaCxZxsjyq.getZmclList()) {
obj.add(aeo);
}
otaBaCxZxsjyq.setZmcl(obj.toString());
}
saveOrUpdate(otaBaCxZxsjyq);
}
@@ -106,6 +117,10 @@ public class OtaBaCxZxsjyqServiceImpl extends ServiceImpl<OtaBaCxZxsjyqMapper, O
if (ObjectUtils.isEmpty(res)) {
res = getByOtaId(otaIdT);
}
if (ObjectUtils.isNotEmpty(res) && StringUtils.isNotEmpty(res.getZmcl())) {
List<AttachmentEO> aeoList = JSONArray.parseArray(res.getZmcl(), AttachmentEO.class);
res.setZmclList(aeoList);
}
return res;
}