Commit 49d090c5 by 涂亚平

2.2.1 年后第一个版本

1 parent a74b24ef
Showing with 541 additions and 14 deletions
......@@ -87,7 +87,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));
}
......
......@@ -36,7 +36,7 @@ public class ClassDictController {
private ClassDictService classDictService;
@PostMapping("getAllClasses")
@ApiOperation("获取某老师下的所有课程 companyId 所选企业id className 班级名称")
@ApiOperation("获取某公司下的所有课程 companyId 所选企业id className 班级名称")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getAllClasses(@RequestBody ClassDictDO classDictDO){
return ResponseData.generateCreatedResponse(0,classDictService.getAllClasses(classDictDO));
......@@ -50,7 +50,7 @@ public class ClassDictController {
}
@PostMapping("addClass")
@ApiOperation("添加课程 userId:登录人id companyId courseId classType className startDate endDate memberId [] 班级学员 classNoticeDOS[noticeType isAuto noticeTime]")
@ApiOperation("添加课程 userId:登录人id companyId courseId classType className startDate endDate isOrder 是否按照顺序播放 isFastPlay 是否快进 memberId [] 班级学员 classNoticeDOS[noticeType isAuto noticeTime]")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addClass(@RequestBody AddClassDTO addClassDTO){
return ResponseData.generateCreatedResponse(0,classDictService.addClass(addClassDTO));
......@@ -85,7 +85,7 @@ public class ClassDictController {
}
@PostMapping("addMemberToClass")
@ApiOperation("将个成员加入到某个班级里 classId memberIds []")
@ApiOperation("将个成员加入到某个班级里 classId memberIds []")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addMemberToClass(@RequestBody AddMemberToClassDTO addMemberToClassDTO){
return ResponseData.generateCreatedResponse(0,classDictService.addMemberToClass(addMemberToClassDTO));
......
package com.subsidy.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 前端控制器
* </p>
*
* @author DengMin
* @since 2022-02-11
*/
@RestController
@Api(tags = "")
@RequestMapping("/company-field-mapping-do")
public class CompanyFieldMappingController {
}
package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.model.JobDictDO;
import com.subsidy.service.JobDictService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 岗位表 前端控制器
* </p>
*
* @author DengMin
* @since 2022-02-10
*/
@RestController
@Api(tags = "岗位表")
@RequestMapping("/jobDict")
//TODO: 字段类型不全
public class JobDictController {
@Autowired
private JobDictService jobDictService;
@PostMapping("queryJobs")
@ApiOperation("查询某公司的岗位 companyId")
public ResponseVO queryJobs(@RequestBody JobDictDO jobDictDO){
return ResponseData.generateCreatedResponse(0,jobDictService.queryJobs(jobDictDO));
}
@PostMapping("deleteJob")
@ApiOperation("删除某个岗位 id")
public ResponseVO deleteJob(@RequestBody JobDictDO jobDictDO){
return ResponseData.generateCreatedResponse(0,jobDictService.deleteJob(jobDictDO));
}
@PostMapping("addJob")
@ApiOperation("添加岗位 companyId jobName")
public ResponseVO addJob(@RequestBody JobDictDO jobDictDO){
return ResponseData.generateCreatedResponse(0,jobDictService.addJob(jobDictDO));
}
@PostMapping("updateJob")
@ApiOperation("更新岗位 jobName")
public ResponseVO updateJob(@RequestBody JobDictDO jobDictDO){
return ResponseData.generateCreatedResponse(0,jobDictService.updateJob(jobDictDO));
}
}
package com.subsidy.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 岗位人员表 前端控制器
* </p>
*
* @author DengMin
* @since 2022-02-10
*/
@RestController
@Api(tags = "岗位人员表")
@RequestMapping("/jobMemberMapping")
public class JobMemberMappingController {
}
......@@ -126,6 +126,10 @@ public class Scheduler {
List<SignInRecordDO> list = signInRecordMapper.getSignInRecord();
if(list != null && list.size() > 0) {
for (SignInRecordDO signInRecordDO : list) {
Set<String> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + signInRecordDO.getClassId() + ":" + DateFormatUtil.format(signInRecordDO.getSignInDate(), "yyyy-MM-dd")+":*");
if(set != null && set.size() > 0) {
redisUtil.del(set);
}
redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + signInRecordDO.getClassId() + ":" + DateFormatUtil.format(signInRecordDO.getSignInDate(), "yyyy-MM-dd") + ":" + DateFormatUtil.LocalDateTimeToSecond(signInRecordDO.getSignInDate()), null);
}
}
......
package com.subsidy.mapper;
import com.subsidy.model.CompanyFieldMappingDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper 接口
* </p>
*
* @author DengMin
* @since 2022-02-11
*/
@Repository
public interface CompanyFieldMappingMapper extends BaseMapper<CompanyFieldMappingDO> {
}
......@@ -6,6 +6,8 @@ import com.subsidy.model.FieldDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 行业字典表 Mapper 接口
......@@ -19,4 +21,5 @@ public interface FieldDictMapper extends BaseMapper<FieldDictDO> {
IPage<FieldDictDO> queryFields(IPage ipage, String fieldName);
}
package com.subsidy.mapper;
import com.subsidy.model.JobDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 岗位表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2022-02-10
*/
@Repository
public interface JobDictMapper extends BaseMapper<JobDictDO> {
}
package com.subsidy.mapper;
import com.subsidy.model.JobMemberMappingDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 岗位人员表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2022-02-10
*/
@Repository
public interface JobMemberMappingMapper extends BaseMapper<JobMemberMappingDO> {
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
*
* </p>
*
* @author DengMin
* @since 2022-02-11
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("company_field_mapping")
public class CompanyFieldMappingDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private Long companyId;
private Long fieldId;
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 岗位表
* </p>
*
* @author DengMin
* @since 2022-02-10
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("job_dict")
public class JobDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 公司id
*/
private Long companyId;
/**
* 岗位名称
*/
private String jobName;
/**
* 排序
*/
private Integer orderNo;
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 岗位人员表
* </p>
*
* @author DengMin
* @since 2022-02-10
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("job_member_mapping")
public class JobMemberMappingDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 岗位id
*/
private Long jobId;
private Long memberId;
}
package com.subsidy.service;
import com.subsidy.model.CompanyFieldMappingDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author DengMin
* @since 2022-02-11
*/
public interface CompanyFieldMappingService extends IService<CompanyFieldMappingDO> {
}
package com.subsidy.service;
import com.subsidy.model.JobDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 岗位表 服务类
* </p>
*
* @author DengMin
* @since 2022-02-10
*/
public interface JobDictService extends IService<JobDictDO> {
List<JobDictDO> queryJobs(JobDictDO jobDictDO);
String deleteJob(JobDictDO jobDictDO);
String addJob(JobDictDO jobDictDO);
String updateJob(JobDictDO jobDictDO);
}
package com.subsidy.service;
import com.subsidy.model.JobMemberMappingDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 岗位人员表 服务类
* </p>
*
* @author DengMin
* @since 2022-02-10
*/
public interface JobMemberMappingService extends IService<JobMemberMappingDO> {
}
......@@ -43,6 +43,7 @@ import com.subsidy.model.SignInRecordDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.model.OprAdmDictDO;
import com.subsidy.service.AdministerService;
import com.subsidy.service.FieldDictService;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.ExcelFormatUtils;
......@@ -181,6 +182,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
@Autowired
private OprAdmDictMapper oprAdmDictMapper;
@Autowired
private FieldDictService fieldDictService;
//@Autowired
//private MongoTemplate mongoTemplate;
......@@ -325,7 +329,14 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
operatorsDTO.setId(null);
}
return companyDictMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getId(), operatorsDTO.getUserName(), 0);
IPage<OperatorsVO> operatorsVOIPage = companyDictMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getId(), operatorsDTO.getUserName(), 0);
List<OperatorsVO> operatorsVOS = operatorsVOIPage.getRecords();
for (OperatorsVO operatorsVO : operatorsVOS){
//operatorsVO.getField()
}
return operatorsVOIPage;
}
public String addAdminister(AdministerDO administerDO) {
......@@ -412,6 +423,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
if (totalLength >= vodDictDO.getVodLength()) {
totalStudyVods++;
}
totalStudyLength+=totalLength;
}
}
classSummaryVO.setStudyVodCounts(MathUtil.intDivCeil(totalStudyVods, classMemberMappingDOS.size()));
......
package com.subsidy.service.impl;
import com.subsidy.model.CompanyFieldMappingDO;
import com.subsidy.mapper.CompanyFieldMappingMapper;
import com.subsidy.service.CompanyFieldMappingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author DengMin
* @since 2022-02-11
*/
@Service
public class CompanyFieldMappingServiceImpl extends ServiceImpl<CompanyFieldMappingMapper, CompanyFieldMappingDO> implements CompanyFieldMappingService {
}
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.subsidy.model.JobDictDO;
import com.subsidy.mapper.JobDictMapper;
import com.subsidy.service.JobDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.tencentcloudapi.tia.v20180226.models.Job;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 岗位表 服务实现类
* </p>
*
* @author DengMin
* @since 2022-02-10
*/
@Service
public class JobDictServiceImpl extends ServiceImpl<JobDictMapper, JobDictDO> implements JobDictService {
public List<JobDictDO> queryJobs(JobDictDO jobDictDO) {
return this.baseMapper.selectList(new QueryWrapper<JobDictDO>()
.lambda()
.eq(JobDictDO::getCompanyId, jobDictDO.getCompanyId())
.orderByAsc(JobDictDO::getOrderNo));
}
public String deleteJob(JobDictDO jobDictDO) {
this.baseMapper.deleteById(jobDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
public String addJob(JobDictDO jobDictDO) {
int orderNo = 0;
List<JobDictDO> jobDictDOS = this.baseMapper.selectList(new QueryWrapper<JobDictDO>()
.lambda()
.eq(JobDictDO::getCompanyId, jobDictDO.getCompanyId())
.orderByDesc(JobDictDO::getOrderNo));
if (jobDictDOS.size() > 0) {
orderNo = jobDictDOS.get(0).getOrderNo();
}
jobDictDO.setOrderNo(orderNo + 1);
this.baseMapper.insert(jobDictDO);
return ConstantUtils.SUCCESS_SEND_OUT;
}
public String updateJob(JobDictDO jobDictDO) {
this.baseMapper.updateById(jobDictDO);
return ConstantUtils.SET_SUCCESS;
}
}
package com.subsidy.service.impl;
import com.subsidy.model.JobMemberMappingDO;
import com.subsidy.mapper.JobMemberMappingMapper;
import com.subsidy.service.JobMemberMappingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 岗位人员表 服务实现类
* </p>
*
* @author DengMin
* @since 2022-02-10
*/
@Service
public class JobMemberMappingServiceImpl extends ServiceImpl<JobMemberMappingMapper, JobMemberMappingDO> implements JobMemberMappingService {
}
......@@ -212,7 +212,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
MemberDO memberDO = new MemberDO();
BeanUtils.copyProperties(addMemberDTO, memberDO);
this.baseMapper.updateById(memberDO);
redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
MemberDO memberDO1 = this.baseMapper.selectById(addMemberDTO.getId());
redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO1);
if (null != addMemberDTO.getDepartmentIds()) {
memberDepartmentMappingMapper.delete(new QueryWrapper<MemberDepartmentMappingDO>()
......@@ -336,6 +337,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
//mongoTemplate.insert(oprMemDictDO);
oprMemDictMapper.insert(oprMemDictDO);
redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + passwordLoginDTO.getCompanyId() + ":" + passwordLoginDTO.getAccountName(),memberDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), 1);
return memberVO;
} else {
......
......@@ -84,6 +84,10 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
for (ClassDictDO classDictDO : classDictDOS) {
Set<String> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + signInRecordDO.getClassId() + ":" + DateFormatUtil.format(signInRecordDO.getSignInDate(), "yyyy-MM-dd")+":*");
if(set != null && set.size() > 0) {
redisUtil.del(set);
}
redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + classDictDO.getId() + ":" + DateFormatUtil.format(new Date(), "yyyy-MM-dd") + ":" + System.currentTimeMillis(), null);
// 存储到缓存到同时保存到数据库
......@@ -136,7 +140,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
long count = classMemberMappingMapper.getMemberClassCount(signInRecordDO.getMemberId());
long size = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + "*:" + DateFormatUtil.format(new Date(), "yyyy-MM-dd")+"*").stream().count();
if (size <= count) {
if (size < count) {
signInStatusVO.setStatus(false);
}
......
package com.subsidy.vo.administer;
import com.subsidy.model.FieldDictDO;
import lombok.Data;
import java.util.List;
@Data
public class OperatorsVO {
......@@ -11,7 +14,7 @@ public class OperatorsVO {
private String telephone;
private String field;
private List<FieldDictDO> field;
private String banner;
......
# 环境配置
spring.profiles.active=dev
spring.profiles.active=prod
# 端口号
spring.server.port=23457
spring.server.port=23459
#嵌入tomcat配置
#和CPU数
spring.server.acceptorThreadCount=600
......
......@@ -25,7 +25,6 @@
t2.id as companyId,
t.telephone,
t.user_name,
t2.field,
t2.banner,
t2.short_name,
t.account_name,
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.CompanyFieldMappingMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.CompanyFieldMappingDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="company_id" property="companyId" />
<result column="field_id" property="fieldId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, company_id, field_id
</sql>
</mapper>
......@@ -138,12 +138,12 @@
<select id="getClassTestPassRate" parameterType="long" resultType="integer">
SELECT
sum( t11.result )
IFNULL( sum( t11.result ), 0 )
FROM
(
SELECT
IF
( sum( cnt )= sum( result ), 1, 0 ) AS result
( sum( cnt ) = sum( result ), 1, 0 ) AS result
FROM
(
SELECT
......@@ -158,12 +158,14 @@
LEFT JOIN paper_dict t2 ON t.paper_id = t2.id
WHERE
t.delete_date IS NULL
AND t.class_id = 2
AND t.class_id = #{classId}
GROUP BY
t.class_id,
t.paper_id,
t.member_id
) t10
GROUP BY
t10.member_id
) t11
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.JobDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.JobDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="company_id" property="companyId" />
<result column="job_name" property="jobName" />
<result column="order_no" property="orderNo" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, company_id, job_name, order_no
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.JobMemberMappingMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.JobMemberMappingDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="job_id" property="jobId" />
<result column="member_id" property="memberId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, job_id, member_id
</sql>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!