开发OTA备案工具-车辆升级

This commit is contained in:
高嵩
2023-03-29 14:21:14 +08:00
parent 39440cf118
commit ef570e5ddd
8 changed files with 145 additions and 58 deletions
@@ -1,6 +1,7 @@
package com.jero.modules.ota.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -8,11 +9,13 @@ import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.extRepo.entity.ExtRepoData;
import com.jero.modules.ota.entity.OtaBaCxList;
import com.jero.modules.ota.service.IOtaBaCxListService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
@@ -57,9 +60,33 @@ public class OtaBaCxListController extends JeroController<OtaBaCxList, IOtaBaCxL
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<OtaBaCxList> queryWrapper = QueryGenerator.initQueryWrapper(otaBaCxList, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
Page<OtaBaCxList> page = new Page<OtaBaCxList>(pageNo, pageSize);
LambdaQueryWrapper<OtaBaCxList> queryWrapper = new LambdaQueryWrapper<>();
// 文件名称模糊查询
String cpdjbh = req.getParameter("cpdjbh");
if (StringUtils.isNotBlank(cpdjbh)) {
cpdjbh = cpdjbh.replace("%", "\\%");
queryWrapper.like(OtaBaCxList::getCpdjbh, cpdjbh);
}
String ggpc = req.getParameter("ggpc");
if (StringUtils.isNotBlank(ggpc)) {
ggpc = ggpc.replace("%", "\\%");
queryWrapper.like(OtaBaCxList::getGgpc, ggpc);
}
String cpsb = req.getParameter("cpsb");
if (StringUtils.isNotBlank(cpsb)) {
cpsb = cpsb.replace("%", "\\%");
queryWrapper.like(OtaBaCxList::getCpsb, cpsb);
}
String cpmc = req.getParameter("cpmc");
if (StringUtils.isNotBlank(cpmc)) {
cpmc = cpmc.replace("%", "\\%");
queryWrapper.like(OtaBaCxList::getCpmc, cpmc);
}
queryWrapper.orderByDesc(OtaBaCxList::getCreateTime);
IPage<OtaBaCxList> pageList = otaBaCxListService.page(page, queryWrapper);
return Result.OK(pageList);
}
@@ -1,5 +1,6 @@
package com.jero.modules.ota.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -176,11 +177,12 @@ public class OtaBaSjListController extends JeroController<OtaBaSjList, IOtaBaSjL
@AutoLog(value = "升级备案-备案维护")
@ApiOperation(value = "升级备案-备案维护", notes = "升级备案-备案维护")
@PostMapping(value = "/batchRecord")
public Result<?> batchRecord(@RequestParam(name = "ids", required = true) String ids,
@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) {
public Result<?> batchRecord(@RequestBody JSONObject json) {
String ids = json.getString("ids");
String bazt = json.getString("bazt");
String batjsj = json.getString("batjsj");
String bz = json.getString("bz");
String cut = json.getString("cut");
otaBaSjListService.batchRecord(ids, bazt, batjsj, bz, cut);
return Result.OK("备案维护成功!");
}
@@ -3,6 +3,7 @@ package com.jero.modules.ota.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -21,105 +22,146 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
/**
* @Description: 升级备案-升级活动备案列表
* @Author: jero-boot
* @Date: 2023-03-17
* @Date: 2023-03-17
* @Version: V1.0
*/
@Data
@TableName("ota_ba_sj_list")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="ota_ba_sj_list对象", description="升级备案-升级活动备案列表")
@ApiModel(value = "ota_ba_sj_list对象", description = "升级备案-升级活动备案列表")
public class OtaBaSjList implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**创建人*/
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
/**
* 创建日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
/**
* 更新人
*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
/**
* 更新日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
/**
* 所属部门
*/
@ApiModelProperty(value = "所属部门")
private java.lang.String sysOrgCode;
/**otaId*/
@Excel(name = "otaId", width = 15)
/**
* otaId
*/
@Excel(name = "otaId", width = 15)
@ApiModelProperty(value = "otaId")
private java.lang.String otaId;
/**产品登记编号*/
@Excel(name = "产品登记编号", width = 15)
/**
* 产品登记编号
*/
@Excel(name = "产品登记编号", width = 15)
@ApiModelProperty(value = "产品登记编号")
private java.lang.String cpdjbh;
/**公告批次*/
@Excel(name = "公告批次", width = 15)
/**
* 公告批次
*/
@Excel(name = "公告批次", width = 15)
@ApiModelProperty(value = "公告批次")
private java.lang.String ggpc;
/**产品商标*/
@Excel(name = "产品商标", width = 15)
/**
* 产品商标
*/
@Excel(name = "产品商标", width = 15)
@ApiModelProperty(value = "产品商标")
private java.lang.String cpsb;
/**产品名称*/
@Excel(name = "产品名称", width = 15)
/**
* 产品名称
*/
@Excel(name = "产品名称", width = 15)
@ApiModelProperty(value = "产品名称")
private java.lang.String cpmc;
/**产品型号*/
@Excel(name = "产品型号", width = 15)
/**
* 产品型号
*/
@Excel(name = "产品型号", width = 15)
@ApiModelProperty(value = "产品型号")
private java.lang.String cpxh;
/**备案状态*/
@Excel(name = "备案状态", width = 15)
/**
* 备案状态
*/
@Excel(name = "备案状态", width = 15)
@ApiModelProperty(value = "备案状态")
@Dict(dicCode = "recordstatus")
private java.lang.String bazt;
/**备案提交时间*/
@Excel(name = "备案提交时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
/**
* 备案提交时间
*/
@Excel(name = "备案提交时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "备案提交时间")
private java.util.Date batjsj;
/**创建时间*/
@Excel(name = "创建时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
/**
* 创建时间
*/
@Excel(name = "创建时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "创建时间")
private java.util.Date cjsj;
/**备注*/
@Excel(name = "备注", width = 15)
/**
* 备注
*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private java.lang.String bz;
/**升级驾驶附件*/
/**
* 升级驾驶附件
*/
@Excel(name = "升级驾驶附件", width = 15)
@ApiModelProperty(value = "升级驾驶附件")
private java.lang.String sjjsfj;
/**
* 升级状态(0:升级中;1:升级结束)
*/
@Excel(name = "升级状态", width = 15)
@ApiModelProperty(value = "升级状态")
private java.lang.String sjzt;
public void updateData(OtaBaSjSjmbcx otaBaSjSjmbcx) {
this.cpdjbh = otaBaSjSjmbcx.getBabh();
@@ -9,8 +9,8 @@ import com.jero.modules.ota.entity.OtaBaCxLsjl;
import com.jero.modules.ota.mapper.OtaBaCxListMapper;
import com.jero.modules.ota.service.*;
import com.jero.modules.ota.utils.ImportFileUtil;
import com.jero.modules.system.util.StringUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.logging.Log;
import org.apache.ibatis.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -2,19 +2,18 @@ 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.OtaBaSjJssj;
import com.jero.modules.ota.entity.OtaBaSjJssjyy;
import com.jero.modules.ota.entity.*;
import com.jero.modules.ota.mapper.OtaBaSjJssjMapper;
import com.jero.modules.ota.service.IOtaBaCxTxjlService;
import com.jero.modules.ota.service.IOtaBaSjJssjService;
import com.jero.modules.ota.service.IOtaBaSjJssjyyService;
import com.jero.modules.ota.service.IOtaBaSjListService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Date;
@@ -32,6 +31,8 @@ public class OtaBaSjJssjServiceImpl extends ServiceImpl<OtaBaSjJssjMapper, OtaBa
@Autowired
private IOtaBaSjJssjyyService otaBaSjJssjyyService;
@Autowired
private IOtaBaSjListService otaBaSjListService;
/**
* 保存
@@ -42,10 +43,23 @@ public class OtaBaSjJssjServiceImpl extends ServiceImpl<OtaBaSjJssjMapper, OtaBa
@Override
public void add(OtaBaSjJssj otaBaSjJssj) {
Date now = new Date();
otaBaSjJssj.setCreateTime(now);
if (StringUtils.isEmpty(otaBaSjJssj.getId())) {
otaBaSjJssj.setCreateTime(now);
OtaBaSjList otaBaSjList = otaBaSjListService.queryById(otaBaSjJssj.getOtaId());
otaBaSjList.setSjzt("1");
otaBaSjListService.editById(otaBaSjList);
}
otaBaSjJssj.setUpdateTime(now);
save(otaBaSjJssj);
otaBaSjJssjyyService.saveBatch(otaBaSjJssj.getList());
saveOrUpdate(otaBaSjJssj);
otaBaSjJssjyyService.deleteByOtaId(otaBaSjJssj.getOtaId());
if (ObjectUtils.isNotEmpty(otaBaSjJssj.getList())) {
List<OtaBaSjJssjyy> yyList = new ArrayList<>();
for (OtaBaSjJssjyy yy : otaBaSjJssj.getList()) {
yy.setOtaId(otaBaSjJssj.getOtaId());
yyList.add(yy);
}
otaBaSjJssjyyService.saveBatch(yyList);
}
}
/**
@@ -111,9 +125,10 @@ public class OtaBaSjJssjServiceImpl extends ServiceImpl<OtaBaSjJssjMapper, OtaBa
LambdaQueryWrapper<OtaBaSjJssj> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaSjJssj::getOtaId, otaId);
OtaBaSjJssj res = this.getOne(queryWrapper, false);
List<OtaBaSjJssjyy> list = otaBaSjJssjyyService.queryByOtaId(otaId);
res.setList(list);
if (ObjectUtils.isNotEmpty(res)) {
List<OtaBaSjJssjyy> list = otaBaSjJssjyyService.queryByOtaId(otaId);
res.setList(list);
}
return res;
}
@@ -78,6 +78,7 @@ public class OtaBaSjSjmbcxServiceImpl extends ServiceImpl<OtaBaSjSjmbcxMapper, O
otaBaSjList = new OtaBaSjList();
otaBaSjList.setId(UUID.randomUUID().toString().replace("-", ""));
otaBaSjList.updateData(otaBaSjSjmbcx);
otaBaSjList.setSjzt("0");
otaBaSjListService.add(otaBaSjList);
otaBaSjSjmbcx.setOtaId(otaBaSjList.getId());
otaBaSjSjmbcx.setCreateTime(now);
@@ -100,7 +100,7 @@ public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl<OtaBaSjSjxtbhMapper, O
oldList = new ArrayList<>();
}
ComparisonUtil cu = new ComparisonUtil();
List<OtaBaCxTxjl> reList = cu.comparisonListRecord(otaId, OtaModuleEnum.SJ_SJXTMCBH, OtaTitleEnum.SJKZQMC.getName(), oldList, newList, sysDictService);
List<OtaBaCxTxjl> reList = cu.comparisonListRecord(otaId, OtaModuleEnum.SJ_SJXTMCBH, OtaTitleEnum.XTMC.getName(), oldList, newList, sysDictService);
saveOrUpdateBatch(newList);
otaBaCxTxjlService.saveBatch(reList);
}
@@ -59,7 +59,7 @@ public class ComparisonUtil<T> {
tableField.setAccessible(true);
String tableFieldStr = "";
Object tableFieldObj = tableField.get(newObj);
if (ObjectUtils.isNotEmpty(tableFieldStr)) {
if (ObjectUtils.isNotEmpty(tableFieldObj)) {
tableFieldStr = tableFieldObj.toString();
}
String content = "新增了一条'" + tableFieldStr + "'";