| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.ibatis.type.JdbcType; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.flowable.engine.TaskService; |
| | | import org.flowable.task.api.Task; |
| | |
| | | import org.jeecg.common.util.TranslateDictTextUtils; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.eam.constant.*; |
| | | import org.jeecg.modules.eam.entity.EamBaseHFCode; |
| | | import org.jeecg.modules.eam.entity.EamEquipment; |
| | | import org.jeecg.modules.eam.entity.EamThirdMaintenanceChange; |
| | | import org.jeecg.modules.eam.entity.EamThirdMaintenanceOrder; |
| | | import org.jeecg.modules.eam.entity.*; |
| | | import org.jeecg.modules.eam.mapper.EamThirdMaintenanceChangeMapper; |
| | | import org.jeecg.modules.eam.request.EamThirdMaintenanceChangeQuery; |
| | | import org.jeecg.modules.eam.request.EamThirdMaintenanceChangeRequest; |
| | |
| | | import org.jeecg.modules.eam.service.IEamThirdMaintenanceOrderService; |
| | | import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; |
| | | import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService; |
| | | import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI; |
| | | import org.jeecg.modules.flowable.apithird.service.FlowCommonService; |
| | | import org.jeecg.modules.flowable.service.IFlowDefinitionService; |
| | | import org.jeecg.modules.flowable.service.IFlowTaskService; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.sql.Timestamp; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | * @Date: 2025-07-11 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Service |
| | | public class EamThirdMaintenanceChangeServiceImpl extends ServiceImpl<EamThirdMaintenanceChangeMapper, EamThirdMaintenanceChange> implements IEamThirdMaintenanceChangeService { |
| | | @Service("IEamThirdMaintenanceChangeService") |
| | | public class EamThirdMaintenanceChangeServiceImpl extends ServiceImpl<EamThirdMaintenanceChangeMapper, EamThirdMaintenanceChange> implements IEamThirdMaintenanceChangeService, FlowCallBackServiceI { |
| | | |
| | | @Resource |
| | | private EamThirdMaintenanceChangeMapper eamThirdMaintenanceChangeMapper; |
| | |
| | | if (sysUser == null) { |
| | | return page; |
| | | } |
| | | if (StringUtils.isNotBlank(sysUser.getEquipmentIds())) { |
| | | if (StringUtils.isNotBlank(sysUser.getEamEquipmentIds())) { |
| | | //选择了设备,根据设备id过滤设备 |
| | | List<String> equipArr = Arrays.asList(sysUser.getEquipmentIds().split(",")); |
| | | List<String> equipArr = Arrays.asList(sysUser.getEamEquipmentIds().split(",")); |
| | | queryWrapper.in("e.equipment_code", equipArr); |
| | | } else { |
| | | //没有选择设备,根据中心过滤设备 |
| | |
| | | request.setApplicant(sysUser.getUsername()); |
| | | request.setApplyDate(new Date()); |
| | | request.setFactoryOrgCode(equipment.getFactoryOrgCode()); |
| | | request.setEquipmentId(equipment.getId()); |
| | | // 三保变更工单HF |
| | | EamBaseHFCode eamBaseHFCode = hfCodeService.selectByCategory(HfTemplateCategoryEnum.THIRD_MAINTENANCE_CHANGE.name()); |
| | | if (eamBaseHFCode == null) { |
| | |
| | | } |
| | | entity.setApplyReasonType(request.getApplyReasonType()); |
| | | entity.setApplyReason(request.getApplyReason()); |
| | | entity.setRemark(request.getRemark()); |
| | | entity.setApplyCategory(request.getApplyCategory()); |
| | | if ("SCRAPPED".equals(request.getApplyCategory())) { |
| | | // 直接设为 null |
| | | entity.setDeferredMaintenanceDate(null); |
| | | } else { |
| | | entity.setDeferredMaintenanceDate(request.getDeferredMaintenanceDate()); |
| | | } |
| | | this.getBaseMapper().updateById(entity); |
| | | return true; |
| | | } |
| | |
| | | //更新工单信息 |
| | | this.getBaseMapper().updateById(entity); |
| | | return entity; |
| | | } |
| | | |
| | | /** |
| | | * 三保加工设备保养计划变更申请单批量打印接口 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<EamThirdMaintenanceChange> export(String ids){ |
| | | QueryWrapper<EamThirdMaintenanceChange> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("tmc.del_flag",CommonConstant.DEL_FLAG_0.toString()); |
| | | //用户数据权限 |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser == null) { |
| | | return new ArrayList<>(); |
| | | } |
| | | if (StringUtils.isNotBlank(sysUser.getEamEquipmentIds())) { |
| | | //选择了设备,根据设备id过滤设备 |
| | | List<String> equipArr = Arrays.asList(sysUser.getEamEquipmentIds().split(",")); |
| | | queryWrapper.in("e.equipment_code", equipArr); |
| | | } else { |
| | | //没有选择设备,根据中心过滤设备 |
| | | List<BaseFactoryUser> baseFactoryUserList=baseFactoryUserService. |
| | | list(new LambdaQueryWrapper<BaseFactoryUser>().eq(BaseFactoryUser::getUserId,sysUser.getId())); |
| | | if(!CollectionUtils.isEmpty(baseFactoryUserList)){ |
| | | Set<String> factoryIds = baseFactoryUserList.stream().map(BaseFactoryUser::getFactoryId).collect(Collectors.toSet()); |
| | | Set<String> factoryCode= baseFactoryService.listByIds(factoryIds).stream().map(BaseFactory::getOrgCode).collect(Collectors.toSet()); |
| | | queryWrapper.in("e.factory_org_code", factoryCode); |
| | | } else { |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | //查询条件过滤 |
| | | if (StrUtil.isNotEmpty(ids)) { |
| | | List<String> idList = Arrays.asList(ids.split(",")); |
| | | queryWrapper.in("tmc.id", idList); |
| | | } else { |
| | | queryWrapper.orderByDesc("tmc.create_time"); |
| | | } |
| | | return eamThirdMaintenanceChangeMapper.queryList(queryWrapper); |
| | | } |
| | | |
| | | /** |
| | |
| | | if(BusinessCodeConst.APPROVED.equals(request.getProductionSupportSignatureResult())) { |
| | | //通过 |
| | | entity.setChangeStatus(ThirdMaintenanceChangeStatusEnum.COMPLETED.name()); |
| | | order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.WAIT_MAINTENANCE.name()); |
| | | order.setMaintenanceDate(entity.getDeferredMaintenanceDate()); |
| | | if ("SCRAPPED".equals(request.getApplyCategory())) { |
| | | order.setMaintenanceDate(null); |
| | | order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.ABOLISH.name()); |
| | | } else { |
| | | order.setMaintenanceDate(entity.getDeferredMaintenanceDate()); |
| | | order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.WAIT_MAINTENANCE.name()); |
| | | } |
| | | thirdMaintenanceOrderService.updateById(order); |
| | | }else { |
| | | //驳回 |
| | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public void afterFlowHandle(FlowMyBusiness business) { |
| | | business.getTaskNameId();//接下来审批的节点 |
| | | business.getValues();//前端传进来的参数 |
| | | business.getActStatus(); |
| | | } |
| | | |
| | | @Override |
| | | public Object getBusinessDataById(String dataId) { |
| | | return this.getById(dataId); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> flowValuesOfTask(String taskNameId, Map<String, Object> values) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List<String> flowCandidateUsernamesOfTask(String taskNameId, Map<String, Object> values) { |
| | | //业务是否干预流程,业务干预,流程干预,指定人员进行处理 |
| | | //获取下一步处理人 |
| | | Object object = values.get("NextAssignee"); |
| | | return (List<String>) object; |
| | | } |
| | | } |