fix: 修复一些问题

This commit is contained in:
曹鹏飞 2025-03-07 15:42:29 +08:00
parent 1a42618421
commit e2df5c07d0
13 changed files with 110 additions and 38 deletions

View File

@ -89,7 +89,7 @@
<dependency> <dependency>
<groupId>org.xhtmlrenderer</groupId> <groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf</artifactId> <artifactId>flying-saucer-pdf</artifactId>
<version>9.1.22</version> <version>9.3.1</version>
</dependency> </dependency>
<!-- iText (required by Flying Saucer) --> <!-- iText (required by Flying Saucer) -->
<dependency> <dependency>

View File

@ -78,9 +78,6 @@ public class TicketController extends ControllerBase {
@Resource @Resource
private IAppAreaService appAreaService; private IAppAreaService appAreaService;
@Resource
private ITBaseAreaService adminAreaService;
@Resource @Resource
private IDictionaryItemService dictionaryItemService; private IDictionaryItemService dictionaryItemService;
@ -99,6 +96,9 @@ public class TicketController extends ControllerBase {
@Resource @Resource
private ITicketFavoritesService ticketFavoritesService; private ITicketFavoritesService ticketFavoritesService;
@Resource
private ITBasePartService partService;
/** /**
* 获取问题类型 * 获取问题类型
* @return 问题类型列表 * @return 问题类型列表
@ -195,6 +195,16 @@ public class TicketController extends ControllerBase {
return ApiResult.success(); return ApiResult.success();
} }
/**
* 获取所有设备部件
* @param name 部件名称模糊查询
* @return 部件列表
*/
@GetMapping("getDeviceComponents")
public ApiResult<List<String>> getDeviceComponents(@RequestParam String name){
return ApiResult.success(partService.getSimpleList(name));
}
/** /**
* 搜索工单 * 搜索工单
* @param request 请求参数 * @param request 请求参数
@ -427,9 +437,9 @@ public class TicketController extends ControllerBase {
if (StrUtil.isNotBlank(ticket.getAttachments())) { if (StrUtil.isNotBlank(ticket.getAttachments())) {
StrUtil.split(ticket.getAttachments(), ",").forEach(item -> { StrUtil.split(ticket.getAttachments(), ",").forEach(item -> {
if (item.endsWith(".jpg") || item.endsWith(".png") || item.endsWith(".jpeg")) { if (item.endsWith(".jpg") || item.endsWith(".png") || item.endsWith(".jpeg")) {
images.add(new FileInfo(item.substring(item.lastIndexOf("/")+1),item)); images.add(new FileInfo(item.substring(item.lastIndexOf("/")+1),urlEncode(item)));
} else { } else {
files.add(new FileInfo(item.substring(item.lastIndexOf("/")+1),item)); files.add(new FileInfo(item.substring(item.lastIndexOf("/")+1),urlEncode(item)));
} }
}); });
} }
@ -438,6 +448,24 @@ public class TicketController extends ControllerBase {
images.add(new FileInfo(item.substring(item.lastIndexOf("/")+1),item)); images.add(new FileInfo(item.substring(item.lastIndexOf("/")+1),item));
}); });
} }
//加上聊天中的图片和文件
List<ChatMessageVO> messageVOS=ticketChatService.getMessages(ticket.getId());
messageVOS.forEach(messageVO -> {
if (CollectionUtil.isNotEmpty(messageVO.getImages())){
messageVO.getImages().forEach(image -> {
images.add(new FileInfo(image.substring(image.lastIndexOf("/")+1),image));
});
}
if (CollectionUtil.isNotEmpty(messageVO.getAttachments())){
messageVO.getAttachments().forEach(attachment -> {
if (attachment.endsWith(".jpg") || attachment.endsWith(".png") || attachment.endsWith(".jpeg")) {
images.add(new FileInfo(attachment.substring(attachment.lastIndexOf("/")+1),urlEncode(attachment)));
} else {
files.add(new FileInfo(attachment.substring(attachment.lastIndexOf("/")+1),urlEncode(attachment)));
}
});
}
});
TicketPdfVO vo = new TicketPdfVO() TicketPdfVO vo = new TicketPdfVO()
.setNo(ticket.getNo()) .setNo(ticket.getNo())
.setTitle(ticket.getTitle()) .setTitle(ticket.getTitle())
@ -489,7 +517,7 @@ public class TicketController extends ControllerBase {
// renderer.layout(); // renderer.layout();
// renderer.createPDF(response.getOutputStream()); // renderer.createPDF(response.getOutputStream());
ITextRenderer renderer = new ITextRenderer(); ITextRenderer renderer = new ITextRenderer();
BaseFont baseFont = BaseFont.createFont("fonts/simsun.ttc,0", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); // BaseFont baseFont = BaseFont.createFont("fonts/simsun.ttc,0", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
renderer.getFontResolver().addFont("fonts/simsun.ttc", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); renderer.getFontResolver().addFont("fonts/simsun.ttc", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
renderer.setDocumentFromString(html); renderer.setDocumentFromString(html);
renderer.layout(); renderer.layout();
@ -503,6 +531,13 @@ public class TicketController extends ControllerBase {
} }
} }
private String urlEncode(String url){
int index = url.lastIndexOf("/");
String pre= url.substring(0,index+1);
String end = url.substring(index+1);
return pre+URLEncoder.encode(end, StandardCharsets.UTF_8);
}
/** /**
* 获取工单详情 * 获取工单详情
* @param id 工单编号 * @param id 工单编号

View File

@ -88,8 +88,8 @@
</tr> </tr>
<tr> <tr>
<td colspan="4"> <td colspan="4">
<div th:each="file:${ticket.files}"> <div>
<a th:href="${file.url}" th:text="${file.name}"></a> <a th:each="file:${ticket.files}" th:href="${file.url}" th:text="${file.name}"></a>
</div> </div>
</td> </td>
</tr> </tr>
@ -98,7 +98,7 @@
</tr> </tr>
<tr> <tr>
<td colspan="4"> <td colspan="4">
<div style="background-color: red;" th:each="file:${ticket.images}"> <div th:each="file:${ticket.images}">
<img class="cimg" alt="" th:src="${file.url}"/> <img class="cimg" alt="" th:src="${file.url}"/>
</div> </div>
</td> </td>

View File

@ -186,6 +186,7 @@ public class TiketController extends ControllerBase {
@GetMapping("getTicket") @GetMapping("getTicket")
public ApiResult<TicketInfoVO> getTicket(@Valid @RequestParam @NotNull Integer id) { public ApiResult<TicketInfoVO> getTicket(@Valid @RequestParam @NotNull Integer id) {
Ticket ticket = ticketService.getById(id); Ticket ticket = ticketService.getById(id);
VUtils.trueThrowBusinessError(Objects.isNull(ticket)).throwMessage("未找到工单");
AppUser user = appUserService.getById(ticket.getUserId()); AppUser user = appUserService.getById(ticket.getUserId());
String areaName; String areaName;
if (user.getIsPrimary()){ if (user.getIsPrimary()){

View File

@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.nflg.mobilebroken.cfs.service.WXQRCodeService; import com.nflg.mobilebroken.cfs.service.WXQRCodeService;
import com.nflg.mobilebroken.common.constant.Constant; import com.nflg.mobilebroken.common.constant.Constant;
import com.nflg.mobilebroken.common.constant.MessageSubType; import com.nflg.mobilebroken.common.constant.MessageSubType;
@ -265,7 +266,16 @@ public class UserController extends ControllerBase {
@PostMapping("deleteUser") @PostMapping("deleteUser")
//@SaUserCheckRole("primary") //@SaUserCheckRole("primary")
public ApiResult<Boolean> deleteUser(@Valid @RequestBody @NotEmpty List<Integer> ids){ public ApiResult<Boolean> deleteUser(@Valid @RequestBody @NotEmpty List<Integer> ids){
return ApiResult.success(appUserService.removeByIds(ids)); appUserService.remove(new LambdaQueryWrapper<AppUser>()
.eq(AppUser::getIsPrimary, false)
.eq(AppUser::getCreateBy, AppUserUtil.getUserName())
.in(AppUser::getId, ids));
appUserApplyforService.remove(new LambdaQueryWrapper<AppUserApplyfor>()
.eq(AppUserApplyfor::getState, 0)
.eq(AppUserApplyfor::getIsPrimary, false)
.eq(AppUserApplyfor::getCreateBy, AppUserUtil.getUserId())
.in(AppUserApplyfor::getId, ids));
return ApiResult.success(true);
} }
/** /**

View File

@ -32,4 +32,7 @@ public class AdminTicketSearchRequest extends TicketSearchRequest {
//收藏夹id //收藏夹id
private Integer favouritesId; private Integer favouritesId;
//区域编码
private String areaCode;
} }

View File

@ -55,7 +55,11 @@ public class AdminTicketVO {
@ExcelColumn("解决方案") @ExcelColumn("解决方案")
private String solution; private String solution;
//区域名称 //代理区域
@ExcelColumn("代理区域")
private String agentAreaName;
//区域
@ExcelColumn("区域") @ExcelColumn("区域")
private String areaName; private String areaName;

View File

@ -27,6 +27,10 @@ public class FileVO {
public String getSourceDesc() { public String getSourceDesc() {
if (source == 0) { if (source == 0) {
return "工单"; return "工单";
}else if (source==1){
return "代理商";
}else if (source==2){
return "账号";
} }
return "未知"; return "未知";
} }

View File

@ -94,6 +94,11 @@ public class AppUserApplyfor implements Serializable {
*/ */
private String salesUserName; private String salesUserName;
/**
* 是否主账号
*/
private Boolean isPrimary;
/** /**
* 创建人id * 创建人id
*/ */

View File

@ -4,9 +4,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.nflg.mobilebroken.common.pojo.dto.ExportPartDTO; import com.nflg.mobilebroken.common.pojo.dto.ExportPartDTO;
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery; import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
import com.nflg.mobilebroken.common.pojo.vo.DepartmentSimpleVO;
import com.nflg.mobilebroken.repository.entity.DeviceComponent;
import com.nflg.mobilebroken.repository.entity.TBaseDepartment;
import com.nflg.mobilebroken.repository.entity.TBasePart; import com.nflg.mobilebroken.repository.entity.TBasePart;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -25,4 +22,6 @@ public interface ITBasePartService extends IService<TBasePart> {
Page<TBasePart> selectListByPage(@Param("query") PageBaseQuery query); Page<TBasePart> selectListByPage(@Param("query") PageBaseQuery query);
List<ExportPartDTO> exportPart(@Param("partNo")String partNo, @Param("partName") String partName); List<ExportPartDTO> exportPart(@Param("partNo")String partNo, @Param("partName") String partName);
List<String> getSimpleList(String name);
} }

View File

@ -1,5 +1,6 @@
package com.nflg.mobilebroken.repository.service.impl; package com.nflg.mobilebroken.repository.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.mobilebroken.common.pojo.dto.ExportPartDTO; import com.nflg.mobilebroken.common.pojo.dto.ExportPartDTO;
@ -11,6 +12,7 @@ import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* <p> * <p>
@ -31,4 +33,15 @@ public class TBasePartServiceImpl extends ServiceImpl<TBasePartMapper, TBasePart
public List<ExportPartDTO> exportPart(@Param("partNo")String partNo, @Param("partName") String partName){ public List<ExportPartDTO> exportPart(@Param("partNo")String partNo, @Param("partName") String partName){
return this.getBaseMapper().exportPart(partNo,partName); return this.getBaseMapper().exportPart(partNo,partName);
} }
@Override
public List<String> getSimpleList(String name) {
return lambdaQuery()
.eq(TBasePart::getEnable, 1)
.like(StrUtil.isNotBlank(name),TBasePart::getPartName, name)
.list()
.stream()
.map(TBasePart::getPartName)
.collect(Collectors.toList());
}
} }

