派生自 projectDept/qhighschool

yn147
2023-05-24 74e042960cc73002795ae5aa88ada1c31094d682
src/main/java/com/qxueyou/scc/school/service/impl/SignService.java
@@ -57,15 +57,15 @@
@Service
public class SignService extends CommonAppService implements ISignService {
   
   private static final String late = "迟到";
   private static final String late = "迟到";
   private static final String normal = "正常";
   private static final String normal = "正常";
   private static Logger log = LogManager.getLogger("SignService");
   
   private SignDAO signDAO;
//   // 签到上大屏
//   // 签到上大屏
//   @Autowired
//   IMsgVenderService  easemobService;
//   
@@ -75,7 +75,7 @@
//   @Autowired
//   ICacheService cacheService;
   
//   /** 微信业务操作  **/
//   /** 微信业务操作  **/
//   @Autowired
//   IWeixinCommonService weixinCommonService;
   
@@ -92,7 +92,7 @@
   }
   /**
     * 依赖注入
     * 依赖注入
     *
     * @param interactDAO
     */
@@ -109,7 +109,7 @@
         List<SchSign> lstSchSign = this.find("select s from SchSign s where s.classScheduleId = ? and s.deleteFlag is false and signId <> ?",
               CollectionUtils.newList(sign.getClassScheduleId(), signId), SchSign.class);
         if(lstSchSign != null && !lstSchSign.isEmpty()){
            return new Result(false, "你选择的课程已经存在签到,请不要重复添加");
            return new Result(false, "你选择的课程已经存在签到,请不要重复添加");
         }
         SchSign objSchSign = this.read(SchSign.class, signId);
         objSchSign.setUpdateId(ClientUtils.getUserId());
@@ -133,10 +133,10 @@
         List<SchSign> lstSchSign = this.find("select s from SchSign s where s.classScheduleId = ? and s.deleteFlag is false",
               CollectionUtils.newList(sign.getClassScheduleId()), SchSign.class);
         if(lstSchSign != null && !lstSchSign.isEmpty()){
            return new Result(false, "你选择的课程已经存在签到,请不要重复添加");
            return new Result(false, "你选择的课程已经存在签到,请不要重复添加");
         }
         // 获取客户端信息
         // 设置基本字段
         // 获取客户端信息
         // 设置基本字段
         String signCode = generateSignCode(ClientUtils.getClassId());
         sign.setCreateId(ClientUtils.getUserId());
         sign.setCreateTime(new Date(System.currentTimeMillis()));
@@ -160,7 +160,7 @@
//            sign.setNoticeUserId(msgUser.getUserId());
//            sign.setNoticePassword(RSAUtils.encrypt(uuidPwd));
//         }
         //添加签到码
         //添加签到码
         SchSignCode signCodeVO = new SchSignCode();
         signCodeVO.setCode(signCode);
         signCodeVO.setClassId(ClientUtils.getClassId());
