工服调整20260126
1、创建订单时的区域的先隐藏,先默认为空; 2、所有的类别属性移除; 3、设备配置调整,部件不再绑定机型,改为绑定产品线; 4、修改解决方案添加组件字段
This commit is contained in:
parent
9ea1e02e60
commit
a27906a75f
|
|
@ -0,0 +1,20 @@
|
|||
package com.nflg.mobilebroken.common.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.ttzero.excel.annotation.ExcelColumn;
|
||||
|
||||
@Data
|
||||
public class GongFuDeviceComponentExportDTO extends GongFuDeviceComponentImportDTO{
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@ExcelColumn(value = "创建人",colIndex = 2)
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ExcelColumn(value = "创建时间",colIndex = 3)
|
||||
private String createTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.nflg.mobilebroken.common.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.ttzero.excel.annotation.ExcelColumn;
|
||||
|
||||
@Data
|
||||
public class GongFuDeviceComponentImportDTO {
|
||||
|
||||
/**
|
||||
* 产品线
|
||||
*/
|
||||
@ExcelColumn("产品线")
|
||||
private String productLine;
|
||||
|
||||
/**
|
||||
* 机型部件
|
||||
*/
|
||||
@ExcelColumn("部件名称")
|
||||
private String modelPartName;
|
||||
}
|
||||
|
|
@ -38,6 +38,11 @@ public class SolutionMeasuresSaveRequest {
|
|||
*/
|
||||
private List<Integer> imageIds;
|
||||
|
||||
/**
|
||||
* 问题部件id
|
||||
*/
|
||||
private Long componentId;
|
||||
|
||||
/**
|
||||
* 解决措施
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public class TicketAddRequest {
|
|||
private String handlerUserName;
|
||||
|
||||
/**
|
||||
* 工单区域id,工服工单必填
|
||||
* 工单区域id
|
||||
*/
|
||||
private Long areaId;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,26 +2,26 @@ package com.nflg.mobilebroken.gongfu.controller;
|
|||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.nflg.mobilebroken.common.constant.STATE;
|
||||
import com.nflg.mobilebroken.common.exception.NflgException;
|
||||
import com.nflg.mobilebroken.common.pojo.ApiResult;
|
||||
import com.nflg.mobilebroken.common.pojo.PageData;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.DevComponentExcel;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.DevComponentImportExcel;
|
||||
import com.nflg.mobilebroken.common.pojo.query.DeviceComponentQuery;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DeviceComponent1VO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DeviceComponentVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DeviceTypeVO;
|
||||
import com.nflg.mobilebroken.common.util.AdminUserUtil;
|
||||
import com.nflg.mobilebroken.common.util.EecExcelUtil;
|
||||
import com.nflg.mobilebroken.common.util.VUtils;
|
||||
import com.nflg.mobilebroken.gongfu.annotation.ApiMark;
|
||||
import com.nflg.mobilebroken.gongfu.pojo.dto.DeviceComponentDTO;
|
||||
import com.nflg.mobilebroken.gongfu.pojo.dto.DeviceComponentDetailDTO;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.GongFuDeviceComponentExportDTO;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.GongFuDeviceComponentImportDTO;
|
||||
import com.nflg.mobilebroken.gongfu.pojo.query.GongFuDeviceComponentQuery;
|
||||
import com.nflg.mobilebroken.gongfu.pojo.vo.GongFuDeviceTypeVO;
|
||||
import com.nflg.mobilebroken.repository.entity.GongfuDeviceComponent;
|
||||
import com.nflg.mobilebroken.repository.entity.GongfuDeviceComponentDetail;
|
||||
import com.nflg.mobilebroken.repository.entity.GongfuDevicePart;
|
||||
|
|
@ -29,6 +29,7 @@ import com.nflg.mobilebroken.repository.service.IGongfuDeviceComponentDetailServ
|
|||
import com.nflg.mobilebroken.repository.service.IGongfuDeviceComponentService;
|
||||
import com.nflg.mobilebroken.repository.service.IGongfuDevicePartService;
|
||||
import com.nflg.mobilebroken.starter.annotation.MethodInfoMark;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
|
@ -41,12 +42,12 @@ import javax.validation.Valid;
|
|||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 机型部件管理
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/deviceComponent")
|
||||
public class DeviceComponentController extends ControllerBase {
|
||||
|
|
@ -67,32 +68,66 @@ public class DeviceComponentController extends ControllerBase {
|
|||
*/
|
||||
@PostMapping("getList")
|
||||
@ApiMark(moduleName = "机型部件管理", apiName = "获取设备机型列表")
|
||||
public ApiResult<PageData<DeviceTypeVO>> getList(@RequestBody DeviceComponentQuery query) {
|
||||
List<DeviceComponent1VO> deviceComponents = deviceComponentService.getWithDeviceType(query.getModelNo(), query.getComponentSort());
|
||||
Map<String, List<DeviceComponent1VO>> mps = deviceComponents.stream().collect(Collectors.groupingBy(DeviceComponent1VO::getDeviceType));
|
||||
AtomicInteger index = new AtomicInteger();
|
||||
int first = (query.getPage() - 1) * query.getPageSize();
|
||||
int last = query.getPage() * query.getPageSize();
|
||||
PageData<DeviceTypeVO> pageData = new PageData<>();
|
||||
List<DeviceTypeVO> items = new ArrayList<>();
|
||||
mps.forEach((k, v) -> {
|
||||
if (index.get() >= first && index.get() < last) {
|
||||
DeviceTypeVO vo = new DeviceTypeVO();
|
||||
vo.setDeviceType(k);
|
||||
vo.setItems(v.stream().map(d -> new DeviceComponentVO()
|
||||
.setId(d.getId())
|
||||
.setModelNo(d.getModelNo())
|
||||
.setPartList(deviceComponentDetailService.getByModelNo(d.getModelNo()))).collect(Collectors.toList())
|
||||
);
|
||||
items.add(vo);
|
||||
}
|
||||
index.getAndIncrement();
|
||||
public ApiResult<PageData<GongFuDeviceTypeVO>> getList(@RequestBody GongFuDeviceComponentQuery query) {
|
||||
// List<DeviceComponent1VO> deviceComponents = deviceComponentService.getByProductLine(query.getProductLine(), query.getComponentSort());
|
||||
// Map<String, List<DeviceComponent1VO>> mps = deviceComponents.stream().collect(Collectors.groupingBy(DeviceComponent1VO::getDeviceType));
|
||||
// AtomicInteger index = new AtomicInteger();
|
||||
// int first = (query.getPage() - 1) * query.getPageSize();
|
||||
// int last = query.getPage() * query.getPageSize();
|
||||
// PageData<DeviceTypeVO> pageData = new PageData<>();
|
||||
// List<DeviceTypeVO> items = new ArrayList<>();
|
||||
// mps.forEach((k, v) -> {
|
||||
// if (index.get() >= first && index.get() < last) {
|
||||
// DeviceTypeVO vo = new DeviceTypeVO();
|
||||
// vo.setDeviceType(k);
|
||||
// vo.setItems(v.stream().map(d -> new DeviceComponentVO()
|
||||
// .setId(d.getId())
|
||||
// .setModelNo(d.getModelNo())
|
||||
// .setPartList(deviceComponentDetailService.getByModelNo(d.getModelNo()))).collect(Collectors.toList())
|
||||
// );
|
||||
// items.add(vo);
|
||||
// }
|
||||
// index.getAndIncrement();
|
||||
// });
|
||||
// pageData.setItems(items);
|
||||
// pageData.setPage(query.getPage());
|
||||
// pageData.setPageSize(query.getPageSize());
|
||||
// pageData.setTotal(mps.size());
|
||||
// return ApiResult.success(pageData);
|
||||
List<GongfuDeviceComponent> productLines = deviceComponentService.lambdaQuery()
|
||||
.select(GongfuDeviceComponent::getId, GongfuDeviceComponent::getProductLine)
|
||||
.eq(GongfuDeviceComponent::getEnable, true)
|
||||
.like(StrUtil.isNotBlank(query.getProductLine()), GongfuDeviceComponent::getProductLine, query.getProductLine())
|
||||
.list();
|
||||
List<GongfuDeviceComponentDetail> details = deviceComponentDetailService.list();
|
||||
details.forEach(d -> d.setId(d.getDeviceComponentId()));
|
||||
List<GongFuDeviceTypeVO> datas = new ArrayList<>();
|
||||
productLines.forEach(p -> {
|
||||
GongFuDeviceTypeVO vo = datas.stream()
|
||||
.filter(d -> StrUtil.equals(p.getProductLine(), d.getProductLine()))
|
||||
.findFirst()
|
||||
.orElseGet(() -> {
|
||||
GongFuDeviceTypeVO v = new GongFuDeviceTypeVO()
|
||||
.setProductLine(p.getProductLine());
|
||||
datas.add(v);
|
||||
return v;
|
||||
});
|
||||
vo.getItems().addAll(
|
||||
details.stream()
|
||||
.filter(d -> Objects.equals(d.getDeviceComponentId(), p.getId()))
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
});
|
||||
pageData.setItems(items);
|
||||
pageData.setPage(query.getPage());
|
||||
pageData.setPageSize(query.getPageSize());
|
||||
pageData.setTotal(mps.size());
|
||||
return ApiResult.success(pageData);
|
||||
if (query.getComponentSort()) {
|
||||
datas.sort(Comparator.comparing(GongFuDeviceTypeVO::getSort).reversed());
|
||||
} else {
|
||||
datas.sort(Comparator.comparing(GongFuDeviceTypeVO::getSort));
|
||||
}
|
||||
List<GongFuDeviceTypeVO> pageData = datas.stream()
|
||||
.skip((long) (query.getPage() - 1) * query.getPageSize())
|
||||
.limit(query.getPageSize())
|
||||
.collect(Collectors.toList());
|
||||
return ApiResult.success(pageData, query, datas.size());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -181,10 +216,9 @@ public class DeviceComponentController extends ControllerBase {
|
|||
// @MethodInfoMark(value = "导入模板下载",menuName = "设备管理")
|
||||
public void downTemplate(HttpServletResponse response) throws IOException {
|
||||
EecExcelUtil.setResponseExcelHeader(response, "机型部件导入模板");
|
||||
|
||||
final ListSheet<DevComponentImportExcel> listSheet = new ListSheet<DevComponentImportExcel>() {
|
||||
final ListSheet<GongFuDeviceComponentImportDTO> listSheet = new ListSheet<>() {
|
||||
@Override
|
||||
protected List<DevComponentImportExcel> more() {
|
||||
protected List<GongFuDeviceComponentImportDTO> more() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
|
@ -196,13 +230,14 @@ public class DeviceComponentController extends ControllerBase {
|
|||
* 检查重复行
|
||||
* @param list
|
||||
*/
|
||||
private List<String> checkDuplicates(List<DevComponentExcel> list) {
|
||||
private List<String> checkDuplicates(List<GongFuDeviceComponentImportDTO> list) {
|
||||
List<String> checkResult = new ArrayList<>();
|
||||
list.stream()
|
||||
.collect(Collectors.groupingBy(d -> d.getModelNo() + "-" + d.getModelPartName()))
|
||||
.entrySet().stream()
|
||||
.collect(Collectors.groupingBy(d -> d.getProductLine() + "-" + d.getModelPartName()))
|
||||
.entrySet()
|
||||
.stream()
|
||||
.filter(e -> e.getValue().size() > 1)
|
||||
.forEach(e -> checkResult.add(e.getKey() + " -> " + e.getValue()));
|
||||
.forEach(e -> checkResult.add(e.getKey().replace("-","->")));
|
||||
return checkResult;
|
||||
}
|
||||
|
||||
|
|
@ -211,61 +246,80 @@ public class DeviceComponentController extends ControllerBase {
|
|||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
@PostMapping("importData")
|
||||
public ApiResult<Boolean> importData(@RequestParam(value = "file") MultipartFile file) {
|
||||
|
||||
try {
|
||||
List<DevComponentExcel> data = EecExcelUtil.getExcelContext(file.getInputStream(), DevComponentExcel.class);
|
||||
List<GongFuDeviceComponentImportDTO> data = EecExcelUtil.getExcelContext(file.getInputStream(), GongFuDeviceComponentImportDTO.class);
|
||||
VUtils.trueThrowBusinessError(CollUtil.isEmpty(data)).throwMessage("导入文件内容为空");
|
||||
//检查内容是否重复
|
||||
List<String> checkResult = checkDuplicates(data);
|
||||
VUtils.trueThrow(CollUtil.isNotEmpty(checkResult)).throwMessage(STATE.PageError, StrUtil.join(",", checkResult) + "内容重复,请检查导入的数据");
|
||||
|
||||
Set<String> modeNos = data.stream().map(DevComponentExcel::getModelNo).collect(Collectors.toSet());
|
||||
List<GongfuDeviceComponent> extstsModes = deviceComponentService.lambdaQuery().in(GongfuDeviceComponent::getModelNo, modeNos).list();
|
||||
Set<String> extstsModesSet = extstsModes.stream().map(GongfuDeviceComponent::getModelNo).collect(Collectors.toSet());
|
||||
Set<String> difference = Sets.difference(modeNos, extstsModesSet);
|
||||
VUtils.trueThrow(CollUtil.isNotEmpty(difference)).throwMessage(STATE.ParamErr, StrUtil.join(",", difference) + " 设备机型不存");
|
||||
VUtils.trueThrow(CollUtil.isNotEmpty(checkResult)).throwMessage(STATE.PageError, "以下内容重复:"+StrUtil.join(",", checkResult));
|
||||
//检查部件是否存在
|
||||
Set<String> partNames = data.stream().map(DevComponentExcel::getModelPartName).collect(Collectors.toSet());
|
||||
Set<String> partNames = data.stream().map(GongFuDeviceComponentImportDTO::getModelPartName).collect(Collectors.toSet());
|
||||
List<GongfuDevicePart> exitsParts = basePartService.lambdaQuery().in(GongfuDevicePart::getPartName, partNames).list();
|
||||
Set<String> exitsPartSet = exitsParts.stream().map(GongfuDevicePart::getPartName).collect(Collectors.toSet());
|
||||
Set<String> diffParts = Sets.difference(partNames, exitsPartSet);
|
||||
VUtils.trueThrow(CollUtil.isNotEmpty(diffParts)).throwMessage(STATE.ParamErr, StrUtil.join(",", diffParts) + " 部件名称不存在,请在部件管理中维护");
|
||||
|
||||
Map<String, List<DevComponentExcel>> dataMap = data.stream().collect(Collectors.groupingBy(DevComponentExcel::getModelNo));
|
||||
Map<String, GongfuDeviceComponent> extstsModeMap = extstsModes.stream().collect(Collectors.toMap(GongfuDeviceComponent::getModelNo, u -> u));
|
||||
Map<String, List<GongFuDeviceComponentImportDTO>> dataMap = data.stream().collect(Collectors.groupingBy(GongFuDeviceComponentImportDTO::getProductLine));
|
||||
List<GongfuDeviceComponent> exitsComponent = deviceComponentService.list();
|
||||
Map<String, GongfuDeviceComponent> extstsModeMap = exitsComponent.stream().collect(Collectors.toMap(GongfuDeviceComponent::getProductLine, u -> u));
|
||||
Map<String, GongfuDevicePart> exitsPartMap = exitsParts.stream().collect(Collectors.toMap(GongfuDevicePart::getPartName, u -> u));
|
||||
|
||||
List<GongfuDeviceComponentDetail> result = new ArrayList<>();
|
||||
List<GongfuDeviceComponent> deviceComponentResult = new ArrayList<>();
|
||||
List<GongfuDeviceComponentDetail> details = new ArrayList<>();
|
||||
List<GongfuDeviceComponent> componentsForAdd = new ArrayList<>();
|
||||
List<GongfuDeviceComponent> componentsForUpdate = new ArrayList<>();
|
||||
for (String key : dataMap.keySet()) {
|
||||
List<DevComponentExcel> componments = dataMap.get(key);
|
||||
GongfuDeviceComponent dev = new GongfuDeviceComponent();
|
||||
dev.setId(extstsModeMap.get(key).getId());
|
||||
dev.setComponent(StrUtil.join(",", componments.stream().map(DevComponentExcel::getModelPartName).collect(Collectors.toSet())));
|
||||
deviceComponentResult.add(dev);
|
||||
//删除现有部件
|
||||
deviceComponentDetailService.removeByMap(ImmutableMap.of("device_component_id", dev.getId()));
|
||||
for (DevComponentExcel componment : componments) {
|
||||
GongfuDeviceComponentDetail ent = new GongfuDeviceComponentDetail();
|
||||
ent.setDeviceComponentId(extstsModeMap.get(key).getId());
|
||||
ent.setModelPartId(exitsPartMap.get(componment.getModelPartName()).getId());
|
||||
ent.setModelPartName(componment.getModelPartName());
|
||||
ent.setCreateBy(AdminUserUtil.getUserName());
|
||||
ent.setCreateTime(LocalDateTime.now());
|
||||
result.add(ent);
|
||||
Set<String> components = dataMap.get(key).stream()
|
||||
.map(GongFuDeviceComponentImportDTO::getModelPartName)
|
||||
.collect(Collectors.toSet());
|
||||
if (extstsModeMap.containsKey(key)) {
|
||||
StrUtil.split(extstsModeMap.get(key).getComponent(), ",").forEach(components::remove);
|
||||
if (CollectionUtil.isNotEmpty(components)) {
|
||||
GongfuDeviceComponent dev = extstsModeMap.get(key);
|
||||
dev.setComponent(dev.getComponent() + "," + StrUtil.join(",", components));
|
||||
dev.setUpdateBy(AdminUserUtil.getUserName());
|
||||
dev.setUpdateTime(LocalDateTime.now());
|
||||
componentsForUpdate.add(dev);
|
||||
for (String component : components) {
|
||||
GongfuDeviceComponentDetail ent = new GongfuDeviceComponentDetail();
|
||||
ent.setDeviceComponentId(extstsModeMap.get(key).getId());
|
||||
ent.setModelPartId(exitsPartMap.get(component).getId());
|
||||
ent.setModelPartName(component);
|
||||
ent.setCreateBy(AdminUserUtil.getUserName());
|
||||
ent.setCreateTime(LocalDateTime.now());
|
||||
details.add(ent);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
GongfuDeviceComponent dev = new GongfuDeviceComponent();
|
||||
dev.setId(IdUtil.getSnowflakeNextId());
|
||||
dev.setProductLine(key);
|
||||
dev.setComponent(StrUtil.join(",", components));
|
||||
dev.setCreateBy(AdminUserUtil.getUserName());
|
||||
dev.setCreateTime(LocalDateTime.now());
|
||||
componentsForAdd.add(dev);
|
||||
for (String component : components) {
|
||||
GongfuDeviceComponentDetail ent = new GongfuDeviceComponentDetail();
|
||||
ent.setDeviceComponentId(dev.getId());
|
||||
ent.setModelPartId(exitsPartMap.get(component).getId());
|
||||
ent.setModelPartName(component);
|
||||
ent.setCreateBy(AdminUserUtil.getUserName());
|
||||
ent.setCreateTime(LocalDateTime.now());
|
||||
details.add(ent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (CollUtil.isNotEmpty(deviceComponentResult)) {
|
||||
deviceComponentService.saveOrUpdateBatch(deviceComponentResult);
|
||||
if (CollUtil.isNotEmpty(componentsForAdd)) {
|
||||
deviceComponentService.saveBatch(componentsForAdd);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
deviceComponentDetailService.saveOrUpdateBatch(result);
|
||||
if (CollUtil.isNotEmpty(componentsForUpdate)) {
|
||||
deviceComponentService.updateBatchById(componentsForUpdate);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(details)) {
|
||||
deviceComponentDetailService.saveOrUpdateBatch(details);
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new NflgException(STATE.BusinessError, "导入失败:" + e.getMessage());
|
||||
}
|
||||
|
|
@ -276,13 +330,12 @@ public class DeviceComponentController extends ControllerBase {
|
|||
/**
|
||||
* 导出部件
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
@GetMapping("exportData")
|
||||
@ApiMark(moduleName = "机型部件管理", apiName = "导出部件")
|
||||
public void exportData(HttpServletResponse response) throws IOException {
|
||||
public void exportData(HttpServletResponse response) {
|
||||
EecExcelUtil.setResponseExcelHeader(response, "机型部件管理");
|
||||
List<DevComponentExcel> list = deviceComponentService.getExportData();
|
||||
List<GongFuDeviceComponentExportDTO> list = deviceComponentService.getExportData();
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
throw new NflgException(STATE.BusinessError, "没有可导出的数据");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -456,9 +456,9 @@ public class DeviceController extends ControllerBase {
|
|||
ent.setDataModifyTime(LocalDateTime.now());
|
||||
deviceTypes.add(ent);
|
||||
}
|
||||
if (!deviceComponentService.lambdaQuery().eq(GongfuDeviceComponent::getModelNo, dto.getModelNo()).exists()) {
|
||||
if (!deviceComponentService.lambdaQuery().eq(GongfuDeviceComponent::getProductLine, dto.getProductLine()).exists()) {
|
||||
GongfuDeviceComponent ent = new GongfuDeviceComponent();
|
||||
ent.setModelNo(dto.getModelNo());
|
||||
ent.setProductLine(dto.getProductLine());
|
||||
ent.setComponent("");
|
||||
ent.setEnable(true);
|
||||
ent.setCreateBy(AdminUserUtil.getUserName());
|
||||
|
|
@ -714,9 +714,9 @@ public class DeviceController extends ControllerBase {
|
|||
ent.setDataModifyTime(LocalDateTime.now());
|
||||
deviceTypes.add(ent);
|
||||
}
|
||||
if (!deviceComponentService.lambdaQuery().eq(GongfuDeviceComponent::getModelNo, dto.getModelNo()).exists()) {
|
||||
if (!deviceComponentService.lambdaQuery().eq(GongfuDeviceComponent::getProductLine, dto.getProductLine()).exists()) {
|
||||
GongfuDeviceComponent ent = new GongfuDeviceComponent();
|
||||
ent.setModelNo(dto.getModelNo());
|
||||
ent.setProductLine(dto.getProductLine());
|
||||
ent.setComponent("");
|
||||
ent.setEnable(true);
|
||||
ent.setCreateBy(AdminUserUtil.getUserName());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package com.nflg.mobilebroken.gongfu.pojo.query;
|
||||
|
||||
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GongFuDeviceComponentQuery extends PageBaseQuery {
|
||||
|
||||
/**
|
||||
* 产品线
|
||||
*/
|
||||
private String productLine;
|
||||
|
||||
// private String component;
|
||||
|
||||
/**
|
||||
* 组件排序,true:有组件在前,false:无组件在前,null:按id倒序
|
||||
*/
|
||||
private Boolean componentSort=false;
|
||||
}
|
||||
|
|
@ -18,10 +18,10 @@ public class PartQuery extends PageBaseQuery {
|
|||
*/
|
||||
private String partName;
|
||||
|
||||
/**
|
||||
* 类别属性
|
||||
*/
|
||||
private String typeAttr;
|
||||
// /**
|
||||
// * 类别属性
|
||||
// */
|
||||
// private String typeAttr;
|
||||
|
||||
/**
|
||||
* 状态 0-禁用 1-启用
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
package com.nflg.mobilebroken.gongfu.pojo.vo;
|
||||
|
||||
import com.nflg.mobilebroken.repository.entity.GongfuDeviceComponentDetail;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class GongFuDeviceTypeVO {
|
||||
|
||||
/**
|
||||
* 产品线
|
||||
*/
|
||||
private String productLine;
|
||||
|
||||
/**
|
||||
* 部件列表
|
||||
*/
|
||||
private List<GongfuDeviceComponentDetail> items = new ArrayList<>();
|
||||
|
||||
private Integer sort;
|
||||
|
||||
public Integer getSort() {
|
||||
return items.size();
|
||||
}
|
||||
}
|
||||
|
|
@ -153,13 +153,13 @@ public class AdminBasePartService {
|
|||
List<GongfuDevicePartLanguageData> languageDataList = new ArrayList<>();
|
||||
for (Map<String, Object> mp : data) {
|
||||
String partName = mp.get("部件名称").toString();
|
||||
String typeAttr = mp.get("类别属性").toString();
|
||||
// String typeAttr = mp.get("类别属性").toString();
|
||||
GongfuDevicePart partEnt = partService.lambdaQuery().eq(GongfuDevicePart::getPartName, partName).one();
|
||||
if (partEnt == null) {
|
||||
partEnt = new GongfuDevicePart();
|
||||
partEnt.setPartNo(UniqueSequenceGenerator.generateCode(Constant1.PartCodePrefix));
|
||||
partEnt.setPartName(partName);
|
||||
partEnt.setTypeAttr(typeAttr);
|
||||
// partEnt.setTypeAttr(typeAttr);
|
||||
partEnt.setEnable(true);
|
||||
partEnt.setCreateBy(AdminUserUtil.getUserName());
|
||||
partEnt.setCreateTime(LocalDateTime.now());
|
||||
|
|
|
|||
|
|
@ -21,21 +21,20 @@ public class AdminDeviceComponentService {
|
|||
@Resource
|
||||
IGongfuDeviceComponentService deviceComponentService;
|
||||
|
||||
public void batchAddModelNo(List<String> modelNos) {
|
||||
public void batchAdd(List<String> productLines) {
|
||||
List<GongfuDeviceComponent> existDeviceTypes = deviceComponentService.lambdaQuery()
|
||||
.in(GongfuDeviceComponent::getModelNo, modelNos)
|
||||
.select(GongfuDeviceComponent::getModelNo).list();
|
||||
.in(GongfuDeviceComponent::getProductLine, productLines)
|
||||
.select(GongfuDeviceComponent::getProductLine).list();
|
||||
|
||||
Set<String> existDeviceModelSet = existDeviceTypes.stream().map(GongfuDeviceComponent::getModelNo).collect(Collectors.toSet());
|
||||
HashSet<String> addTypeSet = Sets.newHashSet(modelNos);
|
||||
Set<String> existDeviceModelSet = existDeviceTypes.stream().map(GongfuDeviceComponent::getProductLine).collect(Collectors.toSet());
|
||||
HashSet<String> addTypeSet = Sets.newHashSet(productLines);
|
||||
Sets.SetView<String> needAddModels = Sets.difference(addTypeSet, existDeviceModelSet);
|
||||
if (CollUtil.isNotEmpty(needAddModels)) {
|
||||
List<GongfuDeviceComponent> modelList = new ArrayList<>();
|
||||
for (String model : needAddModels) {
|
||||
for (String productLine : needAddModels) {
|
||||
GongfuDeviceComponent ent = new GongfuDeviceComponent();
|
||||
ent.setId(null);
|
||||
|
||||
ent.setModelNo(model);
|
||||
ent.setProductLine(productLine);
|
||||
ent.setEnable(Boolean.TRUE);
|
||||
ent.setCreateBy(AdminUserUtil.getUserName());
|
||||
ent.setCreateTime(LocalDateTime.now());
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public class AdminDeviceService {
|
|||
dataTypes.put(deviceDTO.getProductLine(), Set.of(deviceDTO.getModelNo()));
|
||||
adminDeviceTypeService.batchAddDeviceType(dataTypes);
|
||||
//将设备机型
|
||||
adminDeviceComponentService.batchAddModelNo(ImmutableList.of(deviceDTO.getModelNo()));
|
||||
adminDeviceComponentService.batchAdd(ImmutableList.of(deviceDTO.getProductLine()));
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
|
@ -83,7 +83,7 @@ public class AdminDeviceService {
|
|||
dataTypes.put(deviceDTO.getProductLine(), Set.of(deviceDTO.getModelNo()));
|
||||
adminDeviceTypeService.batchAddDeviceType(dataTypes);
|
||||
//将设备机型
|
||||
adminDeviceComponentService.batchAddModelNo(ImmutableList.of(deviceDTO.getModelNo()));
|
||||
adminDeviceComponentService.batchAdd(ImmutableList.of(deviceDTO.getProductLine()));
|
||||
}
|
||||
|
||||
// /**
|
||||
|
|
@ -230,8 +230,8 @@ public class AdminDeviceService {
|
|||
});
|
||||
adminDeviceTypeService.batchAddDeviceType(dataTypes);
|
||||
//将设备机型
|
||||
List<String> models = result.stream().map(GongfuDevice::getModelNo).collect(Collectors.toList());
|
||||
adminDeviceComponentService.batchAddModelNo(models);
|
||||
List<String> productLines = result.stream().map(GongfuDevice::getProductLine).collect(Collectors.toList());
|
||||
adminDeviceComponentService.batchAdd(productLines);
|
||||
deviceService.lambdaUpdate()
|
||||
.set(GongfuDevice::getDataValidState, false)
|
||||
.eq(GongfuDevice::getDataValidState, true)
|
||||
|
|
|
|||
|
|
@ -28,10 +28,15 @@ public class GongfuDeviceComponent implements Serializable {
|
|||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
// /**
|
||||
// * 设备机型
|
||||
// */
|
||||
// private String modelNo;
|
||||
|
||||
/**
|
||||
* 设备机型
|
||||
* 产品线
|
||||
*/
|
||||
private String modelNo;
|
||||
private String productLine;
|
||||
|
||||
/**
|
||||
* 机型部件
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@ public class GongfuDevicePart implements Serializable {
|
|||
*/
|
||||
private String partName;
|
||||
|
||||
/**
|
||||
* 类别属性
|
||||
*/
|
||||
private String typeAttr;
|
||||
// /**
|
||||
// * 类别属性
|
||||
// */
|
||||
// private String typeAttr;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.nflg.mobilebroken.repository.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.DevComponentExcel;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.GongFuDeviceComponentExportDTO;
|
||||
import com.nflg.mobilebroken.common.pojo.query.DeviceComponentQuery;
|
||||
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DeviceComponent1VO;
|
||||
|
|
@ -29,7 +30,7 @@ public interface GongfuDeviceComponentMapper extends BaseMapper<GongfuDeviceComp
|
|||
*/
|
||||
Page<DeviceComponentVO> selectListByPage(@Param("page") Page<PageBaseQuery> page, @Param("query") DeviceComponentQuery query);
|
||||
|
||||
List<DevComponentExcel> getExportData();
|
||||
List<GongFuDeviceComponentExportDTO> getExportData();
|
||||
|
||||
List<DeviceComponent1VO> getWithDeviceType(String modelNo, Boolean componentSort);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nflg.mobilebroken.repository.service;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.DevComponentExcel;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.GongFuDeviceComponentExportDTO;
|
||||
import com.nflg.mobilebroken.common.pojo.query.DeviceComponentQuery;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DeviceComponent1VO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DeviceComponentVO;
|
||||
|
|
@ -37,7 +38,7 @@ public interface IGongfuDeviceComponentService extends IService<GongfuDeviceComp
|
|||
|
||||
Boolean saveOrUpdateBatchComponent(List<GongfuDeviceComponent> data);
|
||||
|
||||
List<DevComponentExcel> getExportData();
|
||||
List<GongFuDeviceComponentExportDTO> getExportData();
|
||||
|
||||
List<DeviceComponent1VO> getWithDeviceType(String modelNo, Boolean componentSort);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nflg.mobilebroken.repository.service.impl;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.DevComponentExcel;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.GongFuDeviceComponentExportDTO;
|
||||
import com.nflg.mobilebroken.common.pojo.query.DeviceComponentQuery;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DeviceComponent1VO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DeviceComponentVO;
|
||||
|
|
@ -58,7 +59,7 @@ public class GongfuDeviceComponentServiceImpl extends ServiceImpl<GongfuDeviceCo
|
|||
|
||||
}
|
||||
|
||||
public List<DevComponentExcel> getExportData() {
|
||||
public List<GongFuDeviceComponentExportDTO> getExportData() {
|
||||
return this.getBaseMapper().getExportData();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -271,6 +271,7 @@ public class TicketSolutionServiceImpl extends ServiceImpl<TicketSolutionMapper,
|
|||
.set(GongfuTicket::getReason, request.getReason())
|
||||
.set(GongfuTicket::getQuestion, request.getQuestion())
|
||||
.set(GongfuTicket::getAccidentLevel, request.getAccidentLevel())
|
||||
.set(GongfuTicket::getComponentId, request.getComponentId())
|
||||
.eq(GongfuTicket::getId, request.getTicketId())
|
||||
.update();
|
||||
if (CollectionUtil.isNotEmpty(idForReserve)) {
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getExportData" resultType="com.nflg.mobilebroken.common.pojo.dto.DevComponentExcel">
|
||||
select a.model_no,b.model_part_name,b.create_by,b.create_time
|
||||
<select id="getExportData" resultType="com.nflg.mobilebroken.common.pojo.dto.GongFuDeviceComponentExportDTO">
|
||||
select a.product_line,b.model_part_name,b.create_by,b.create_time
|
||||
from gongfu_device_component a
|
||||
join gongfu_device_component_detail b on a.id=b.device_component_id
|
||||
join t_base_part c on b.model_part_id=c.id
|
||||
join gongfu_device_component_detail b on a.id=b.device_component_id
|
||||
join gongfu_device_part c on b.model_part_id=c.id
|
||||
</select>
|
||||
|
||||
<select id="getWithDeviceType" resultType="com.nflg.mobilebroken.common.pojo.vo.DeviceComponent1VO">
|
||||
|
|
|
|||
|
|
@ -9,31 +9,33 @@
|
|||
<if test="query.partName!=null and query.partName!=''">
|
||||
and part_name like concat('%', #{query.partName},'%')
|
||||
</if>
|
||||
<if test="query.typeAttr!=null and query.typeAttr!=''">
|
||||
and type_attr=#{query.typeAttr}
|
||||
</if>
|
||||
<!-- <if test="query.typeAttr!=null and query.typeAttr!=''">-->
|
||||
<!-- and type_attr=#{query.typeAttr}-->
|
||||
<!-- </if>-->
|
||||
<if test="query.enable!=null">
|
||||
and enable=#{query.enable}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getListByPage" resultType="com.nflg.mobilebroken.repository.entity.GongfuDevicePart">
|
||||
select * from gongfu_device_part where 1=1
|
||||
<include refid="whr">
|
||||
</include>
|
||||
select * from gongfu_device_part
|
||||
<where>
|
||||
<include refid="whr">
|
||||
</include>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="exportPart" resultType="com.nflg.mobilebroken.common.pojo.dto.ExportPartDTO">
|
||||
select a.part_name,a.type_attr,b.language_name,b.language_value
|
||||
from gongfu_device_part a join gongfu_device_part_language_data b on a.id=b.source_id
|
||||
where 1=1
|
||||
<if test="partNo!=null and partNo!=''">
|
||||
and part_no=#{partNo}
|
||||
</if>
|
||||
<if test="partName!=null and partName!=''">
|
||||
and part_name like concat('%', #{partName},'%')
|
||||
</if>
|
||||
|
||||
|
||||
select a.part_name,a.type_attr,b.language_name,b.language_value
|
||||
from gongfu_device_part a
|
||||
join gongfu_device_part_language_data b on a.id=b.source_id
|
||||
<where>
|
||||
<if test="partNo!=null and partNo!=''">
|
||||
and part_no=#{partNo}
|
||||
</if>
|
||||
<if test="partName!=null and partName!=''">
|
||||
and part_name like concat('%', #{partName},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue