Compare commits
12 Commits
896cfa3752
...
960f0f79cb
| Author | SHA1 | Date |
|---|---|---|
|
|
960f0f79cb | |
|
|
5e533f4d39 | |
|
|
26084b1e1b | |
|
|
4e94408ab2 | |
|
|
5e38841aae | |
|
|
94baf89b03 | |
|
|
8302a7e8cf | |
|
|
736978c29f | |
|
|
f68b70dc3d | |
|
|
58dd7806de | |
|
|
8d3a43d152 | |
|
|
f317319940 |
|
|
@ -5,6 +5,9 @@ import cn.hutool.core.convert.Convert;
|
|||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.nflg.mobilebroken.admin.pojo.dto.ModelParamsImportDTO;
|
||||
import com.nflg.mobilebroken.admin.pojo.dto.ModelParamsImportItemDTO;
|
||||
import com.nflg.mobilebroken.admin.pojo.dto.ModelParamsImportLanguageItemDTO;
|
||||
import com.nflg.mobilebroken.common.constant.Constant;
|
||||
import com.nflg.mobilebroken.common.constant.PublishState;
|
||||
import com.nflg.mobilebroken.common.constant.STATE;
|
||||
|
|
@ -389,7 +392,7 @@ public class ProductModelController extends ControllerBase {
|
|||
VUtils.trueThrowBusinessError(Objects.isNull(info)).throwMessage("无效的数据");
|
||||
VUtils.trueThrowBusinessError(StrUtil.equals(request.getLanguageCode(), Constant.DEFAULT_LANGUAGE_CODE)
|
||||
&& productModelParamsItemService.lambdaQuery()
|
||||
.ne(ProductModelParamsItem::getId,request.getModelParamsItemId())
|
||||
.ne(ProductModelParamsItem::getId, request.getModelParamsItemId())
|
||||
.eq(ProductModelParamsItem::getModelParamsId, request.getModelParamsId())
|
||||
.eq(ProductModelParamsItem::getLanguageCode, Constant.DEFAULT_LANGUAGE_CODE)
|
||||
.eq(ProductModelParamsItem::getIndexName, request.getIndexName())
|
||||
|
|
@ -656,9 +659,227 @@ public class ProductModelController extends ControllerBase {
|
|||
public ApiResult<Integer> importModelParamsItem(@Valid @RequestParam @NotNull int modelId
|
||||
, @RequestParam(required = false, defaultValue = "0") int modelParamsId
|
||||
, @Valid @RequestParam(value = "file") @NotNull MultipartFile file) {
|
||||
VUtils.trueThrowBusinessError(true).throwMessage("方法已弃用,改用importModelParamsItemMonolingual");
|
||||
return ApiResult.success(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入设备技术参数项(多语言)
|
||||
* @param modelParamsId 机型参数ID
|
||||
* @param file 文件
|
||||
* @return 机型参数id
|
||||
*/
|
||||
@Transactional
|
||||
@PostMapping("/importModelParamsItemMultilingual")
|
||||
public ApiResult<Integer> importModelParamsItemMultilingual(@Valid @RequestParam @NotNull int modelId
|
||||
, @RequestParam(required = false, defaultValue = "0") int modelParamsId
|
||||
, @Valid @RequestParam(value = "file") @NotNull MultipartFile file) {
|
||||
ProductModel model = productModelService.getById(modelId);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(model)).throwMessage("无效的" + modelId);
|
||||
List<String> repeats=new ArrayList<>();
|
||||
List<String> repeats = new ArrayList<>();
|
||||
DataFormatter dataFormatter = new DataFormatter();
|
||||
try (InputStream inputStream = file.getInputStream(); org.apache.poi.ss.usermodel.Workbook workbook = new XSSFWorkbook(inputStream)) {
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
String no = StrUtil.trim(sheet.getRow(1).getCell(1).getStringCellValue());
|
||||
VUtils.trueThrowBusinessError(!StrUtil.equals(model.getNo(), no)).throwMessage("产品型号不一致");
|
||||
List<ModelParamsImportDTO> datas = new ArrayList<>();
|
||||
String indexName = null;
|
||||
ModelParamsImportDTO lastDTO = null;
|
||||
for (int index = 4, count = sheet.getLastRowNum(); index <= count; index++) {
|
||||
log.info("处理第{}行", index);
|
||||
Row row = sheet.getRow(index);
|
||||
if (Objects.isNull(row) || StrUtil.isBlank(row.getCell(1).getStringCellValue())) {
|
||||
break;
|
||||
}
|
||||
ModelParamsImportDTO dto;
|
||||
String rowIndexName = row.getCell(0).getStringCellValue();
|
||||
if (StrUtil.isBlank(rowIndexName) || StrUtil.equals(rowIndexName, indexName)) {
|
||||
rowIndexName = indexName;
|
||||
dto = lastDTO;
|
||||
} else {
|
||||
indexName = rowIndexName;
|
||||
dto = new ModelParamsImportDTO().setIndexName(rowIndexName);
|
||||
lastDTO = dto;
|
||||
datas.add(dto);
|
||||
}
|
||||
ModelParamsImportItemDTO item = new ModelParamsImportItemDTO();
|
||||
item.setName(row.getCell(1).getStringCellValue());
|
||||
if (dto.getItems().stream().anyMatch(litem -> litem.getName().equals(item.getName()))) {
|
||||
repeats.add(item.getName());
|
||||
}
|
||||
item.setMain(row.getCell(3).getStringCellValue().equals("是"));
|
||||
item.setCompare(row.getCell(4).getStringCellValue().equals("是"));
|
||||
dto.getItems().add(item);
|
||||
//中文
|
||||
ModelParamsImportLanguageItemDTO cn = new ModelParamsImportLanguageItemDTO().setLanguage("中文");
|
||||
cn.setIndexName(rowIndexName);
|
||||
cn.setName(row.getCell(1).getStringCellValue());
|
||||
cn.setValue(dataFormatter.formatCellValue(row.getCell(2)));
|
||||
item.getLanguages().add(cn);
|
||||
int cc = 5;
|
||||
while (row.getLastCellNum() > cc) {
|
||||
int trindex = index;
|
||||
ModelParamsImportLanguageItemDTO languageItem = new ModelParamsImportLanguageItemDTO();
|
||||
languageItem.setIndexName(row.getCell(cc).getStringCellValue());
|
||||
while (StrUtil.isBlank(languageItem.getIndexName())) {
|
||||
languageItem.setIndexName(sheet.getRow(trindex).getCell(cc).getStringCellValue());
|
||||
trindex--;
|
||||
}
|
||||
languageItem.setLanguage(sheet.getRow(2).getCell(cc).getStringCellValue());
|
||||
languageItem.setName(row.getCell(cc + 1).getStringCellValue());
|
||||
languageItem.setValue(dataFormatter.formatCellValue(row.getCell(cc + 2)));
|
||||
item.getLanguages().add(languageItem);
|
||||
cc += 3;
|
||||
}
|
||||
}
|
||||
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(repeats))
|
||||
.throwMessage("以下参数名称重复:" + StrUtil.join(",", repeats));
|
||||
VUtils.trueThrowBusinessError(CollectionUtil.isEmpty(datas)).throwMessage("数据不能为空");
|
||||
List<Language> languages = languageService.getLanguages();
|
||||
int resultId;
|
||||
if (modelParamsId == 0) {
|
||||
resultId = productModelParamsService.add(modelId, IdUtil.getSnowflakeNextIdStr());
|
||||
List<ProductModelParamsItem> items = new ArrayList<>();
|
||||
int finalResultId = resultId;
|
||||
datas.forEach(dto -> {
|
||||
dto.getItems().forEach(dit -> {
|
||||
String batchNumber = IdUtil.getSnowflakeNextIdStr();
|
||||
dit.getLanguages().forEach(languageItem -> {
|
||||
Language language = languages.stream()
|
||||
.filter(l -> StrUtil.equals(l.getName(), languageItem.getLanguage()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(language)).throwMessage("语言不存在:" + languageItem.getLanguage());
|
||||
ProductModelParamsItem item = new ProductModelParamsItem()
|
||||
.setModelParamsId(finalResultId)
|
||||
.setLanguageCode(language.getCode())
|
||||
.setBatchNumber(batchNumber)
|
||||
.setMain(dit.getMain())
|
||||
.setCompare(dit.getCompare())
|
||||
.setIndexName(languageItem.getIndexName())
|
||||
.setName(languageItem.getName())
|
||||
.setValue(languageItem.getValue())
|
||||
.setCreateBy(AdminUserUtil.getUserName())
|
||||
.setCreateTime(LocalDateTime.now());
|
||||
items.add(item);
|
||||
});
|
||||
});
|
||||
});
|
||||
productModelParamsItemService.saveBatch(items);
|
||||
} else {
|
||||
ProductModelParams info = productModelParamsService.getById(modelParamsId);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(info)).throwMessage("无效的" + modelParamsId);
|
||||
resultId = modelParamsId;
|
||||
if (Objects.equals(info.getState(), PublishState.Published.getState())) {
|
||||
resultId = productModelParamsService.add(modelId, info.getBatchNumber());
|
||||
productModelParamsService.copyItems(modelParamsId, resultId);
|
||||
}
|
||||
List<ProductModelParamsItem> oldItems = productModelParamsItemService.lambdaQuery().eq(ProductModelParamsItem::getModelParamsId, resultId).list();
|
||||
int finalResultId1 = resultId;
|
||||
List<ProductModelParamsItem> itemsForAdd = new ArrayList<>();
|
||||
datas.forEach(dto -> {
|
||||
dto.getItems().forEach(dit -> {
|
||||
ProductModelParamsItem oitem = oldItems.stream()
|
||||
.filter(it -> StrUtil.equals(it.getLanguageCode(), Constant.DEFAULT_LANGUAGE_CODE)
|
||||
&& StrUtil.equals(it.getIndexName(), dto.getIndexName())
|
||||
&& StrUtil.equals(it.getName(), dit.getName())
|
||||
)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.isNull(oitem)) {
|
||||
String batchNumber = IdUtil.getSnowflakeNextIdStr();
|
||||
dit.getLanguages().forEach(languageItem -> {
|
||||
Language language = languages.stream()
|
||||
.filter(l -> StrUtil.equals(l.getName(), languageItem.getLanguage()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(language)).throwMessage("语言不存在:" + languageItem.getLanguage());
|
||||
ProductModelParamsItem item = new ProductModelParamsItem()
|
||||
.setModelParamsId(finalResultId1)
|
||||
.setLanguageCode(language.getCode())
|
||||
.setBatchNumber(batchNumber)
|
||||
.setMain(dit.getMain())
|
||||
.setCompare(dit.getCompare())
|
||||
.setIndexName(languageItem.getIndexName())
|
||||
.setName(languageItem.getName())
|
||||
.setValue(languageItem.getValue())
|
||||
.setCreateBy(AdminUserUtil.getUserName())
|
||||
.setCreateTime(LocalDateTime.now());
|
||||
itemsForAdd.add(item);
|
||||
});
|
||||
} else {
|
||||
ModelParamsImportLanguageItemDTO cn = dit.getLanguages().stream()
|
||||
.filter(it -> StrUtil.equals(it.getLanguage(), "中文"))
|
||||
.findFirst()
|
||||
.get();
|
||||
oitem.setValue(cn.getValue());
|
||||
oitem.setUpdateBy(AdminUserUtil.getUserName());
|
||||
oitem.setUpdateTime(LocalDateTime.now());
|
||||
languages.removeIf(l -> StrUtil.equals(l.getCode(), Constant.DEFAULT_LANGUAGE_CODE));
|
||||
dit.getLanguages().forEach(languageItem -> {
|
||||
if (!StrUtil.equals(languageItem.getLanguage(), "中文")) {
|
||||
Language language = languages.stream()
|
||||
.filter(l -> StrUtil.equals(l.getName(), languageItem.getLanguage()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(language)).throwMessage("语言不存在:" + languageItem.getLanguage());
|
||||
ProductModelParamsItem olitem = oldItems.stream()
|
||||
.filter(it -> StrUtil.equals(it.getBatchNumber(), oitem.getBatchNumber())
|
||||
&& StrUtil.equals(it.getLanguageCode(), language.getCode()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.isNull(olitem)) {
|
||||
ProductModelParamsItem item = new ProductModelParamsItem()
|
||||
.setModelParamsId(finalResultId1)
|
||||
.setLanguageCode(language.getCode())
|
||||
.setBatchNumber(oitem.getBatchNumber())
|
||||
.setMain(dit.getMain())
|
||||
.setCompare(dit.getCompare())
|
||||
.setIndexName(languageItem.getIndexName())
|
||||
.setName(languageItem.getName())
|
||||
.setValue(languageItem.getValue())
|
||||
.setCreateBy(AdminUserUtil.getUserName())
|
||||
.setCreateTime(LocalDateTime.now());
|
||||
itemsForAdd.add(item);
|
||||
} else {
|
||||
olitem.setIndexName(languageItem.getIndexName());
|
||||
olitem.setName(languageItem.getName());
|
||||
olitem.setValue(languageItem.getValue());
|
||||
olitem.setUpdateBy(AdminUserUtil.getUserName());
|
||||
olitem.setUpdateTime(LocalDateTime.now());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(oldItems)) {
|
||||
productModelParamsItemService.updateBatchById(oldItems);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(itemsForAdd)) {
|
||||
productModelParamsItemService.saveBatch(itemsForAdd);
|
||||
}
|
||||
}
|
||||
return ApiResult.success(resultId);
|
||||
} catch (IOException e) {
|
||||
throw new NflgException(STATE.BusinessError, "导入失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入设备技术参数项(中文语言)
|
||||
* @param modelParamsId 机型参数ID
|
||||
* @param file 文件
|
||||
* @return 机型参数id
|
||||
*/
|
||||
@Transactional
|
||||
@PostMapping("/importModelParamsItemMonolingual")
|
||||
public ApiResult<Integer> importModelParamsItemMonolingual(@Valid @RequestParam @NotNull int modelId
|
||||
, @RequestParam(required = false, defaultValue = "0") int modelParamsId
|
||||
, @Valid @RequestParam(value = "file") @NotNull MultipartFile file) {
|
||||
ProductModel model = productModelService.getById(modelId);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(model)).throwMessage("无效的" + modelId);
|
||||
List<String> repeats = new ArrayList<>();
|
||||
try (InputStream inputStream = file.getInputStream(); org.apache.poi.ss.usermodel.Workbook workbook = new XSSFWorkbook(inputStream)) {
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
String no = StrUtil.trim(sheet.getRow(1).getCell(1).getStringCellValue());
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ package com.nflg.mobilebroken.admin.controller;
|
|||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.BooleanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.itextpdf.text.pdf.BaseFont;
|
||||
import com.nflg.mobilebroken.admin.annotation.ApiMark;
|
||||
|
|
@ -21,6 +23,7 @@ import com.nflg.mobilebroken.repository.entity.*;
|
|||
import com.nflg.mobilebroken.repository.service.*;
|
||||
import com.nflg.mobilebroken.starter.annotation.MethodInfoMark;
|
||||
import com.nflg.mobilebroken.starter.service.UniPushService;
|
||||
import com.nflg.mobilebroken.starter.service.impl.DeepSeekTranslate;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
|
|
@ -40,6 +43,7 @@ import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
|
|||
import org.xhtmlrenderer.pdf.ITextRenderer;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
|
@ -145,6 +149,11 @@ public class TicketController extends ControllerBase {
|
|||
@Resource
|
||||
private ITBaseAreaService areaService;
|
||||
|
||||
@Resource
|
||||
private DeepSeekTranslate deepSeekTranslate;
|
||||
@Resource
|
||||
private ILanguageService languageService;
|
||||
|
||||
/**
|
||||
* 获取问题类型
|
||||
* @return 问题类型列表
|
||||
|
|
@ -152,8 +161,9 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("getQuestions")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "获取问题类型", isPublic = true)
|
||||
public ApiResult<List<String>> getQuestions() {
|
||||
|
||||
return ApiResult.success(Arrays.asList("技术设计问题", "装配工艺问题", "焊接质量问题", "机组装配质量问题", "电控问题", "工况方案问题", "操作不当", "原材料配件质量问题", "QC检验遗漏/误差", "部件/整机外观"));
|
||||
return ApiResult.success(Arrays.asList("技术设计问题", "装配工艺问题", "焊接质量问题", "机组装配质量问题", "电控问题"
|
||||
, "工况方案问题", "客户操作不当", "原材料配件质量问题", "QC检验遗漏/误差", "部件/整机外观", "安装问题", "调试问题"
|
||||
, "外购件质量问题", "运输问题", "非故障问题/参数咨询"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -164,7 +174,6 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("getFavorites")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "获取收藏夹", isPublic = true)
|
||||
public ApiResult<FavoritesVO> getFavorites(@RequestParam(defaultValue = "0") Integer id) {
|
||||
|
||||
return ApiResult.success(ticketFavoritesService.getMBList(AdminUserUtil.getUserId(), Constant.FROM_ADMIN, id));
|
||||
}
|
||||
|
||||
|
|
@ -175,7 +184,6 @@ public class TicketController extends ControllerBase {
|
|||
*/
|
||||
@GetMapping("getFavoritesTree")
|
||||
public ApiResult<FavoritesVO> getFavoritesTree(@RequestParam(defaultValue = "0") Integer id) {
|
||||
|
||||
return ApiResult.success(ticketFavoritesService.getTree(AdminUserUtil.getUserId(), Constant.FROM_ADMIN, id));
|
||||
}
|
||||
|
||||
|
|
@ -187,7 +195,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("addFavorites")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "添加收藏夹", isPublic = true)
|
||||
public ApiResult<Void> addFavorites(@Valid @RequestBody AdminFavoritesRequest request) {
|
||||
|
||||
ticketFavoritesService.addFavorites(request, AdminUserUtil.getUserId(), Constant.FROM_ADMIN);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -198,7 +205,6 @@ public class TicketController extends ControllerBase {
|
|||
*/
|
||||
@PostMapping("updateFavorites")
|
||||
public ApiResult<Void> updateFavorites(@Valid @RequestBody FavoritesUpdateRequest request) {
|
||||
|
||||
ticketFavoritesService.updateFavorites(request, AdminUserUtil.getUserId(), Constant.FROM_ADMIN);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -211,7 +217,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("deleteFavorites")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "删除收藏夹", isPublic = true)
|
||||
public ApiResult<Void> deleteFavorites(@Valid @RequestParam @NotNull Integer favoritesId) {
|
||||
|
||||
ticketFavoritesService.deleteFavorites(AdminUserUtil.getUserId(), Constant.FROM_ADMIN, favoritesId);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -222,7 +227,6 @@ public class TicketController extends ControllerBase {
|
|||
*/
|
||||
@PostMapping("moveFavorites")
|
||||
public ApiResult<Void> moveFavorites(@Valid @RequestBody FavoritesMoveRequest request) {
|
||||
|
||||
ticketFavoritesService.moveFavorites(request);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -233,7 +237,6 @@ public class TicketController extends ControllerBase {
|
|||
*/
|
||||
@PostMapping("moveFavoritesTicket")
|
||||
public ApiResult<Void> moveFavoritesTicket(@Valid @RequestBody FavoritesTicketMoveRequest request) {
|
||||
|
||||
ticketFavoritesService.moveFavoritesTicket(AdminUserUtil.getUserId(), Constant.FROM_ADMIN, request);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -245,7 +248,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("followTiket")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "关注工单")
|
||||
public ApiResult<Void> followTiket(@Valid @RequestBody AdminFollowRequest request) {
|
||||
|
||||
ticketFollowService.follow(request, AdminUserUtil.getUserId(), Constant.FROM_ADMIN);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -256,7 +258,6 @@ public class TicketController extends ControllerBase {
|
|||
**/
|
||||
@PostMapping("unfollowTicket")
|
||||
public ApiResult<Void> unfollowTicket(@Valid @RequestParam @NotNull Integer ticketId) {
|
||||
|
||||
ticketFollowService.unfollow(AdminUserUtil.getUserId(), Constant.FROM_ADMIN, Long.valueOf(ticketId));
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -268,7 +269,6 @@ public class TicketController extends ControllerBase {
|
|||
*/
|
||||
@GetMapping("getDeviceComponents")
|
||||
public ApiResult<List<ComponentInfo>> getDeviceComponents(@RequestParam String name) {
|
||||
|
||||
return ApiResult.success(partService.getSimpleList(name));
|
||||
}
|
||||
|
||||
|
|
@ -278,7 +278,6 @@ public class TicketController extends ControllerBase {
|
|||
*/
|
||||
@GetMapping("getDeviceAgents")
|
||||
public ApiResult<List<DeviceAgentVO>> getDeviceAgents() {
|
||||
|
||||
return ApiResult.success(deviceService.getAgents());
|
||||
}
|
||||
|
||||
|
|
@ -289,16 +288,30 @@ public class TicketController extends ControllerBase {
|
|||
*/
|
||||
@PostMapping("searchTicket")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "搜索工单")
|
||||
public ApiResult<PageData<AdminTicketVO>> searchTicket(@Valid @RequestBody AdminTicketSearchRequest request) {
|
||||
|
||||
public ApiResult<PageData<AdminTicketVO>> searchTicket(@Valid @RequestBody AdminTicketSearchRequest request, HttpServletRequest request2) {
|
||||
// 20260311 工单标题,在列表页面把它的翻译列展示出来
|
||||
String languageCode = request2.getHeader("language");
|
||||
Language language;
|
||||
if (StrUtil.isNotBlank(languageCode)) {
|
||||
language = languageService.lambdaQuery().eq(Language::getCode, languageCode).one();
|
||||
} else {
|
||||
language = null;
|
||||
}
|
||||
return ApiResult.success(PageUtil.convert(ticketService.searchPage(request), d -> {
|
||||
d.setEvaluate(getTicketEvaluateForList(Math.toIntExact(d.getId())));
|
||||
// 标题字符串不含中文才翻译
|
||||
if (ObjectUtil.isNotEmpty(d.getTitle()) && !Validator.hasChinese(d.getTitle())) {
|
||||
String text = d.getTitle().replaceAll("<br>", ",");
|
||||
if (language != null && language.getName() != null) {
|
||||
String titleTranslate = deepSeekTranslate.translateWord(text, "auto", language.getName(), "text");
|
||||
d.setTitleTranslate(titleTranslate);
|
||||
}
|
||||
}
|
||||
return d;
|
||||
}));
|
||||
}
|
||||
|
||||
private TicketEvaluateVO getTicketEvaluateForList(Integer ticketId) {
|
||||
|
||||
TicketEvaluate ticketEvaluate = ticketEvaluateService.lambdaQuery().eq(TicketEvaluate::getTicketId, ticketId).one();
|
||||
if (Objects.isNull(ticketEvaluate)) {
|
||||
return null;
|
||||
|
|
@ -354,7 +367,6 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("getReason")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "获取工单根本原因分析", isPublic = true)
|
||||
public ApiResult<String> getReason(@Valid @RequestParam @NotNull Integer ticketId) {
|
||||
|
||||
Ticket ticket = ticketService.getById(ticketId);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
|
||||
return ApiResult.success(ticket.getReason());
|
||||
|
|
@ -367,7 +379,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("exportSearchTicket")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "导出搜索工单")
|
||||
public void exportSearchTicket(HttpServletResponse response, @Valid @RequestBody AdminTicketSearchRequest request) throws IOException {
|
||||
|
||||
request.setPageSize(Integer.MAX_VALUE);
|
||||
List<AdminTicketVO> datas = ticketService.exportSearch(request);
|
||||
EecExcelUtil.export("工单", "sheet1", datas, response);
|
||||
|
|
@ -381,7 +392,6 @@ public class TicketController extends ControllerBase {
|
|||
@MethodInfoMark(value = "分派工单", menuName = "工单管理")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "分派工单")
|
||||
public ApiResult<Void> assignmentTicket(@Valid @RequestBody AssignmentTicketRequest request) {
|
||||
|
||||
Ticket ticket = ticketService.assignmentTicket(request);
|
||||
ticketEventPublisher.publishTicketAssignedEvent(ticket, request.getUserIds());
|
||||
ChatMessageDTO message = new ChatMessageDTO()
|
||||
|
|
@ -411,7 +421,6 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("getTicketHandle")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "获取工单处理人")
|
||||
public ApiResult<List<AdminUserSimpleVO>> getTicketHandle(@Valid @RequestParam @NotNull(message = "工单编号不能为空") Long id) {
|
||||
|
||||
return ApiResult.success(ticketService.getTicketHandle(id));
|
||||
}
|
||||
|
||||
|
|
@ -423,7 +432,6 @@ public class TicketController extends ControllerBase {
|
|||
@MethodInfoMark(value = "添加工单处理人", menuName = "工单管理")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "添加工单处理人")
|
||||
public ApiResult<Void> addTicketHandle(@Valid @RequestBody TicketHandleAddRequest request) {
|
||||
|
||||
Ticket ticket = ticketService.getById(request.getTicketId());
|
||||
List<Integer> handleIds = StrUtil.split(ticket.getHandle(), ",").stream().map(Integer::parseInt).collect(Collectors.toList());
|
||||
// VUtils.trueThrowBusinessError(handleIds.stream().anyMatch(uid -> Objects.equals(uid, AdminUserUtil.getUserId()))
|
||||
|
|
@ -445,7 +453,6 @@ public class TicketController extends ControllerBase {
|
|||
@MethodInfoMark(value = "完成工单", menuName = "工单管理")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "完成工单")
|
||||
public ApiResult<Void> completeTicket(@Valid @RequestBody @NotEmpty List<Integer> ids) {
|
||||
|
||||
for (Integer id : ids) {
|
||||
Ticket ticket = ticketService.completeTicket(id);
|
||||
ticketEventPublisher.publishTicketCompleteEvent(ticket);
|
||||
|
|
@ -477,7 +484,6 @@ public class TicketController extends ControllerBase {
|
|||
@MethodInfoMark(value = "驳回工单", menuName = "工单管理")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "驳回工单")
|
||||
public ApiResult<Void> rejectTicket(@Valid @RequestBody @NotEmpty List<Integer> ids) {
|
||||
|
||||
for (Integer id : ids) {
|
||||
Ticket ticket = ticketService.rejectTicket(id);
|
||||
// ticketEventPublisher.publishTicketCompleteEvent(ticket);
|
||||
|
|
@ -505,7 +511,6 @@ public class TicketController extends ControllerBase {
|
|||
**/
|
||||
@GetMapping("revokedTicket")
|
||||
public ApiResult<Void> revokedTicket(@Valid @RequestParam @NotNull Integer id) {
|
||||
|
||||
ticketService.revokedFromAdmin(id);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -657,7 +662,7 @@ public class TicketController extends ControllerBase {
|
|||
} else if (Objects.nonNull(user.getAreaId())) {
|
||||
areaName = appAreaService.getById(user.getAreaId()).getName();
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
areaName = Optional.ofNullable(areaService.getById(user.getAreaId())).map(TBaseArea::getAreaName).orElse("");
|
||||
}
|
||||
}
|
||||
|
|
@ -736,7 +741,6 @@ public class TicketController extends ControllerBase {
|
|||
}
|
||||
|
||||
private List<FileUploadVO> getFileVOs(String ids) {
|
||||
|
||||
if (StrUtil.isBlank(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
|
@ -747,7 +751,6 @@ public class TicketController extends ControllerBase {
|
|||
}
|
||||
|
||||
private TicketEvaluateVO getTicketEvaluate(Integer ticketId) {
|
||||
|
||||
TicketEvaluate ticketEvaluate = ticketEvaluateService.lambdaQuery().eq(TicketEvaluate::getTicketId, ticketId).one();
|
||||
if (Objects.isNull(ticketEvaluate)) {
|
||||
return null;
|
||||
|
|
@ -795,7 +798,6 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("getChatMessages")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "获取工单聊天记录")
|
||||
public ApiResult<MessageVO> getChatMessages(@Valid @RequestParam @NotNull Integer ticketId) {
|
||||
|
||||
Integer userId = AdminUserUtil.getUserId();
|
||||
MessageVO vo = new MessageVO();
|
||||
List<ChatMessageVO> messageVOS = ticketChatService.getMessages(Long.valueOf(ticketId), userId);
|
||||
|
|
@ -835,7 +837,6 @@ public class TicketController extends ControllerBase {
|
|||
**/
|
||||
@PostMapping("setChatMessageReaded")
|
||||
public ApiResult<Void> setChatMessageReaded(@RequestBody Long ticketId) {
|
||||
|
||||
stringRedisTemplate.delete("chatMessage:notreaded:" + ticketId + ":admin:" + AdminUserUtil.getUserId());
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -847,7 +848,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("addChatMessage")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "添加聊天记录")
|
||||
public ApiResult<Void> addChatMessage(@Valid @RequestBody AddChatMessageRequest request) {
|
||||
|
||||
Ticket ticket = ticketService.getById(request.getTicketId());
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
|
||||
VUtils.trueThrowBusinessError(Byte.compare(ticket.getState(), TicketState.Processing.getState()) > 1)
|
||||
|
|
@ -911,7 +911,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("withdrawChatMessage")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "撤回聊天记录")
|
||||
public ApiResult<Void> withdrawChatMessage(@Valid @RequestBody WithdrawChatMessageRequest request) {
|
||||
|
||||
ticketChatService.withdrawMessage(request.getTicketId(), request.getMessageId());
|
||||
//推送消息
|
||||
ssePushService.sendTicketMessageWithdrawToAdmin(request.getTicketId(), request.getMessageId());
|
||||
|
|
@ -973,7 +972,6 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("getSolutionReviewDepartment")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "获取工单解决方案评审部门")
|
||||
public ApiResult<List<SolutionReviewDepartmentVO>> getSolutionReviewDepartment(@Valid @RequestParam @NotNull Integer ticketId) {
|
||||
|
||||
return ApiResult.success(ticketSolutionAuditService.getByTicket(Long.valueOf(ticketId)));
|
||||
}
|
||||
|
||||
|
|
@ -984,7 +982,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("saveSolutionReviewDepartment")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "保存工单解决方案评审部门")
|
||||
public ApiResult<Void> saveSolutionReviewDepartment(@Valid @RequestBody SolutionReviewDepartmentSaveRequest request) {
|
||||
|
||||
ticketSolutionAuditService.saveSolutionReviewDepartment(request);
|
||||
adminMessageService.setReaded(AdminUserUtil.getUserId(), Long.valueOf(request.getTicketId()), MessageSubType.TicketCompletion.getState());
|
||||
return ApiResult.success();
|
||||
|
|
@ -997,7 +994,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("rejectSolution")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "驳回工单解决方案")
|
||||
public ApiResult<Void> rejectSolution(@Valid @RequestBody SolutionRejectRequest request) {
|
||||
|
||||
Ticket ticket = ticketSolutionAuditService.reject(request);
|
||||
if (Objects.nonNull(ticket)) {
|
||||
TicketSolutionAudit audit = ticketSolutionAuditService.lambdaQuery()
|
||||
|
|
@ -1030,7 +1026,6 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("passSolution")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "通过工单解决方案")
|
||||
public ApiResult<Void> passSolution(@Valid @RequestParam @NotNull Integer ticketId) {
|
||||
|
||||
if (ticketSolutionAuditService.pass(ticketId)) {
|
||||
Ticket ticket = ticketService.getById(ticketId);
|
||||
ticketEventPublisher.publishTicketCloseEvent(ticket);
|
||||
|
|
@ -1058,7 +1053,6 @@ public class TicketController extends ControllerBase {
|
|||
@PostMapping("exportTicketReport")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "导出工单报表")
|
||||
public void exportTicketReport(HttpServletResponse response, @Valid @RequestBody AdminTicketSearchRequest request) throws IOException {
|
||||
|
||||
request.setPageSize(Integer.MAX_VALUE);
|
||||
List<AdminTicketVO> datas = ticketService.exportSearch(request);
|
||||
EecExcelUtil.export("工单报表", "sheet1", Convert.toList(AdminTicketReportVO.class, datas), response);
|
||||
|
|
@ -1071,7 +1065,6 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("/exportTicketExcel")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "导出工单详情为excel")
|
||||
public void exportExcel(HttpServletResponse response, @Valid @RequestParam @NotNull Integer ticketId) throws Exception {
|
||||
|
||||
Ticket ticket = ticketService.getById(ticketId);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("工单不存在");
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
|
|
@ -1273,7 +1266,6 @@ public class TicketController extends ControllerBase {
|
|||
}
|
||||
|
||||
private void addMergedRegion(Sheet sheet, int firstRow, int lastRow, int firstCol, int lastCol) {
|
||||
|
||||
CellRangeAddress region = new CellRangeAddress(firstRow, lastRow, firstCol, lastCol);
|
||||
sheet.addMergedRegion(region);
|
||||
RegionUtil.setBorderBottom(BorderStyle.THIN, region, sheet);
|
||||
|
|
@ -1283,14 +1275,12 @@ public class TicketController extends ControllerBase {
|
|||
}
|
||||
|
||||
private void createCell(Row row, int index, CellStyle style, String value) {
|
||||
|
||||
Cell cell = row.createCell(index);
|
||||
cell.setCellValue(value);
|
||||
cell.setCellStyle(style);
|
||||
}
|
||||
|
||||
private void bindPic(String url, Workbook workbook, Sheet sheet, int rowIndex, int colStart, int colEnd) {
|
||||
|
||||
try {
|
||||
byte[] imageBytes;
|
||||
try (InputStream inputStream = new URL(url).openStream()) {
|
||||
|
|
@ -1316,7 +1306,6 @@ public class TicketController extends ControllerBase {
|
|||
}
|
||||
|
||||
private CellStyle getNormalStyle(Workbook workbook) {
|
||||
|
||||
CellStyle centerStyle = workbook.createCellStyle();
|
||||
centerStyle.setAlignment(HorizontalAlignment.LEFT);
|
||||
centerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
|
@ -1336,7 +1325,6 @@ public class TicketController extends ControllerBase {
|
|||
}
|
||||
|
||||
private CellStyle getCenterStyle(Workbook workbook) {
|
||||
|
||||
CellStyle centerStyle = workbook.createCellStyle();
|
||||
centerStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
centerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
|
@ -1356,7 +1344,6 @@ public class TicketController extends ControllerBase {
|
|||
}
|
||||
|
||||
private CellStyle getTitleStyle(Workbook workbook) {
|
||||
|
||||
CellStyle titleStyle = workbook.createCellStyle();
|
||||
titleStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
|
@ -1383,7 +1370,6 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("/getHandlers")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "获取工单处理人")
|
||||
public ApiResult<List<AdminUserSimpleVO>> getHandlers(@Valid @RequestParam @NotNull Long ticketId) {
|
||||
|
||||
return ApiResult.success(ticketService.getTicketHandle(ticketId));
|
||||
}
|
||||
|
||||
|
|
@ -1609,7 +1595,6 @@ public class TicketController extends ControllerBase {
|
|||
*/
|
||||
@GetMapping("getShengWangChannelUsers")
|
||||
public ApiResult<List<Integer>> getShengWangChannelUsers(Long ticketId) throws IOException, InterruptedException {
|
||||
|
||||
return ApiResult.success(shengWangService.getChannelUsers("ticket" + ticketId).getUsers());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.nflg.mobilebroken.admin.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ModelParamsImportDTO {
|
||||
|
||||
/**
|
||||
* 指标名称
|
||||
*/
|
||||
private String IndexName;
|
||||
|
||||
private List<ModelParamsImportItemDTO> items=new ArrayList<>();
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.nflg.mobilebroken.admin.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ModelParamsImportItemDTO {
|
||||
|
||||
/**
|
||||
* 参数名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 是否主要参数
|
||||
*/
|
||||
private Boolean main;
|
||||
|
||||
/**
|
||||
* 是否参与比较
|
||||
*/
|
||||
private Boolean compare;
|
||||
|
||||
private List<ModelParamsImportLanguageItemDTO> languages=new ArrayList<>();
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.nflg.mobilebroken.admin.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ModelParamsImportLanguageItemDTO {
|
||||
|
||||
/**
|
||||
* 语言
|
||||
*/
|
||||
private String language;
|
||||
|
||||
/**
|
||||
* 指标名称
|
||||
*/
|
||||
private String IndexName;
|
||||
|
||||
/**
|
||||
* 参数名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 参数指标
|
||||
*/
|
||||
private String value;
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.nflg.mobilebroken.common.pojo.request;
|
|||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DispatchSearchRequest extends PageRequest {
|
||||
|
|
@ -51,4 +52,6 @@ public class DispatchSearchRequest extends PageRequest {
|
|||
* 结束时间
|
||||
*/
|
||||
private LocalDate endDate;
|
||||
|
||||
private List<Long> ids;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ public class AdminTicketVO {
|
|||
@ExcelColumn("标题")
|
||||
private String title;
|
||||
|
||||
@ExcelColumn("标题翻译")
|
||||
private String titleTranslate = "";
|
||||
|
||||
//工单状态
|
||||
@JsonIgnore
|
||||
@IgnoreExport
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
package com.nflg.mobilebroken.gongfu.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.nflg.mobilebroken.common.constant.MessageSubType;
|
||||
import com.nflg.mobilebroken.common.constant.MessageType;
|
||||
import com.nflg.mobilebroken.common.constant.TicketState;
|
||||
import com.nflg.mobilebroken.common.pojo.ApiResult;
|
||||
import com.nflg.mobilebroken.common.pojo.PageData;
|
||||
import com.nflg.mobilebroken.common.pojo.request.*;
|
||||
|
|
@ -15,26 +19,36 @@ import com.nflg.mobilebroken.common.pojo.vo.GongfuFileVO;
|
|||
import com.nflg.mobilebroken.common.util.AdminUserUtil;
|
||||
import com.nflg.mobilebroken.common.util.DateTimeUtil;
|
||||
import com.nflg.mobilebroken.common.util.VUtils;
|
||||
import com.nflg.mobilebroken.gongfu.annotation.ApiMark;
|
||||
import com.nflg.mobilebroken.gongfu.pojo.dto.DispatchDTO;
|
||||
import com.nflg.mobilebroken.gongfu.pojo.vo.ApplyforAuditVO;
|
||||
import com.nflg.mobilebroken.gongfu.pojo.vo.DispatchApplyforAuditVO;
|
||||
import com.nflg.mobilebroken.gongfu.publisher.DispatchEventPublisher;
|
||||
import com.nflg.mobilebroken.repository.entity.AdminMessage;
|
||||
import com.nflg.mobilebroken.repository.entity.GongfuDispatch;
|
||||
import com.nflg.mobilebroken.repository.entity.GongfuDispatchApplyfor;
|
||||
import com.nflg.mobilebroken.repository.entity.GongfuFile;
|
||||
import com.nflg.mobilebroken.repository.entity.*;
|
||||
import com.nflg.mobilebroken.repository.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.ttzero.excel.entity.ListSheet;
|
||||
import org.ttzero.excel.entity.Workbook;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -62,6 +76,8 @@ public class DispatchController extends ControllerBase {
|
|||
|
||||
@Resource
|
||||
private IAdminMessageService adminMessageService;
|
||||
@Resource
|
||||
private IDictionaryItemService dictionaryItemService;
|
||||
|
||||
/**
|
||||
* 新增派工单
|
||||
|
|
@ -362,4 +378,60 @@ public class DispatchController extends ControllerBase {
|
|||
);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出选中的派工
|
||||
* @param ids 选中的id集合
|
||||
*/
|
||||
@PostMapping("exportSelect")
|
||||
@ApiMark(moduleName = "派工管理", apiName = "导出选中的派工")
|
||||
public void exportSelect(HttpServletResponse response, @RequestBody @NotEmpty List<Long> ids) throws Exception {
|
||||
DispatchSearchRequest request = new DispatchSearchRequest();
|
||||
request.setIds(ids);
|
||||
handleExportData(response, request);
|
||||
}
|
||||
|
||||
private void handleExportData(HttpServletResponse response, DispatchSearchRequest request) throws IOException {
|
||||
request.setPage(1);
|
||||
request.setPageSize(Integer.MAX_VALUE);
|
||||
IPage<DispatchVO> page = dispatchService.search(request, AdminUserUtil.getUserId());
|
||||
List<DispatchVO> list = page.getRecords();
|
||||
Set<Integer> typeSet = list.stream().map(DispatchVO::getType).collect(Collectors.toSet());
|
||||
List<DictionaryItem> dictionaryItems = dictionaryItemService.listByIds(typeSet);
|
||||
// List<GongfuDispatchApplyfor> applyforList = dispatchApplyforService.lambdaQuery().in(GongfuDispatchApplyfor::getTicketId, list.stream().map(DispatchVO::getId).collect(Collectors.toList())).list();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
List<DispatchDTO> datas = list.stream().map(d -> {
|
||||
DispatchDTO data = new DispatchDTO();
|
||||
BeanUtil.copyProperties(d, data);
|
||||
TicketState ticketState = TicketState.findByValue(data.getState().byteValue());
|
||||
if (ObjectUtil.isNotEmpty(ticketState)) {
|
||||
data.setStateDesc(ticketState.getDescription());
|
||||
}
|
||||
Optional<DictionaryItem> itemOptional = dictionaryItems.stream().filter(di -> di.getId().equals(data.getType())).findFirst();
|
||||
itemOptional.ifPresent(dictionaryItem -> data.setTypeDesc(dictionaryItem.getName()));
|
||||
data.setIsDelayDesc(data.isDelay() ? "是" : "否");
|
||||
// if (CollectionUtil.isNotEmpty(applyforList)) {
|
||||
// Optional<GongfuDispatchApplyfor> applyforOptional = applyforList.stream().filter(a -> a.getTicketId().equals(data.getId())).findFirst();
|
||||
// applyforOptional.ifPresent(applyfor -> data.setDelayEndDate(applyfor.getEndDate()));
|
||||
// }
|
||||
if (ObjectUtil.isNotEmpty(data.getActualEndDate()) && ObjectUtil.isNotEmpty(data.getPlanEndDate())) {
|
||||
data.setIsOntime(LocalDate.parse(data.getActualEndDate(), formatter).isAfter(LocalDate.parse(data.getPlanEndDate(), formatter))
|
||||
? "否" : (ObjectUtil.isNotEmpty(data.getActualEndDate()) ? "是" : ""));
|
||||
}
|
||||
data.setAssetInfo(data.getCustomerName() + "(" + data.getDeviceNo() + ")");
|
||||
return data;
|
||||
}).collect(Collectors.toList());
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("派工导出.xlsx", StandardCharsets.UTF_8));
|
||||
new Workbook().addSheet(new ListSheet<>(datas)).writeTo(response.getOutputStream());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出派工列表
|
||||
* @param request
|
||||
*/
|
||||
@PostMapping("exportSearch")
|
||||
public void exportSearch(HttpServletResponse response, @RequestBody DispatchSearchRequest request) throws IOException {
|
||||
handleExportData(response, request);
|
||||
}
|
||||
}
|
||||
|
|
@ -23,6 +23,7 @@ import javax.validation.Valid;
|
|||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
|
@ -36,14 +37,9 @@ import java.util.Objects;
|
|||
@RequestMapping("/file")
|
||||
public class FileController extends ControllerBase {
|
||||
|
||||
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
|
||||
@Resource
|
||||
private IGongfuFileService fileService;
|
||||
|
||||
@Resource
|
||||
private FileUploadService fileUploadService;
|
||||
|
||||
/**
|
||||
* 文件搜索
|
||||
*/
|
||||
|
|
@ -59,35 +55,24 @@ public class FileController extends ControllerBase {
|
|||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param type 类型,1:服务月报
|
||||
* @param type 类型,1:服务月报
|
||||
* @param fileName 文件名称
|
||||
* @param file 文件
|
||||
* @param fileUrl 文件地址
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
public ApiResult<Void> upload(@RequestParam Integer type,@RequestParam String fileName,@RequestParam MultipartFile file) throws IOException {
|
||||
String url = fileUploadService.upload(buildFilePath(getFileType(file.getOriginalFilename())), file);
|
||||
public ApiResult<Void> upload(@RequestParam Integer type, @RequestParam String fileName, @RequestParam String fileUrl) throws IOException {
|
||||
fileService.save(
|
||||
new GongfuFile()
|
||||
.setType(type)
|
||||
.setFileName(fileName)
|
||||
.setFileSize(file.getSize())
|
||||
.setFileSuffix(FilenameUtils.getExtension(file.getOriginalFilename()))
|
||||
.setFileUrl(url)
|
||||
.setFileSuffix(FilenameUtils.getExtension(new URL(fileUrl).getPath()))
|
||||
.setFileUrl(fileUrl)
|
||||
.setCreateBy(AdminUserUtil.getUserName())
|
||||
.setCreateTime(LocalDateTime.now())
|
||||
);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
private String buildFilePath(String fileType) {
|
||||
return StrUtil.format("gongfu/{}/{}/{}/{}{}", LocalDateTime.now().format(FORMATTER), AdminUserUtil.getUserId()
|
||||
, RandomUtil.randomString(4), IdUtil.fastUUID(), fileType);
|
||||
}
|
||||
|
||||
private String getFileType(String fileName) {
|
||||
return "." + FilenameUtils.getExtension(fileName).toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件删除
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.nflg.mobilebroken.gongfu.controller;
|
|||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.itextpdf.text.pdf.BaseFont;
|
||||
import com.nflg.mobilebroken.common.constant.*;
|
||||
|
|
@ -24,6 +26,7 @@ import com.nflg.mobilebroken.repository.entity.*;
|
|||
import com.nflg.mobilebroken.repository.service.*;
|
||||
import com.nflg.mobilebroken.starter.annotation.MethodInfoMark;
|
||||
import com.nflg.mobilebroken.starter.service.UniPushService;
|
||||
import com.nflg.mobilebroken.starter.service.impl.DeepSeekTranslate;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
|
|
@ -42,6 +45,7 @@ import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
|
|||
import org.xhtmlrenderer.pdf.ITextRenderer;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
|
@ -138,6 +142,11 @@ public class TicketController extends ControllerBase {
|
|||
@Resource
|
||||
private ITicketSolutionAuditService ticketSolutionAuditService;
|
||||
|
||||
@Resource
|
||||
private DeepSeekTranslate deepSeekTranslate;
|
||||
@Resource
|
||||
private ILanguageService languageService;
|
||||
|
||||
/**
|
||||
* 获取问题类型
|
||||
* @return 问题类型列表
|
||||
|
|
@ -145,7 +154,9 @@ public class TicketController extends ControllerBase {
|
|||
@GetMapping("getQuestions")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "获取问题类型", isPublic = true)
|
||||
public ApiResult<List<String>> getQuestions() {
|
||||
return ApiResult.success(Arrays.asList("技术设计问题", "装配工艺问题", "焊接质量问题", "机组装配质量问题", "电控问题", "工况方案问题", "操作不当", "原材料配件质量问题", "QC检验遗漏/误差", "部件/整机外观"));
|
||||
return ApiResult.success(Arrays.asList("技术设计问题", "装配工艺问题", "焊接质量问题", "机组装配质量问题", "电控问题"
|
||||
, "工况方案问题", "客户操作不当", "原材料配件质量问题", "QC检验遗漏/误差", "部件/整机外观", "安装问题", "调试问题"
|
||||
, "外购件质量问题", "运输问题", "非故障问题/参数咨询"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -271,9 +282,25 @@ public class TicketController extends ControllerBase {
|
|||
*/
|
||||
@PostMapping("searchTicket")
|
||||
@ApiMark(moduleName = "工单管理", apiName = "搜索工单")
|
||||
public ApiResult<PageData<AdminTicketVO>> searchTicket(@Valid @RequestBody AdminTicketSearchRequest request) {
|
||||
public ApiResult<PageData<AdminTicketVO>> searchTicket(@Valid @RequestBody AdminTicketSearchRequest request, HttpServletRequest request2) {
|
||||
// 20260311 工单标题,在列表页面把它的翻译列展示出来
|
||||
String languageCode = request2.getHeader("language");
|
||||
Language language;
|
||||
if (StrUtil.isNotBlank(languageCode)) {
|
||||
language = languageService.lambdaQuery().eq(Language::getCode, languageCode).one();
|
||||
} else {
|
||||
language = null;
|
||||
}
|
||||
return ApiResult.success(PageUtil.convert(ticketService.searchPage(request), d -> {
|
||||
d.setEvaluate(getTicketEvaluateForList(d.getId()));
|
||||
// 标题字符串不含中文才翻译
|
||||
if (ObjectUtil.isNotEmpty(d.getTitle()) && !Validator.hasChinese(d.getTitle())) {
|
||||
String text = d.getTitle().replaceAll("<br>", ",");
|
||||
if (language != null && language.getName() != null) {
|
||||
String titleTranslate = deepSeekTranslate.translateWord(text, "auto", language.getName(), "text");
|
||||
d.setTitleTranslate(titleTranslate);
|
||||
}
|
||||
}
|
||||
return d;
|
||||
}));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,196 @@
|
|||
package com.nflg.mobilebroken.gongfu.pojo.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.ttzero.excel.annotation.ExcelColumn;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DispatchDTO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
// @ExcelColumn("id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 派工编号
|
||||
*/
|
||||
@ExcelColumn("派工编号")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 派工名称
|
||||
*/
|
||||
@ExcelColumn("派工名称")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 状态:0:待处理;1:处理中;2:完成
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 单据状态
|
||||
*/
|
||||
@ExcelColumn("单据状态")
|
||||
private String stateDesc;
|
||||
|
||||
/**
|
||||
* 类型:0:工单;1:定检;2:培训;3:个案;4:回访;5:安装调试
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 类型描述
|
||||
*/
|
||||
@ExcelColumn("派工类型")
|
||||
private String typeDesc;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
@ExcelColumn("设备编号")
|
||||
private String deviceNo;
|
||||
|
||||
@ExcelColumn("资产信息")
|
||||
private String assetInfo;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
@ExcelColumn("客户名称")
|
||||
private String customerName;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
@ExcelColumn("派工地址")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 执行人类型,1:内部用户;2:外部用户
|
||||
*/
|
||||
private Integer handlerUserType;
|
||||
|
||||
/**
|
||||
* 执行人id
|
||||
*/
|
||||
private Long handlerUserId;
|
||||
|
||||
/**
|
||||
* 执行人
|
||||
*/
|
||||
@ExcelColumn("派工执行人")
|
||||
private String handlerUserName;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@ExcelColumn("派工任务描述")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 代理商名称
|
||||
*/
|
||||
@ExcelColumn("代理商名称")
|
||||
private String agentName;
|
||||
|
||||
/**
|
||||
* 计划开始日期
|
||||
*/
|
||||
@ExcelColumn("计划开始日期")
|
||||
private String planStartDate;
|
||||
|
||||
/**
|
||||
* 计划完成日期
|
||||
*/
|
||||
@ExcelColumn("计划完成日期")
|
||||
private String planEndDate;
|
||||
|
||||
/**
|
||||
* 实际开始日期
|
||||
*/
|
||||
@ExcelColumn("实际开始日期")
|
||||
private String actualStartDate;
|
||||
|
||||
/**
|
||||
* 实际结束日期
|
||||
*/
|
||||
@ExcelColumn("实际结束日期")
|
||||
private String actualEndDate;
|
||||
|
||||
/**
|
||||
* 是否延期
|
||||
*/
|
||||
@JsonProperty("isDelay")
|
||||
private boolean isDelay;
|
||||
|
||||
/**
|
||||
* 是否延期
|
||||
*/
|
||||
@ExcelColumn("是否延期")
|
||||
private String isDelayDesc;
|
||||
|
||||
/**
|
||||
* 延期结束日期
|
||||
*/
|
||||
// @ExcelColumn("延期日期")
|
||||
private String delayEndDate;
|
||||
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@ExcelColumn("完结时间")
|
||||
private LocalDateTime completeDate;
|
||||
|
||||
/**
|
||||
* 计划执行天数
|
||||
*/
|
||||
@ExcelColumn("计划执行天数")
|
||||
private long planNum;
|
||||
|
||||
/**
|
||||
* 是否按时完成
|
||||
*/
|
||||
@ExcelColumn("是否按时完成")
|
||||
private String isOntime = "";
|
||||
|
||||
/**
|
||||
* 延期原因
|
||||
*/
|
||||
private String delayReason;
|
||||
|
||||
/**
|
||||
* 实际执行天数
|
||||
*/
|
||||
private Long actualNum;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Integer createById;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@ExcelColumn("派单人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ExcelColumn("派单日期")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 延期申请id
|
||||
*/
|
||||
private Long applyforId;
|
||||
}
|
||||
|
|
@ -44,12 +44,7 @@ public class ProductHonorServiceImpl extends ServiceImpl<ProductHonorMapper, Pro
|
|||
@Override
|
||||
public Integer add(ProductHonorAddRequest request) {
|
||||
ProductHonor productHonor = new ProductHonor()
|
||||
.setTitle(request.getItems().stream()
|
||||
.filter(it-> StrUtil.equals(it.getLanguageCode(), Constant.DEFAULT_LANGUAGE_CODE))
|
||||
.findFirst()
|
||||
.get()
|
||||
.getTitle()
|
||||
.trim())
|
||||
.setTitle(request.getItems().get(0).getTitle().trim())
|
||||
.setObtainingTime(request.getObtainingTime())
|
||||
.setBatchNumber(request.getBatchNumber())
|
||||
.setEnable(request.getEnable())
|
||||
|
|
|
|||
|
|
@ -42,13 +42,8 @@ public class ProductPartServiceImpl extends ServiceImpl<ProductPartMapper, Produ
|
|||
@Transactional
|
||||
@Override
|
||||
public void add(ProductPartAddRequest request) {
|
||||
ProductPartInfoAddRequest cn=request.getItems().stream()
|
||||
.filter(it-> StrUtil.equals(it.getLanguageCode(), Constant.DEFAULT_LANGUAGE_CODE))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(cn)).throwMessage("必须包含中文数据");
|
||||
ProductPart part = new ProductPart()
|
||||
.setName(cn.getName())
|
||||
.setName(request.getItems().get(0).getName())
|
||||
.setAttrId(request.getAttrId())
|
||||
.setDescribe(request.getDescribe())
|
||||
.setCreateBy(AdminUserUtil.getUserName())
|
||||
|
|
@ -60,14 +55,9 @@ public class ProductPartServiceImpl extends ServiceImpl<ProductPartMapper, Produ
|
|||
@Transactional
|
||||
@Override
|
||||
public void update(ProductPartUpdateRequest request) {
|
||||
ProductPartInfoAddRequest cn = request.getItems().stream()
|
||||
.filter(it -> StrUtil.equals(it.getLanguageCode(), Constant.DEFAULT_LANGUAGE_CODE))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(cn)).throwMessage("必须包含中文数据");
|
||||
lambdaUpdate()
|
||||
.set(ProductPart::getAttrId, request.getAttrId())
|
||||
.set(ProductPart::getName, cn.getName())
|
||||
.set(ProductPart::getName, request.getItems().get(0).getName())
|
||||
.set(ProductPart::getDescribe, request.getDescribe())
|
||||
.set(ProductPart::getUpdateBy, AdminUserUtil.getUserName())
|
||||
.set(ProductPart::getUpdateTime, LocalDateTime.now())
|
||||
|
|
|
|||
|
|
@ -51,14 +51,9 @@ public class ProductSeriesServiceImpl extends ServiceImpl<ProductSeriesMapper, P
|
|||
@Transactional
|
||||
@Override
|
||||
public Integer add(ProductSeriesAddRequest request) {
|
||||
ProductSeriesInfoAddRequest cn=request.getItems().stream()
|
||||
.filter(it-> StrUtil.equals(it.getLanguageCode(), Constant.DEFAULT_LANGUAGE_CODE))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(cn)).throwMessage("必须包含中文数据");
|
||||
ProductSeries productSeries = new ProductSeries()
|
||||
.setModuleId(request.getModuleId())
|
||||
.setName(cn.getName().trim())
|
||||
.setName(request.getItems().get(0).getName().trim())
|
||||
.setBatchNumber(IdUtil.getSnowflakeNextIdStr())
|
||||
.setSort(RandomUtil.randomInt(0,10000))
|
||||
.setCreateBy(AdminUserUtil.getUserName())
|
||||
|
|
@ -88,13 +83,8 @@ public class ProductSeriesServiceImpl extends ServiceImpl<ProductSeriesMapper, P
|
|||
save(info);
|
||||
productSeriesInfoService.add(info.getId(), request.getItems());
|
||||
} else {
|
||||
ProductSeriesInfoAddRequest cn = request.getItems().stream()
|
||||
.filter(it -> StrUtil.equals(it.getLanguageCode(), Constant.DEFAULT_LANGUAGE_CODE))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(cn)).throwMessage("必须包含中文数据");
|
||||
info.setModuleId(request.getModuleId());
|
||||
info.setName(cn.getName().trim());
|
||||
info.setName(request.getItems().get(0).getName().trim());
|
||||
// info.setSort(request.getSort());
|
||||
info.setUpdateBy(AdminUserUtil.getUserName());
|
||||
info.setUpdateTime(LocalDateTime.now());
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import java.util.Objects;
|
|||
* <p>
|
||||
* 产品中心-产品类型 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
|
|
@ -43,7 +42,7 @@ import java.util.Objects;
|
|||
public class ProductTypeServiceImpl extends ServiceImpl<ProductTypeMapper, ProductType> implements IProductTypeService {
|
||||
|
||||
@Resource
|
||||
private IProductTypeInfoService productTypeInfoService;
|
||||
private IProductTypeInfoService productTypeInfoService;
|
||||
|
||||
@Resource
|
||||
private IProductTypeFileService productTypeFileService;
|
||||
|
|
@ -54,17 +53,12 @@ public class ProductTypeServiceImpl extends ServiceImpl<ProductTypeMapper, Produ
|
|||
@Transactional
|
||||
@Override
|
||||
public Integer add(ProductTypeAddRequest request) {
|
||||
ProductTypeInfoAddRequest cn=request.getItems().stream()
|
||||
.filter(it-> StrUtil.equals(it.getLanguageCode(), Constant.DEFAULT_LANGUAGE_CODE))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(cn)).throwMessage("必须包含中文数据");
|
||||
ProductType productType = new ProductType()
|
||||
.setModuleId(request.getModuleId())
|
||||
.setSeriesNumber(request.getSeriesNumber())
|
||||
.setBatchNumber(request.getBatchNumber())
|
||||
.setName(cn.getName().trim())
|
||||
.setSort(RandomUtil.randomInt(0,10000))
|
||||
.setName(request.getItems().get(0).getName().trim())
|
||||
.setSort(RandomUtil.randomInt(0, 10000))
|
||||
.setCreateBy(AdminUserUtil.getUserName())
|
||||
.setCreateTime(LocalDateTime.now());
|
||||
save(productType);
|
||||
|
|
@ -73,17 +67,17 @@ public class ProductTypeServiceImpl extends ServiceImpl<ProductTypeMapper, Produ
|
|||
.setId(productType.getId())
|
||||
.setState(PublishState.Published.getState()));
|
||||
}
|
||||
productTypeInfoService.add(productType.getId(),request.getItems());
|
||||
List<ProductFileAddRequest> files=new ArrayList<>();
|
||||
request.getItems().forEach(item->{
|
||||
if (CollectionUtil.isNotEmpty(item.getFiles())){
|
||||
item.getFiles().forEach(file->{
|
||||
productTypeInfoService.add(productType.getId(), request.getItems());
|
||||
List<ProductFileAddRequest> files = new ArrayList<>();
|
||||
request.getItems().forEach(item -> {
|
||||
if (CollectionUtil.isNotEmpty(item.getFiles())) {
|
||||
item.getFiles().forEach(file -> {
|
||||
file.setLanguageCode(item.getLanguageCode());
|
||||
files.add(file);
|
||||
});
|
||||
}
|
||||
});
|
||||
productTypeFileService.add(productType.getId(),files);
|
||||
productTypeFileService.add(productType.getId(), files);
|
||||
return productType.getId();
|
||||
}
|
||||
|
||||
|
|
@ -97,12 +91,7 @@ public class ProductTypeServiceImpl extends ServiceImpl<ProductTypeMapper, Produ
|
|||
return id;
|
||||
// baseMapper.copyItems(request.getId(), id);
|
||||
} else {
|
||||
ProductTypeInfoAddRequest cn=request.getItems().stream()
|
||||
.filter(it-> StrUtil.equals(it.getLanguageCode(), Constant.DEFAULT_LANGUAGE_CODE))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(cn)).throwMessage("必须包含中文数据");
|
||||
info.setName(cn.getName().trim());
|
||||
info.setName(request.getItems().get(0).getName().trim());
|
||||
info.setModuleId(request.getModuleId());
|
||||
info.setSeriesNumber(request.getSeriesNumber());
|
||||
// info.setSort(request.getSort());
|
||||
|
|
@ -115,9 +104,9 @@ public class ProductTypeServiceImpl extends ServiceImpl<ProductTypeMapper, Produ
|
|||
.setState(PublishState.Published.getState()));
|
||||
}
|
||||
productTypeInfoService.update(request.getItems());
|
||||
List<ProductFileAddRequest> files=new ArrayList<>();
|
||||
request.getItems().forEach(item->{
|
||||
if (CollectionUtil.isNotEmpty(item.getFiles())){
|
||||
List<ProductFileAddRequest> files = new ArrayList<>();
|
||||
request.getItems().forEach(item -> {
|
||||
if (CollectionUtil.isNotEmpty(item.getFiles())) {
|
||||
files.addAll(item.getFiles());
|
||||
}
|
||||
});
|
||||
|
|
@ -128,7 +117,7 @@ public class ProductTypeServiceImpl extends ServiceImpl<ProductTypeMapper, Produ
|
|||
|
||||
@Override
|
||||
public Page<ProductTypeSearchVO> getList(ProductTypeSearchRequest request) {
|
||||
return baseMapper.getList(request,new Page<>(request.getPage(), request.getPageSize()));
|
||||
return baseMapper.getList(request, new Page<>(request.getPage(), request.getPageSize()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -142,17 +131,17 @@ public class ProductTypeServiceImpl extends ServiceImpl<ProductTypeMapper, Produ
|
|||
|
||||
@Override
|
||||
public void enable(EnableRequest request) {
|
||||
ProductType info=getById(request.getId());
|
||||
ProductType info = getById(request.getId());
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(info)).throwMessage("无效的数据");
|
||||
if (request.getEnable()){
|
||||
if (request.getEnable()) {
|
||||
//启用
|
||||
info.setEnable(true);
|
||||
info.setUpdateBy(AdminUserUtil.getUserName());
|
||||
info.setUpdateTime(LocalDateTime.now());
|
||||
updateById(info);
|
||||
}else {
|
||||
} else {
|
||||
//禁用
|
||||
VUtils.trueThrowBusinessError(Objects.equals(info.getState(),PublishState.Published.getState()))
|
||||
VUtils.trueThrowBusinessError(Objects.equals(info.getState(), PublishState.Published.getState()))
|
||||
.throwMessage("不能禁用已发布的数据");
|
||||
info.setEnable(false);
|
||||
info.setUpdateBy(AdminUserUtil.getUserName());
|
||||
|
|
@ -244,7 +233,7 @@ public class ProductTypeServiceImpl extends ServiceImpl<ProductTypeMapper, Produ
|
|||
VUtils.trueThrowBusinessError(Objects.isNull(info)).throwMessage("无效的数据");
|
||||
List<ProductTypeInfoAddRequest> items = productTypeInfoService.getInfo(typeId);
|
||||
items.forEach(item -> {
|
||||
item.setFiles(productTypeFileService.getInfo(typeId,item.getLanguageCode()));
|
||||
item.setFiles(productTypeFileService.getInfo(typeId, item.getLanguageCode()));
|
||||
});
|
||||
return new ProductTypeInfoVO()
|
||||
.setId(info.getId())
|
||||
|
|
@ -308,22 +297,22 @@ public class ProductTypeServiceImpl extends ServiceImpl<ProductTypeMapper, Produ
|
|||
|
||||
@Override
|
||||
public ProductTypeLanguageInfoVO getInfoByLanguage(String typeNumber, String language) {
|
||||
return productTypeInfoService.getInfoByLanguage(typeNumber,language);
|
||||
return productTypeInfoService.getInfoByLanguage(typeNumber, language);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProductTypeSimpleVO> getSimpleListByLanguage(String batchNumber, String language) {
|
||||
return baseMapper.getSimpleListByLanguage(batchNumber,language);
|
||||
return baseMapper.getSimpleListByLanguage(batchNumber, language);
|
||||
}
|
||||
|
||||
private void delete(Integer typeId){
|
||||
ProductType info=getById(typeId);
|
||||
private void delete(Integer typeId) {
|
||||
ProductType info = getById(typeId);
|
||||
removeById(typeId);
|
||||
productTypeInfoService.delete(Collections.singletonList(typeId));
|
||||
productTypeFileService.delete(Collections.singletonList(typeId));
|
||||
if(!lambdaQuery()
|
||||
if (!lambdaQuery()
|
||||
.eq(ProductType::getSeriesNumber, info.getSeriesNumber())
|
||||
.exists()){
|
||||
.exists()) {
|
||||
log.info("删除对应的设备机型数据");
|
||||
productModelService.deleteByParent(info.getBatchNumber());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,12 @@
|
|||
or dv.customer_name like concat('%',#{request.key},'%')
|
||||
)
|
||||
</if>
|
||||
<if test="request.ids!=null">
|
||||
AND da.id in
|
||||
<foreach collection="request.ids" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY usort DESC,da.state,da.plan_start_date DESC,da.id DESC
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@
|
|||
,t.create_time AS 'createTime',t.solve_time AS 'completeTime',di.name AS 'warrantyStatusDesc',d.device_type AS 'deviceType'
|
||||
,d.model_no AS 'equipmentModel',d.shipment_date AS 'shipmentDate',IF(tf.id IS NULL, false, true) AS 'followed'
|
||||
,auc.user_name AS 'cqm',t.update_time AS 'closeTime',auh.user_name AS 'currentHandle',dt2.cqm_person_name AS 'cqms'
|
||||
,t.handle_name AS 'handle',t.description,t.throughput
|
||||
,t.handle_name AS 'handle',t.description,t.throughput,t.accident_level
|
||||
FROM gongfu_ticket t
|
||||
LEFT JOIN app_user u ON t.user_id=u.id
|
||||
LEFT JOIN admin_user au ON t.user_id=au.id
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
<select id="get" resultType="com.nflg.mobilebroken.common.pojo.vo.ProductHonorVO">
|
||||
SELECT ph.id,YEAR(ph.obtaining_time) AS 'year',phi.title,phi.image
|
||||
FROM product_honor ph
|
||||
LEFT JOIN product_honor_info phi ON phi.honor_id=ph.id AND phi.language_code=#{language}
|
||||
INNER JOIN product_honor_info phi ON phi.honor_id=ph.id AND phi.language_code=#{language}
|
||||
WHERE ph.enable=1 AND ph.state=1
|
||||
ORDER BY ph.obtaining_time DESC, ph.id DESC
|
||||
</select>
|
||||
|
|
|
|||
Loading…
Reference in New Issue