feat: 一些调整
This commit is contained in:
parent
a7487dcafa
commit
2c85fcff65
|
|
@ -163,16 +163,16 @@ public class AppUserController extends ControllerBase {
|
|||
return ApiResult.success(appUserService.searchAppUserForAdmin(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取代理商子账号列表
|
||||
*
|
||||
* @param id 主账号id
|
||||
*/
|
||||
@GetMapping("getChildrenOfAppUser")
|
||||
@MethodInfoMark(value = "获取代理商子账号列表", menuName = "代理商管理")
|
||||
public ApiResult<List<AppUserForAdminVO>> getChildrenOfAppUser(@Valid @RequestParam Integer id) {
|
||||
return ApiResult.success(appUserService.getChildrenOfAppUser(id));
|
||||
}
|
||||
// /**
|
||||
// * 获取代理商子账号列表
|
||||
// *
|
||||
// * @param id 主账号id
|
||||
// */
|
||||
// @GetMapping("getChildrenOfAppUser")
|
||||
// @MethodInfoMark(value = "获取代理商子账号列表", menuName = "代理商管理")
|
||||
// public ApiResult<List<AppUserForAdminVO>> getChildrenOfAppUser(@Valid @RequestParam Integer id) {
|
||||
// return ApiResult.success(appUserService.getChildrenOfAppUser(id));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 启用/禁用代理商
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import java.time.Instant;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -43,8 +42,10 @@ public class TiketController extends ControllerBase {
|
|||
@Resource
|
||||
private ITicketFollowService ticketFollowService;
|
||||
|
||||
// @Resource
|
||||
// private ITicketChatService ticketChatService;
|
||||
@Resource
|
||||
private ITicketChatService ticketChatService;
|
||||
private TicketChatService ticketChatService;
|
||||
|
||||
@Resource
|
||||
private IAppUserService appUserService;
|
||||
|
|
@ -107,6 +108,14 @@ public class TiketController extends ControllerBase {
|
|||
@PostMapping("/addTiket")
|
||||
public ApiResult<Void> addTiket(@Valid @RequestBody TicketAddRequest request) {
|
||||
Integer ticketId = ticketService.add(request, AppUserUtil.getUserId());
|
||||
ticketChatService.add(new TicketChat()
|
||||
.setTicketId(ticketId)
|
||||
.setMessages(Collections.singletonList(new ChatMessageVO()
|
||||
.setFrom("system")
|
||||
.setSenderId(0)
|
||||
.setSenderName("服务助手")
|
||||
.setCreateTime(Instant.now())
|
||||
.setContent("<b>正在为您分派工程师,请稍后</b><br/>工程师将尽快回复您,如需补充信息,请继续留言。"))));
|
||||
adminMessageService.addCQMNotify(ticketId);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
|
@ -171,11 +180,7 @@ public class TiketController extends ControllerBase {
|
|||
**/
|
||||
@GetMapping("getChatMessages")
|
||||
public ApiResult<List<ChatMessageVO>> getChatMessages(@Valid @RequestParam @NotNull Integer ticketId) {
|
||||
TicketChat ticketChat=ticketChatService.findByTicketId(ticketId);
|
||||
if (Objects.isNull(ticketChat)){
|
||||
return ApiResult.success(Collections.emptyList());
|
||||
}
|
||||
return ApiResult.success(ticketChat.getMessages());
|
||||
return ApiResult.success(ticketChatService.getMessages(ticketId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -185,11 +190,17 @@ public class TiketController extends ControllerBase {
|
|||
@PostMapping("addChatMessage")
|
||||
public ApiResult<Void> addChatMessage(@Valid @RequestBody AddChatMessageRequest request){
|
||||
ChatMessageVO message = new ChatMessageVO()
|
||||
.setSenderId(Integer.toString(AppUserUtil.getUserId()))
|
||||
.setFrom("app")
|
||||
.setSenderId(AppUserUtil.getUserId())
|
||||
.setSenderName(AppUserUtil.getUserName())
|
||||
.setContent(request.getContent())
|
||||
.setCreateTime(Instant.now())
|
||||
.setAttachments(request.getAttachments());
|
||||
ticketChatService.pushMessage(request.getTicketId(),message);
|
||||
// ticketChatService.pushMessage(request.getTicketId(),message);
|
||||
// TicketChat chat=ticketChatService.findByTicketId(request.getTicketId());
|
||||
// chat.getMessages().add(message);
|
||||
// ticketChatService.save(chat);
|
||||
ticketChatService.addMessage(request.getTicketId(), message);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,31 +2,41 @@ package com.nflg.mobilebroken.common.pojo.request;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class AccountAddRequest {
|
||||
|
||||
//登录名称
|
||||
@NotBlank
|
||||
private String loginName;
|
||||
|
||||
//用户名
|
||||
@NotBlank
|
||||
private String userName;
|
||||
|
||||
//手机号码
|
||||
private String phone;
|
||||
|
||||
//邮箱
|
||||
@NotBlank
|
||||
private String email;
|
||||
|
||||
//部门id
|
||||
@NotNull
|
||||
private Integer departmentId;
|
||||
|
||||
//职位id
|
||||
@NotNull
|
||||
private Integer titleId;
|
||||
|
||||
//用户号
|
||||
@NotBlank
|
||||
private String userCode;
|
||||
|
||||
//是否启用
|
||||
@NotNull
|
||||
private Boolean enabled;
|
||||
|
||||
//头像
|
||||
|
|
|
|||
|
|
@ -34,5 +34,5 @@ public class MenuAddRequest {
|
|||
|
||||
// 是否显示
|
||||
@NotNull
|
||||
private boolean isShow;
|
||||
private boolean show;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import lombok.experimental.Accessors;
|
|||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
|
|
@ -63,4 +64,7 @@ public class AppUserForAdminVO {
|
|||
|
||||
//是否主账号
|
||||
private boolean isPrimary;
|
||||
|
||||
//下级账号
|
||||
private List<AppUserForAdminVO> children;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,11 @@ import java.util.List;
|
|||
@Accessors(chain = true)
|
||||
public class ChatMessageVO {
|
||||
|
||||
//来源
|
||||
private String from;
|
||||
|
||||
// 发送者id
|
||||
private String senderId;
|
||||
private Integer senderId;
|
||||
|
||||
// 发送者名称
|
||||
private String senderName;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public class MenuVO {
|
|||
private boolean enable;
|
||||
|
||||
// 是否显示
|
||||
private boolean isShow;
|
||||
private boolean show;
|
||||
|
||||
// 创建人
|
||||
private String createBy;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
package com.nflg.mobilebroken.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 后台-菜单
|
||||
|
|
@ -56,7 +58,8 @@ public class AdminMenu implements Serializable {
|
|||
/**
|
||||
* 是否显示
|
||||
*/
|
||||
private Boolean isShow;
|
||||
@TableField(value = "`show`")
|
||||
private Boolean show;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.nflg.mobilebroken.repository.entity;
|
|||
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ChatMessageVO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
|
|
@ -9,6 +10,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Document(collection = "TicketChat")
|
||||
public class TicketChat {
|
||||
|
||||
|
|
@ -18,4 +20,4 @@ public class TicketChat {
|
|||
private Integer ticketId;
|
||||
|
||||
private List<ChatMessageVO> messages = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.nflg.mobilebroken.repository.service;
|
||||
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ChatMessageVO;
|
||||
import com.nflg.mobilebroken.repository.entity.TicketChat;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.data.mongodb.core.query.Update;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class TicketChatService {
|
||||
|
||||
@Resource
|
||||
private MongoTemplate mongoTemplate;
|
||||
|
||||
public void add(TicketChat ticketChat) {
|
||||
mongoTemplate.save(ticketChat);
|
||||
}
|
||||
|
||||
public List<ChatMessageVO> getMessages(Integer ticketId) {
|
||||
Query query = new Query(Criteria.where("ticketId").is(ticketId));
|
||||
TicketChat ticketChat = mongoTemplate.findOne(query, TicketChat.class);
|
||||
if (Objects.isNull(ticketChat)) {
|
||||
return Collections.emptyList();
|
||||
} else {
|
||||
return ticketChat.getMessages();
|
||||
}
|
||||
}
|
||||
|
||||
public void addMessage(Integer ticketId, ChatMessageVO newMessage) {
|
||||
// 创建查询条件,查找 ticketId = ticketId 的 TicketChat
|
||||
Query query = new Query(Criteria.where("ticketId").is(ticketId));
|
||||
// 创建更新操作,向 messages 列表中添加新消息
|
||||
Update update = new Update().push("messages", newMessage);
|
||||
// 执行更新操作
|
||||
mongoTemplate.findAndModify(query, update, TicketChat.class);
|
||||
}
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@ public class AdminMenuServiceImpl extends ServiceImpl<AdminMenuMapper, AdminMenu
|
|||
.setUrl(request.getUrl())
|
||||
.setSort(request.getSort())
|
||||
.setEnable(request.isEnable())
|
||||
.setIsShow(request.isShow())
|
||||
.setShow(request.isShow())
|
||||
.setParentId(request.getParentId())
|
||||
.setCreateBy(AdminUserUtil.getUserName())
|
||||
.setCreateTime(LocalDateTime.now());
|
||||
|
|
@ -87,7 +87,7 @@ public class AdminMenuServiceImpl extends ServiceImpl<AdminMenuMapper, AdminMenu
|
|||
.setUrl(request.getUrl())
|
||||
.setSort(request.getSort())
|
||||
.setEnable(request.isEnable())
|
||||
.setIsShow(request.isShow())
|
||||
.setShow(request.isShow())
|
||||
.setParentId(request.getParentId())
|
||||
.setUpdateBy(AdminUserUtil.getUserName())
|
||||
.setUpdateTime(LocalDateTime.now());
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.chrono.ChronoLocalDate;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -178,25 +179,27 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
|
|||
if (Objects.nonNull(d.getUpdateBy())) {
|
||||
updateBy = getById(d.getUpdateBy()).getName();
|
||||
}
|
||||
List<Integer> companyIds = Arrays.stream(d.getCompanyId().split(",")).filter(StrUtil::isNotBlank).map(Integer::valueOf).collect(Collectors.toList());
|
||||
List<String> customers = customerService.listByIds(companyIds).stream().map(TBaseCustomer::getAgencyCompanyName).collect(Collectors.toList());
|
||||
return new AppUserForAdminVO()
|
||||
.setId(d.getId())
|
||||
.setAvatar(d.getAvatar())
|
||||
.setLoginName(d.getLoginName())
|
||||
.setUserName(d.getName())
|
||||
.setCompanyName(d.getCompanyId())
|
||||
.setCompanyName(StrUtil.join(",", customers))
|
||||
.setName(d.getSalesUserName())
|
||||
.setEmail(d.getEmail())
|
||||
.setSalesUserName(d.getSalesUserName())
|
||||
.setAreaName(area.getName())
|
||||
.setEnable(d.getEnable())
|
||||
.setEnable(d.getEnable())
|
||||
.setExpireTime(d.getExpireTime())
|
||||
.setCreateBy(appUser.getName())
|
||||
.setCreateTime(d.getCreateTime())
|
||||
.setUpdateBy(updateBy)
|
||||
.setPrimary(true)
|
||||
.setState(d.getExpireTime().isAfter(ChronoLocalDate.from(LocalDateTime.now())) ? 1 : 2)
|
||||
.setLastLoginTime(d.getLastLoginTime());
|
||||
.setLastLoginTime(d.getLastLoginTime())
|
||||
.setChildren(getChildrenOfAppUser(d.getId()));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.nflg.mobilebroken.repository.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
|
@ -62,12 +63,10 @@ public class ParamConfigServiceImpl extends ServiceImpl<ParamConfigMapper, Param
|
|||
|
||||
@Override
|
||||
public PageData<ParamConfigVO> search(SearchConfigRequest request) {
|
||||
IPage<ParamConfig> page = new Page<>();
|
||||
page.setCurrent(request.getPage());
|
||||
page.setSize(request.getPageSize());
|
||||
lambdaQuery().like(ParamConfig::getName, request.getName())
|
||||
.like(ParamConfig::getCode, request.getCode())
|
||||
.page(page);
|
||||
IPage<ParamConfig> page = lambdaQuery()
|
||||
.like(StrUtil.isNotBlank(request.getName()), ParamConfig::getName, request.getName())
|
||||
.like(StrUtil.isNotBlank(request.getCode()), ParamConfig::getCode, request.getCode())
|
||||
.page(new Page<>(request.getPage(), request.getPageSize()));
|
||||
if (CollectionUtil.isEmpty(page.getRecords())) {
|
||||
return new PageData<>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ public class CodeGenerator {
|
|||
.enableChainModel()
|
||||
.enableFileOverride();
|
||||
builder.controllerBuilder().disable();
|
||||
builder.addExclude("admin_menu");
|
||||
})
|
||||
.templateEngine(new FreemarkerTemplateEngine())
|
||||
.execute();
|
||||
|
|
|
|||
Loading…
Reference in New Issue