Commit d98838ac authored by tangwei's avatar tangwei

新增培训管理接口

parent 13038bf7
......@@ -106,6 +106,8 @@ public class ControllerAop {
urls.add("/hygf/qiyuesuo/callback");
urls.add("/hygf/unit-info/unitRegister");
urls.add("/hygf/maintenance/getDealer");
urls.add("/hygf/maintenance/save");
urls.add("/hygf/qiyuesuo/getUserToken");
// 获取请求路径
for (String uri : urls) {
......
......@@ -31,6 +31,6 @@ public class TrainingDto extends BaseDto {
private String files;
@ApiModelProperty(value = "学习状态")
private String status;
private Integer status;
}
......@@ -13,6 +13,6 @@ import java.util.Map;
*/
public interface MaintenanceTrainingMapper extends BaseMapper<MaintenanceTraining> {
Map<String,Integer> selectTrainingStatus(String userId);
Map<String,Long> selectTrainingStatus(String userId);
}
......@@ -6,6 +6,8 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.Training;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 培训信息表 Mapper 接口
*
......@@ -17,9 +19,12 @@ public interface TrainingMapper extends BaseMapper<Training> {
/**
* 查询当前人培训资料学习状态
* */
Page<TrainingDto> currentStudyStatusList(
List<TrainingDto> currentStudyStatusList(
@Param("current") Integer current,
@Param("size") Integer size,
@Param("userId") String userId);
@Param("userId") String userId,
@Param("status") Integer status,
@Param("name") String name
);
}
......@@ -3,14 +3,20 @@
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.mapper.TrainingMapper">
<select id="currentStudyStatusList" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.TrainingDto">
SELECT
ht.name,
ht.type,
ht.files,
count(hmt.sequence_nbr) as status
select * from (SELECT
ht.*,
(select COUNT(hmt.sequence_nbr) from hygf_maintenance_training hmt where hmt.training_id = ht.sequence_nbr and hmt.user_id = #{userId} )
as status
FROM
hygf_training AS ht
LEFT JOIN hygf_maintenance_training hmt ON hmt.training_id = ht.sequence_nbr AND hmt.user_id = #{userId}
) hh
where hh.is_delete=0
<if test="status!=null ">
and hh.status =#{status}
</if>
<if test="name!=null and name!='' ">
and hh.name like concat(concat("%",#{name}),"%")
</if>
</select>
</mapper>
......@@ -51,7 +51,7 @@ public class MaintenanceController extends BaseController {
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增运维人员", notes = "新增运维人员")
public ResponseModel<Maintenance> save(@RequestBody Maintenance model) {
......
......@@ -43,12 +43,10 @@ public class MaintenanceTrainingController extends BaseController {
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public ResponseModel<MaintenanceTrainingDto> save(@RequestBody MaintenanceTrainingDto model) {
model = maintenanceTrainingServiceImpl.createWithModel(model);
boolean flag = maintenanceTrainingServiceImpl.selectTrainingStatus(model.getUserId());
//如果是true 则已学习完 需修改运维人员的培训状态为完成 当为完成时 运维方可进行工单业务
if (flag){
maintenanceService.updateTraining(model.getUserId());
}
maintenanceTrainingServiceImpl.selectTrainingStatus(model,model.getUserId());
return ResponseHelper.buildResponse(model);
}
......
......@@ -104,11 +104,13 @@ public class TrainingController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "培训信息表列表全部数据查询", notes = "培训信息表列表全部数据查询")
@GetMapping(value = "/page")
public ResponseModel<Page<TrainingDto>> currentStudyStatusList(Integer current, Integer size) {
Page<TrainingDto> page = new Page<TrainingDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(trainingServiceImpl.currentStudyStatusList(current,size));
public ResponseModel<Page<TrainingDto>> currentStudyStatusList(Integer current,
Integer size,
@RequestParam(required = false) String status,
@RequestParam(required = false) String name
) {
return ResponseHelper.buildResponse(trainingServiceImpl.currentStudyStatusList(current,size, status,
name));
}
......
......@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.Enum.MaintenanceTypeEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.mapper.*;
......@@ -63,6 +64,11 @@ public class MaintenanceServiceImpl extends BaseService<MaintenanceDto,Maintenan
@Value("${dealer.appcode.manage}")
private String appCodes;
@Value("${dealer.amosDealerId}")
private Long amosDealerId;
@Value("${dealer.appcode.role}")
private Long role;
......@@ -263,12 +269,17 @@ public class MaintenanceServiceImpl extends BaseService<MaintenanceDto,Maintenan
@Transactional
public Maintenance examine(Long sequenceNbr, MaintenanceLog maintenanceLog) {
//保存操作日志
maintenanceLog.setMaintenanceId(sequenceNbr);
maintenanceLogMapper.insert(maintenanceLog);
//判断审核状态
Maintenance maintenance = maintenanceMapper.selectById(sequenceNbr);
MaintenanceDto maintenanceDto = maintenanceMapper.selectOneById(sequenceNbr);
if (maintenanceLog.getOperationResults().equals(MaintenanceUtil.BH)) {
maintenance.setReviewStatus(MaintenanceUtil.BH);
maintenanceMapper.updateById(maintenance);
......@@ -295,8 +306,16 @@ public class MaintenanceServiceImpl extends BaseService<MaintenanceDto,Maintenan
Map<Long, List<RoleModel>> orgRoles = new HashMap<>();
List<Long> roleIds = new ArrayList<>();
roleIds.add(role);
if(maintenanceDto.getMaintenanceTypeCode().equals(MaintenanceTypeEnum.社会人员运维.getCode())){
roleSeqMap.put(amosDealerId, roleIds);
orgRoles.put(amosDealerId, userRoleList);
}else{
roleSeqMap.put(Long.valueOf(maintenanceDto.getAmosDealerId()), roleIds);
orgRoles.put(Long.valueOf(maintenanceDto.getAmosDealerId()), userRoleList);
}
agencyUserModel.setOrgRoles(orgRoles);
agencyUserModel.setOrgRoleSeqs(roleSeqMap);
// 将创建用户加入用户组
......
......@@ -4,6 +4,8 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.MaintenanceTraining;
import com.yeejoin.amos.boot.module.hygf.api.mapper.MaintenanceTrainingMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IMaintenanceTrainingService;
import com.yeejoin.amos.boot.module.hygf.api.dto.MaintenanceTrainingDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
......@@ -19,6 +21,9 @@ import java.util.Map;
*/
@Service
public class MaintenanceTrainingServiceImpl extends BaseService<MaintenanceTrainingDto,MaintenanceTraining,MaintenanceTrainingMapper> implements IMaintenanceTrainingService {
@Autowired
MaintenanceServiceImpl maintenanceService;
/**
* 分页查询
*/
......@@ -35,16 +40,22 @@ public class MaintenanceTrainingServiceImpl extends BaseService<MaintenanceTrain
return this.queryForList("" , false);
}
public boolean selectTrainingStatus(String userId){
@Transactional
public void selectTrainingStatus(MaintenanceTrainingDto model,String userId){
model = this.createWithModel(model);
//查询培训科目总数及当前已学习总数
Map<String, Integer> map = this.getBaseMapper().selectTrainingStatus(userId);
Integer total = map.get("total");
Integer num = map.get("num");
Map<String, Long> map = this.getBaseMapper().selectTrainingStatus(userId);
Long total = map.get("total");
Long num = map.get("num");
//如果相减是0 即已学习完 反之为学习完
if ((total - num) == 0){
return true;
//如果是true 则已学习完 需修改运维人员的培训状态为完成 当为完成时 运维方可进行工单业务
maintenanceService.updateTraining(model.getUserId());
}
return false;
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.module.hygf.api.dto.MaintenanceDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.Training;
import com.yeejoin.amos.boot.module.hygf.api.mapper.TrainingMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.ITrainingService;
......@@ -40,10 +43,30 @@ public class TrainingServiceImpl extends BaseService<TrainingDto,Training,Traini
/**
* 查询当前人培训资料学习状态
* */
public Page<TrainingDto> currentStudyStatusList(Integer current, Integer size){
public Page<TrainingDto> currentStudyStatusList(Integer current, Integer size, String status,
String name){
Integer statusflag=null;
if(status!=null&&status.equals("未学")){
statusflag=0;
}else if(status!=null&&status.equals("已学")){
statusflag=1;
}
//查询当前人userId
String exeUserId = RequestContext.getExeUserId();
//通过userId查询对应运维人员培训表中的数据来区分是否学习
return this.getBaseMapper().currentStudyStatusList(current,size,exeUserId);
PageHelper.startPage(current, size);
List<TrainingDto> resultPage= this.getBaseMapper().currentStudyStatusList(current,size,exeUserId,statusflag,name);
PageInfo<TrainingDto> page = new PageInfo(resultPage);
Page<TrainingDto> pagenew = new Page<TrainingDto>();
pagenew.setCurrent(current);
pagenew.setTotal(page.getTotal());
pagenew.setSize(size);
pagenew.setRecords(page.getList());
return pagenew;
}
}
\ No newline at end of file
......@@ -223,3 +223,4 @@ cheduled.crons=0 10 0 * * ?
dealer.appcode.manage=studio_normalapp_5155413,studio_normalapp_5133538
dealer.appcode.role=1767363928842571777
dealer.amosDealerId=1767820997374775298
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment