Commit 301a3dcd by 涂亚平

账号名称根据拼音生成

1 parent 374745fa
Showing with 278 additions and 89 deletions
......@@ -55,6 +55,13 @@
</dependency>
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>com.tencentcloudapi</groupId>
<artifactId>tencentcloud-sdk-java</artifactId>
<version>3.1.64</version>
......
......@@ -84,7 +84,7 @@ public class AdministerController {
@PostMapping("classSummary")
@ApiOperation("课程汇总 id 班级id ")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO classSummary(@RequestBody ClassDetailDTO classDetailDTO){
return ResponseData.generateCreatedResponse(0,administerService.classSummary(classDetailDTO));
}
......@@ -98,7 +98,7 @@ public class AdministerController {
@PostMapping("exportClassDetail")
@ApiOperation("班级管理--班级成员--导出 id 班级id userName")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public void exportClassDetail(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
classDetailDTO.setFlag(true);
administerService.exportClassDetail(classDetailDTO);
......
......@@ -4,11 +4,13 @@ package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.classDict.AddClassDTO;
import com.subsidy.dto.classDict.AddMemberToClassDTO;
import com.subsidy.dto.classDict.GetAllClassesDTO;
import com.subsidy.dto.classDict.GetSpareMembersDTO;
import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassMemberMappingDO;
import com.subsidy.model.CourseDictDO;
import com.subsidy.service.ClassDictService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.ApiOperation;
......@@ -51,10 +53,10 @@ public class ClassDictController {
}
@PostMapping("addClass")
@ApiOperation("添加课程 ** companyId courseId className startDate endDate")
@ApiOperation("添加课程 ** userId:登录人id companyId courseId className startDate endDate")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addClass(@RequestBody ClassDictDO classDictDO){
return ResponseData.generateCreatedResponse(0,classDictService.addClass(classDictDO));
public ResponseVO addClass(@RequestBody AddClassDTO addClassDTO){
return ResponseData.generateCreatedResponse(0,classDictService.addClass(addClassDTO));
}
@PostMapping("updateClass")
......@@ -80,7 +82,7 @@ public class ClassDictController {
@PostMapping("getSpareMembers")
@ApiOperation("获取不在某班级的某企业里所有成员 ** companyId 企业id classId 班级id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getSpareMembers(@RequestBody GetSpareMembersDTO getSpareMembersDTO){
return ResponseData.generateCreatedResponse(0,classDictService.getSpareMembers(getSpareMembersDTO));
}
......@@ -93,4 +95,11 @@ public class ClassDictController {
}
@PostMapping("batchSms")
@ApiOperation("批量发送班级短信 {id 班级id}")
public ResponseVO batchSms(@RequestBody ClassDictDO classDictDO){
return ResponseData.generateCreatedResponse(0,classDictService.batchSms(classDictDO));
}
}
package com.subsidy.dto.classDict;
import com.subsidy.model.ClassDictDO;
import lombok.Data;
@Data
public class AddClassDTO extends ClassDictDO {
private Long userId;
}
......@@ -38,5 +38,9 @@ public interface ClassDictMapper extends BaseMapper<ClassDictDO> {
*/
List<MemberDO> getSpareMembers(GetSpareMembersDTO getSpareMembersDTO);
/**
* 查询班级里的学生信息
*/
List<MemberDO> classMembers(Long classId);
}
......@@ -45,4 +45,5 @@ public interface CourseDictMapper extends BaseMapper<CourseDictDO> {
*/
IPage<QueryCoursesVO> queryCompanyCourse(IPage page, String courseName, Long categoryId, String courseType, String courseSource,Long companyId);
}
......@@ -39,6 +39,11 @@ public class ClassDictDO extends BaseModel {
private String className;
/**
* 班级类型
*/
private String classType;
/**
* 课程id
*/
private Long courseId;
......
package com.subsidy.service;
import com.subsidy.dto.classDict.AddClassDTO;
import com.subsidy.dto.classDict.AddMemberToClassDTO;
import com.subsidy.dto.classDict.GetAllClassesDTO;
import com.subsidy.dto.classDict.GetSpareMembersDTO;
import com.subsidy.model.ClassDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.model.ClassMemberMappingDO;
import com.subsidy.model.CourseDictDO;
import com.subsidy.model.MemberDO;
import com.subsidy.vo.classdict.GetAllClassesVO;
......@@ -25,7 +27,7 @@ public interface ClassDictService extends IService<ClassDictDO> {
String deleteClasses(ClassDictDO classDictDO);
String addClass(ClassDictDO classDictDO);
String addClass(AddClassDTO addClassDTO);
String updateClass(ClassDictDO classDictDO);
......@@ -37,4 +39,5 @@ public interface ClassDictService extends IService<ClassDictDO> {
String addMemberToClass(AddMemberToClassDTO addMemberToClassDTO);
String batchSms(ClassDictDO classDictDO);
}
......@@ -24,4 +24,5 @@ public interface CourseDictService extends IService<CourseDictDO> {
String updateCourses(CourseDictDO courseDictDO);
IPage queryCompanyCourse(QueryCoursesDTO queryCoursesDTO);
}
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.subsidy.dto.classDict.AddClassDTO;
import com.subsidy.dto.classDict.AddMemberToClassDTO;
import com.subsidy.dto.classDict.GetAllClassesDTO;
import com.subsidy.dto.classDict.GetSpareMembersDTO;
import com.subsidy.mapper.AdministerMapper;
import com.subsidy.mapper.ClassMemberMappingMapper;
import com.subsidy.mapper.RoleAdministerMappingMapper;
import com.subsidy.mapper.*;
import com.subsidy.model.*;
import com.subsidy.mapper.ClassDictMapper;
import com.subsidy.service.ClassDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.SMSUtils;
import com.subsidy.vo.classdict.GetAllClassesVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -35,6 +36,15 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
@Autowired
private ClassMemberMappingMapper classMemberMappingMapper;
@Autowired
private RoleAdministerMappingMapper roleAdministerMappingMapper;
@Autowired
private CourseDictMapper courseDictMapper;
@Autowired
private CompanyDictMapper companyDictMapper;
public List<GetAllClassesVO> getAllClasses(ClassDictDO classDictDO) {
return this.baseMapper.getAllClasses(classDictDO);
......@@ -50,7 +60,23 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
return ConstantUtils.DELETE_SUCCESS;
}
public String addClass(ClassDictDO classDictDO) {
public String addClass(AddClassDTO addClassDTO) {
//查看当前登录人的角色
int count = roleAdministerMappingMapper.selectCount(new QueryWrapper<RoleAdministerMappingDO>()
.lambda()
.eq(RoleAdministerMappingDO::getAdministerId,addClassDTO.getUserId())
.eq(RoleAdministerMappingDO::getRoleId,1));
ClassDictDO classDictDO = new ClassDictDO();
BeanUtils.copyProperties(addClassDTO,classDictDO);
if (count>0){
classDictDO.setClassType("平台支持");
}else{
classDictDO.setClassType("企业自建");
}
this.baseMapper.insert(classDictDO);
return ConstantUtils.ADD_SUCCESS;
}
......@@ -89,4 +115,27 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
return ConstantUtils.ADD_SUCCESS;
}
public String batchSms(ClassDictDO classDictDO){
ClassDictDO classDictDO1 = this.baseMapper.selectById(classDictDO.getId());
CourseDictDO courseDictDO = courseDictMapper.selectById(classDictDO1.getCourseId());
CompanyDictDO companyDictDO = companyDictMapper.selectById(classDictDO.getCompanyId());
//查找这个班级里的学员的手机号
List<MemberDO> memberDOS = this.baseMapper.classMembers(classDictDO.getId());
StringBuilder telephone = new StringBuilder();
String param = "{\"company\":\""+companyDictDO.getCompanyName()+ "\",course\":\""+courseDictDO.getCourseName()+ "\",\"startDate\":\""+classDictDO1.getStartDate() +"\",\"endDate\":\""+classDictDO1.getEndDate() +"\"}";
if (memberDOS.size()>0){
for (int i = 0 ;i< memberDOS.size();i++){
telephone.append(memberDOS.get(i).getTelephone());
if (i!=memberDOS.size()-1){
telephone.append(",");
}
}
SMSUtils.sendNoticeSMS("SMS_228117919",telephone.toString(),param);
}
return ConstantUtils.SUCCESS_SEND_OUT;
}
}
......@@ -8,15 +8,13 @@ import com.subsidy.dto.course.QueryCoursesDTO;
import com.subsidy.mapper.AdministerMapper;
import com.subsidy.mapper.CompanyDictMapper;
import com.subsidy.mapper.RoleAdministerMappingMapper;
import com.subsidy.model.AdministerDO;
import com.subsidy.model.CompanyDictDO;
import com.subsidy.model.CourseDictDO;
import com.subsidy.model.*;
import com.subsidy.mapper.CourseDictMapper;
import com.subsidy.model.RoleAdministerMappingDO;
import com.subsidy.service.CompanyDictService;
import com.subsidy.service.CourseDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.SMSUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -37,12 +35,6 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD
@Autowired
private RoleAdministerMappingMapper roleAdministerMappingMapper;
@Autowired
private AdministerMapper administerMapper;
@Autowired
private CompanyDictMapper companyDictMapper;
public String addCourse(CourseDictDO courseDictDO) {
int count = 0;
......@@ -147,4 +139,5 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD
}
}
......@@ -372,8 +372,10 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
if (vodPlayHistoryDOS.size()>0){
VodPlayHistoryDO vodPlayHistoryDO = vodPlayHistoryDOS.get(0);
VodDictDO vodDictDO = vodDictMapper.selectById(vodPlayHistoryDO.getVodId());
BeanUtils.copyProperties(vodDictDO,contentVodNewVO);
contentVodNewVO.setPlayRecord(vodPlayHistoryDO.getPlayRecord());
if (null!=vodDictDO){
BeanUtils.copyProperties(vodDictDO,contentVodNewVO);
contentVodNewVO.setPlayRecord(vodPlayHistoryDO.getPlayRecord());
}
}
return contentVodNewVO;
}
......@@ -435,12 +437,21 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
ExerciseDoneResultDO exerciseDoneResultDO = exerciseDoneResultMapper.selectOne(new QueryWrapper<ExerciseDoneResultDO>()
.lambda()
.eq(ExerciseDoneResultDO::getCourseId, courseDictDO.getId())
.eq(ExerciseDoneResultDO::getClassId, classDictDO.getId())
.eq(ExerciseDoneResultDO::getMemberId, contentMemberDTO.getMemberId()));
if (null != exerciseDoneResultDO) {
getCourseTestVO.setRightCount(String.valueOf(exerciseDoneResultDO.getRightCounts()));
getCourseTestVO.setTotalCount(String.valueOf(exerciseDoneResultDO.getTotalCounts()));
//正确率
Integer percent = MathUtil.intDivFloorPercent(exerciseDoneResultDO.getRightCounts(),exerciseDoneResultDO.getTotalCounts());
if(percent>=60){
getCourseTestVO.setResult("合格");
}else {
getCourseTestVO.setResult("不合格");
}
getCourseTestVO.setPercent(String.valueOf(percent));
} else {
getCourseTestVO.setRightCount("-");
//该课程下有多少习题
......@@ -448,6 +459,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
.lambda()
.eq(ExerciseDictDO::getCourseId, courseDictDO.getId()));
getCourseTestVO.setTotalCount(String.valueOf(count));
getCourseTestVO.setPercent("-");
getCourseTestVO.setResult("不合格");
}
return getCourseTestVO;
}
......@@ -459,7 +472,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId());
//第几天
long diff = Duration.between(LocalDateTime.now(), memberDO1.getCreateDate()).toDays();
long diff = Duration.between(memberDO1.getCreateDate(),LocalDateTime.now()).toDays();
getStudyInfoVO.setDiff(diff);
//已学课程
......
......@@ -65,11 +65,11 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
this.baseMapper.delete(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getMemberId,signInRecordDO.getMemberId())
.gt(SignInRecordDO::getSignInDate, LocalDate.now()));
.lambda()
.eq(SignInRecordDO::getMemberId, signInRecordDO.getMemberId())
.gt(SignInRecordDO::getSignInDate, LocalDate.now()));
for (ClassDictDO classDictDO : classDictDOS){
for (ClassDictDO classDictDO : classDictDOS) {
SignInRecordDO signInRecordDO1 = new SignInRecordDO();
signInRecordDO1.setClassId(classDictDO.getId());
signInRecordDO1.setMemberId(signInRecordDO.getMemberId());
......@@ -84,15 +84,15 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
Page pager = new Page(classSignInfoDTO.getPageNum(), classSignInfoDTO.getPageSize());
IPage<ClassSignInfoVO> classSignInfoVOIPage = this.baseMapper.classSignInfo(pager, classSignInfoDTO.getClassName(), classSignInfoDTO.getCourseName(),classSignInfoDTO.getCompanyId());
IPage<ClassSignInfoVO> classSignInfoVOIPage = this.baseMapper.classSignInfo(pager, classSignInfoDTO.getClassName(), classSignInfoDTO.getCourseName(), classSignInfoDTO.getCompanyId());
List<ClassSignInfoVO> classSignInfoVOS = classSignInfoVOIPage.getRecords();
for (ClassSignInfoVO classSignInfoVO : classSignInfoVOS){
for (ClassSignInfoVO classSignInfoVO : classSignInfoVOS) {
//班级人数
List<ClassMemberMappingDO> classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper<ClassMemberMappingDO>()
.lambda()
.eq(ClassMemberMappingDO::getClassId,classSignInfoVO.getClassId()));
.lambda()
.eq(ClassMemberMappingDO::getClassId, classSignInfoVO.getClassId()));
classSignInfoVO.setMemberCount(classMemberMappingDOS.size());
......@@ -103,29 +103,29 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
int totalStudyVods = 0;
int totalStudyLength = 0 ;
int totalStudyLength = 0;
//学生总共学习课时数
for (VodDictDO vodDictDO : vodDictDOS) {
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
List<VodPlayHistoryDO> vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper<VodPlayHistoryDO>()
.lambda()
.eq(VodPlayHistoryDO::getMemberId, classMemberMappingDO.getId())
.eq(VodPlayHistoryDO::getMemberId, classMemberMappingDO.getMemberId())
.eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
.orderByDesc(VodPlayHistoryDO::getPlayRecord));
for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS){
totalStudyLength+=vodPlayHistoryDO.getPlayLength();
for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) {
totalStudyLength += vodPlayHistoryDO.getPlayLength();
}
if (vodPlayHistoryDOS.size() > 0) {
if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) {
if (vodPlayHistoryDOS.get(0).getPlayRecord() >= vodDictDO.getVodLength() * 0.8) {
totalStudyVods++;
}
}
}
}
classSignInfoVO.setStudyVodCounts(MathUtil.intDivFloorPercent(totalStudyVods, vodDictDOS.size()));
classSignInfoVO.setStudyVodCounts(MathUtil.intDivCeil(totalStudyVods, classMemberMappingDOS.size() ));
//平均完成时长 学生观看课程视频的全部时长/总人数
int avg = MathUtil.intDivCeil(totalStudyLength,classMemberMappingDOS.size());
int avg = MathUtil.intDivCeil(totalStudyLength, classMemberMappingDOS.size());
classSignInfoVO.setAvgVodPlayLength(avg);
//测试通过率
......@@ -136,19 +136,19 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
int passNum = 0;
for (ExerciseDoneResultDO exerciseDoneResultDO : exerciseDoneResultDOS) {
if (exerciseDoneResultDO.getRightCounts() > exerciseDoneResultDO.getTotalCounts()*0.6){
if (exerciseDoneResultDO.getRightCounts() > exerciseDoneResultDO.getTotalCounts() * 0.6) {
passNum++;
}
}
classSignInfoVO.setPassRate(MathUtil.intDivFloorPercent(passNum,classMemberMappingDOS.size()));
classSignInfoVO.setPassRate(MathUtil.intDivFloorPercent(passNum, classMemberMappingDOS.size()));
//平均签到数 向上取整
//签到总次数
Integer signCount = this.baseMapper.selectCount(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getClassId,classSignInfoVO.getClassId()));
classSignInfoVO.setAvgSignCount(MathUtil.intDivCeil(signCount,classMemberMappingDOS.size()));
.eq(SignInRecordDO::getClassId, classSignInfoVO.getClassId()));
classSignInfoVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classMemberMappingDOS.size()));
//答疑数
Integer count = answeringQuestionMapper.selectCount(new QueryWrapper<AnsweringQuestionDO>()
......@@ -162,7 +162,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
}
public SignInStatusVO signInStatus(SignInRecordDO signInRecordDO){
public SignInStatusVO signInStatus(SignInRecordDO signInRecordDO) {
SignInStatusVO signInStatusVO = new SignInStatusVO();
......@@ -172,15 +172,14 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
for (ClassDictDO classDictDO : classDictDOS){
for (ClassDictDO classDictDO : classDictDOS) {
Integer count = this.baseMapper.selectCount(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getClassId,classDictDO.getId())
.eq(SignInRecordDO::getMemberId,signInRecordDO.getMemberId())
.gt(SignInRecordDO::getSignInDate,LocalDate.now()));
.lambda()
.eq(SignInRecordDO::getClassId, classDictDO.getId())
.eq(SignInRecordDO::getMemberId, signInRecordDO.getMemberId())
.gt(SignInRecordDO::getSignInDate, LocalDate.now()));
if (count == 0 ){
if (count == 0) {
flag = false;
}
......
......@@ -44,6 +44,8 @@ public class ConstantUtils {
public static final String NOTICE_NAME = "有课进度通知";
public static final String TECH_NAME = "有课互联科技";
public static final String PUBLISH_SUCCESS = "发布成功";
public static final String LOGIN_OUT ="登出成功";
......
package com.subsidy.util;
import java.util.Arrays;
import java.util.List;
public class ExcelFormatUtils {
public static final List<String> memberList = Arrays.asList(new String[]{"序号", "成员名称", "身份证号码", "账号", "联系方式", "签到次数", "课程进度", "培训时长", "答疑数", "测试成绩", "总评价"});
public static final List<String> signList = Arrays.asList(new String[]{"序号", "成员名称", "身份证号码", "手机号码", "培训时长", "课程进度", "完成率", "签到次数", "签到日期"});
public static final List<String> scoreList = Arrays.asList(new String[]{"序号", "成员名称", "身份证号码", "手机号码", "测试最高成绩", "测试次数", "总评价"});
public static final List<String> answersList = Arrays.asList(new String[]{"序号", "提问", "答疑", "提问时间", "提问成员", "答疑时间"});
}
......@@ -89,12 +89,13 @@ public class MathUtil {
return counts.multiply(new BigDecimal(100)).divide(total, RoundingMode.CEILING).stripTrailingZeros().toPlainString() + "%";
}
}
//百分比 不带%输出
public static String getPercentAvgIndexWithPercent(BigDecimal counts, BigDecimal total) {
if (BigDecimal.ZERO.equals(total) || BigDecimal.ZERO.equals(counts)) {
return "0";
} else {
return counts.multiply(new BigDecimal(100)).divide(total,2,BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString();
return counts.multiply(new BigDecimal(100)).divide(total, 2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString();
}
}
......@@ -103,7 +104,7 @@ public class MathUtil {
if (BigDecimal.ZERO.equals(total) || BigDecimal.ZERO.equals(counts)) {
return "0";
} else {
return counts.multiply(new BigDecimal(100)).divide(total,2,BigDecimal.ROUND_CEILING).stripTrailingZeros().toPlainString();
return counts.multiply(new BigDecimal(100)).divide(total, 2, BigDecimal.ROUND_CEILING).stripTrailingZeros().toPlainString();
}
}
......@@ -124,7 +125,7 @@ public class MathUtil {
return (int) Math.floor((double) a * 100 / b);
}
public static Integer getRandomNum(Integer i){
public static Integer getRandomNum(Integer i) {
Random random = new Random();
return random.nextInt(i);
}
......@@ -134,4 +135,36 @@ public class MathUtil {
// System.out.println(getRandomNum(2));
// }
// }
public static String secToTime(int time) {
String timeStr = null;
int hour = 0;
int minute = 0;
int second = 0;
if (time <= 0) {
return "00:00";
} else {
minute = time / 60;
if (minute < 60) {
second = time % 60;
timeStr = unitFormat(minute) + ":" + unitFormat(second);
} else {
hour = minute / 60;
minute = minute % 60;
second = time - hour * 3600 - minute * 60;
timeStr = unitFormat(hour) + ":" + unitFormat(minute) + ":" + unitFormat(second);
}
}
return timeStr;
}
public static String unitFormat(int i) {
String retStr = null;
if (i >= 0 && i < 10) {
retStr = "0" + Integer.toString(i);
} else {
retStr = "" + i;
}
return retStr;
}
}
......@@ -11,6 +11,11 @@ import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import com.subsidy.common.configure.AliyunSmsProperties;
import com.subsidy.common.exception.HttpException;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -110,7 +115,7 @@ public class SMSUtils {
request.setSysAction("SendSms");
request.putQueryParameter("RegionId",ConstantUtils.REGION_ID);
request.putQueryParameter("PhoneNumbers",telephone);
request.putQueryParameter("SignName",ConstantUtils.NOTICE_NAME);
request.putQueryParameter("SignName",ConstantUtils.TECH_NAME);
request.putQueryParameter("TemplateCode",templateId);
// if (StringUtils.isEmpty(param)){
// request.putQueryParameter("TemplateParam","{ \"code\":\""+verifyCode +"\"}");
......@@ -131,9 +136,22 @@ public class SMSUtils {
}
}
public static void main(String[] args) {
String param = "{ \"company\":\""+"基金会"+ "\",\"time\":\""+"2020-01-02" +"\",\"address\":\""+"上海市" +"\"}";
sendNoticeSMS("SMS_215336604","15201936167",param);
//public static void main(String[] args) {
// String param = "{ \"course\":\""+"语文课"+ "\",\"time\":\""+"2020-01-02" +"\",\"address\":\""+"上海市" +"\"}";
// sendNoticeSMS("SMS_215336604","15201936167,18201963812",param);
//}
public static void main(String[] args) throws BadHanyuPinyinOutputFormatCombination {
HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
//拼音小写
format.setCaseType(HanyuPinyinCaseType.LOWERCASE);
//不带声调
format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
//format.setVCharType();
//要转换的中文,格式,转换之后的拼音的分隔符,遇到不能转换的是否保留 wo,shi,zhong,guo,ren,,hello
System.out.println(PinyinHelper.toHanYuPinyinString("我是中国人", format, "", false));
}
}
......@@ -267,7 +267,7 @@ public class ExcelUtil {
titleFont.setBoldweight((short) 700);
titleStyle.setFont(titleFont);
//第二行
//第二行/第三行样式
CellStyle secondStyle = workbook.createCellStyle();
secondStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); //下边框
secondStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);//左边框
......@@ -277,16 +277,6 @@ public class ExcelUtil {
Font secondFont = workbook.createFont();
secondStyle.setFont(secondFont);
//第三行
CellStyle thirdStyle = workbook.createCellStyle();
thirdStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); //下边框
thirdStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);//左边框
thirdStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);//上边框
thirdStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);//右边框
secondStyle.setAlignment(HSSFCellStyle.ALIGN_LEFT);
Font thirdFont = workbook.createFont();
thirdStyle.setFont(thirdFont);
// 列头样式
CellStyle headerStyle = workbook.createCellStyle();
setStyle(headerStyle);
......@@ -384,10 +374,10 @@ public class ExcelUtil {
sheet.addMergedRegion(cellRangeAddress32);
setBorderStyle(HSSFCellStyle.BORDER_THIN, cellRangeAddress32, sheet, workbook); //给合并过的单元格加边框
thirdRow.createCell(0).setCellValue(thirdHead[0]);
thirdRow.getCell(0).setCellStyle(thirdStyle);
thirdRow.getCell(0).setCellStyle(secondStyle);
thirdRow.createCell(5).setCellValue(thirdHead[1]);
thirdRow.getCell(5).setCellStyle(thirdStyle);
thirdRow.getCell(5).setCellStyle(secondStyle);
//标题 3
SXSSFRow headerRow = sheet.createRow(3); //列头 rowIndex =1
......@@ -444,7 +434,7 @@ public class ExcelUtil {
newCell = dataRow.createCell(7);
newCell.setCellStyle(cellStyle);
newCell.setCellValue(classDetailVO.getTrainingLength());
newCell.setCellValue(classDetailVO.getTrainingLengthStr());
newCell = dataRow.createCell(8);
newCell.setCellStyle(cellStyle);
......@@ -660,7 +650,7 @@ public class ExcelUtil {
newCell = dataRow.createCell(4);
newCell.setCellStyle(cellStyle);
newCell.setCellValue(classSignVO.getTrainingLength());
newCell.setCellValue(classSignVO.getTrainingLengthStr());
newCell = dataRow.createCell(5);
newCell.setCellStyle(cellStyle);
......
......@@ -24,4 +24,5 @@ public class ExerciseTestVO {
private String telephone;
private Integer count;
}
......@@ -4,7 +4,7 @@ import com.subsidy.util.excel.ExcelColumn;
import lombok.Data;
@Data
public class ClassDetailVO <T>{
public class ClassDetailVO{
private Long id;
......@@ -40,9 +40,12 @@ public class ClassDetailVO <T>{
@ExcelColumn(col = 6,value = "课程进度")
private String classProcess;
@ExcelColumn(col = 7,value = "培训时长")
private Integer trainingLength;
@ExcelColumn(col = 7,value = "培训时长")
private String trainingLengthStr;
/**
* 作对个数
*/
......@@ -66,7 +69,7 @@ public class ClassDetailVO <T>{
private Integer askCounts;
private String result;
......
......@@ -19,4 +19,6 @@ public class GetAllClassesVO {
private Integer cnt;
private String classType;
}
......@@ -29,9 +29,11 @@ public class ClassSignVO {
/**
* 培训时长
*/
@ExcelColumn(col = 4,value = "培训时长")
private Integer trainingLength;
@ExcelColumn(col = 4,value = "培训时长")
private String trainingLengthStr;
/**
* 已看视频
*/
......
......@@ -15,4 +15,8 @@ public class GetCourseTestVO {
private String deadline;
private String result;
private String percent;
}
......@@ -53,5 +53,8 @@ public class ClassSignInfoVO {
*/
private Integer answerCount;
private String classType;
}
......@@ -41,7 +41,7 @@
<if test="memberId != null ">
and t.ask_id = #{memberId}
</if>
order by t.create_date
order by t.create_date desc
</select>
</mapper>
......@@ -30,7 +30,8 @@
t2.course_name,
t.start_date,
t.end_date,
t4.cnt
t4.cnt,
t.class_type
FROM
class_dict t
LEFT JOIN course_dict t2 ON t.course_id = t2.id
......@@ -76,7 +77,7 @@
AND t3.company_id = #{companyId}
AND t2.id NOT IN (
SELECT
t3.id
t3.member_id
FROM
class_member_mapping t3
WHERE
......@@ -84,4 +85,16 @@
AND t3.class_id = #{classId})
</select>
<select id="classMembers" parameterType="long" resultType="com.subsidy.model.MemberDO">
SELECT
t2.*
FROM
class_member_mapping t
LEFT JOIN member t2 ON t.member_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t.class_id = #{classId}
</select>
</mapper>
......@@ -115,4 +115,7 @@
AND t.company_id = #{companyId}
</if>
</select>
</mapper>
......@@ -23,16 +23,17 @@
<select id="classSignInfo" resultType="com.subsidy.vo.sign.ClassSignInfoVO">
SELECT
t.id as classId,
t2.id as courseId,
t.id AS classId,
t2.id AS courseId,
t.class_name,
t2.course_name,
t.start_date,
t.end_date
t.end_date,
t.class_type
FROM
company_dict t3
left join class_dict t on t3.id = t.company_id
LEFT JOIN course_dict t2 ON t.course_id = t2.id
class_dict t
LEFT JOIN company_dict t3 ON t3.id = t.company_id
LEFT JOIN course_dict t2 ON t.course_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
......
......@@ -31,7 +31,8 @@
t2.vod_url,
t2.vod_name,
t3.play_record,
round( t3.play_record * 100 / t2.vod_length, 0 ) AS percent
round( t3.play_record * 100 / t2.vod_length, 0 ) AS percent,
t.playDate
FROM
(
SELECT
......@@ -53,6 +54,7 @@
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
WHERE
t2.delete_date IS NULL
order by t.playDate desc
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!