@@ -179,8 +179,8 @@
   }
   
   /**
    * 生成签到码
    * @param classId 班级ID
    * 生成签到码
    * @param classId 班级ID
    * @return
    */
   private String generateSignCode(String classId){
@@ -203,14 +203,14 @@
      
      SchSignItem signItem = new SchSignItem();
      // 获取当前用户
      // 获取当前用户
      signItem.setSignId(sign.getSignId());
      signItem.setDeleteFlag(false);
      signItem.setSignAddress(signAddress);
      signItem.setSignTime(signTime);
      signItem.setUserId(userId);
      signItem.setUserName(userName);
      // 公用配置
      // 公用配置
      TraceUtils.setCreateTrace(signItem);
      
      this.save(signItem);
@@ -220,15 +220,15 @@
   
   @Override
   /**
    * 签到
    * 签到
    */
   public int insertSignOrder(SchSign signVO, Date signTime) {
      String hql = "from SchSignOrder where deleteFlag is false and signId=? ";
      
      // 该堂课已经签到多少位
      // 该堂课已经签到多少位
      int signCount =  this.findCount(hql, 
            CollectionUtils.newList(signVO.getSignId()));
      // 签到+1
      // 签到+1
      signCount++;
      
      SchSignOrder signOrder = new SchSignOrder();
@@ -239,17 +239,17 @@
      signOrder.setSignOrder(signCount);
      signOrder.setSignTime(signTime);
      
      // 公用配置
      // 公用配置
      TraceUtils.setCreateTrace(signOrder);
      
      // 保存到db
      // 保存到db
      this.save(signOrder);
      
      return signCount;
   }
   
   /**
    *  得到签到明细
    *  得到签到明细
    * @param signId
    * @return
    */
@@ -276,14 +276,14 @@
                "ORDER BY TS.START_TIME IS NULL , TS.START_TIME ASC ";
            listResult = signDAO.querySignItemList(strSQL, CollectionUtils.newList(classId,signId,signId));
      }else{
         log.error("查询签到明细失败,参数不正确:cls=".concat(ClientUtils.getClassId()).concat(";signId=").concat(signId));
         log.error("查询签到明细失败,参数不正确:cls=".concat(ClientUtils.getClassId()).concat(";signId=").concat(signId));
      }
      
      return listResult;
   }
   
   /**
    * 有一个时分秒的问题:只需要检测到分钟:9:00是标准时间  9:00:59 仍然是正常
    * 有一个时分秒的问题:只需要检测到分钟:9:00是标准时间  9:00:59 仍然是正常
    * @param realTime
    * @param standardTime
    * @return
@@ -299,7 +299,7 @@
   }
   
   /**
    * 有一个时分秒的问题:只需要检测到分钟:
    * 有一个时分秒的问题:只需要检测到分钟:
    * @param realTime
    * @param standardTime
    * @return
@@ -309,18 +309,18 @@
      if(null != realTime && null != standardTime){
         Date real = DateUtils.truncate(realTime, Calendar.MINUTE);
         Date standard = DateUtils.truncate(standardTime, Calendar.MINUTE);
         status = real.compareTo(standard) == -1 ? "早退" :normal;
         status = real.compareTo(standard) == -1 ? "早退" :normal;
      }
      return status;
   }
   
    /**
     * 插入签到统计信息
     * 插入签到统计信息
     */
   public SignStatisResult insertSignStatistics(SchSign sign, String signAddress,
         Date signTime,Short terminalType,String userId,String userName,String mobilePhone, String location) {
      User user = this.read(User.class, userId);
      //判断签到类型,1:仅上课签到;2:上下课都需签到
      //判断签到类型,1:仅上课签到;2:上下课都需签到
      SignStatisResult result = new SignStatisResult();
      short signType = sign.getSignType();
      if(SchSign.SIGN_TYPE_FIRST == signType){
@@ -337,7 +337,7 @@
   }
   
   /**
    * 查询签到当天的课次
    * 查询签到当天的课次
    * 
    * @param signId
    * @return
@@ -349,7 +349,7 @@
   }
   
   /**
    * 插入签到
    * 插入签到
    * 
    * @param signVO
    * @param signAddress
@@ -359,16 +359,16 @@
    * @return
    */
   public SignStatisResult insertSignStatistics(SchSign signVO, String signAddress, String userId, String userName, String mobilePhone, short type){
      // 签到时间
      // 签到时间
      Date signTime= new Date(System.currentTimeMillis());
      String strAddress = this.getAddress(signAddress);
      
      //3. 插入签到统计
      //3. 插入签到统计
      SignStatisResult result = this.insertSignStatistics(signVO, strAddress, signTime,type ,userId,userName,mobilePhone, signAddress);
      if(!result.getResult()){
         return new SignStatisResult(false,result.getErrMsg());
      }
      // 2.插入签到历史记录
      // 2.插入签到历史记录
      this.insertSignItem(signVO, signAddress, signTime,ClientUtils.getUserId(),ClientUtils.getUserName());
      
      List<SchSignStatistics> schSignStatisticss = this.queryPageLstSignStatistics(result.getSignStatistics(), null, result.getSignType(), signVO.getSignId());
@@ -377,12 +377,12 @@
         obj.setSignType(result.getSignType());
      }
      
      //查询班主任名字
      //查询班主任名字
      ClsClass objOrgClass = this.read(ClsClass.class, signVO.getClassId());
      
      result.setSignAddr(strAddress);
      result.setSignStatisticss(schSignStatisticss);
      //2015-08-10增加返回是否班级成员
      //2015-08-10增加返回是否班级成员
      result.setRegFlag(this.queryRegistrationFlag(ClientUtils.getUserId(), signVO.getClassId()));
      result.setClassCharger(objOrgClass.getClassCharger());
      
@@ -390,7 +390,7 @@
   }
   
   /**
    * 根据经纬度获取地址
    * 根据经纬度获取地址
    * @param location
    * @return
    */
@@ -424,7 +424,7 @@
   }
   
   /**
    * 活动签到,插入签到统计信息(上课,只有第一次插入记录)
    * 活动签到,插入签到统计信息(上课,只有第一次插入记录)
    * @param sign
    * @param signAddress
    * @param signTime
@@ -435,12 +435,12 @@
      
      int signOrder = 0;
      SignStatisResult result = new SignStatisResult();
      //1.查询是否已签到,查询当天签到情况
      //获取当天用户是否签到
      //1.查询是否已签到,查询当天签到情况
      //1.查询是否已签到,查询当天签到情况
      //获取当天用户是否签到
      //1.查询是否已签到,查询当天签到情况
      String hql = "from SchSignStatistics where deleteFlag is false and signId = ? and userId = ?";
      SchSignStatistics objSchSignStatistics = findUnique(hql,CollectionUtils.newList(sign.getSignId(), userId),SchSignStatistics.class);
      //第一次保存,以后不更新,已最早时间为准(每次更新最新签到地址)
      //第一次保存,以后不更新,已最早时间为准(每次更新最新签到地址)
      if(null != objSchSignStatistics){
         signOrder = objSchSignStatistics.getFirstSignOrder();
         objSchSignStatistics.setTerminalType(terminalType);
@@ -449,7 +449,7 @@
         save(objSchSignStatistics);
         result.setSignStatistics(objSchSignStatistics);
      }else{
         // 已经签到个数
         // 已经签到个数
         String hql1 = "from SchSignStatistics where deleteFlag is false and signId = ?";
         int signCount =  findCount(hql1,CollectionUtils.newList(sign.getSignId()));
         signOrder = signCount + 1;
@@ -473,7 +473,7 @@
         obj.setMobilePhone(mobilePhone);
         obj.setInstallFlag(queryInstallFlag(userId));
         obj.setRegisteFlag(queryRegistrationFlag(userId,sign.getClassId()));
         //第一次保存
         //第一次保存
         save(obj);
         result.setSignStatistics(obj);
      }
@@ -485,7 +485,7 @@
   }
   
   /**
    * 是否超过签到限制距离
    * 是否超过签到限制距离
    * 
    * @param signVO
    * @param signAddress
@@ -498,14 +498,14 @@
         return new Result(true);
      }
      if(StringUtils.isBlank(signAddress)){
         return new Result(false, "签到失败,未获取到签到地址,请确认是否开启定位");
         return new Result(false, "签到失败,未获取到签到地址,请确认是否开启定位");
      }
      SchScheduleAddress objSchScheduleAddress = this.read(SchScheduleAddress.class, objSchClassSchedule.getAddressId());
      if(objSchScheduleAddress == null){
         return new Result(false, "签到失败,课程签到地址设置错误,请联系班主任修正签到地址");
         return new Result(false, "签到失败,课程签到地址设置错误,请联系班主任修正签到地址");
      }
      if(StringUtils.isBlank(objSchScheduleAddress.getLatitudeY()) || StringUtils.isBlank(objSchScheduleAddress.getLongitudeX())){
         return new Result(false, "签到失败,课程签到地址设置错误,请联系班主任修正签到地址");
         return new Result(false, "签到失败,课程签到地址设置错误,请联系班主任修正签到地址");
      }
      String[] signAddresss = signAddress.split(",");
      
@@ -519,17 +519,17 @@
         objSchSignStatistics.setStatisticsFlag(SchSignStatistics.STATISTICS_FLAG_NO);
      }
      objSchSignStatistics.setOutOfRange(range*1000);
      return new Result(true, b?"":"签到成功,由于您的签到地址超出上课地址的签到范围,因此你的签到无法记录本班当日已出勤人数,请与班主任联系");
      return new Result(true, b?"":"签到成功,由于您的签到地址超出上课地址的签到范围,因此你的签到无法记录本班当日已出勤人数,请与班主任联系");
   }
   
   /**
    * 获取当天签到地址
    * 获取当天签到地址
    * 
    * @param signId
    * @return
    */
   public SchScheduleAddress getSchScheduleAddress(String signId){
      //获取签到码当天签到的课程
      //获取签到码当天签到的课程
      SchClassSchedule objSchClassSchedule = this.getSchClassSchedule(signId);
      if(objSchClassSchedule == null){
         return new SchScheduleAddress();
@@ -540,7 +540,7 @@
   }
   
   /**
    * 上课签到,插入签到统计信息(上课,只有第一次插入记录)
    * 上课签到,插入签到统计信息(上课,只有第一次插入记录)
    * @param sign
    * @param signAddress
    * @param signTime
@@ -555,19 +555,19 @@
      SignStatisResult result = new SignStatisResult();
      result.setSignType(SignStatisResult.SIGN_TYPE_FIRST);
      
      //1.查询是否已签到,查询当天签到情况
      //获取当天用户是否签到
      //1.查询是否已签到,查询当天签到情况
      //获取当天用户是否签到
      SchSignStatistics objSchSignStatistics = this.getSchSignStatistics(sign.getSignId(), userId);
      //获取签到码当天签到的课程
      //获取签到码当天签到的课程
      SchClassSchedule objSchClassSchedule = this.getSchClassSchedule(sign.getSignId());
      boolean activeFlag = queryActiveflag(userId,sign.getClassId());
      if(sign.getRegisterAllow() == 1 && !activeFlag){
         result.setErrMsg("签到失败,您还未加入该班级");
         result.setErrMsg("签到失败,您还未加入该班级");
         result.setResult(false);
         return result;
      }
      if(objSchClassSchedule == null){
         result.setErrMsg("签到失败,今天该课程未开课");
         result.setErrMsg("签到失败,今天该课程未开课");
         result.setResult(false);
         return result;
      }
@@ -576,15 +576,15 @@
      int signCount = 0;
      if(lstSchSignStatistics == null){
         String hql1 = "from SchSignStatistics where deleteFlag is false and signId = ? and date(signDate) = date(now())";
         // 已经签到个数
         // 已经签到个数
         signCount =  findCount(hql1,CollectionUtils.newList(sign.getSignId()));
      }else{
         signCount = lstSchSignStatistics.size();
      }
      //第一次保存,以后不更新,已最早时间为准(每次更新最新签到地址)
      //第一次保存,以后不更新,已最早时间为准(每次更新最新签到地址)
      if(null == objSchSignStatistics){
         
         //查询课程信息
         //查询课程信息
         SchClassSubject objSchClassSubject = this.getCommonDAO().read(SchClassSubject.class, sign.getClassScheduleId());
         signOrder = signCount + 1;
         objSchSignStatistics = new SchSignStatistics();
@@ -610,7 +610,7 @@
         objSchSignStatistics.setMobilePhone(mobilePhone);
         objSchSignStatistics.setInstallFlag(queryInstallFlag(userId));
         objSchSignStatistics.setRegisteFlag(activeFlag);
         //第一次保存
         //第一次保存
      }
      Result isOutofRange = this.isOutofRange(sign, location, objSchClassSchedule, activeFlag, objSchSignStatistics);
      if(!isOutofRange.isSuccess()){
@@ -650,21 +650,21 @@
   }
   
   /**
    * 获取当天是否已经签到
    * 获取当天是否已经签到
    * 
    * @param signId
    * @return
    */
   public SchSignStatistics getSchSignStatistics(String signId, String userId){
      //1.查询是否已签到,查询当天签到情况
      //1.查询是否已签到,查询当天签到情况
      String hql = "from SchSignStatistics where deleteFlag is false and signId = ? and userId = ? and date(signDate) = date(now())";
      return findUnique(hql,CollectionUtils.newList(signId, userId),SchSignStatistics.class);
   }
   
   /**
    *  上下课都需签到时,插入签到统计信息
    *  上课签到:调用insertSignFirst()
    *  下课签到:每次更新,按下课签到时间倒序排列
    *  上下课都需签到时,插入签到统计信息
    *  上课签到:调用insertSignFirst()
    *  下课签到:每次更新,按下课签到时间倒序排列
    * @param sign
    * @param signAddress
    * @param signTime
@@ -675,18 +675,18 @@
         Date signTime,Short terminalType,String userId,String userName,String mobilePhone, String location){
      
      SignStatisResult result = new SignStatisResult();
      //1.判断当前签到是上课,else:下课签到
      //精确到分钟比较
      //获取签到码当天签到的课程
      //1.判断当前签到是上课,else:下课签到
      //精确到分钟比较
      //获取签到码当天签到的课程
      SchClassSchedule objSchClassSchedule = this.getSchClassSchedule(sign.getSignId());
      if(objSchClassSchedule == null){
         result.setErrMsg("今天该课程未开课,不需要签到");
         result.setErrMsg("今天该课程未开课,不需要签到");
         result.setResult(false);
         return result;
      }
      boolean activeFlag = queryActiveflag(userId,sign.getClassId());
      if(sign.getRegisterAllow() == 1 && !activeFlag){
         result.setErrMsg("签到失败,您还未加入该班级");
         result.setErrMsg("签到失败,您还未加入该班级");
         result.setResult(false);
         return result;
      }
@@ -695,7 +695,7 @@
      Date signDate = DateUtils.truncate(signTime, Calendar.MINUTE);
      if((endDate.getTime() + startDate.getTime())/2  >=  signDate.getTime()){
         result.setSignType(SignStatisResult.SIGN_TYPE_FIRST);
         //插入上课签到信息
         //插入上课签到信息
         result = insertSignFirst(sign,signAddress,signTime,terminalType,userId,userName,mobilePhone, location);
      }else{
         result.setSignType(SignStatisResult.SIGN_TYPE_LAST);
@@ -707,7 +707,7 @@
            }else{
               obj.setLastSignStatus(SchSignStatistics.SIGN_STATUS_EARLY);
            }
            //每次更新
            //每次更新
            obj.setUserName(userName);
            obj.setInstallFlag(queryInstallFlag(userId));
            obj.setRegisteFlag(activeFlag);
@@ -726,9 +726,9 @@
            result.setRange(obj.getOutOfRange());
            result.setErrMsg(isOutofRange.getMsg());
         }else{
            //查询课程信息
            //查询课程信息
            SchClassSubject objSchClassSubject = this.getCommonDAO().read(SchClassSubject.class, sign.getClassScheduleId());
            //否则第一次下课签到
            //否则第一次下课签到
            SchSignStatistics objNew = new SchSignStatistics();
            TraceUtils.setCreateTrace(objNew);
            objNew.setSignId(sign.getSignId());
@@ -758,7 +758,7 @@
               result.setResult(false);
               return result;
            }
            //第一次保存
            //第一次保存
            save(objNew);
            result.setSignStatistics(objNew);
            result.setRange(objNew.getOutOfRange());
@@ -770,7 +770,7 @@
   }
   
   /**
    * 查询是否安装(通过账号登录记录)
    * 查询是否安装(通过账号登录记录)
    */
   public boolean queryInstallFlag(String userId){
      String hql = "from UserOperate where deleteFlag is false and userId= ? ";
@@ -779,7 +779,7 @@
   }
   
   /**
    * 查询是否班级成员(通过账号登录记录)
    * 查询是否班级成员(通过账号登录记录)
    */
   public boolean queryRegistrationFlag(String userId,String classId){
      String hql = "from UserRegistration where deleteFlag is false and userId= ? and classId = ? ";
@@ -788,7 +788,7 @@
   }
   
   /**
    * 查询是否班级激活
    * 查询是否班级激活
    */
   public boolean queryActiveflag(String userId,String classId){
      String hql = "from UserRegistration where deleteFlag is false and userId= ? and classId = ? and status = ?";
@@ -797,7 +797,7 @@
   }
   
   /**
    *  得到满足要求的签到明细(优化版本)
    *  得到满足要求的签到明细(优化版本)
    * @param signId
    * @return
    */
@@ -806,7 +806,7 @@
   }
   
   /**
    * 查询
    * 查询
    * 
    * @param signId
    * @param signDate
@@ -823,7 +823,7 @@
      
      List<SchSignStatistics> lstStatistics = this.signDAO.querySchSignStatisticses(hql, CollectionUtils.newList(signId, 2));
      
      //查询,SQL会清晰
      //查询,SQL会清晰
      String hql0 = " select r.USER_ID as userId,r.user_name as userName,r.mobile_phone as mobilePhone ,case when o.user_id is not null then 1 else 0 end installFlag,u.attribute1 as companyName  from user_registration r  "
                + " left join  "
                + " user_operate o  "
@@ -843,14 +843,14 @@
   }
   
   /**
    * 导出(优化版本)
    * 导出(优化版本)
    * @param signId
    * @param objSchSign
    * @return
    */
   public List<ExportSchSignItem> exportSimpleItems(String signId, String signDate){
      
      //查询列表的数据
      //查询列表的数据
      List<SchSignStatistics> lstStatistics = getHandleStatistics(signId, signDate);
      
      List<ExportSchSignItem> lstExports = new ArrayList<ExportSchSignItem>();
@@ -888,13 +888,13 @@
            value = late;
            break;
         case SchSignStatistics.SIGN_STATUS_EARLY :
            value = "早退";
            value = "早退";
            break;
         case SchSignStatistics.SIGN_STATUS_NO :
            value = "未签到";
            value = "未签到";
            break;
         default:
            value = "签到异常";
            value = "签到异常";
            break;
      }
      
