Browse Source

定时任务修改环境提示

Administrator 4 years ago
parent
commit
29e87f142b

+ 4 - 1
src/main/java/com/goafanti/common/task/OrderDunTask.java

@@ -13,6 +13,7 @@ import javax.mail.MessagingException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Controller;
@@ -63,6 +64,8 @@ public class OrderDunTask {
 	private PaymentNodeMapper	paymentNodeMapper;
 	@Autowired
 	private OrderProjectService	orderProjectService;
+	@Value(value = "${dev.name}")
+	private String devName=null;
 	@Autowired
 	private AsyncUtils	asyncUtils;
 	Logger							logger	= LoggerFactory.getLogger(OrderDunTask.class);
@@ -140,7 +143,7 @@ public class OrderDunTask {
 		}
   		
   		} catch (Exception e) {
-  			EmailBo emailBo = new EmailBo( "催款处理失败",  AFTConstants.ADMIN_EMAIL,  "超管", "平台",  "系统", "催款处理失败");
+  			EmailBo emailBo = new EmailBo( "催款处理失败",  AFTConstants.ADMIN_EMAIL,  "超管", "平台",  "系统", devName+"催款处理失败");
 			try {
 				asyncUtils.send(emailBo);
 			} catch (UnsupportedEncodingException | MessagingException e1) {

+ 4 - 4
src/main/java/com/goafanti/common/task/ReleaseUserTask.java

@@ -10,6 +10,7 @@ import javax.annotation.Resource;
 import javax.mail.MessagingException;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Controller;
@@ -20,7 +21,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import com.goafanti.common.bo.EmailBo;
 import com.goafanti.common.bo.userDaysBo;
 import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.dao.NoticeMapper;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.model.Notice;
 import com.goafanti.common.model.User;
@@ -40,9 +40,9 @@ public class ReleaseUserTask {
 	private UserService userService;
 	@Autowired
 	private AsyncUtils	asyncUtils;
+	@Value(value = "${dev.name}")
+	private String devName=null;
 	
-	@Autowired
-	private NoticeMapper	noticeMapper;
 
 	int pointsDataLimit = 50;
 
@@ -188,7 +188,7 @@ public class ReleaseUserTask {
 			Notice n = new Notice(UUID.randomUUID().toString(), new Date(), 0, "1",
 					NoticeStatus.TASK_PATENT_ERROR.getCode(), "==============客户释放失败================",null);
 			asyncUtils.addNotice(n);
-			EmailBo emailBo = new EmailBo("释放客户失败", AFTConstants.ADMIN_EMAIL, "超管", "平台", "系统", "释放客户失败");
+			EmailBo emailBo = new EmailBo("释放客户失败", AFTConstants.ADMIN_EMAIL, "超管", "平台", "系统", devName+"释放客户失败");
 			try {
 				asyncUtils.send(emailBo);
 			} catch (UnsupportedEncodingException | MessagingException e1) {

+ 1 - 0
src/main/resources/props/config_local.properties

@@ -1,3 +1,4 @@
+dev.name=local
 #Driver
 jdbc.driverClassName=com.mysql.jdbc.Driver
 #本地

+ 1 - 0
src/main/resources/props/config_test.properties

@@ -1,3 +1,4 @@
+dev.name=test
 #Driver
 jdbc.driverClassName=com.mysql.jdbc.Driver
 #\u6570\u636e\u5e93\u94fe\u63a5\uff0c