|
|
@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.ydtech.constants.InsuranceImageEnum;
|
|
|
import com.ydtech.constants.SysConstants;
|
|
|
+import com.ydtech.constants.enums.dict.organization.OrganizationSource;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.core.page.PageResult;
|
|
|
import com.ydtech.exception.SystemException;
|
|
|
@@ -21,10 +22,7 @@ import com.ydtech.modules.admin.components.UnionPayRequestApiComponent;
|
|
|
import com.ydtech.modules.admin.components.request.UnionPayRequest;
|
|
|
import com.ydtech.modules.admin.components.response.UnionPayResponse;
|
|
|
import com.ydtech.modules.admin.constants.*;
|
|
|
-import com.ydtech.modules.admin.dao.SysDeptMapper;
|
|
|
-import com.ydtech.modules.admin.dao.SysPartnerMapper;
|
|
|
-import com.ydtech.modules.admin.dao.SysUserLinkAreaMapper;
|
|
|
-import com.ydtech.modules.admin.dao.SysUserMapper;
|
|
|
+import com.ydtech.modules.admin.dao.*;
|
|
|
import com.ydtech.modules.admin.model.*;
|
|
|
import com.ydtech.modules.admin.model.dto.*;
|
|
|
import com.ydtech.modules.admin.model.po.SysUserAgentTrack;
|
|
|
@@ -44,7 +42,9 @@ import com.ydtech.modules.esm.model.vo.EsmUserImageVo;
|
|
|
import com.ydtech.modules.esm.service.EsmUserImageService;
|
|
|
import com.ydtech.modules.esm.service.EsmUserReferrerService;
|
|
|
import com.ydtech.modules.message.constants.MessageTypeConstants;
|
|
|
+import com.ydtech.modules.message.entity.SystemMessage;
|
|
|
import com.ydtech.modules.message.service.MessageSecretaryService;
|
|
|
+import com.ydtech.modules.message.service.SystemMessageService;
|
|
|
import com.ydtech.modules.protocol.utils.AssertionUtils;
|
|
|
import com.ydtech.security.utils.PasswordUtils;
|
|
|
import com.ydtech.utils.IDCardUtils;
|
|
|
@@ -142,6 +142,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
@Autowired
|
|
|
private SysUserBankCardService bankCardService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SystemMessageService systemMessageService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysUserRoleMapper sysUserRoleMapper;
|
|
|
+
|
|
|
@Value("${httpUrl}")
|
|
|
private String httpUrl;
|
|
|
//晋掌柜APP: 未注册的手机号登录时创建新账户使用 -deptId -referrerId
|
|
|
@@ -872,6 +878,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
SysUserInfo userInfo = sysUserVo.getSysUserInfo();
|
|
|
userInfo.setId(sysUser.getId());
|
|
|
sysUserInfoService.save(userInfo);
|
|
|
+ //站内信发送
|
|
|
+ pushMessageOrder(sysUser);
|
|
|
} else {
|
|
|
userId = gainNextUserId(sysUser.getDeptId());
|
|
|
|
|
|
@@ -896,6 +904,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
//如果是 团队长或代码人 并且没有推荐人 则默认推荐人为自己
|
|
|
esmUserReferrerService.addReferrer(sysUser.getId(), userId);
|
|
|
}
|
|
|
+ if ("20".equals(sysUser.getRoleId())) {
|
|
|
+ //如果是添加代理人则发送站内信
|
|
|
+ pushMessageAgent(sysUser);
|
|
|
+ }
|
|
|
SysUserInfo userInfo = sysUserVo.getSysUserInfo();
|
|
|
if (userInfo != null) {
|
|
|
if (null != userInfo.getLiveAddressString() && userInfo.getLiveAddressString().length > 0) {
|
|
|
@@ -914,6 +926,102 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
return HttpResult.ok("新增成功");
|
|
|
}
|
|
|
|
|
|
+ //新增出单员发送新增站内信
|
|
|
+ private void pushMessageOrder(SysUser sysUser) {
|
|
|
+ //获取有渠道管理权限的用户ID
|
|
|
+ List<SysUserRole> sysUserRoles = sysUserRoleMapper.selectBymenuId(454);
|
|
|
+ List<SysUserRole> sysUserRoleList = sysUserRoles.stream()
|
|
|
+ .filter(user -> !StringUtils.isNullOrEmpty(user))
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ List<SystemMessage> systemMessageList = new ArrayList<>();
|
|
|
+
|
|
|
+ SysUser user = BaseController.getUser();
|
|
|
+ StringBuilder loger = new StringBuilder()
|
|
|
+ .append(user.getId())
|
|
|
+ .append(user.getName());
|
|
|
+ Date date = new Date();
|
|
|
+ String dateString = new SimpleDateFormat("yyyy-MM-dd").format(date);
|
|
|
+ map.put("${添加人员账号姓名}", loger.toString());
|
|
|
+ map.put("${创建时间}", dateString);
|
|
|
+ map.put("${出单员姓名}", sysUser.getName());
|
|
|
+ map.put("${出单员工号}", sysUser.getId());
|
|
|
+ String content = systemMessageService.makeMessage(MessageModelConstants.MODEL_1.getContent(), map, null);
|
|
|
+ StringBuilder highLight = new StringBuilder()
|
|
|
+ .append(loger).append(";")
|
|
|
+ .append(dateString).append(";")
|
|
|
+ .append(sysUser.getName()).append(";")
|
|
|
+ .append(sysUser.getId()).append(";");
|
|
|
+
|
|
|
+ for (SysUserRole sysUserRole : sysUserRoleList) {
|
|
|
+ SystemMessage systemMessage = new SystemMessage();
|
|
|
+ systemMessage.setClassify(MessageConstants.CLASSIFY_3.getCode());
|
|
|
+ systemMessage.setType(MessageConstants.TYPE_1.getCode());
|
|
|
+ systemMessage.setTitle(MessageModelConstants.MODEL_1.getTitle());
|
|
|
+ systemMessage.setContent(content);
|
|
|
+ systemMessage.setJump("1");
|
|
|
+ systemMessage.setJumpUrl(MessageModelConstants.MODEL_1.getUrl());
|
|
|
+ systemMessage.setSenderId(BaseController.getUserId());
|
|
|
+ systemMessage.setReceiverId(sysUserRole.getUserId());
|
|
|
+ systemMessage.setState("0");
|
|
|
+ systemMessage.setHighLight(highLight.toString());
|
|
|
+ systemMessage.setSendTime(date);
|
|
|
+ systemMessageList.add(systemMessage);
|
|
|
+ }
|
|
|
+ systemMessageService.addSystemMessageList(systemMessageList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //代理人新增 发送审核站内信
|
|
|
+ private void pushMessageAgent(SysUser sysUser) {
|
|
|
+ //获取有代理人审核权限的用户ID
|
|
|
+ List<SysUserRole> sysUserRoles = sysUserRoleMapper.selectBymenuId(98);
|
|
|
+ List<SysUserRole> sysUserRoleList = sysUserRoles.stream()
|
|
|
+ .filter(user -> !StringUtils.isNullOrEmpty(user))
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ String managementSource = new String();
|
|
|
+ SysDept dept = sysDeptService.getById(sysUser.getDeptId());
|
|
|
+ if (!StringUtils.isNullOrEmpty(dept))
|
|
|
+ managementSource = dept.getManagementSource();
|
|
|
+
|
|
|
+
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ List<SystemMessage> systemMessageList = new ArrayList<>();
|
|
|
+
|
|
|
+ Date date = new Date();
|
|
|
+ String dateString = new SimpleDateFormat("yyyy-MM-dd").format(date);
|
|
|
+ map.put("${人员类型}", OrganizationSource.getDescByCode(managementSource));
|
|
|
+ map.put("${审核数据生成时间}", dateString);
|
|
|
+ map.put("${待审核人员姓名}", sysUser.getName());
|
|
|
+ map.put("${待审核人员工号}", sysUser.getId());
|
|
|
+ String content = systemMessageService.makeMessage(MessageModelConstants.MODEL_2.getContent(), map, null);
|
|
|
+ StringBuilder highLight = new StringBuilder()
|
|
|
+ .append(OrganizationSource.getDescByCode(managementSource)).append(";")
|
|
|
+ .append(dateString).append(";")
|
|
|
+ .append(sysUser.getName()).append(";")
|
|
|
+ .append(sysUser.getId()).append(";");
|
|
|
+
|
|
|
+ for (SysUserRole sysUserRole : sysUserRoleList) {
|
|
|
+ SystemMessage systemMessage = new SystemMessage();
|
|
|
+ systemMessage.setClassify(MessageConstants.CLASSIFY_3.getCode());
|
|
|
+ systemMessage.setType(MessageConstants.TYPE_2.getCode());
|
|
|
+ systemMessage.setTitle(MessageModelConstants.MODEL_2.getTitle());
|
|
|
+ systemMessage.setContent(content);
|
|
|
+ systemMessage.setJump("1");
|
|
|
+ systemMessage.setJumpUrl(MessageModelConstants.MODEL_2.getUrl());
|
|
|
+ systemMessage.setSenderId(BaseController.getUserId());
|
|
|
+ systemMessage.setReceiverId(sysUserRole.getUserId());
|
|
|
+ systemMessage.setState("0");
|
|
|
+ systemMessage.setHighLight(highLight.toString());
|
|
|
+ systemMessage.setSendTime(date);
|
|
|
+ systemMessageList.add(systemMessage);
|
|
|
+ }
|
|
|
+ systemMessageService.addSystemMessageList(systemMessageList);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public SysUser saveUserJzgInfo(SysUser2Vo sysUserVo) {
|