@@ -926,7 +926,7 @@
   }
   
   /**
    * 签到历史
    * 签到历史
    * @return
    */
   @Override
@@ -936,7 +936,7 @@
   }
   
   /**
    * 微信签到高级设置
    * 微信签到高级设置
    * @param sign
    * @return
    */
@@ -968,13 +968,13 @@
      if(null!=sign.getOrgShow()){
         objSign.setOrgShow(sign.getOrgShow());
      }
      // 获取客户端信息
      // 获取客户端信息
      objSign.setUpdateId(ClientUtils.getUserId());
      objSign.setUpdateTime(new Date(System.currentTimeMillis()));
      objSign.setUpdator(ClientUtils.getUserName());
      
      save(objSign);
      //更新缓存
      //更新缓存
//      cacheService.set(CacheConstants.SCH_SIGN_ID_PREFIX.concat(objSign.getSignId()), CacheConstants.SCH_SIGN_ID_TIME, objSign);
      
      return new Result(true);
@@ -982,7 +982,7 @@
   
   
   /**
    * 签到 发送消息,环信替代
    * 签到 发送消息,环信替代
    * @param signType
    * @param signIndex
    * @param signId
@@ -994,7 +994,7 @@
      SchSign schSign  = this.getSignFromCacheOrDB(signId);
      
      Map<String,String> extra = new HashMap<String,String>();
      extra.put("title", "签到");
      extra.put("title", "签到");
      extra.put("userId", user.getUserId());
      extra.put("userName", user.getName());
      extra.put("userImg", user.getImgPath());
@@ -1002,13 +1002,13 @@
      extra.put("signIndex", String.valueOf(signIndex));
      extra.put("signId", signId);
      
//      easemobService.doSendTextMsgToUsers("notice-sys", new String[]{schSign.getNoticeUserId()}, "用户签到", extra);
//      easemobService.doSendTextMsgToUsers("notice-sys", new String[]{schSign.getNoticeUserId()}, "用户签到", extra);
      
      return new Result(true) ;
   }
   /**
    * 初始化签到信息
    * 初始化签到信息
    * @param signId
    * @param userId
    * @param initType
@@ -1057,7 +1057,7 @@
   }
   
   /**
    * 根据课程信息获取签到信息
    * 根据课程信息获取签到信息
    * 
    * @param strClassSubjectId
    * @return
@@ -1068,7 +1068,7 @@
   }
   
   /**
    * 根据课程信息获取签到人员记录
    * 根据课程信息获取签到人员记录
    * 
    * @param strClassSubjectId
    * @return
@@ -1082,7 +1082,7 @@
   
   
   /**
    * 查询签到历史
    * 查询签到历史
    * @param hql
    * @param args
    * @param page
@@ -1103,11 +1103,11 @@
         return lstSchSignStatistics;
      }
      StringBuffer sb = new StringBuffer(512);
      // 4.查询签到名次
      // 4.查询签到名次
      sb.append("select s, u.imgPath from SchSignStatistics s, User u where ");
      sb.append(" s.userId=u.userId and s.deleteFlag is false and s.signId = ? ");
      
      //根据类型判断排序规则
      //根据类型判断排序规则
      if(signType == null || SchSign.SIGN_TYPE_ALL == signType){
         sb.append(" and date(s.signDate) = date(NOW()) and s.lastSignTime is not null order by s.lastSignTime desc  ");
      }else if(SchSign.SIGN_TYPE_FIRST == signType){
@@ -1124,7 +1124,7 @@
         currPage.setPageSize(200);
      }
      
      // 查询并且缓存
      // 查询并且缓存
      List<SchSignStatistics> lstData = this.querySignItemListStat(sb.toString(), CollectionUtils.newList(signId));
//      cacheService.set(cache, CacheConstants.BUSINESS_DATA_TIME, lstData);
      
@@ -1133,7 +1133,7 @@
   }
   
   /**
    * 签到,根据signId得到schSign
    * 签到,根据signId得到schSign
    * @param signId
    * @return
    */