View File

@ -51,7 +51,8 @@
SELECT d.device_no AS 'deviceNo',d.device_name AS 'deviceName',d.model_no AS 'modelNo',d.device_type AS 'deviceType',d.shipment_date AS 'shipmentDate' SELECT d.device_no AS 'deviceNo',d.device_name AS 'deviceName',d.model_no AS 'modelNo',d.device_type AS 'deviceType',d.shipment_date AS 'shipmentDate'
FROM device d FROM device d
INNER JOIN t_base_customer c ON d.agent_code=c.agency_company_code INNER JOIN t_base_customer c ON d.agent_code=c.agency_company_code
WHERE d.data_valid_state=1 AND c.id IN INNER JOIN dictionary_item di ON di.id=d.device_state
WHERE d.data_valid_state=1 AND di.`code`='Normal' AND c.id IN
<foreach collection="companyIds" open="(" close=")" item="companyId" separator=","> <foreach collection="companyIds" open="(" close=")" item="companyId" separator=",">
#{companyId} #{companyId}
</foreach> </foreach>
@ -90,10 +91,10 @@
</update> </update>
<select id="getComponents" resultType="com.nflg.mobilebroken.common.pojo.vo.ComponentInfo"> <select id="getComponents" resultType="com.nflg.mobilebroken.common.pojo.vo.ComponentInfo">
SELECT dcd.model_part_name AS 'name',ld.language_value AS 'languageValue' SELECT dcd.model_part_name AS 'name', ld.language_value AS 'languageValue'
FROM device_component_detail dcd FROM device_component_detail dcd
INNER JOIN t_base_part p ON dcd.model_part_id=p.id INNER JOIN t_base_part p ON dcd.model_part_id = p.id
LEFT JOIN t_base_language_data ld ON dcd.model_part_id=ld.source_id LEFT JOIN t_base_language_data ld ON dcd.model_part_id = ld.source_id
WHERE dcd.device_component_id=#{componentId} AND ld.language_code=#{language} WHERE p.enable=1 AND dcd.device_component_id=#{componentId} AND ld.language_code=#{language}
</select> </select>
</mapper> </mapper>

View File

@ -50,8 +50,8 @@
<if test="request.companyId!=null"> <if test="request.companyId!=null">
AND u.company_id=#{request.companyId} AND u.company_id=#{request.companyId}
</if> </if>
<if test="request.areaId!=null"> <if test="request.areaCode!=null and request.areaCode!=''">
AND u.area_id=#{request.areaId} AND FIND_IN_SET(#{request.areaCode},c.area_code)>0
</if> </if>
<if test="request.question!=null and request.question!=''"> <if test="request.question!=null and request.question!=''">
AND t.question=#{request.question} AND t.question=#{request.question}
@ -78,11 +78,10 @@
</sql> </sql>
<select id="searchMy" resultType="com.nflg.mobilebroken.common.pojo.vo.TicketVO"> <select id="searchMy" resultType="com.nflg.mobilebroken.common.pojo.vo.TicketVO">
SELECT t.*,IF(u.is_primary,a1.area_name,a2.`name`) AS 'areaName',IF(tf.id IS NULL, false, true) AS 'followed' SELECT t.*,IF(u.is_primary,fun_getPrimaryUserArea(u.company_id),a2.`name`) AS 'areaName',IF(tf.id IS NULL, false, true) AS 'followed'
,u.`name` AS 'createBy',t.handle ,u.`name` AS 'createBy',t.handle
FROM ticket t FROM ticket t
LEFT JOIN app_user u ON t.user_id=u.id LEFT JOIN app_user u ON t.user_id=u.id
LEFT JOIN t_base_area a1 ON u.area_id=a1.id
LEFT JOIN app_area a2 ON u.area_id=a2.id LEFT JOIN app_area a2 ON u.area_id=a2.id
LEFT JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.user_id=#{userId} AND tf.from=0 LEFT JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.user_id=#{userId} AND tf.from=0
WHERE t.user_id=#{userId} AND t.state!=4 WHERE t.user_id=#{userId} AND t.state!=4
@ -91,10 +90,9 @@
</select> </select>
<select id="searchFollow" resultType="com.nflg.mobilebroken.common.pojo.vo.TicketVO"> <select id="searchFollow" resultType="com.nflg.mobilebroken.common.pojo.vo.TicketVO">
SELECT t.*,IF(u.is_primary,a1.area_name,a2.`name`) AS 'areaName',true AS 'followed',u.`name` AS 'createBy',true AS 'followed',t.handle SELECT t.*,IF(u.is_primary,fun_getPrimaryUserArea(u.company_id),a2.`name`) AS 'areaName',true AS 'followed',u.`name` AS 'createBy',true AS 'followed',t.handle
FROM ticket t FROM ticket t
LEFT JOIN app_user u ON t.user_id=u.id LEFT JOIN app_user u ON t.user_id=u.id
LEFT JOIN t_base_area a1 ON u.area_id=a1.id
LEFT JOIN app_area a2 ON u.area_id=a2.id LEFT JOIN app_area a2 ON u.area_id=a2.id
INNER JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.from=0 INNER JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.from=0
WHERE tf.user_id=#{userId} AND t.state!=4 WHERE tf.user_id=#{userId} AND t.state!=4
@ -103,11 +101,10 @@
</select> </select>
<select id="searchArea" resultType="com.nflg.mobilebroken.common.pojo.vo.TicketVO"> <select id="searchArea" resultType="com.nflg.mobilebroken.common.pojo.vo.TicketVO">
SELECT t.*,IF(u.is_primary,a1.area_name,a2.`name`) AS 'areaName',IF(tf.id IS NULL, false, true) AS 'followed' SELECT t.*,IF(u.is_primary,fun_getPrimaryUserArea(u.company_id),a2.`name`) AS 'areaName',IF(tf.id IS NULL, false, true) AS 'followed'
,u.`name` AS 'createBy',t.handle ,u.`name` AS 'createBy',t.handle
FROM ticket t FROM ticket t
LEFT JOIN app_user u ON t.user_id=u.id LEFT JOIN app_user u ON t.user_id=u.id
LEFT JOIN t_base_area a1 ON u.area_id=a1.id
LEFT JOIN app_area a2 ON u.area_id=a2.id LEFT JOIN app_area a2 ON u.area_id=a2.id
LEFT JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.user_id=#{userId} AND tf.from=0 LEFT JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.user_id=#{userId} AND tf.from=0
WHERE t.state!=4 AND u.company_id IN WHERE t.state!=4 AND u.company_id IN
@ -119,7 +116,8 @@
</select> </select>
<select id="searchFromAdmin" resultType="com.nflg.mobilebroken.common.pojo.vo.AdminTicketVO"> <select id="searchFromAdmin" resultType="com.nflg.mobilebroken.common.pojo.vo.AdminTicketVO">
SELECT t.id,t.`no`,t.title,t.state,t.urgency,t.component,t.question,t.solution,IF(u.is_primary,a1.area_name,a2.`name`) AS 'areaName' SELECT t.id,t.`no`,t.title,t.state,t.urgency,t.component,t.question,t.solution
,IF(u.is_primary,fun_getPrimaryUserArea(u.company_id),'') AS 'areaName',IF(u.is_primary,'',a2.`name`) AS 'agentAreaName'
,d.customer_name AS 'companyName',u.company_id AS 'companyId',u.`name` AS 'createBy',t.device_no AS 'deviceNo',t.use_time AS 'useTime' ,d.customer_name AS 'companyName',u.company_id AS 'companyId',u.`name` AS 'createBy',t.device_no AS 'deviceNo',t.use_time AS 'useTime'
,t.create_time AS 'createTime',t.update_time AS 'completeTime',di.name AS 'warrantyStatusDesc',d.device_type AS 'deviceType' ,t.create_time AS 'createTime',t.update_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' ,d.model_no AS 'equipmentModel',d.shipment_date AS 'shipmentDate',IF(tf.id IS NULL, false, true) AS 'followed',auc.user_name AS 'cqm'
@ -128,7 +126,6 @@
FROM ticket t FROM ticket t
LEFT JOIN app_user u ON t.user_id=u.id LEFT JOIN app_user u ON t.user_id=u.id
LEFT JOIN t_base_customer c ON u.company_id=c.id LEFT JOIN t_base_customer c ON u.company_id=c.id
LEFT JOIN t_base_area a1 ON u.area_id=a1.id
LEFT JOIN app_area a2 ON u.area_id=a2.id LEFT JOIN app_area a2 ON u.area_id=a2.id
LEFT JOIN device d ON t.device_no=d.device_no AND d.data_valid_state=1 LEFT JOIN device d ON t.device_no=d.device_no AND d.data_valid_state=1
LEFT JOIN t_base_device_type dt ON d.device_type=dt.device_type LEFT JOIN t_base_device_type dt ON d.device_type=dt.device_type
@ -150,7 +147,8 @@
<!-- </select>--> <!-- </select>-->
<select id="searchAllFromAdmin" resultType="com.nflg.mobilebroken.common.pojo.vo.AdminTicketVO"> <select id="searchAllFromAdmin" resultType="com.nflg.mobilebroken.common.pojo.vo.AdminTicketVO">
SELECT t.id,t.`no`,t.title,t.state,t.urgency,t.component,t.question,t.solution,IF(u.is_primary,a1.area_name,a2.`name`) AS 'areaName' SELECT t.id,t.`no`,t.title,t.state,t.urgency,t.component,t.question,t.solution
,IF(u.is_primary,fun_getPrimaryUserArea(u.company_id),'') AS 'areaName',IF(u.is_primary,'',a2.`name`) AS 'agentAreaName'
,d.customer_name AS 'companyName',u.company_id AS 'companyId',u.`name` AS 'createBy',t.device_no AS 'deviceNo',t.use_time AS 'useTime' ,d.customer_name AS 'companyName',u.company_id AS 'companyId',u.`name` AS 'createBy',t.device_no AS 'deviceNo',t.use_time AS 'useTime'
,t.create_time AS 'createTime',t.update_time AS 'completeTime',di.name AS 'warrantyStatusDesc',d.device_type AS 'deviceType' ,t.create_time AS 'createTime',t.update_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' ,d.model_no AS 'equipmentModel',d.shipment_date AS 'shipmentDate',IF(tf.id IS NULL, false, true) AS 'followed',auc.user_name AS 'cqm'
@ -159,7 +157,6 @@
FROM ticket t FROM ticket t
LEFT JOIN app_user u ON t.user_id=u.id LEFT JOIN app_user u ON t.user_id=u.id
LEFT JOIN t_base_customer c ON u.company_id=c.id LEFT JOIN t_base_customer c ON u.company_id=c.id
LEFT JOIN t_base_area a1 ON u.area_id=a1.id
LEFT JOIN app_area a2 ON u.area_id=a2.id LEFT JOIN app_area a2 ON u.area_id=a2.id
LEFT JOIN device d ON t.device_no=d.device_no AND d.data_valid_state=1 LEFT JOIN device d ON t.device_no=d.device_no AND d.data_valid_state=1
LEFT JOIN t_base_device_type dt ON d.device_type=dt.device_type LEFT JOIN t_base_device_type dt ON d.device_type=dt.device_type
@ -172,7 +169,8 @@
</select> </select>
<select id="searchFromAdminAndFollow" resultType="com.nflg.mobilebroken.common.pojo.vo.AdminTicketVO"> <select id="searchFromAdminAndFollow" resultType="com.nflg.mobilebroken.common.pojo.vo.AdminTicketVO">
SELECT t.id,t.`no`,t.title,t.state,t.urgency,t.component,t.question,t.solution,IF(u.is_primary,a1.area_name,a2.`name`) AS 'areaName' SELECT t.id,t.`no`,t.title,t.state,t.urgency,t.component,t.question,t.solution
,IF(u.is_primary,fun_getPrimaryUserArea(u.company_id),'') AS 'areaName',IF(u.is_primary,'',a2.`name`) AS 'agentAreaName'
,d.customer_name AS 'companyName',u.company_id AS 'companyId',u.`name` AS 'createBy',t.device_no AS 'deviceNo',t.use_time AS 'useTime' ,d.customer_name AS 'companyName',u.company_id AS 'companyId',u.`name` AS 'createBy',t.device_no AS 'deviceNo',t.use_time AS 'useTime'
,t.create_time AS 'createTime',t.update_time AS 'completeTime',di.name AS 'warrantyStatusDesc',d.device_type AS 'deviceType' ,t.create_time AS 'createTime',t.update_time AS 'completeTime',di.name AS 'warrantyStatusDesc',d.device_type AS 'deviceType'
,d.model_no AS 'equipmentModel',d.shipment_date AS 'shipmentDate',true AS 'followed',auc.user_name AS 'cqm' ,d.model_no AS 'equipmentModel',d.shipment_date AS 'shipmentDate',true AS 'followed',auc.user_name AS 'cqm'
@ -181,7 +179,6 @@
FROM ticket t FROM ticket t
LEFT JOIN app_user u ON t.user_id=u.id LEFT JOIN app_user u ON t.user_id=u.id
LEFT JOIN t_base_customer c ON u.company_id=c.id LEFT JOIN t_base_customer c ON u.company_id=c.id
LEFT JOIN t_base_area a1 ON u.area_id=a1.id
LEFT JOIN app_area a2 ON u.area_id=a2.id LEFT JOIN app_area a2 ON u.area_id=a2.id
INNER JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.user_id=#{userId} AND tf.from=1 INNER JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.user_id=#{userId} AND tf.from=1
LEFT JOIN device d ON t.device_no=d.device_no AND d.data_valid_state=1 LEFT JOIN device d ON t.device_no=d.device_no AND d.data_valid_state=1
@ -194,7 +191,8 @@
</select> </select>
<select id="searchAllFromAdminAndFollow" resultType="com.nflg.mobilebroken.common.pojo.vo.AdminTicketVO"> <select id="searchAllFromAdminAndFollow" resultType="com.nflg.mobilebroken.common.pojo.vo.AdminTicketVO">
SELECT t.id,t.`no`,t.title,t.state,t.urgency,t.component,t.question,t.solution,IF(u.is_primary,a1.area_name,a2.`name`) AS 'areaName' SELECT t.id,t.`no`,t.title,t.state,t.urgency,t.component,t.question,t.solution
,IF(u.is_primary,fun_getPrimaryUserArea(u.company_id),'') AS 'areaName',IF(u.is_primary,'',a2.`name`) AS 'agentAreaName'
,d.customer_name AS 'companyName',u.company_id AS 'companyId',u.`name` AS 'createBy',t.device_no AS 'deviceNo',t.use_time AS 'useTime' ,d.customer_name AS 'companyName',u.company_id AS 'companyId',u.`name` AS 'createBy',t.device_no AS 'deviceNo',t.use_time AS 'useTime'
,t.create_time AS 'createTime',t.update_time AS 'completeTime',di.name AS 'warrantyStatusDesc',true AS 'followed' ,t.create_time AS 'createTime',t.update_time AS 'completeTime',di.name AS 'warrantyStatusDesc',true AS 'followed'
,auc.user_name AS 'cqm',t.solve_time AS 'closeTime',u.name AS 'primaryUserName',auh.user_name AS 'currentHandle' ,auc.user_name AS 'cqm',t.solve_time AS 'closeTime',u.name AS 'primaryUserName',auh.user_name AS 'currentHandle'
@ -202,7 +200,6 @@
FROM ticket t FROM ticket t
LEFT JOIN app_user u ON t.user_id=u.id LEFT JOIN app_user u ON t.user_id=u.id
LEFT JOIN t_base_customer c ON u.company_id=c.id LEFT JOIN t_base_customer c ON u.company_id=c.id
LEFT JOIN t_base_area a1 ON u.area_id=a1.id
LEFT JOIN app_area a2 ON u.area_id=a2.id LEFT JOIN app_area a2 ON u.area_id=a2.id
INNER JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.user_id=#{userId} AND tf.from=1 INNER JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.user_id=#{userId} AND tf.from=1
LEFT JOIN device d ON t.device_no=d.device_no AND d.data_valid_state=1 LEFT JOIN device d ON t.device_no=d.device_no AND d.data_valid_state=1
@ -225,7 +222,8 @@
</select> </select>
<select id="searchByFavouritesId" resultType="com.nflg.mobilebroken.common.pojo.vo.AdminTicketVO"> <select id="searchByFavouritesId" resultType="com.nflg.mobilebroken.common.pojo.vo.AdminTicketVO">
SELECT t.id,t.`no`,t.title,t.state,t.urgency,t.component,t.question,t.solution,IF(u.is_primary,a1.area_name,a2.`name`) AS 'areaName' SELECT t.id,t.`no`,t.title,t.state,t.urgency,t.component,t.question,t.solution
,IF(u.is_primary,fun_getPrimaryUserArea(u.company_id),'') AS 'areaName',IF(u.is_primary,'',a2.`name`) AS 'agentAreaName'
,d.customer_name AS 'companyName',u.company_id AS 'companyId',u.`name` AS 'createBy',t.device_no AS 'deviceNo',t.use_time AS 'useTime' ,d.customer_name AS 'companyName',u.company_id AS 'companyId',u.`name` AS 'createBy',t.device_no AS 'deviceNo',t.use_time AS 'useTime'
,t.create_time AS 'createTime',t.update_time AS 'completeTime',di.name AS 'warrantyStatusDesc',d.device_type AS 'deviceType' ,t.create_time AS 'createTime',t.update_time AS 'completeTime',di.name AS 'warrantyStatusDesc',d.device_type AS 'deviceType'
,d.model_no AS 'equipmentModel',d.shipment_date AS 'shipmentDate',true AS 'followed',auc.user_name AS 'cqm' ,d.model_no AS 'equipmentModel',d.shipment_date AS 'shipmentDate',true AS 'followed',auc.user_name AS 'cqm'
@ -234,7 +232,6 @@
FROM ticket t FROM ticket t
LEFT JOIN app_user u ON t.user_id=u.id LEFT JOIN app_user u ON t.user_id=u.id
LEFT JOIN t_base_customer c ON u.company_id=c.id LEFT JOIN t_base_customer c ON u.company_id=c.id
LEFT JOIN t_base_area a1 ON u.area_id=a1.id
LEFT JOIN app_area a2 ON u.area_id=a2.id LEFT JOIN app_area a2 ON u.area_id=a2.id
INNER JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.user_id=#{userId} AND tf.from=1 AND tf.favorites_id=#{favouritesId} INNER JOIN ticket_follow tf ON t.id=tf.ticket_id AND tf.user_id=#{userId} AND tf.from=1 AND tf.favorites_id=#{favouritesId}
LEFT JOIN device d ON t.device_no=d.device_no AND d.data_valid_state=1 LEFT JOIN device d ON t.device_no=d.device_no AND d.data_valid_state=1