Compare commits
10 Commits
b48c639f27
...
34df03ebd9
| Author | SHA1 | Date |
|---|---|---|
|
|
34df03ebd9 | |
|
|
381b9ec5f8 | |
|
|
0642a7f1cf | |
|
|
04d2482850 | |
|
|
fb5a57d9fc | |
|
|
40993513dd | |
|
|
e9b3a581ab | |
|
|
e0571e24b3 | |
|
|
32ee948087 | |
|
|
8d215772fe |
|
|
@ -1,14 +1,22 @@
|
|||
package com.nflg.mobilebroken.admin.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.nflg.mobilebroken.common.pojo.ApiResult;
|
||||
import com.nflg.mobilebroken.common.pojo.request.TranslateWordRequest;
|
||||
import com.nflg.mobilebroken.common.util.AdminUserUtil;
|
||||
import com.nflg.mobilebroken.common.util.VUtils;
|
||||
import com.nflg.mobilebroken.repository.entity.Language;
|
||||
import com.nflg.mobilebroken.repository.service.IDictionaryItemService;
|
||||
import com.nflg.mobilebroken.repository.service.ILanguageService;
|
||||
import com.nflg.mobilebroken.starter.service.ITranslate;
|
||||
import com.nflg.mobilebroken.starter.service.impl.DeepSeekTranslate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 翻译相关
|
||||
|
|
@ -23,6 +31,9 @@ public class TranslateController extends ControllerBase{
|
|||
@Resource
|
||||
private DeepSeekTranslate deepSeekTranslate;
|
||||
|
||||
@Resource
|
||||
private ILanguageService languageService;
|
||||
|
||||
/**
|
||||
* 文字翻译
|
||||
* @param request 请求参数
|
||||
|
|
@ -39,8 +50,16 @@ public class TranslateController extends ControllerBase{
|
|||
* @return 翻译结果
|
||||
*/
|
||||
@PostMapping("deepseek")
|
||||
public ApiResult<String> deepseek(@RequestParam String text) {
|
||||
public ApiResult<String> deepseek(HttpServletRequest request, @RequestParam String text) {
|
||||
String languageCode = request.getHeader("language");
|
||||
if (StrUtil.isBlank(languageCode)) {
|
||||
return ApiResult.success("");
|
||||
}
|
||||
Language language = languageService.lambdaQuery().eq(Language::getCode, languageCode).one();
|
||||
if (Objects.isNull(language)) {
|
||||
return ApiResult.success("");
|
||||
}
|
||||
text = text.replaceAll("<br>", ",");
|
||||
return ApiResult.success(deepSeekTranslate.translateWord(text, "auto", AdminUserUtil.getLanguageName(), "text"));
|
||||
return ApiResult.success(deepSeekTranslate.translateWord(text, "auto", language.getName(), "text"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
package com.nflg.mobilebroken.cfs.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.nflg.mobilebroken.common.pojo.ApiResult;
|
||||
import com.nflg.mobilebroken.common.util.AppUserUtil;
|
||||
import com.nflg.mobilebroken.repository.entity.Language;
|
||||
import com.nflg.mobilebroken.repository.service.ILanguageService;
|
||||
import com.nflg.mobilebroken.starter.service.impl.DeepSeekTranslate;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
|
@ -9,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 翻译相关
|
||||
|
|
@ -20,13 +25,24 @@ public class TranslateController extends ControllerBase {
|
|||
@Resource
|
||||
private DeepSeekTranslate deepSeekTranslate;
|
||||
|
||||
@Resource
|
||||
private ILanguageService languageService;
|
||||
|
||||
/**
|
||||
* deepseek翻译
|
||||
* @param text 要翻译的文本
|
||||
* @return 翻译结果
|
||||
*/
|
||||
@PostMapping("deepseek")
|
||||
public ApiResult<String> deepseek(@RequestParam String text) {
|
||||
return ApiResult.success(deepSeekTranslate.translateWord(text, "auto", AppUserUtil.getLanguageName(), "text"));
|
||||
public ApiResult<String> deepseek(HttpServletRequest request, @RequestParam String text) {
|
||||
String languageCode = request.getHeader("language");
|
||||
if (StrUtil.isBlank(languageCode)) {
|
||||
return ApiResult.success("");
|
||||
}
|
||||
Language language = languageService.lambdaQuery().eq(Language::getCode, languageCode).one();
|
||||
if (Objects.isNull(language)) {
|
||||
return ApiResult.success("");
|
||||
}
|
||||
return ApiResult.success(deepSeekTranslate.translateWord(text, "auto", language.getName(), "text"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,4 +20,9 @@ public class SolutionMeasuresVO {
|
|||
|
||||
// 是否审核通过,默认为null,表示未审核;false:不通过,true:通过
|
||||
private Boolean approved;
|
||||
|
||||
/**
|
||||
* 部件列表
|
||||
*/
|
||||
private List<ComponentInfo> components;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,6 @@ public class DeviceComponentController extends ControllerBase {
|
|||
.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()
|
||||
|
|
@ -108,6 +107,7 @@ public class DeviceComponentController extends ControllerBase {
|
|||
.findFirst()
|
||||
.orElseGet(() -> {
|
||||
GongFuDeviceTypeVO v = new GongFuDeviceTypeVO()
|
||||
.setId(p.getId())
|
||||
.setProductLine(p.getProductLine());
|
||||
datas.add(v);
|
||||
return v;
|
||||
|
|
|
|||
|
|
@ -669,6 +669,7 @@ public class TicketController extends ControllerBase {
|
|||
.setDeviceAddress(ticket.getDeviceAddress())
|
||||
.setModelNo(device.getModelNo())
|
||||
.setDeviceType(device.getDeviceType())
|
||||
.setComponentId(ticket.getComponentId())
|
||||
.setComponent(Objects.nonNull(part) ? part.getPartName() : "")
|
||||
.setUseTime(ticket.getUseTime())
|
||||
.setDescription(ticket.getDescription())
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ import java.util.List;
|
|||
@Accessors(chain = true)
|
||||
public class GongFuDeviceTypeVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 产品线
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -47,5 +47,5 @@ public interface DeviceMapper extends BaseMapper<Device> {
|
|||
|
||||
List<DeviceAgentVO> getAgents();
|
||||
|
||||
List<ComponentInfo> getComponents1(String modelNo, String language);
|
||||
List<ComponentInfo> getComponents1(String productLine, String language);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.nflg.mobilebroken.common.constant.Constant;
|
||||
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
|
||||
import com.nflg.mobilebroken.common.pojo.request.SearchDeviceRequest;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ComponentInfo;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DeviceAgentVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DeviceInfoVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DeviceVO;
|
||||
|
|
@ -39,7 +40,7 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
|||
if (Objects.equals(vo.getType(), 0)) {
|
||||
vo.setComponents(baseMapper.getComponents(vo.getModelNo(), MultilingualUtil.getLanguage()));
|
||||
} else {
|
||||
vo.setComponents(baseMapper.getComponents1(vo.getModelNo(), MultilingualUtil.getLanguage()));
|
||||
vo.setComponents(baseMapper.getComponents1(vo.getProductLine(), MultilingualUtil.getLanguage()));
|
||||
}
|
||||
}
|
||||
return Optional.ofNullable(vo).orElse(new DeviceInfoVO());
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.nflg.mobilebroken.common.constant.Constant;
|
|||
import com.nflg.mobilebroken.common.constant.TicketState;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.TicketDTO;
|
||||
import com.nflg.mobilebroken.common.pojo.request.SolutionMeasuresSaveRequest;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DeviceInfoVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.SolutionMeasuresDataItemVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.SolutionMeasuresItemVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.SolutionMeasuresVO;
|
||||
|
|
@ -56,6 +57,9 @@ public class TicketSolutionServiceImpl extends ServiceImpl<TicketSolutionMapper,
|
|||
@Resource
|
||||
private IFileUploadRecordService fileUploadRecordService;
|
||||
|
||||
@Resource
|
||||
private IDeviceService deviceService;
|
||||
|
||||
@Override
|
||||
public SolutionMeasuresVO getSolutionMeasures(Long ticketId) {
|
||||
TicketDTO ticket = ticketService.getDto(ticketId);
|
||||
|
|
@ -129,6 +133,12 @@ public class TicketSolutionServiceImpl extends ServiceImpl<TicketSolutionMapper,
|
|||
}
|
||||
}
|
||||
vo.setMeasures(items);
|
||||
if (Objects.equals(ticket.getType(), 1)) {
|
||||
DeviceInfoVO deviceInfoVO = deviceService.getByDeviceNo(ticket.getDeviceNo());
|
||||
if (Objects.nonNull(deviceInfoVO)) {
|
||||
vo.setComponents(deviceInfoVO.getComponents());
|
||||
}
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -144,6 +144,6 @@
|
|||
inner join gongfu_device_component dc ON dc.id = dcd.device_component_id
|
||||
INNER JOIN gongfu_device_part p ON dcd.model_part_id = p.id
|
||||
LEFT JOIN gongfu_device_part_language_data ld ON dcd.model_part_id = ld.source_id
|
||||
WHERE p.enable=1 AND dc.`enable` = 1 AND dc.model_no=#{modelNo} AND ld.language_code=#{language}
|
||||
WHERE p.enable=1 AND dc.`enable` = 1 AND dc.product_line=#{productLine} AND ld.language_code=#{language}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue