From 2fcd97552d16718cc7997629fd637a73a5a4483f Mon Sep 17 00:00:00 2001 From: 郑永安 <zyazyz250@sina.com> Date: 星期一, 19 六月 2023 14:44:19 +0800 Subject: [PATCH] 删除 --- src/main/java/com/gk/firework/Service/ServiceImpl/AccessAssessApplyServiceImpl.java | 239 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 239 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/gk/firework/Service/ServiceImpl/AccessAssessApplyServiceImpl.java b/src/main/java/com/gk/firework/Service/ServiceImpl/AccessAssessApplyServiceImpl.java new file mode 100644 index 0000000..e3693b2 --- /dev/null +++ b/src/main/java/com/gk/firework/Service/ServiceImpl/AccessAssessApplyServiceImpl.java @@ -0,0 +1,239 @@ +package com.gk.firework.Service.ServiceImpl; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gk.firework.Domain.AccessAssessApply; +import com.gk.firework.Domain.AssessApply; +import com.gk.firework.Domain.Enum.AssessAppealStatus; +import com.gk.firework.Domain.Enum.AssessApplyStatus; +import com.gk.firework.Domain.Enum.AssessType; +import com.gk.firework.Domain.Enum.PunishStatus; +import com.gk.firework.Domain.Exception.BusinessException; +import com.gk.firework.Domain.UserInfo; +import com.gk.firework.Domain.Utils.Properties; +import com.gk.firework.Domain.Utils.StringUtils; +import com.gk.firework.Domain.Utils.UploadUtil; +import com.gk.firework.Domain.Vo.AssessApplyAppealVo; +import com.gk.firework.Mapper.AccessAssessApplyMapper; +import com.gk.firework.Service.AccessAssessApplyService; +import com.gk.firework.Service.UserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; + +@Service("accessAssessApplyService") +public class AccessAssessApplyServiceImpl extends ServiceImpl<AccessAssessApplyMapper, AccessAssessApply> implements AccessAssessApplyService { + + @Autowired + private AccessAssessApplyMapper accessAssessApplyMapper; + @Autowired + private UserService userService; + + + /** + * @Description: 准入评定分页查询 + * @date 2021/7/5 14:30 + */ + @Override + public IPage selectAccessPages(Page<AccessAssessApply> page, Map filter, UserInfo user) { + Map<String, Object> params = new HashMap<>(); + params.put("type", AssessType.ACCESS); + params.put("code", filter.get("code")); + params.put("enterprisename", filter.get("enterprisename")); + params.put("status", filter.get("status")); + //不是超级管理员只能看到自己的 + if (user.getType() != 1 && user.getType()!= 2) { + params.put("requestorid", user.getId()); + } + List<AccessAssessApply> data = accessAssessApplyMapper.selectPages(params, page); + return page.setRecords(data); + } + + + @Override + public void AccessAppeal(AccessAssessApply accessAccessApply, UserInfo user) { + + Long id = accessAccessApply.getId(); + if (id == null) throw new + BusinessException("参数传递错误,请联系管理员"); + String appealcontent = accessAccessApply.getAppealcontent(); + AccessAssessApply aa = this.getById(id); + assert aa.getDeadline() != null; + Date now = new Date(); + //时间检查 + if (now.after(aa.getDeadline())) + throw new BusinessException("已超过截止日期,不可申诉"); + //处罚状态 + if (aa.getPunishstatus() != PunishStatus.UNPUNISH) + throw new BusinessException("处罚已经执行,不能申诉"); + //状态变更为申诉中 + if (aa.getAppealstatus() != AssessAppealStatus.UNAPPEALED) + throw new BusinessException("单子已经在申诉中或者已经完成,无法再次申诉"); + + if (accessAccessApply.getFile() == null) + throw new BusinessException("请上传申诉文件"); + + try { + String filename = UploadUtil.uploadFile(accessAccessApply.getFile(), com.gk.firework.Domain.Utils.Properties.assessApplyPath); + aa.setPath2(Properties.assessApply + filename); + } catch (Exception e) { + e.printStackTrace(); + throw new BusinessException("上传文件出现问题,请联系管理员"); + } + aa.setAppealstatus(AssessAppealStatus.APPEALING); + aa.setAppealtime(now); + aa.setAppealcontent(StringUtils.isBlank(appealcontent) ? null : appealcontent); + this.updateById(aa); + } + + + @Override + public void approveAccessAssessApply(JSONObject entity, UserInfo user) { + Long id = entity.getLong("id"); + if (id == null ) throw new BusinessException("传参有误,请联系管理员"); + + AccessAssessApply accessAssessApply = this.getById(id); + if (accessAssessApply == null) throw new BusinessException("传参有误或者单子不存在"); + + accessAssessApply.setApprover(user.getUsername()); + Date approveDate = new Date(); + accessAssessApply.setApprovetime(approveDate); + //往后推两周 后的晚上零点为截止日期 + Calendar calendar = Calendar.getInstance(); + calendar.setTime(approveDate); + calendar.add(Calendar.WEEK_OF_YEAR, 2); + calendar.add(Calendar.DATE,1); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + accessAssessApply.setDeadline(calendar.getTime()); + accessAssessApply.setStatus(AssessApplyStatus.APPROVED); + accessAssessApply.setAppealstatus(AssessAppealStatus.UNAPPEALED); + this.updateById(accessAssessApply); + } + + @Override + public void rejectAccessAssessApply(JSONObject entity, UserInfo user) { + Long id = entity.getLong("id"); + String lastrejectreason = entity.getString("lastrejectreason"); + + if (id == null ) throw new BusinessException("传参有误,请联系管理员"); + + if (StringUtils.isBlank(lastrejectreason)) throw new BusinessException("请填写拒绝理由"); + + AccessAssessApply accessAssessApply = this.getById(id); + if (accessAssessApply == null) throw new BusinessException("传参有误或者单子不存在"); + + Date now = new Date(); + accessAssessApply.setApprover(user.getUsername()); + accessAssessApply.setApprovetime(now); + accessAssessApply.setLastrejecttime(now); + accessAssessApply.setStatus(AssessApplyStatus.REJECT); + accessAssessApply.setLastrejectreason(lastrejectreason); + this.updateById(accessAssessApply); + } + + + /** + * @Description: 申诉通过 + * @date 2021/7/9 9:11 + */ + @Override + @Transactional + public void appealAccessPass(Long id, UserInfo user) { + + if (id == null) + throw new BusinessException("参数传递错误,请联系管理员"); + + AccessAssessApply accessAssessApply = this.getById(id); + if (accessAssessApply == null) + throw new BusinessException("参数传递错误或者申请单不存在"); + + if (accessAssessApply.getAppealstatus() == AssessAppealStatus.UNPASSED) + throw new BusinessException("申请单已被拒绝,不能再次审批"); + + if (accessAssessApply.getAppealstatus() == AssessAppealStatus.PASSED) + throw new BusinessException("申诉已通过,请勿再次审批"); + + //通过 + accessAssessApply.setAppealstatus(AssessAppealStatus.PASSED); + accessAssessApply.setAppealapprovetime(new Date()); + accessAssessApply.setAppealapprover(user.getUsername()); + this.updateById(accessAssessApply); + + } + + @Override + public void appealAccessReject(JSONObject entity, UserInfo user) { + Long id = entity.getLong("id"); + if (id == null) + throw new BusinessException("参数传递错误,请联系管理员"); + + AccessAssessApply accessAssessApply = this.getById(id); + if (accessAssessApply == null) + throw new BusinessException("参数传递错误或者申请单不存在"); + + AssessAppealStatus appealstatus = accessAssessApply.getAppealstatus(); + if (appealstatus != AssessAppealStatus.APPEALING) + throw new BusinessException("当前申请单状态为"+appealstatus.getMsg()+",不可以拒绝"); + + String appealrejectreason = entity.getString("appealrejectreason"); + accessAssessApply.setAppealstatus(AssessAppealStatus.UNPASSED); + accessAssessApply.setAppealrejectreason(StringUtils.isBlank(appealrejectreason) ? null : appealrejectreason); + this.updateById(accessAssessApply); + + } + + /** + * @Description: 获取所有超过14日公示日的未申诉的准入评定信息 + * @date 2021/7/12 13:56 + */ + @Override + public List<AccessAssessApply> selectAllOverTimeAccessAssessApply() { + //条件一:type准入 + //条件二:不是申诉通过的 + //条件三:未惩罚的 + return accessAssessApplyMapper.selectAllOverTimeAccessAssessApply(AssessType.ACCESS,AssessAppealStatus.PASSED,PunishStatus.UNPUNISH); + } + + @Override + public List<AccessAssessApply> selectAllPunishingAccessAssessApply() { + //条件一:type准入 + //条件二:惩罚中的 + return accessAssessApplyMapper.selectAllPunishingAccessAssessApply(AssessType.ACCESS,PunishStatus.PUNISHING); + } + + + @Override + public IPage selectAccessAppealPages(Page<AssessApplyAppealVo> page, Map filter, UserInfo user) { + UserInfo userInfo = userService.getById(user.getId()); + + Map<String, Object> params = new HashMap<>(); + //判断参数 参数-未申诉 + params.put("unappealed", AssessAppealStatus.UNAPPEALED); + params.put("passed", AssessAppealStatus.PASSED); + params.put("unpunish", PunishStatus.UNPUNISH); + //固定页面变量 + params.put("type", AssessType.ACCESS); + params.put("status", AssessApplyStatus.APPROVED); + + //页面过滤条件 + params.put("code", filter.get("code")); + params.put("enterprisename", filter.get("enterprisename")); + params.put("appealstatus", filter.get("appealstatus")); + + //只看到自己的 + if (user.getType() != 1 && user.getType()!= 2) { + params.put("enterprisenumber", userInfo.getCompanynumber()); + } + + List<AssessApplyAppealVo> data = accessAssessApplyMapper.selectAppealPages(params,page); + return page.setRecords(data); + } + +} -- Gitblit v1.9.2