9 files modified
1 files added
| | |
| | | import org.springblade.modules.directive.entity.DirectiveFile; |
| | | import org.springblade.modules.directive.service.DirectiveService; |
| | | import org.springblade.modules.directive.vo.DirectiveVo; |
| | | import org.springblade.modules.workreport.vo.WorkReportVo; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Date; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 自定义分页--接收到的指令 |
| | | * @param query page,size |
| | | * @param directive 指令对象 |
| | | */ |
| | | @GetMapping("/pageReply") |
| | | public R<IPage<DirectiveVo>> pageReply(DirectiveVo directive, Query query) { |
| | | IPage<DirectiveVo> pages = directiveService.selectDirectiveReplyPage(Condition.getPage(query), directive); |
| | | // List<WorkReportVo> records = pages.getRecords(); |
| | | // for (WorkReportVo record : records) { |
| | | // record.setReplyRealName(getReplyRealName(record)); |
| | | // record.setReplyDeptName(getReplyDeptName(record)); |
| | | // } |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | * @param directive 指令信息对象 |
| | | */ |
| | |
| | | * @return |
| | | */ |
| | | int deleteByDirectiveId(@Param("id") Long id); |
| | | |
| | | /** |
| | | * 自定义分页--接收到的指令 |
| | | * @param page,size |
| | | * @param directive 指令对象 |
| | | */ |
| | | List<DirectiveVo> selectDirectiveReplyPage(IPage<DirectiveVo> page, @Param("directive")DirectiveVo directive); |
| | | } |
| | |
| | | where |
| | | 1=1 |
| | | <if test="directive.type!=null and directive.type!=''"> |
| | | and sll.type = #{directive.type} |
| | | and sd.type = #{directive.type} |
| | | </if> |
| | | <if test="directive.startTime!=null and directive.startTime!=''"> |
| | | and sl.send_time >= #{directive.startTime} |
| | | and sd.send_time >= #{directive.startTime} |
| | | </if> |
| | | <if test="directive.endTime!=null and directive.endTime!=''"> |
| | | and sl.send_time <= #{directive.endTime} |
| | | and sd.send_time <= #{directive.endTime} |
| | | </if> |
| | | <if test="directive.sendDirectiveId!=null and directive.sendDirectiveId!=''"> |
| | | and sd.send_directive_id like concat('%', #{directive.sendDirectiveId},'%') |
| | | </if> |
| | | <if test="directive.receiveDirectiveIds!=null and directive.receiveDirectiveIds!=''"> |
| | | and sd.receive_directive_ids like concat('%', #{directive.receiveDirectiveIds},'%') |
| | | </if> |
| | | </select> |
| | | |
| | |
| | | delete from sys_directive_file where directive_id = #{id} |
| | | </delete> |
| | | |
| | | <!--自定义分页-接收到的指令--> |
| | | <select id="selectDirectiveReplyPage" resultType="org.springblade.modules.directive.vo.DirectiveVo"> |
| | | SELECT |
| | | sd.*, |
| | | bu.real_name sendName |
| | | FROM |
| | | sys_directive sd |
| | | left join |
| | | blade_user bu |
| | | on |
| | | bu.id = sd.send_directive_id |
| | | where |
| | | 1=1 |
| | | <if test="directive.type!=null and directive.type!=''"> |
| | | and sd.type = #{directive.type} |
| | | </if> |
| | | <if test="directive.startTime!=null and directive.startTime!=''"> |
| | | and sd.send_time >= #{directive.startTime} |
| | | </if> |
| | | <if test="directive.endTime!=null and directive.endTime!=''"> |
| | | and sd.send_time <= #{directive.endTime} |
| | | </if> |
| | | <if test="directive.receiveDirectiveIds!=null and directive.receiveDirectiveIds!=''"> |
| | | and sd.receive_directive_ids like concat('%', #{directive.receiveDirectiveIds},'%') |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | * @return |
| | | */ |
| | | int deleleByDirectiveId(Long id); |
| | | |
| | | /** |
| | | * 自定义分页--接收到的指令 |
| | | * @param page,size |
| | | * @param directive 指令对象 |
| | | */ |
| | | IPage<DirectiveVo> selectDirectiveReplyPage(IPage<DirectiveVo> page, DirectiveVo directive); |
| | | } |
| | |
| | | public int deleleByDirectiveId(Long id) { |
| | | return baseMapper.deleteByDirectiveId(id); |
| | | } |
| | | |
| | | /** |
| | | * 自定义分页--接收到的指令 |
| | | * @param page,size |
| | | * @param directive 指令对象 |
| | | */ |
| | | @Override |
| | | public IPage<DirectiveVo> selectDirectiveReplyPage(IPage<DirectiveVo> page, DirectiveVo directive) { |
| | | IPage<DirectiveVo> directiveVoIPage = page.setRecords(baseMapper.selectDirectiveReplyPage(page, directive)); |
| | | List<DirectiveVo> records = directiveVoIPage.getRecords(); |
| | | for (DirectiveVo record : records) { |
| | | // String[] receiveDirectiveIds = record.getReceiveDirectiveIds().toString().split(","); |
| | | // StringBuilder builder = new StringBuilder(); |
| | | // for (String receiveDirectiveId : receiveDirectiveIds) { |
| | | // User user = userService.getById(receiveDirectiveId); |
| | | // builder.append(user.getRealName()).append(","); |
| | | // } |
| | | //查询图片 |
| | | List<DirectiveFile> directiveFiles = baseMapper.getDirectiveFileList(record.getId()); |
| | | if (directiveFiles.size()>0){ |
| | | StringBuilder builderFile = new StringBuilder(); |
| | | for (DirectiveFile directiveFile : directiveFiles) { |
| | | builderFile.append(directiveFile.getUrl()).append(","); |
| | | } |
| | | String urls = builderFile.toString(); |
| | | record.setUrl(urls.substring(0, urls.length() - 1)); |
| | | } |
| | | // record.setReceiveName(builder.toString().substring(0, builder.toString().length() - 1)); |
| | | } |
| | | return directiveVoIPage; |
| | | } |
| | | } |
| | |
| | | private String weight; |
| | | |
| | | /** |
| | | * 报名电话 |
| | | * 培训报名申请id |
| | | */ |
| | | private String phone; |
| | | @TableField("train_exam_id") |
| | | private String trainExamId; |
| | | |
| | | /** |
| | | * 身份证号 |
| | |
| | | private String academicUrl; |
| | | |
| | | /** |
| | | * 培训公司名称 |
| | | * 培训公司id |
| | | */ |
| | | @TableField("training_unit_name") |
| | | private String trainingUnitName; |
| | | @TableField("training_unit_id") |
| | | private String trainingUnitId; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 培训时间 |
| | | * 培训报名时间 |
| | | */ |
| | | @TableField("training_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date trainingTime; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private Integer cancel; |
| | | |
| | | /** |
| | | * 报名人员id |
| | | */ |
| | | @TableField("user_id") |
| | | private String userId; |
| | | |
| | | } |
| | |
| | | <!--报名培训分页信息--> |
| | | <select id="selectTrainingRegistrationPage" resultType="org.springblade.modules.training.vo.TrainingRegistrationVo"> |
| | | SELECT |
| | | sr.*,bt.dept_name AS deptName |
| | | sr.*, |
| | | bt.dept_name AS deptName, |
| | | bt0.dept_name AS trainUnitName, |
| | | bu.real_name realName,bu.phone,bu.cardid idCardNo, |
| | | ste.start_time trainExamTime,ste.train_exam_name trainExamName |
| | | FROM |
| | | sys_training_registration sr |
| | | sys_training_registration sr |
| | | LEFT JOIN |
| | | blade_dept bt |
| | | blade_dept bt |
| | | ON |
| | | sr.dept_id = bt.id |
| | | sr.dept_id = bt.id |
| | | LEFT JOIN |
| | | blade_dept bt0 |
| | | ON |
| | | sr.training_unit_id = bt0.id |
| | | left join |
| | | blade_user bu |
| | | on |
| | | sr.user_id = bu.id |
| | | left join |
| | | sys_train_exam ste |
| | | on |
| | | ste.id = sr.train_exam_id |
| | | WHERE |
| | | 1=1 |
| | | 1=1 |
| | | <if test="trainingRegistration.trainingUnitId!=null and trainingRegistration.trainingUnitId!=''"> |
| | | and ste.dept_id = #{trainingRegistration.trainingUnitId} |
| | | </if> |
| | | <if test="trainingRegistration.deptName!=null and trainingRegistration.deptName!=''"> |
| | | and bt.dept_name like concat('%', #{trainingRegistration.deptName},'%') |
| | | </if> |
| | | <if test="trainingRegistration.name!=null and trainingRegistration.name!=''"> |
| | | and sr.name like concat('%', #{trainingRegistration.name},'%') |
| | | <if test="trainingRegistration.realName!=null and trainingRegistration.realName!=''"> |
| | | and bu.real_name like concat('%', #{trainingRegistration.realName},'%') |
| | | </if> |
| | | <if test="trainingRegistration.cancel!=null"> |
| | | and sr.cancel = #{trainingRegistration.cancel} |
| | |
| | | import org.springblade.modules.training.entity.TrainingRegistration; |
| | | import org.springblade.modules.training.mapper.TrainingRegistrationMapper; |
| | | import org.springblade.modules.training.service.TrainingRegistrationService; |
| | | import org.springblade.modules.training.util.LongTimeUtil; |
| | | import org.springblade.modules.training.vo.TrainingRegistrationVo; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 报名培训服务实现类 |
| | |
| | | |
| | | @Override |
| | | public IPage<TrainingRegistrationVo> selectTrainingRegistrationPage(IPage<TrainingRegistrationVo> page, TrainingRegistrationVo trainingRegistration) { |
| | | return page.setRecords(baseMapper.selectTrainingRegistrationPage(page, trainingRegistration)); |
| | | List<TrainingRegistrationVo> trainingRegistrationVos = baseMapper.selectTrainingRegistrationPage(page, trainingRegistration); |
| | | trainingRegistrationVos.forEach(trainingRegistrationVo -> { |
| | | trainingRegistrationVo.setRemainingTime(LongTimeUtil.getDistanceTime(trainingRegistrationVo.getTrainExamTime().getTime(), System.currentTimeMillis())); |
| | | }); |
| | | return page.setRecords(trainingRegistrationVos); |
| | | } |
| | | |
| | | /** |
| New file |
| | |
| | | package org.springblade.modules.training.util; |
| | | |
| | | /** |
| | | * @author zhongrj |
| | | */ |
| | | public class LongTimeUtil { |
| | | |
| | | /** |
| | | * 计算time2减去time1的差值 差值只设置 几天 几个小时 或 几分钟 根据差值返回多长之间前或多长时间后 |
| | | * @param time1 |
| | | * @param time2 |
| | | * @return |
| | | */ |
| | | public static String getDistanceTime(long time1, long time2) { |
| | | long day = 0; |
| | | long hour = 0; |
| | | long min = 0; |
| | | long sec = 0; |
| | | long diff; |
| | | |
| | | if (time1 < time2) { |
| | | return "已超时"; |
| | | } else { |
| | | diff = time1 - time2; |
| | | } |
| | | day = diff / (24 * 60 * 60 * 1000); |
| | | hour = (diff / (60 * 60 * 1000) - day * 24); |
| | | min = ((diff / (60 * 1000)) - day * 24 * 60 - hour * 60); |
| | | sec = (diff / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60); |
| | | if (day != 0) { |
| | | return day + "天"+hour + "小时"+min + "分钟" + sec + "秒"; |
| | | } |
| | | if (hour != 0) { |
| | | return hour + "小时"+ min + "分钟" + sec + "秒"; |
| | | } |
| | | if (min != 0) { |
| | | return min + "分钟" + sec + "秒"; |
| | | } |
| | | if (sec != 0) { |
| | | return sec + "秒" ; |
| | | } |
| | | return "0秒"; |
| | | } |
| | | } |
| | |
| | | package org.springblade.modules.training.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import org.springblade.modules.training.entity.TrainingRegistration; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhongrj |
| | |
| | | * 组织机构名称 |
| | | */ |
| | | private String deptName; |
| | | |
| | | |
| | | /** |
| | | * 距离考试截止时间 |
| | | */ |
| | | private String remainingTime; |
| | | |
| | | /** |
| | | * 身份证号 |
| | | */ |
| | | private String idCardNo; |
| | | |
| | | /** |
| | | * 培训考试时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date trainExamTime; |
| | | |
| | | /** |
| | | * 报名人员姓名 |
| | | */ |
| | | private String realName; |
| | | |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | private String phone; |
| | | |
| | | /** |
| | | * 培训公司名称 |
| | | */ |
| | | private String trainUnitName; |
| | | |
| | | |
| | | /** |
| | | * 考试名称 |
| | | */ |
| | | private String trainExamName; |
| | | } |