diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java index 12599a1..c605947 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java @@ -2,8 +2,6 @@ package com.hnac.hzims.message.fegin; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.IdWorker; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; import com.hnac.hzims.common.invalid.Create; import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.dto.*; @@ -12,18 +10,17 @@ import com.hnac.hzims.message.entity.config.MessageTemplateEntity; import com.hnac.hzims.message.service.IMessagePushRecordService; import com.hnac.hzims.message.service.IMessageService; import com.hnac.hzims.message.service.IMessageTemplateService; -import com.hnac.hzims.message.service.impl.PushMessageServiceImpl; import com.hnac.hzims.message.service.impl.SmsMessageServiceImpl; -import com.xxl.job.core.log.XxlJobLogger; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.CollectionUtils; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.*; -import org.springblade.system.entity.Dept; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.core.tool.utils.SpringUtil; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; @@ -32,10 +29,10 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; -import javax.xml.ws.WebServiceException; import java.time.LocalDateTime; -import java.time.ZoneId; -import java.util.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; import java.util.stream.Collectors; /** @@ -90,7 +87,7 @@ public class MessageClient extends BladeController implements IMessageClient{ entity.setDeptName(Func.isNotEmpty(entity.getDeptName()) ? entity.getDeptName() : this.getDeptNameById(entity.getDeptId())); entity.setMessageId(IdWorker.getId()); entity.setPusher(userId.toString()); - //entity.setPusherName(Optional.ofNullable(UserCache.getUser(userId)).map(User::getName).orElse(null)); + entity.setPusherName(Optional.ofNullable(UserCache.getUser(userId)).map(User::getName).orElse(null)); entity.setPushType(MessageConstants.IMMEDIATELY); entity.setAccount(userId.toString()); entity.setPlanTime(LocalDateTime.now()); @@ -98,11 +95,11 @@ public class MessageClient extends BladeController implements IMessageClient{ entity.setCreateDept(entity.getDeptId()); return entity; }).collect(Collectors.toList()); - /*boolean isSave = recordService.saveBatch(messages); + boolean isSave = recordService.saveBatch(messages); if(isSave){ return R.data(recordService.sendWxMessageByUser(request,messages)); - }*/ - return R.data(recordService.sendWxMessageByUser(request,messages)); + } + return R.data(false); } @PostMapping(PLAN_SEND_MESSAGE) diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java index 276b1b3..2dab3a3 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java @@ -490,12 +490,17 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpllambdaUpdate() .set(MessagePushRecordEntity::getPushTime, LocalDateTime.now()) .set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS) .in(MessagePushRecordEntity::getId, records.stream().map(MessagePushRecordEntity::getId).collect(Collectors.toList()))); - }*/ + }else{ + this.update(Wrappers.lambdaUpdate() + .set(MessagePushRecordEntity::getPushTime, LocalDateTime.now()) + .set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_FAILED) + .in(MessagePushRecordEntity::getId, records.stream().map(MessagePushRecordEntity::getId).collect(Collectors.toList()))); + } return isSend; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java index b00f071..535e981 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java @@ -104,33 +104,12 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl> list(OperMaintenanceTaskDTO req) { - List inspects = (List) redisTemplate.opsForValue() - .get("maintenance_task_list" + req.getCurrent() + req.getSize()); - Long total = (Long) redisTemplate.opsForValue().get("maintenance_task_list_total"); - IPage pages = new Page<>(req.getCurrent(), req.getSize()); - if (ObjectUtil.isEmpty(inspects) || ObjectUtil.isEmpty(total)) { - Query query = new Query(); - query.setSize(req.getSize()); - query.setCurrent(req.getCurrent()); - Wrapper queryWrapper = getQueryWrapper(req); - List list = super.list(queryWrapper); - List voList = new ArrayList<>(); - list.forEach(x -> { - OperMaintenanceTaskVO operMaintenanceTaskVO = new OperMaintenanceTaskVO(); - BeanUtils.copyProperties(x, operMaintenanceTaskVO); - voList.add(operMaintenanceTaskVO); - }); - pages.setRecords(voList); - redisTemplate.opsForValue().set("maintenance_task_list" + req.getCurrent() + req.getSize(), voList); - redisTemplate.expire("maintenance_task_list" + req.getCurrent() + req.getSize(),60, TimeUnit.SECONDS); - redisTemplate.opsForValue().set("maintenance_task_list_total",pages.getTotal()); - redisTemplate.expire("maintenance_task_list_total",60, TimeUnit.SECONDS); - return R.data(pages); - } - pages.setRecords(inspects); - pages.setCurrent(req.getCurrent()); - pages.setSize(req.getSize()); - pages.setTotal(total); + Query query=new Query(); + query.setSize(req.getSize()); + query.setCurrent(req.getCurrent()); + Wrapper queryWrapper = getQueryWrapper(req); + IPage pages = super.page(Condition.getPage(query), queryWrapper); + pages.setRecords(OperMaintenanceTaskWrapper.build().listVO(pages.getRecords())); return R.data(pages); }