소스 검색

新增项目修改

anderx 1 년 전
부모
커밋
a9dece120c

+ 10 - 0
src/main/java/com/goafanti/business/service/impl/RestrictProjectServiceImpl.java

@@ -7,8 +7,10 @@ import com.goafanti.business.bo.UserRestrictProjectBo;
 import com.goafanti.business.service.RestrictProjectService;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.*;
+import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.*;
+import com.goafanti.common.utils.AsyncUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
@@ -34,6 +36,10 @@ public class RestrictProjectServiceImpl extends BaseMybatisDao<RestrictProjectMa
     private UserMapper userMapper;
     @Resource
     private AdminMapper adminMapper;
+    @Resource
+    private AsyncUtils asyncUtils;
+    @Resource
+    private BusinessProjectMapper businessProjectMapper;
 
 
 
@@ -71,6 +77,10 @@ public class RestrictProjectServiceImpl extends BaseMybatisDao<RestrictProjectMa
         ub.setRemarks("领取限定项目触发");
         userBusinessMapper.insertSelective(ub);
         addUserLog(in,0);
+        User user = userMapper.selectByPrimaryKey(in.getUid());
+        BusinessProject businessProject = businessProjectMapper.selectByPrimaryKey(in.getPid());
+        String str =String.format("客户:%s,已被营销员%s领取了【限定项目:%s】",user.getNickname(),TokenManager.getAdminToken().getName(),businessProject.getBname());
+        asyncUtils.addNoticAndEmail(new Notice(user.getAid(), NoticeStatus.RECEIVE_RESTRICT_PROJECT.getCode(),str));
         return 1;
     }
 

+ 1 - 0
src/main/java/com/goafanti/common/enums/NoticeStatus.java

@@ -87,6 +87,7 @@ public enum NoticeStatus {
 
 	RESTRICT_PROJECT_LOSE30_REMIND(78,"限时私有项目释放提醒"),
 	RESTRICT_PROJECT_LOSE270_REMIND(79,"限时签单项目释放提醒"),
+	RECEIVE_RESTRICT_PROJECT(80,"领取限定项目"),
 	OTHER(0, "其他");
 
 	private NoticeStatus(Integer code, String desc) {

+ 20 - 4
src/main/java/com/goafanti/common/model/Notice.java

@@ -1,13 +1,13 @@
 package com.goafanti.common.model;
 
-import java.util.Date;
-
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.enums.NoticeTypes;
 import org.apache.commons.lang3.time.DateFormatUtils;
 
-import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.enums.NoticeStatus;
 import java.io.Serializable;
+import java.util.Date;
+import java.util.UUID;
 
 public class Notice implements Serializable {
 	/**
@@ -330,6 +330,22 @@ public class Notice implements Serializable {
 		this.content=content;
 	}
 
+	/**
+	 *
+	 * @param aid 接收人
+	 * @param noticeType 接受类型
+	 * @param content 内容
+	 */
+	public Notice(String aid,Integer noticeType,String content) {
+		this.id= UUID.randomUUID().toString();
+		this.createTime=new Date();
+		this.readed=0;
+		this.aid=aid;
+		this.noticeType=noticeType;
+		this.type= NoticeTypes.getType(noticeType);
+		this.content=content;
+	}
+
 
 
 	public String getNoticeTypeName(){