开发OTA备案工具-车辆升级
This commit is contained in:
+1
-1
@@ -87,7 +87,7 @@ public class OtaBaCxListController extends JeroController<OtaBaCxList, IOtaBaCxL
|
|||||||
queryWrapper.like(OtaBaCxList::getCpmc, cpmc);
|
queryWrapper.like(OtaBaCxList::getCpmc, cpmc);
|
||||||
}
|
}
|
||||||
|
|
||||||
String cpxh = req.getParameter("cpmc");
|
String cpxh = req.getParameter("cpxh");
|
||||||
if (StringUtils.isNotBlank(cpxh)) {
|
if (StringUtils.isNotBlank(cpxh)) {
|
||||||
cpxh = cpxh.replace("%", "\\%");
|
cpxh = cpxh.replace("%", "\\%");
|
||||||
queryWrapper.like(OtaBaCxList::getCpxh, cpxh);
|
queryWrapper.like(OtaBaCxList::getCpxh, cpxh);
|
||||||
|
|||||||
+9
@@ -4,6 +4,7 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.jero.common.api.vo.Result;
|
import com.jero.common.api.vo.Result;
|
||||||
import com.jero.common.system.query.QueryGenerator;
|
import com.jero.common.system.query.QueryGenerator;
|
||||||
import com.jero.modules.ota.entity.OtaBaSjGnxtwh;
|
import com.jero.modules.ota.entity.OtaBaSjGnxtwh;
|
||||||
@@ -82,7 +83,11 @@ public class OtaBaSjGnxtwhController extends JeroController<OtaBaSjGnxtwh, IOtaB
|
|||||||
@ApiOperation(value = "车型备案-功能系统维护-添加", notes = "车型备案-功能系统维护-添加")
|
@ApiOperation(value = "车型备案-功能系统维护-添加", notes = "车型备案-功能系统维护-添加")
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
public Result<?> add(@Validated @RequestBody OtaBaSjGnxtwh otaBaSjGnxtwh) {
|
public Result<?> add(@Validated @RequestBody OtaBaSjGnxtwh otaBaSjGnxtwh) {
|
||||||
|
try {
|
||||||
otaBaSjGnxtwhService.add(otaBaSjGnxtwh);
|
otaBaSjGnxtwhService.add(otaBaSjGnxtwh);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return Result.error(e.getMessage());
|
||||||
|
}
|
||||||
return Result.OK("添加成功!");
|
return Result.OK("添加成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +101,11 @@ public class OtaBaSjGnxtwhController extends JeroController<OtaBaSjGnxtwh, IOtaB
|
|||||||
@ApiOperation(value = "车型备案-功能系统维护-编辑", notes = "车型备案-功能系统维护-编辑")
|
@ApiOperation(value = "车型备案-功能系统维护-编辑", notes = "车型备案-功能系统维护-编辑")
|
||||||
@PutMapping(value = "/edit")
|
@PutMapping(value = "/edit")
|
||||||
public Result<?> edit(@Validated @RequestBody OtaBaSjGnxtwh otaBaSjGnxtwh) {
|
public Result<?> edit(@Validated @RequestBody OtaBaSjGnxtwh otaBaSjGnxtwh) {
|
||||||
|
try {
|
||||||
otaBaSjGnxtwhService.editById(otaBaSjGnxtwh);
|
otaBaSjGnxtwhService.editById(otaBaSjGnxtwh);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return Result.error(e.getMessage());
|
||||||
|
}
|
||||||
return Result.OK("编辑成功!");
|
return Result.OK("编辑成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -19,7 +19,7 @@ public interface IOtaBaSjGnxtwhService extends IService<OtaBaSjGnxtwh> {
|
|||||||
* @param otaBaSjGnxtwh
|
* @param otaBaSjGnxtwh
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void add(OtaBaSjGnxtwh otaBaSjGnxtwh);
|
void add(OtaBaSjGnxtwh otaBaSjGnxtwh) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新
|
* 更新
|
||||||
@@ -27,7 +27,7 @@ public interface IOtaBaSjGnxtwhService extends IService<OtaBaSjGnxtwh> {
|
|||||||
* @param otaBaSjGnxtwh
|
* @param otaBaSjGnxtwh
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void editById(OtaBaSjGnxtwh otaBaSjGnxtwh);
|
void editById(OtaBaSjGnxtwh otaBaSjGnxtwh) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id删除
|
* 通过id删除
|
||||||
|
|||||||
+57
-2
@@ -1,8 +1,10 @@
|
|||||||
package com.jero.modules.ota.service.impl;
|
package com.jero.modules.ota.service.impl;
|
||||||
|
|
||||||
|
import com.jero.common.exception.JeroBootException;
|
||||||
import com.jero.modules.ota.entity.OtaBaSjGnxtwh;
|
import com.jero.modules.ota.entity.OtaBaSjGnxtwh;
|
||||||
import com.jero.modules.ota.mapper.OtaBaSjGnxtwhMapper;
|
import com.jero.modules.ota.mapper.OtaBaSjGnxtwhMapper;
|
||||||
import com.jero.modules.ota.service.IOtaBaSjGnxtwhService;
|
import com.jero.modules.ota.service.IOtaBaSjGnxtwhService;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -26,10 +28,28 @@ public class OtaBaSjGnxtwhServiceImpl extends ServiceImpl<OtaBaSjGnxtwhMapper, O
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void add(OtaBaSjGnxtwh otaBaSjGnxtwh) {
|
public void add(OtaBaSjGnxtwh otaBaSjGnxtwh) throws Exception {
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
otaBaSjGnxtwh.setCreateTime(now);
|
otaBaSjGnxtwh.setCreateTime(now);
|
||||||
otaBaSjGnxtwh.setUpdateTime(now);
|
otaBaSjGnxtwh.setUpdateTime(now);
|
||||||
|
String str = otaBaSjGnxtwh.getDykzq();
|
||||||
|
if (StringUtils.isNotEmpty(str)) {
|
||||||
|
String[] arr = str.split(",");
|
||||||
|
for (int i = 0; i < arr.length - 1; i++) {
|
||||||
|
for (int j = i + 1; j < arr.length; j++) {
|
||||||
|
if (arr[i].equals(arr[j])) {
|
||||||
|
throw new JeroBootException("对应控制器重复:" + arr[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (String s : arr) {
|
||||||
|
if (null != queryGnxtByKzq(s)) {
|
||||||
|
throw new JeroBootException("对应控制器重复:" + s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new JeroBootException("对应控制器不能为空");
|
||||||
|
}
|
||||||
save(otaBaSjGnxtwh);
|
save(otaBaSjGnxtwh);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,9 +60,26 @@ public class OtaBaSjGnxtwhServiceImpl extends ServiceImpl<OtaBaSjGnxtwhMapper, O
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void editById(OtaBaSjGnxtwh otaBaSjGnxtwh) {
|
public void editById(OtaBaSjGnxtwh otaBaSjGnxtwh) throws Exception {
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
otaBaSjGnxtwh.setUpdateTime(now);
|
otaBaSjGnxtwh.setUpdateTime(now);
|
||||||
|
String str = otaBaSjGnxtwh.getDykzq();
|
||||||
|
if (StringUtils.isNotEmpty(str)) {
|
||||||
|
String[] arr = str.split(",");
|
||||||
|
for (int i = 0; i < arr.length - 1; i++) {
|
||||||
|
for (int j = i + 1; j < arr.length; j++) {
|
||||||
|
if (arr[i].equals(arr[j])) {
|
||||||
|
throw new JeroBootException("对应控制器重复:" + arr[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String res = queryGnxtByKzq(otaBaSjGnxtwh);
|
||||||
|
if (null != res) {
|
||||||
|
throw new JeroBootException("对应控制器重复:" + res);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new JeroBootException("对应控制器不能为空");
|
||||||
|
}
|
||||||
saveOrUpdate(otaBaSjGnxtwh);
|
saveOrUpdate(otaBaSjGnxtwh);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +116,24 @@ public class OtaBaSjGnxtwhServiceImpl extends ServiceImpl<OtaBaSjGnxtwhMapper, O
|
|||||||
return getById(id);
|
return getById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String queryGnxtByKzq(OtaBaSjGnxtwh kzq) {
|
||||||
|
List<OtaBaSjGnxtwh> list = list();
|
||||||
|
for (OtaBaSjGnxtwh wh : list) {
|
||||||
|
if (kzq.getId().equals(wh.getId())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String[] strs = wh.getDykzq().split(",");
|
||||||
|
String[] strs1 = kzq.getDykzq().split(",");
|
||||||
|
for (String str : strs) {
|
||||||
|
for (String str1 : strs1) {
|
||||||
|
if (str.equals(str1)) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String queryGnxtByKzq(String kzq) {
|
public String queryGnxtByKzq(String kzq) {
|
||||||
|
|||||||
Reference in New Issue
Block a user