|  | @@ -11,9 +11,11 @@ import org.nutz.dao.Chain;
 | 
	
		
			
				|  |  |  import org.nutz.dao.Cnd;
 | 
	
		
			
				|  |  |  import org.nutz.dao.Dao;
 | 
	
		
			
				|  |  |  import org.nutz.dao.Sqls;
 | 
	
		
			
				|  |  | +import org.nutz.dao.sql.Criteria;
 | 
	
		
			
				|  |  |  import org.nutz.dao.sql.Sql;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | +import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.time.LocalDateTime;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
	
		
			
				|  | @@ -36,6 +38,7 @@ public class GameMonitorAlarmServiceImpl implements IGameMonitorAlarmService {
 | 
	
		
			
				|  |  |      @DubboReference(providedBy = ErpServer.SERVER_DUBBO_NAME)
 | 
	
		
			
				|  |  |      private IDingTalkMsgRpc dingTalkMsgRpc;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |      public boolean sendMsgToUser() {
 | 
	
		
			
				|  |  |          //数据库查表
 | 
	
		
			
				|  |  |          Sql sql = Sqls.create(getMonitorAlarmInfoSql());
 | 
	
	
		
			
				|  | @@ -43,18 +46,29 @@ public class GameMonitorAlarmServiceImpl implements IGameMonitorAlarmService {
 | 
	
		
			
				|  |  |          sql.setEntity(dao.getEntity(GameMonitorAlarmVO.class));
 | 
	
		
			
				|  |  |          dao.execute(sql);
 | 
	
		
			
				|  |  |          //结果
 | 
	
		
			
				|  |  | -        List<GameMonitorAlarmVO> list = sql.getList(GameMonitorAlarmVO.class).stream().map(vo -> {
 | 
	
		
			
				|  |  | -            if (vo.getRoleId() == 784836198449371267L) {
 | 
	
		
			
				|  |  | -                String s = alarmStr(vo);
 | 
	
		
			
				|  |  | -                dingTalkMsgRpc.sendByUserId(401L, alarmStr(vo));
 | 
	
		
			
				|  |  | -                dao.update(AdsMonitorAlarm.class, Chain.make("warn_status", 1),
 | 
	
		
			
				|  |  | -                        Cnd.where("role_id", "=", "784836198449371267"));
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            return vo;
 | 
	
		
			
				|  |  | -        }).collect(Collectors.toList());
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        //修改数据库 状态值
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +        try{
 | 
	
		
			
				|  |  | +            List<GameMonitorAlarmVO> list = sql.getList(GameMonitorAlarmVO.class).stream().map(vo -> {
 | 
	
		
			
				|  |  | +                dingTalkMsgRpc.sendByUserId(vo.getPitcherId(), alarmStr(vo));
 | 
	
		
			
				|  |  | +                //更新的条件
 | 
	
		
			
				|  |  | +                Criteria cri = Cnd.cri();
 | 
	
		
			
				|  |  | +                if (vo.getId() != null) {
 | 
	
		
			
				|  |  | +                    cri.where().andEquals("id", vo.getId());
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if (vo.getDt() != null) {
 | 
	
		
			
				|  |  | +                    cri.where().andEquals("dt", vo.getDt());
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if (vo.getGameId() != null) {
 | 
	
		
			
				|  |  | +                    cri.where().andEquals("gameId", vo.getGameId());
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if (vo.getUserId() != null) {
 | 
	
		
			
				|  |  | +                    cri.where().andEquals("userId", vo.getUserId());
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                dao.update(AdsMonitorAlarm.class, Chain.make("warn_status", 1), cri);
 | 
	
		
			
				|  |  | +                return vo;
 | 
	
		
			
				|  |  | +            }).toList();
 | 
	
		
			
				|  |  | +        } catch (Exception e) {
 | 
	
		
			
				|  |  | +            log.error("游戏监控告警出错,原因:{}", e.getMessage(), e);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          return true;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 |