| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.catalina.Manager; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | |
| | | * @since 2025/04/02 17:49 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class WorkorderServiceImpl implements WorkorderService { |
| | | |
| | | @Autowired |
| | |
| | | } |
| | | |
| | | |
| | | private static final String [] qwDetailUrls = {"/pages/details_she/details_she","/pages/workOrder_dca/workOrder_dca","","/pages/workOrder_she/workOrder_she"}; |
| | | |
| | | /** |
| | | * 通知文案整理 |
| | | * @param workorder |
| | |
| | | public QywxTextCardMsgRequest dealMessageContent(Workorder workorder,String userName ,String categoryName,Integer contentType,String csInfo){ |
| | | QywxTextCardMsgRequest textCard = new QywxTextCardMsgRequest(); |
| | | String message = ""; |
| | | textCard.setUrl(qwDetailUrls[workorder.getType()]+"?id="+workorder.getId()); |
| | | if(Constants.equalsInteger(workorder.getType(),Constants.ZERO)){ |
| | | textCard.setTitle("【SHE事件上报】"); |
| | | if(Constants.equalsInteger(workorder.getMemberType(),Constants.ZERO)){ |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Workorder getDetail(Integer id){ |
| | | public Workorder getDetail(Integer id,Member member){ |
| | | Workorder workorder = workorderMapper.selectJoinOne(Workorder.class, |
| | | new MPJLambdaWrapper<Workorder>() |
| | | .selectAll(Workorder.class) |
| | |
| | | .selectAs(Member::getName,Workorder::getMemberName) |
| | | .selectAs(Member::getCompanyName,Workorder::getCompanyName) |
| | | .select(" c3.name ",Workorder::getTypeName) |
| | | .select(" c4.name ",Workorder::getProblemName) |
| | | .select(" c4.name ",Workorder::getCategoryName) |
| | | .leftJoin(Member.class,Member::getId,Workorder::getMemberId) |
| | | .leftJoin(" category c3 on t.TYPE_ID = c3.id ") //风险类型 |
| | | .leftJoin(" category c4 on t.PROBLEM_ID = c4.id ") //DCA问题编码 |
| | | .leftJoin(" category c4 on t.CATEGORY_ID = c4.id ") //DCA问题编码 |
| | | .eq(Workorder::getId,id) |
| | | .last(" limit 1 ") |
| | | ); |
| | | if(Objects.nonNull(workorder)){ |
| | | this.dealButton(workorder,member); |
| | | //查询附件信息 |
| | | List<Multifile> multifileList = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda().eq(Multifile::getIsdeleted,Constants.ZERO) |
| | | .eq(Multifile::getObjId,workorder.getId()).orderByAsc(Multifile::getId)); |
| | |
| | | return workorder; |
| | | } |
| | | |
| | | public void dealButton(Workorder workorder,Member member){ |
| | | workorder.setPassOnButton(Constants.ZERO); |
| | | workorder.setCloseButton(Constants.ZERO); |
| | | if(org.apache.commons.lang3.StringUtils.isNotBlank(member.getQwId())){ |
| | | List<String> closeUserList = new ArrayList<>(); |
| | | closeUserList.addAll(Arrays.asList(workorder.getQwnoticeMemberIds().split(","))); |
| | | closeUserList.add(org.apache.commons.lang3.StringUtils.isNotBlank(workorder.getManagerId())?workorder.getManagerId():null); |
| | | closeUserList.add(org.apache.commons.lang3.StringUtils.isNotBlank(workorder.getDealerId())?workorder.getDealerId():null); |
| | | workorder.setCloseButton(closeUserList.stream().filter(i->i.equals(member.getQwId())).collect(Collectors.toList()).size()>Constants.ZERO?Constants.ONE:Constants.ZERO); |
| | | List<String> passOnUserList = new ArrayList<>(); |
| | | //待分配状态 处理转交按钮 |
| | | if(Constants.equalsInteger(workorder.getStatus(),Constants.WorkOrderStatus.waitConfirm.getKey())){ |
| | | passOnUserList.addAll(Arrays.asList(workorder.getQwnoticeMemberIds().split(","))); |
| | | }else if(Constants.equalsInteger(workorder.getStatus(),Constants.WorkOrderStatus.waitAllocation.getKey())){ |
| | | closeUserList.add(workorder.getManagerId()); |
| | | } |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(passOnUserList)){ |
| | | workorder.setPassOnButton(passOnUserList.stream().filter(i->i.equals(member.getQwId())).collect(Collectors.toList()).size()>Constants.ZERO?Constants.ONE:Constants.ZERO); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public List<WorkorderLog> getLogList(Integer orderId){ |
| | | List<WorkorderLog> logList = workorderLogMapper.selectJoinList(WorkorderLog.class, |
| | |
| | | ); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(logList)){ |
| | | String path = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode() |
| | | +systemDictDataBiz.queryByCode(Constants.FTP,Constants.WORKORDER_FILE_PATH).getCode(); |
| | | +systemDictDataBiz.queryByCode(Constants.FTP,Constants.WORKORDER_LOG_FILE_PATH).getCode(); |
| | | for (WorkorderLog workorderLog:logList) { |
| | | //查询附件信息 |
| | | List<Multifile> multifileList = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda() |
| | |
| | | } |
| | | |
| | | } |
| | | @Override |
| | | public void sendSheEmail(){ |
| | | if(Constants.WORKORDER_SHE_EMAIL_SENDING){ |
| | | return; |
| | | } |
| | | Constants.WORKORDER_SHE_EMAIL_SENDING = true; |
| | | try { |
| | | List<Notices> list = noticesMapper.selectList(new QueryWrapper<Notices>().lambda() |
| | | .eq(Notices::getIsdeleted,Constants.ZERO) |
| | | .eq(Notices::getStatus,Constants.ZERO) |
| | | .eq(Notices::getType,Constants.THREE)//邮箱通知 |
| | | ); |
| | | |
| | | }catch (Exception e){ |
| | | log.error("==================定时发生SHE邮件失败:"+e.getMessage()); |
| | | }finally { |
| | | Constants.WORKORDER_SHE_EMAIL_SENDING = false; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {BusinessException.class,Exception.class}) |