Browse Source

#日常维护代码还原

zhongwei
yang_shj 10 months ago
parent
commit
c7bee39006
  1. 25
      hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java
  2. 9
      hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java
  3. 27
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java

25
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)

9
hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java

@ -490,12 +490,17 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
WxMessageServiceImpl service = SpringUtil.getBean(WxMessageServiceImpl.class);
boolean isSend = service.send(message);
/*if (isSend) {
if (isSend) {
this.update(Wrappers.<MessagePushRecordEntity>lambdaUpdate()
.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.<MessagePushRecordEntity>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;
}

27
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java

@ -104,33 +104,12 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
@Override
public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req) {
List<OperMaintenanceTaskVO> inspects = (List<OperMaintenanceTaskVO>) redisTemplate.opsForValue()
.get("maintenance_task_list" + req.getCurrent() + req.getSize());
Long total = (Long) redisTemplate.opsForValue().get("maintenance_task_list_total");
IPage<OperMaintenanceTaskVO> pages = new Page<>(req.getCurrent(), req.getSize());
if (ObjectUtil.isEmpty(inspects) || ObjectUtil.isEmpty(total)) {
Query query = new Query();
Query query=new Query();
query.setSize(req.getSize());
query.setCurrent(req.getCurrent());
Wrapper<OperMaintenanceTaskEntity> queryWrapper = getQueryWrapper(req);
List<OperMaintenanceTaskEntity> list = super.list(queryWrapper);
List<OperMaintenanceTaskVO> 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);
IPage pages = super.page(Condition.getPage(query), queryWrapper);
pages.setRecords(OperMaintenanceTaskWrapper.build().listVO(pages.getRecords()));
return R.data(pages);
}

Loading…
Cancel
Save