@@ -1157,7 +1157,7 @@
   }
   
   /**
    * 签到对应活动,根据signId得到相对应的活动
    * 签到对应活动,根据signId得到相对应的活动
    * @param signId
    * @return
    */
@@ -1181,7 +1181,7 @@
//   }
   
   /**
    * 根据sign得到相对应的机构图像
    * 根据sign得到相对应的机构图像
    * @param signId
    * @return
    */
@@ -1207,7 +1207,7 @@
   
   public Result sendSignQueueMsg(String args){
      
      // 延时一分钟发送
      // 延时一分钟发送
//      ONSMsg msg = new ONSMsg(onsProducer.getTopic());
      
//      msg.put("msgType", "SCH_SIGN_QUEUE");
@@ -1227,9 +1227,9 @@
   }
   
   /**
    * 签到异步处理部分代码
    * 签到异步处理部分代码
    * 
    * @param strArgs json对象
    * @param strArgs json对象
    * @return
    */
   @SuppressWarnings("unused")
@@ -1251,7 +1251,7 @@
      
//      if(StringUtils.isNotBlank(inputCode) && StringUtils.isNotBlank(openId)){
//         
//         // 查询并更新绑定关系
//         // 查询并更新绑定关系
//         UserReWeixin weixin = weixinCommonService.queryUserReWxByOpenId(openId);
//         if(weixin == null){
//            weixinCommonService.saveUserReWeixin(openId, userId, source);
@@ -1260,10 +1260,10 @@
//         }
//      }
      
      //签到积分
      //签到积分
//      scoreChangeService.doSign(userId, signId);
            
      //签到大屏,发送消息
      //签到大屏,发送消息
      User user = new User();
      user.setName(userName);
      user.setUserId(userId);
@@ -1276,16 +1276,16 @@
   }
   
   /**
    * 通过openId得到user
    * 通过openId得到user
    * @param openId
    * @return
    */
   public User getUserFromOpenId(String openId){
      User user = null;
//      // 通过openId找user
//      // 通过openId找user
//      if(StringUtils.isNotBlank(openId)){
//         
//         // 查询绑定关系
//         // 查询绑定关系
//         UserReWeixin weixin = weixinCommonService.queryUserReWxByOpenId(openId);
//         if (null != weixin) {
//            user = read(User.class, weixin.getUserId());
@@ -1311,17 +1311,17 @@
            .concat(String.valueOf(currPage.getPageSize()));
      
//      if(SignStatisResult.SIGN_TYPE_FIRST == signType){
//         // 如果满一页取缓存
//         // 如果满一页取缓存
//         Object obj = cacheService.get(cacheKey, Object.class);
//         if(null != obj ){
//            return (List<SchSignStatistics>)obj;
//         }
//      }
      
      // 查询并且缓存
      // 查询并且缓存
      List<SchSignStatistics> lstData = signDAO.querySignItemListCom(hql, currPage, args);
      
      // 满一页数据缓存
      // 满一页数据缓存
//      if(lstData.size() == currPage.getPageSize() ){
//         cacheService.set(cacheKey, CacheConstants.SCH_SIGN_STATISTICS_FIRST_ACTPAGE_TIME, lstData);
//      }
@@ -1331,7 +1331,7 @@
   }
   
   /**
    * 未签到统计页面
    * 未签到统计页面
    * 
    * @param signId
    * @param signDate
@@ -1339,7 +1339,7 @@
    */
   public Result updateFlag(String signStatisticsIds){
      if(StringUtils.isBlank(signStatisticsIds)){
         return new Result(false, "参数错误");
         return new Result(false, "参数错误");
      }
      
      this.bulkUpdateInLoop("update SchSignStatistics s set s.statisticsFlag = 1 where s.signStatisticsId = ?", signStatisticsIds.split(","));
@@ -1364,7 +1364,7 @@
   }
   
   /**
    * 班级听课证签到
    * 班级听课证签到
    * 
    * @param signVO
    * @param userId
@@ -1373,11 +1373,11 @@
    */
   public SignStatisResult doSignByClassCard(SchSign signVO, String userId){
      User user = this.read(User.class, userId);
      //设置默认不控制距离和只能本班签到
      //设置默认不控制距离和只能本班签到
      signVO.setRegisterAllow(SchSign.SIGN_ACT_DISALLOW);
      signVO.setOutRangeAllow(SchSign.SIGN_ACT_ALLOW);
      
      //3. 插入签到统计
      //3. 插入签到统计
      SignStatisResult result = this.insertSignStatistics(signVO, null, new Date(),
            SchSignStatistics.TERMINAL_TYPE_WECHAT, userId, user.getName(), user.getMobilePhone(), null);
      if(!result.getResult()){