Commit 148a074f by 涂亚平

补贴培训第一次上课熬夜改数据

1 parent b0c7650e
...@@ -93,30 +93,27 @@ public class AuthenticationInterceptor implements HandlerInterceptor { ...@@ -93,30 +93,27 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
Localstorage.setUser(administerDO); Localstorage.setUser(administerDO);
return true; return true;
} }
} else if(ConstantUtils.MOBILE_TERMINATE.equals(type)) { } else if (ConstantUtils.MOBILE_TERMINATE.equals(type)) {
MemberDO memberDO = memberMapper.selectById(claimMap.get("id").asLong()); MemberDO memberDO = memberMapper.selectById(claimMap.get("id").asLong());
if (timeRequired !=null){ if (timeRequired != null) {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY); int hour = calendar.get(Calendar.HOUR_OF_DAY);
if (hour<6){ int minute = calendar.get(Calendar.MINUTE);
// OprMemDictDO oprMemDictDO = new OprMemDictDO(); if (hour < 6 || (hour >= 23 && minute >= 30)) {
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登出");
// oprMemDictDO.setResult(1);
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(17001); throw new HttpException(17001);
} }
} }
if(memberDO != null) { if (memberDO != null) {
Localstorage.setUser(memberDO); Localstorage.setUser(memberDO);
return true; return true;
} }
int count = memberTokensMapper.selectCount(new QueryWrapper<MemberTokensDO>() int count = memberTokensMapper.selectCount(new QueryWrapper<MemberTokensDO>()
.lambda() .lambda()
.eq(MemberTokensDO::getMemberId,memberDO.getId())); .eq(MemberTokensDO::getMemberId, memberDO.getId()));
if (count==0){ if (count == 0) {
throw new HttpException(1011); throw new HttpException(1011);
} }
......
...@@ -14,10 +14,7 @@ import com.subsidy.service.VodPlayHistoryService; ...@@ -14,10 +14,7 @@ import com.subsidy.service.VodPlayHistoryService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/** /**
* <p> * <p>
...@@ -48,7 +45,6 @@ public class VodPlayHistoryController { ...@@ -48,7 +45,6 @@ public class VodPlayHistoryController {
@ApiOperation("记录学生看视频位置 classId班级id vodId 视频id memberId 成员id " + @ApiOperation("记录学生看视频位置 classId班级id vodId 视频id memberId 成员id " +
"playLength 播放时长 playRecord 位点 suspendLength") "playLength 播放时长 playRecord 位点 suspendLength")
@TimeRequired @TimeRequired
// @LoginRequired
public ResponseVO insertHistoryNew(@RequestBody String param){ public ResponseVO insertHistoryNew(@RequestBody String param){
InsertHistoryNewDTO insertHistoryNewDTO = JSON.parseObject(param, InsertHistoryNewDTO.class); InsertHistoryNewDTO insertHistoryNewDTO = JSON.parseObject(param, InsertHistoryNewDTO.class);
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistoryNew(insertHistoryNewDTO)); return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistoryNew(insertHistoryNewDTO));
...@@ -82,10 +78,16 @@ public class VodPlayHistoryController { ...@@ -82,10 +78,16 @@ public class VodPlayHistoryController {
vodPlayHistoryService.playLengthFix(remainSecondsDTO); vodPlayHistoryService.playLengthFix(remainSecondsDTO);
} }
@PostMapping("testPlays") @GetMapping("testPlays")
@ApiOperation("解决有交叉时间的数据") @ApiOperation("解决有交叉时间的数据 classId")
public ResponseVO testPlays(@RequestBody VodPlayHistoryDO vodPlayHistoryDO){ public ResponseVO testPlays(@RequestParam("classId") Long classId ){
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.testPlays(vodPlayHistoryDO)); return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.testPlays(classId));
}
@PostMapping("warning")
@ApiOperation("短信报警")
public void warning(){
vodPlayHistoryService.warning();
} }
} }
package com.subsidy.jobs;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.subsidy.mapper.ClassMemberMappingMapper;
import com.subsidy.mapper.VodDictMapper;
import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.ClassMemberMappingDO;
import com.subsidy.util.SMSUtils;
import com.subsidy.vo.vod.VodPlayStateVO;
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 java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
@Component
public class WarningJob {
/**
* 每天定时查看是否有问题数据,有问题的话并发送短信
*/
@Autowired
private VodPlayHistoryMapper vodPlayHistoryMapper;
@Autowired
private ClassMemberMappingMapper classMemberMappingMapper;
@Autowired
private VodDictMapper vodDictMapper;
@Autowired
private SMSUtils smsUtils;
@Value("${spring.profiles.active}")
private String env;
/**
* POST-2:班级基本信息信息采集接口
*/
@Scheduled(cron = "0 0 1 * * ?")
public void classBaseInfo() throws IOException {
if ("prod".equals(env)) {
List<Long> result = new ArrayList<>();
//查看当天产生视频学习的班级
List<Long> classIds = vodPlayHistoryMapper.dailyVodRecord();
for (Long classId : classIds) {
List<ClassMemberMappingDO> classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper<ClassMemberMappingDO>()
.lambda()
.eq(ClassMemberMappingDO::getClassId, classId));
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
List<VodPlayStateVO> vodPlayStateVOS = vodDictMapper.testPlays(classMemberMappingDO.getMemberId(), Long.valueOf(classId));
for (int i = 0; i < vodPlayStateVOS.size() - 1; i++) {
VodPlayStateVO vodPlayStateVO = vodPlayStateVOS.get(i + 1); //后面
VodPlayStateVO vodPlayStateVO1 = vodPlayStateVOS.get(i); //前面
if (vodPlayStateVO1.getEndDate().getTime() > vodPlayStateVO.getStartDate().getTime()) {
result.add(vodPlayStateVO.getClassId());
break;
}
}
}
}
// List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812", "18217669021"});
// telephones.stream().forEach(x -> {
// smsUtils.sendVerifySMS("SMS_460945631", x, result.toString());
// });
smsUtils.sendVerifySMS("SMS_460945631", "15201936167", result.toString());
StringBuffer stringBuffer = new StringBuffer();
for (int i = 0; i < result.size(); i++) {
stringBuffer.append(result);
if (i == result.size()-1){
stringBuffer.append("n");
}
}
// List<String> strings = Arrays.asList(new String[]{"15201936167", "18201963812", "18217669021"});
// List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812", "18217669021"});
// for (String telephone : telephones){
// smsUtils.sendVerifySMS("SMS_460945631", telephone, stringBuffer.toString());
// }
smsUtils.sendWarning("SMS_460945631", "15201936167", stringBuffer.toString());
}
}
}
...@@ -112,4 +112,8 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> { ...@@ -112,4 +112,8 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
double getSubsidyStudyTotal(); double getSubsidyStudyTotal();
int getStudyHistoryNum(); int getStudyHistoryNum();
//查看当天产生视频学习的班级
List<Long> dailyVodRecord();
} }
...@@ -33,5 +33,8 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> { ...@@ -33,5 +33,8 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> {
void playLengthFix(RemainSecondsDTO remainSecondsDTO); void playLengthFix(RemainSecondsDTO remainSecondsDTO);
HashSet<Long> testPlays(VodPlayHistoryDO vodPlayHistoryDO); HashSet<Long> testPlays(Long classId);
void warning();
} }
...@@ -102,27 +102,27 @@ public class RenSheJuServiceImpl implements RenSheJuService { ...@@ -102,27 +102,27 @@ public class RenSheJuServiceImpl implements RenSheJuService {
System.out.println(JSONObject.fromObject(classBaseInfoDTO).toString()); System.out.println(JSONObject.fromObject(classBaseInfoDTO).toString());
RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classBaseInfoDTO).toString()); // RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classBaseInfoDTO).toString());
Request request = new Request.Builder() // Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/enterprise/uploadClass") // .url(renSheConfig.getUrl() + "/import/downstream/enterprise/uploadClass")
.method("POST", body) // .method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)") // .addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.addHeader("Content-Type", "application/json") // .addHeader("Content-Type", "application/json")
.build(); // .build();
Response response = client.newCall(request).execute(); // Response response = client.newCall(request).execute();
//
RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class); // RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class);
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); // RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_2); // renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_2);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classBaseInfoDTO).toString()); // renshejuHistoryDO.setInputParam(JSONObject.fromObject(classBaseInfoDTO).toString());
if (200 == response.code()) { // if (200 == response.code()) {
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString()); // renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
} else { // } else {
renshejuHistoryDO.setOutputParam(RenSheJuConstant.API_ERROR); // renshejuHistoryDO.setOutputParam(RenSheJuConstant.API_ERROR);
} // }
renshejuHistoryMapper.insert(renshejuHistoryDO); // renshejuHistoryMapper.insert(renshejuHistoryDO);
return rensheResponseVO; // return rensheResponseVO;
// return null; return null;
} else { } else {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_2); renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_2);
......
...@@ -13,6 +13,7 @@ import com.subsidy.service.VodPlayHistoryService; ...@@ -13,6 +13,7 @@ import com.subsidy.service.VodPlayHistoryService;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil; import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.RedisUtil; import com.subsidy.util.RedisUtil;
import com.subsidy.util.SMSUtils;
import com.subsidy.vo.vod.VodPlayStateVO; import com.subsidy.vo.vod.VodPlayStateVO;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -57,6 +58,9 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -57,6 +58,9 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
@Autowired @Autowired
private MemberStudyLengthMapper memberStudyLengthMapper; private MemberStudyLengthMapper memberStudyLengthMapper;
@Autowired
private SMSUtils smsUtils;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) { public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) {
...@@ -631,26 +635,23 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -631,26 +635,23 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
// } // }
} }
public HashSet<Long> testPlays(VodPlayHistoryDO vodPlayHistoryDO) { public HashSet<Long> testPlays(Long classId) {
String classIds = "402";
String[] classIdArr = classIds.split(",");
// String[] classIdArr = classIds.split(",");
HashSet<Long> result = new HashSet<>(); HashSet<Long> result = new HashSet<>();
for (String classId : classIdArr) { // for (String classId : classIdArr) {
List<ClassMemberMappingDO> classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper<ClassMemberMappingDO>() List<ClassMemberMappingDO> classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper<ClassMemberMappingDO>()
.lambda() .lambda()
.eq(ClassMemberMappingDO::getClassId, classId)); .eq(ClassMemberMappingDO::getClassId, classId));
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) { for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
List<VodPlayStateVO> vodPlayStateVOS = vodDictMapper.testPlays(classMemberMappingDO.getMemberId(), Long.valueOf(classId)); List<VodPlayStateVO> vodPlayStateVOS = vodDictMapper.testPlays(classMemberMappingDO.getMemberId(), Long.valueOf(classId));
for (int i = 0; i < vodPlayStateVOS.size() - 1; i++) { for (int i = 0; i < vodPlayStateVOS.size() - 1; i++) {
VodPlayStateVO vodPlayStateVO = vodPlayStateVOS.get(i + 1); //后面 VodPlayStateVO vodPlayStateVO = vodPlayStateVOS.get(i + 1); //后面
VodPlayStateVO vodPlayStateVO1 = vodPlayStateVOS.get(i); //前面 VodPlayStateVO vodPlayStateVO1 = vodPlayStateVOS.get(i); //前面
if (vodPlayStateVO1.getEndDate().getTime() > vodPlayStateVO.getStartDate().getTime()) { if (vodPlayStateVO1.getEndDate().getTime() > vodPlayStateVO.getStartDate().getTime()) {
//这一条数据有问题 //这一条数据有问题
System.out.println("111111111111111111111" + vodPlayStateVO); System.out.println("111111111111111111111" + vodPlayStateVO);
//查看这个人 这个课程 当天的全部数据 按照createDate升序排序 //查看这个人 这个课程 当天的全部数据 按照createDate升序排序
// List<VodPlayHistoryDO> vodPlayHistoryDOS = this.baseMapper.getVodPlayDay(Long.valueOf(classId), classMemberMappingDO.getMemberId(), vodPlayStateVO.getStartDate()); // List<VodPlayHistoryDO> vodPlayHistoryDOS = this.baseMapper.getVodPlayDay(Long.valueOf(classId), classMemberMappingDO.getMemberId(), vodPlayStateVO.getStartDate());
// //从第一条开始看,顺延减去第二条的playlength得到第二条的create_date 以此类推 // //从第一条开始看,顺延减去第二条的playlength得到第二条的create_date 以此类推
// for (int l = 0; l < vodPlayHistoryDOS.size() - 1; l++) { // for (int l = 0; l < vodPlayHistoryDOS.size() - 1; l++) {
...@@ -663,15 +664,58 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -663,15 +664,58 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
// vph2.setPlayDate(dateTmp); // vph2.setPlayDate(dateTmp);
// this.baseMapper.updateById(vph2); // this.baseMapper.updateById(vph2);
// } // }
result.add(vodPlayStateVO.getId()); result.add(vodPlayStateVO.getId());
// break; // break;
}
} }
} }
} }
// }
return result; return result;
} }
public void warning() {
//有问题的班级
List<Long> result = new ArrayList<>();
//查看当天产生视频学习的班级
List<Long> classIds = vodPlayHistoryMapper.dailyVodRecord();
for (Long classId : classIds) {
List<ClassMemberMappingDO> classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper<ClassMemberMappingDO>()
.lambda()
.eq(ClassMemberMappingDO::getClassId, classId));
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
List<VodPlayStateVO> vodPlayStateVOS = vodDictMapper.testPlays(classMemberMappingDO.getMemberId(), Long.valueOf(classId));
for (int i = 0; i < vodPlayStateVOS.size() - 1; i++) {
VodPlayStateVO vodPlayStateVO = vodPlayStateVOS.get(i + 1); //后面
VodPlayStateVO vodPlayStateVO1 = vodPlayStateVOS.get(i); //前面
if (vodPlayStateVO1.getEndDate().getTime() > vodPlayStateVO.getStartDate().getTime()) {
if (!result.contains(vodPlayStateVO1.getClassId())){
result.add(vodPlayStateVO.getClassId());
}
}
break;
}
}
}
//
// StringBuffer stringBuffer = new StringBuffer();
// for (int i = 0; i < result.size(); i++) {
// stringBuffer.append(result);
// if (i == result.size()-1){
// stringBuffer.append("n");
// }
// }
if (result.size()>0){
List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812", "18217669021"});
for (String telephone : telephones){
smsUtils.sendWarning("SMS_460945631", telephone, result.toString());
}
}
}
//19为基数的话,3次签到6.5到8,4次签到4.8-6, //19为基数的话,3次签到6.5到8,4次签到4.8-6,
// 5次4-6,6次3.2-6,7次及以上2.5-6吧 // 5次4-6,6次3.2-6,7次及以上2.5-6吧
//int randNumber =rand.nextInt(MAX - MIN + 1) + MIN; //int randNumber =rand.nextInt(MAX - MIN + 1) + MIN;
...@@ -712,9 +756,15 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -712,9 +756,15 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
} }
public static void main(String[] args) { public static void main(String[] args) {
while (true) {
System.out.println(getRandom1_2()); List<Long> list = new ArrayList<Long>();
} list.add(1L);
list.add(2L);
System.out.println(list.toString());
// while (true) {
// System.out.println(getRandom1_2());
// }
// System.out.println(LocalDateTime.now()); // System.out.println(LocalDateTime.now());
// System.out.println(LocalDateTime.now().minusMinutes(3)); // System.out.println(LocalDateTime.now().minusMinutes(3));
......
...@@ -65,12 +65,12 @@ public class ConstantUtils { ...@@ -65,12 +65,12 @@ public class ConstantUtils {
/** /**
* 短信 RAM账号AccessKey ID * 短信 RAM账号AccessKey ID
*/ */
public static final String ACCESS_KEY_ID = "LTAIOrpFKrDqsQ2c"; public static final String ACCESS_KEY_ID = "LTAI5tPAH7P7WQVeowo517BE";
/** /**
* 短信 RAM账号AccessKey Secret * 短信 RAM账号AccessKey Secret
*/ */
public static final String SECRET = "1Qp8huLETbWiBBJvHXJ7MOIhtKuA1G"; public static final String SECRET = "0ueqhIfdAZyw5lWlBVSLpAxTtx37RY";
/** /**
* 腾讯云点播视频转码模板 * 腾讯云点播视频转码模板
......
...@@ -76,27 +76,69 @@ public class SMSUtils { ...@@ -76,27 +76,69 @@ public class SMSUtils {
* @param telephone 手机号 * @param telephone 手机号
* @return * @return
*/ */
public static String sendVerifySMS(String templateId,String telephone,String param){ public String sendVerifySMS(String templateId,String telephone,String param){
DefaultProfile profile = DefaultProfile.getProfile(ConstantUtils.REGION_ID, ConstantUtils.ACCESS_KEY_ID, ConstantUtils.SECRET);
IAcsClient client = new DefaultAcsClient(profile);
CommonRequest request = new CommonRequest();
request.setSysMethod(MethodType.POST);
request.setSysDomain("dysmsapi.aliyuncs.com");
request.setSysVersion("2017-05-25");
request.setSysAction("SendSms");
request.putQueryParameter("RegionId",ConstantUtils.REGION_ID);
request.putQueryParameter("PhoneNumbers",telephone);
request.putQueryParameter("SignName",ConstantUtils.VERIFY_NAME);
request.putQueryParameter("TemplateCode",templateId);
// if (StringUtils.isEmpty(param)){
// request.putQueryParameter("TemplateParam","{ \"code\":\""+verifyCode +"\"}");
// }
request.putQueryParameter("TemplateParam",param);
CommonResponse response = null;
try { try {
response = client.getCommonResponse(request); System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
return ConstantUtils.SUCCESS_SEND_OUT; System.setProperty("sun.net.client.defaultReadTimeout", "10000");
//初始化acsClient,暂不支持region化
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", aliyunSmsProperties.getAccessKeyId(), aliyunSmsProperties.getAccessKeySecret());
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", aliyunSmsProperties.getProduct(), aliyunSmsProperties.getDomain());
IAcsClient acsClient = new DefaultAcsClient(profile);
//组装请求对象-具体描述见控制台-文档部分内容
SendSmsRequest request = new SendSmsRequest();
//必填:待发送手机号
request.setPhoneNumbers(telephone);
//必填:短信签名-可在短信控制台中找到
request.setSignName("有课互联");
//必填:短信模板-可在短信控制台中找到
request.setTemplateCode(templateId);
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
request.setTemplateParam("{\"code\":\""+ param +"\"}");
//hint 此处可能会抛出异常,注意catch
SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
if(sendSmsResponse != null && sendSmsResponse.getCode().equals("OK")) {
return ConstantUtils.SUCCESS_SEND_OUT;
}
throw new Exception(sendSmsResponse.getMessage());
} catch(Exception e) {
e.printStackTrace();
return ConstantUtils.FAIL_SEND_OUT;
}
}
public String sendWarning(String templateId,String telephone,String param){
try {
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
System.setProperty("sun.net.client.defaultReadTimeout", "10000");
//初始化acsClient,暂不支持region化
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", aliyunSmsProperties.getAccessKeyId(), aliyunSmsProperties.getAccessKeySecret());
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", aliyunSmsProperties.getProduct(), aliyunSmsProperties.getDomain());
IAcsClient acsClient = new DefaultAcsClient(profile);
//组装请求对象-具体描述见控制台-文档部分内容
SendSmsRequest request = new SendSmsRequest();
//必填:待发送手机号
request.setPhoneNumbers(telephone);
//必填:短信签名-可在短信控制台中找到
request.setSignName("有课互联科技");
//必填:短信模板-可在短信控制台中找到
request.setTemplateCode(templateId);
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
request.setTemplateParam("{\"ids\":\""+ param +"\"}");
//hint 此处可能会抛出异常,注意catch
SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
if(sendSmsResponse != null && sendSmsResponse.getCode().equals("OK")) {
return ConstantUtils.SUCCESS_SEND_OUT;
}
throw new Exception(sendSmsResponse.getMessage());
} catch(Exception e) { } catch(Exception e) {
e.printStackTrace(); e.printStackTrace();
return ConstantUtils.FAIL_SEND_OUT; return ConstantUtils.FAIL_SEND_OUT;
...@@ -109,7 +151,7 @@ public class SMSUtils { ...@@ -109,7 +151,7 @@ public class SMSUtils {
* @param telephone 手机号 * @param telephone 手机号
* @return * @return
*/ */
public static String sendNoticeSMS(String templateId,String telephone,String param){ public static String sendNoticeSMS(String templateId,String telephone,String param){
DefaultProfile profile = DefaultProfile.getProfile(ConstantUtils.REGION_ID, ConstantUtils.ACCESS_KEY_ID, ConstantUtils.SECRET); DefaultProfile profile = DefaultProfile.getProfile(ConstantUtils.REGION_ID, ConstantUtils.ACCESS_KEY_ID, ConstantUtils.SECRET);
IAcsClient client = new DefaultAcsClient(profile); IAcsClient client = new DefaultAcsClient(profile);
......
...@@ -10,6 +10,8 @@ public class VodPlayStateVO { ...@@ -10,6 +10,8 @@ public class VodPlayStateVO {
private Long id; private Long id;
private Long classId;
private Long memberId; private Long memberId;
private Date startDate; private Date startDate;
......
...@@ -67,7 +67,7 @@ meishu.code-message[15002]=类型已存在证书,删除失败 ...@@ -67,7 +67,7 @@ meishu.code-message[15002]=类型已存在证书,删除失败
meishu.code-message[16001]=该条件已存在 meishu.code-message[16001]=该条件已存在
meishu.code-message[17001]=系统不支持00:00:00~06:00:00学习 meishu.code-message[17001]=系统不支持23:30:00~06:00:00学习
meishu.code-message[18001]=已超过当日验证次数上线 meishu.code-message[18001]=已超过当日验证次数上线
......
...@@ -99,6 +99,7 @@ ...@@ -99,6 +99,7 @@
<select id="testPlays" parameterType="long" resultType="com.subsidy.vo.vod.VodPlayStateVO"> <select id="testPlays" parameterType="long" resultType="com.subsidy.vo.vod.VodPlayStateVO">
SELECT SELECT
id, id,
t.class_id,
member_id, member_id,
DATE_SUB( create_date, INTERVAL (play_length+suspend_length) SECOND ) AS start_date, DATE_SUB( create_date, INTERVAL (play_length+suspend_length) SECOND ) AS start_date,
create_date AS end_date, create_date AS end_date,
......
...@@ -505,4 +505,19 @@ ...@@ -505,4 +505,19 @@
delete_date IS NULL delete_date IS NULL
</select> </select>
<select id="dailyVodRecord" resultType="long">
SELECT DISTINCT
t1.class_id
FROM
vod_play_history t1
LEFT JOIN class_dict t2 ON t1.class_id = t2.id
WHERE
DATE_FORMAT( t1.create_date, '%Y-%m-%d' ) = CURDATE()
AND t2.class_code IS NOT NULL
AND t2.class_type = 0
AND t1.delete_date IS NULL
AND t2.delete_date IS NULL
</select>
</mapper> </mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!