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;
|
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.ApiResult;
|
||||||
import com.nflg.mobilebroken.common.pojo.request.TranslateWordRequest;
|
import com.nflg.mobilebroken.common.pojo.request.TranslateWordRequest;
|
||||||
import com.nflg.mobilebroken.common.util.AdminUserUtil;
|
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.ITranslate;
|
||||||
import com.nflg.mobilebroken.starter.service.impl.DeepSeekTranslate;
|
import com.nflg.mobilebroken.starter.service.impl.DeepSeekTranslate;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 翻译相关
|
* 翻译相关
|
||||||
|
|
@ -23,6 +31,9 @@ public class TranslateController extends ControllerBase{
|
||||||
@Resource
|
@Resource
|
||||||
private DeepSeekTranslate deepSeekTranslate;
|
private DeepSeekTranslate deepSeekTranslate;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ILanguageService languageService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文字翻译
|
* 文字翻译
|
||||||
* @param request 请求参数
|
* @param request 请求参数
|
||||||
|
|
@ -39,8 +50,16 @@ public class TranslateController extends ControllerBase{
|
||||||
* @return 翻译结果
|
* @return 翻译结果
|
||||||
*/
|
*/
|
||||||
@PostMapping("deepseek")
|
@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>", ",");
|
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;
|
package com.nflg.mobilebroken.cfs.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.nflg.mobilebroken.common.pojo.ApiResult;
|
import com.nflg.mobilebroken.common.pojo.ApiResult;
|
||||||
import com.nflg.mobilebroken.common.util.AppUserUtil;
|
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 com.nflg.mobilebroken.starter.service.impl.DeepSeekTranslate;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
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 org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 翻译相关
|
* 翻译相关
|
||||||
|
|
@ -20,13 +25,24 @@ public class TranslateController extends ControllerBase {
|
||||||
@Resource
|
@Resource
|
||||||
private DeepSeekTranslate deepSeekTranslate;
|
private DeepSeekTranslate deepSeekTranslate;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ILanguageService languageService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* deepseek翻译
|
* deepseek翻译
|
||||||
* @param text 要翻译的文本
|
* @param text 要翻译的文本
|
||||||
* @return 翻译结果
|
* @return 翻译结果
|
||||||
*/
|
*/
|
||||||
@PostMapping("deepseek")
|
@PostMapping("deepseek")
|
||||||
public ApiResult<String> deepseek(@RequestParam String text) {
|
public ApiResult<String> deepseek(HttpServletRequest request, @RequestParam String text) {
|
||||||
return ApiResult.success(deepSeekTranslate.translateWord(text, "auto", AppUserUtil.getLanguageName(), "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:通过
|
// 是否审核通过,默认为null,表示未审核;false:不通过,true:通过
|
||||||
private Boolean approved;
|
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())
|
.like(StrUtil.isNotBlank(query.getProductLine()), GongfuDeviceComponent::getProductLine, query.getProductLine())
|
||||||
.list();
|
.list();
|
||||||
List<GongfuDeviceComponentDetail> details = deviceComponentDetailService.list();
|
List<GongfuDeviceComponentDetail> details = deviceComponentDetailService.list();
|
||||||
details.forEach(d -> d.setId(d.getDeviceComponentId()));
|
|
||||||
List<GongFuDeviceTypeVO> datas = new ArrayList<>();
|
List<GongFuDeviceTypeVO> datas = new ArrayList<>();
|
||||||
productLines.forEach(p -> {
|
productLines.forEach(p -> {
|
||||||
GongFuDeviceTypeVO vo = datas.stream()
|
GongFuDeviceTypeVO vo = datas.stream()
|
||||||
|
|
@ -108,6 +107,7 @@ public class DeviceComponentController extends ControllerBase {
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElseGet(() -> {
|
.orElseGet(() -> {
|
||||||
GongFuDeviceTypeVO v = new GongFuDeviceTypeVO()
|
GongFuDeviceTypeVO v = new GongFuDeviceTypeVO()
|
||||||
|
.setId(p.getId())
|
||||||
.setProductLine(p.getProductLine());
|
.setProductLine(p.getProductLine());
|
||||||
datas.add(v);
|
datas.add(v);
|
||||||
return v;
|
return v;
|
||||||
|
|
|
||||||
|
|
@ -669,6 +669,7 @@ public class TicketController extends ControllerBase {
|
||||||
.setDeviceAddress(ticket.getDeviceAddress())
|
.setDeviceAddress(ticket.getDeviceAddress())
|
||||||
.setModelNo(device.getModelNo())
|
.setModelNo(device.getModelNo())
|
||||||
.setDeviceType(device.getDeviceType())
|
.setDeviceType(device.getDeviceType())
|
||||||
|
.setComponentId(ticket.getComponentId())
|
||||||
.setComponent(Objects.nonNull(part) ? part.getPartName() : "")
|
.setComponent(Objects.nonNull(part) ? part.getPartName() : "")
|
||||||
.setUseTime(ticket.getUseTime())
|
.setUseTime(ticket.getUseTime())
|
||||||
.setDescription(ticket.getDescription())
|
.setDescription(ticket.getDescription())
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ import java.util.List;
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class GongFuDeviceTypeVO {
|
public class GongFuDeviceTypeVO {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 产品线
|
* 产品线
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -47,5 +47,5 @@ public interface DeviceMapper extends BaseMapper<Device> {
|
||||||
|
|
||||||
List<DeviceAgentVO> getAgents();
|
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.constant.Constant;
|
||||||
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
|
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
|
||||||
import com.nflg.mobilebroken.common.pojo.request.SearchDeviceRequest;
|
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.DeviceAgentVO;
|
||||||
import com.nflg.mobilebroken.common.pojo.vo.DeviceInfoVO;
|
import com.nflg.mobilebroken.common.pojo.vo.DeviceInfoVO;
|
||||||
import com.nflg.mobilebroken.common.pojo.vo.DeviceVO;
|
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)) {
|
if (Objects.equals(vo.getType(), 0)) {
|
||||||
vo.setComponents(baseMapper.getComponents(vo.getModelNo(), MultilingualUtil.getLanguage()));
|
vo.setComponents(baseMapper.getComponents(vo.getModelNo(), MultilingualUtil.getLanguage()));
|
||||||
} else {
|
} else {
|
||||||
vo.setComponents(baseMapper.getComponents1(vo.getModelNo(), MultilingualUtil.getLanguage()));
|
vo.setComponents(baseMapper.getComponents1(vo.getProductLine(), MultilingualUtil.getLanguage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Optional.ofNullable(vo).orElse(new DeviceInfoVO());
|
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.constant.TicketState;
|
||||||
import com.nflg.mobilebroken.common.pojo.dto.TicketDTO;
|
import com.nflg.mobilebroken.common.pojo.dto.TicketDTO;
|
||||||
import com.nflg.mobilebroken.common.pojo.request.SolutionMeasuresSaveRequest;
|
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.SolutionMeasuresDataItemVO;
|
||||||
import com.nflg.mobilebroken.common.pojo.vo.SolutionMeasuresItemVO;
|
import com.nflg.mobilebroken.common.pojo.vo.SolutionMeasuresItemVO;
|
||||||
import com.nflg.mobilebroken.common.pojo.vo.SolutionMeasuresVO;
|
import com.nflg.mobilebroken.common.pojo.vo.SolutionMeasuresVO;
|
||||||
|
|
@ -56,6 +57,9 @@ public class TicketSolutionServiceImpl extends ServiceImpl<TicketSolutionMapper,
|
||||||
@Resource
|
@Resource
|
||||||
private IFileUploadRecordService fileUploadRecordService;
|
private IFileUploadRecordService fileUploadRecordService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IDeviceService deviceService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SolutionMeasuresVO getSolutionMeasures(Long ticketId) {
|
public SolutionMeasuresVO getSolutionMeasures(Long ticketId) {
|
||||||
TicketDTO ticket = ticketService.getDto(ticketId);
|
TicketDTO ticket = ticketService.getDto(ticketId);
|
||||||
|
|
@ -129,6 +133,12 @@ public class TicketSolutionServiceImpl extends ServiceImpl<TicketSolutionMapper,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vo.setMeasures(items);
|
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;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,6 @@
|
||||||
inner join gongfu_device_component dc ON dc.id = dcd.device_component_id
|
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
|
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
|
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>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue