fix: 攀枝花东区-缴费处理mag-app
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
package com.yida.data.school.fallback.transaction;
|
||||
|
||||
import com.yida.data.common.core.annotation.Fallback;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.school.feign.transaction.RemoteStudentApplyService;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* RemoteStudentApplyService fallback处理类
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022/8/26
|
||||
*/
|
||||
@Slf4j
|
||||
@Fallback
|
||||
public class RemoteStudentApplyServiceFallback implements FallbackFactory<RemoteStudentApplyService> {
|
||||
|
||||
@Override
|
||||
public RemoteStudentApplyService create(Throwable throwable) {
|
||||
log.error("RemoteStudentApplyService fallback reason:{}", throwable.getMessage());
|
||||
|
||||
return new RemoteStudentApplyService() {
|
||||
@Override
|
||||
public ResultBean<Map<Long, List<String>>> listApplyCode(Long[] studentIds) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean<Boolean> hasApply(Long studentId, String applyCode) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.yida.data.school.feign.transaction;
|
||||
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.constant.FebsServerConstant;
|
||||
|
||||
import com.yida.data.school.fallback.transaction.RemoteStudentApplyServiceFallback;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(value = FebsServerConstant.EDU_SCHOOL, contextId = "studentApplyServiceClient",
|
||||
fallbackFactory = RemoteStudentApplyServiceFallback.class)
|
||||
public interface RemoteStudentApplyService {
|
||||
|
||||
@GetMapping("/in/transaction/studentApply/listApply")
|
||||
ResultBean<Map<Long, List<String>>> listApplyCode(@RequestParam("studentIds") Long[] studentIds);
|
||||
|
||||
@GetMapping("/transaction/studentApply/hasApply")
|
||||
ResultBean<Boolean> hasApply(@RequestParam("studentId") Long studentId,
|
||||
@RequestParam("applyCode") String applyCode);
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.yida.data.school.vo.news;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 发布稿件进度 - 实体
|
||||
*/
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public class ManuscriptPublishPathVO {
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String label;
|
||||
|
||||
@ApiModelProperty("")
|
||||
private Integer value;
|
||||
|
||||
private static Integer wxPath = 0;
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.yida.data.school.vo.transcation;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StudentApplyImportErrorVO {
|
||||
|
||||
@ExcelProperty(index = 1, value = "有效结束时间")
|
||||
@ApiModelProperty("错误信息")
|
||||
private String errorMsg;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.yida.data.school.vo.transcation;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StudentApplyImportProgressVO {
|
||||
|
||||
private Integer totalNum;
|
||||
private Integer currentNum;
|
||||
private String errorPageUrl;
|
||||
private Integer finish;
|
||||
private String redisKey;
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.yida.data.school.vo.transcation;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.yida.data.common.core.converter.LocalDateTimeConverter;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StudentApplyImportVO {
|
||||
|
||||
@ExcelProperty(index = 0, value = "序号")
|
||||
@ApiModelProperty(value = "序号")
|
||||
private Long indexNo;
|
||||
|
||||
@ExcelProperty(index = 1, value = "学校名称")
|
||||
@ApiModelProperty("学校名称")
|
||||
private String schoolName;
|
||||
|
||||
@ExcelProperty(index = 2, value = "校区名称")
|
||||
@ApiModelProperty("校区名称")
|
||||
private String campusName;
|
||||
|
||||
@ExcelProperty(index = 3, value = "学段名称")
|
||||
@ApiModelProperty("学段名称")
|
||||
private String sectionName;
|
||||
|
||||
@ExcelProperty(index = 4, value = "年级名称")
|
||||
@ApiModelProperty("年级名称")
|
||||
private String gradeName;
|
||||
|
||||
@ExcelProperty(index = 5, value = "班级名称")
|
||||
@ApiModelProperty("班级名称")
|
||||
private String className;
|
||||
|
||||
@ExcelProperty(index = 6, value = "学生姓名")
|
||||
@ApiModelProperty("学生姓名")
|
||||
private String studentName;
|
||||
|
||||
@ExcelProperty(index = 7, value = "学生学号")
|
||||
@ApiModelProperty("学生学号")
|
||||
private String studentNumber;
|
||||
|
||||
@ExcelProperty(index = 8, value = "开通应用")
|
||||
@ApiModelProperty("开通应用")
|
||||
private String applyCode;
|
||||
|
||||
@ExcelProperty(index = 9, value = "有效开始时间")
|
||||
@ApiModelProperty("有效开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ExcelProperty(index = 10, value = "有效结束时间")
|
||||
@ApiModelProperty("有效结束时间")
|
||||
private String endTime;
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.yida.data.school.vo.transcation;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
public class StudentApplyStatusVO {
|
||||
|
||||
@ApiModelProperty("应用状态,0-未开通,1-使用中,2-已过期")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("过期时间")
|
||||
private LocalDate deadLine;
|
||||
}
|
||||
+156
-156
@@ -1,156 +1,156 @@
|
||||
package com.yida.data.school.atlas.mq;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import com.yida.data.common.core.entity.apply.enums.DelFlagType;
|
||||
import com.yida.data.common.core.entity.atlas.CoreAtlasManagement;
|
||||
import com.yida.data.common.core.entity.atlas.CoreAtlasManagementDetails;
|
||||
import com.yida.data.common.core.entity.atlas.CoreAtlasManagementDetailsLike;
|
||||
import com.yida.data.common.core.enums.AtlasManagementRedisEnum;
|
||||
import com.yida.data.rabbit.constant.RabbitConstant;
|
||||
import com.yida.data.school.atlas.mapper.CoreAtlasManagementDetailsLikeMapper;
|
||||
import com.yida.data.school.atlas.service.CoreAtlasManagementDetailsService;
|
||||
import com.yida.data.school.atlas.service.CoreAtlasManagementService;
|
||||
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 图集mq接收类
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2021/9/7
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AtlasLikeRabbitReceiver {
|
||||
|
||||
private final RedisService redisService;
|
||||
|
||||
private final CoreAtlasManagementService coreAtlasManagementService;
|
||||
|
||||
private final CoreAtlasManagementDetailsService coreAtlasManagementDetailsService;
|
||||
|
||||
private final CoreAtlasManagementDetailsLikeMapper coreAtlasManagementDetailsLikeMapper;
|
||||
|
||||
/**
|
||||
* 图集mq点赞和取消赞接收处理方法
|
||||
*
|
||||
* @param coreAtlasManagementDetailsLike 接收的消息
|
||||
* @param channel channel频道
|
||||
* @param message mq的Message对象
|
||||
* @author ZYJ
|
||||
* @date 2021/9/7 13:47
|
||||
*/
|
||||
@RabbitListener(bindings = @QueueBinding(
|
||||
value = @Queue(RabbitConstant.ATLAS_LIKE_QUEUE),
|
||||
exchange = @Exchange(RabbitConstant.ATLAS_LIKE_EXCHANGE)
|
||||
))
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void atlasLikeReceiveMessage(CoreAtlasManagementDetailsLike coreAtlasManagementDetailsLike,
|
||||
Channel channel, Message message)
|
||||
throws IOException {
|
||||
log.info("接受到图集点赞相关消息: {}", JSONUtil.toJsonStr(coreAtlasManagementDetailsLike));
|
||||
log.info("开始处理消息: {}", coreAtlasManagementDetailsLike.getMark());
|
||||
CoreAtlasManagementDetailsLike byMark =
|
||||
this.coreAtlasManagementDetailsLikeMapper.selectOne(
|
||||
new LambdaQueryWrapper<>(new CoreAtlasManagementDetailsLike())
|
||||
.eq(CoreAtlasManagementDetailsLike::getCoreAtlasManagementDetailsId, coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId())
|
||||
.eq(CoreAtlasManagementDetailsLike::getUserId, coreAtlasManagementDetailsLike.getUserId()));
|
||||
// 数据库没有点赞记录,并传过来的对象delFlag参数为0,才表示是新增操作
|
||||
if (Objects.isNull(byMark) && DelFlagType.NORMAL_TYPE.getValue().equals(coreAtlasManagementDetailsLike.getDelFlag())) {
|
||||
// 新增点赞记录
|
||||
coreAtlasManagementDetailsLikeMapper.insert(coreAtlasManagementDetailsLike);
|
||||
|
||||
// 修改图集照片或视频的点赞数+1
|
||||
CoreAtlasManagementDetails coreAtlasManagementDetails =
|
||||
this.coreAtlasManagementDetailsService.getById(coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId());
|
||||
if (Objects.isNull(coreAtlasManagementDetails)) {
|
||||
log.error("点赞图集作品信息为空, 不做任何操作");
|
||||
// 确认收到消息,只确认当前消费者的一个消息收到
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
return;
|
||||
}
|
||||
coreAtlasManagementDetails.setLikeNum(coreAtlasManagementDetails.getLikeNum() + 1);
|
||||
this.coreAtlasManagementDetailsService.updateById(coreAtlasManagementDetails);
|
||||
// 修改图集的点赞数+1
|
||||
CoreAtlasManagement coreAtlasManagement = this.coreAtlasManagementService.
|
||||
getById(coreAtlasManagementDetails.getCoreAtlasManagementId());
|
||||
if (Objects.isNull(coreAtlasManagement)) {
|
||||
log.error("点赞图集信息为空, 不做任何操作");
|
||||
// 确认收到消息,只确认当前消费者的一个消息收到
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
return;
|
||||
}
|
||||
coreAtlasManagement.setLikeNum(coreAtlasManagement.getLikeNum() + 1);
|
||||
this.coreAtlasManagementService.updateById(coreAtlasManagement);
|
||||
// 更新redis中的数据
|
||||
redisService.hset(AtlasManagementRedisEnum.ATLAS_MANAGEMENT_DETAILS_LIKE_DETAILS.
|
||||
getValue() + ":" + coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId(),
|
||||
String.valueOf(coreAtlasManagementDetailsLike.getUserId()), coreAtlasManagementDetailsLike);
|
||||
// 确认收到消息,只确认当前消费者的一个消息收到
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
log.info("点赞消息处理完成: {}", coreAtlasManagementDetailsLike.getMark());
|
||||
} else {
|
||||
// 取消点赞记录
|
||||
// 需要防止点赞记录还未保存,取消点赞已经先处理,需要重新放入队列
|
||||
int i = this.coreAtlasManagementDetailsLikeMapper.deleteById(coreAtlasManagementDetailsLike.getId());
|
||||
if (i == 0) {
|
||||
if (Boolean.TRUE.equals(message.getMessageProperties().getRedelivered())) {
|
||||
log.info("当前数据: {}已重新放入队列过,不再重新放入队列!", coreAtlasManagementDetailsLike.getMark());
|
||||
// 拒绝消息,并且不再重新进入队列
|
||||
//public void basicReject(long deliveryTag, boolean requeue)
|
||||
channel.basicReject(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} else {
|
||||
log.info("重新放入队列的数据: {}", coreAtlasManagementDetailsLike.getMark());
|
||||
//设置消息重新回到队列处理
|
||||
// requeue表示是否重新回到队列,true重新入队
|
||||
channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, true);
|
||||
}
|
||||
} else {
|
||||
// 修改图集照片或视频的点赞数-1
|
||||
CoreAtlasManagementDetails coreAtlasManagementDetails =
|
||||
this.coreAtlasManagementDetailsService.getById(coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId());
|
||||
if (Objects.isNull(coreAtlasManagementDetails)) {
|
||||
log.error("取消赞图集作品信息为空, 不做任何操作");
|
||||
// 确认收到消息,只确认当前消费者的一个消息收到
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
return;
|
||||
}
|
||||
coreAtlasManagementDetails.setLikeNum(coreAtlasManagementDetails.getLikeNum() - 1);
|
||||
this.coreAtlasManagementDetailsService.updateById(coreAtlasManagementDetails);
|
||||
// 修改图集的点赞数-1
|
||||
CoreAtlasManagement coreAtlasManagement = this.coreAtlasManagementService.
|
||||
getById(coreAtlasManagementDetails.getCoreAtlasManagementId());
|
||||
if (Objects.isNull(coreAtlasManagement)) {
|
||||
log.error("取消赞图集信息为空, 不做任何操作");
|
||||
// 确认收到消息,只确认当前消费者的一个消息收到
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
return;
|
||||
}
|
||||
coreAtlasManagement.setLikeNum(coreAtlasManagement.getLikeNum() - 1);
|
||||
this.coreAtlasManagementService.updateById(coreAtlasManagement);
|
||||
redisService.hdel(AtlasManagementRedisEnum.ATLAS_MANAGEMENT_DETAILS_LIKE_DETAILS.
|
||||
getValue() + ":" + coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId(),
|
||||
String.valueOf(coreAtlasManagementDetailsLike.getUserId()));
|
||||
// 确认收到消息,只确认当前消费者的一个消息收到
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
log.info("取消赞消息处理完成: {}" + coreAtlasManagementDetailsLike.getMark());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//package com.yida.data.school.atlas.mq;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
//import com.rabbitmq.client.Channel;
|
||||
//import com.yida.data.common.core.entity.apply.enums.DelFlagType;
|
||||
//import com.yida.data.common.core.entity.atlas.CoreAtlasManagement;
|
||||
//import com.yida.data.common.core.entity.atlas.CoreAtlasManagementDetails;
|
||||
//import com.yida.data.common.core.entity.atlas.CoreAtlasManagementDetailsLike;
|
||||
//import com.yida.data.common.core.enums.AtlasManagementRedisEnum;
|
||||
//import com.yida.data.rabbit.constant.RabbitConstant;
|
||||
//import com.yida.data.school.atlas.mapper.CoreAtlasManagementDetailsLikeMapper;
|
||||
//import com.yida.data.school.atlas.service.CoreAtlasManagementDetailsService;
|
||||
//import com.yida.data.school.atlas.service.CoreAtlasManagementService;
|
||||
//
|
||||
//import org.springframework.amqp.core.Message;
|
||||
//import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
//import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
//import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//import org.springframework.transaction.annotation.Transactional;
|
||||
//
|
||||
//import java.io.IOException;
|
||||
//import java.util.Objects;
|
||||
//
|
||||
//import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
//import cn.hutool.json.JSONUtil;
|
||||
//import lombok.RequiredArgsConstructor;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//
|
||||
///**
|
||||
// * 图集mq接收类
|
||||
// *
|
||||
// * @author ZYJ
|
||||
// * @date 2021/9/7
|
||||
// */
|
||||
//@Slf4j
|
||||
//@Component
|
||||
//@RequiredArgsConstructor
|
||||
//public class AtlasLikeRabbitReceiver {
|
||||
//
|
||||
// private final RedisService redisService;
|
||||
//
|
||||
// private final CoreAtlasManagementService coreAtlasManagementService;
|
||||
//
|
||||
// private final CoreAtlasManagementDetailsService coreAtlasManagementDetailsService;
|
||||
//
|
||||
// private final CoreAtlasManagementDetailsLikeMapper coreAtlasManagementDetailsLikeMapper;
|
||||
//
|
||||
// /**
|
||||
// * 图集mq点赞和取消赞接收处理方法
|
||||
// *
|
||||
// * @param coreAtlasManagementDetailsLike 接收的消息
|
||||
// * @param channel channel频道
|
||||
// * @param message mq的Message对象
|
||||
// * @author ZYJ
|
||||
// * @date 2021/9/7 13:47
|
||||
// */
|
||||
// @RabbitListener(bindings = @QueueBinding(
|
||||
// value = @Queue(RabbitConstant.ATLAS_LIKE_QUEUE),
|
||||
// exchange = @Exchange(RabbitConstant.ATLAS_LIKE_EXCHANGE)
|
||||
// ))
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
// public void atlasLikeReceiveMessage(CoreAtlasManagementDetailsLike coreAtlasManagementDetailsLike,
|
||||
// Channel channel, Message message)
|
||||
// throws IOException {
|
||||
// log.info("接受到图集点赞相关消息: {}", JSONUtil.toJsonStr(coreAtlasManagementDetailsLike));
|
||||
// log.info("开始处理消息: {}", coreAtlasManagementDetailsLike.getMark());
|
||||
// CoreAtlasManagementDetailsLike byMark =
|
||||
// this.coreAtlasManagementDetailsLikeMapper.selectOne(
|
||||
// new LambdaQueryWrapper<>(new CoreAtlasManagementDetailsLike())
|
||||
// .eq(CoreAtlasManagementDetailsLike::getCoreAtlasManagementDetailsId, coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId())
|
||||
// .eq(CoreAtlasManagementDetailsLike::getUserId, coreAtlasManagementDetailsLike.getUserId()));
|
||||
// // 数据库没有点赞记录,并传过来的对象delFlag参数为0,才表示是新增操作
|
||||
// if (Objects.isNull(byMark) && DelFlagType.NORMAL_TYPE.getValue().equals(coreAtlasManagementDetailsLike.getDelFlag())) {
|
||||
// // 新增点赞记录
|
||||
// coreAtlasManagementDetailsLikeMapper.insert(coreAtlasManagementDetailsLike);
|
||||
//
|
||||
// // 修改图集照片或视频的点赞数+1
|
||||
// CoreAtlasManagementDetails coreAtlasManagementDetails =
|
||||
// this.coreAtlasManagementDetailsService.getById(coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId());
|
||||
// if (Objects.isNull(coreAtlasManagementDetails)) {
|
||||
// log.error("点赞图集作品信息为空, 不做任何操作");
|
||||
// // 确认收到消息,只确认当前消费者的一个消息收到
|
||||
// channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
// return;
|
||||
// }
|
||||
// coreAtlasManagementDetails.setLikeNum(coreAtlasManagementDetails.getLikeNum() + 1);
|
||||
// this.coreAtlasManagementDetailsService.updateById(coreAtlasManagementDetails);
|
||||
// // 修改图集的点赞数+1
|
||||
// CoreAtlasManagement coreAtlasManagement = this.coreAtlasManagementService.
|
||||
// getById(coreAtlasManagementDetails.getCoreAtlasManagementId());
|
||||
// if (Objects.isNull(coreAtlasManagement)) {
|
||||
// log.error("点赞图集信息为空, 不做任何操作");
|
||||
// // 确认收到消息,只确认当前消费者的一个消息收到
|
||||
// channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
// return;
|
||||
// }
|
||||
// coreAtlasManagement.setLikeNum(coreAtlasManagement.getLikeNum() + 1);
|
||||
// this.coreAtlasManagementService.updateById(coreAtlasManagement);
|
||||
// // 更新redis中的数据
|
||||
// redisService.hset(AtlasManagementRedisEnum.ATLAS_MANAGEMENT_DETAILS_LIKE_DETAILS.
|
||||
// getValue() + ":" + coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId(),
|
||||
// String.valueOf(coreAtlasManagementDetailsLike.getUserId()), coreAtlasManagementDetailsLike);
|
||||
// // 确认收到消息,只确认当前消费者的一个消息收到
|
||||
// channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
// log.info("点赞消息处理完成: {}", coreAtlasManagementDetailsLike.getMark());
|
||||
// } else {
|
||||
// // 取消点赞记录
|
||||
// // 需要防止点赞记录还未保存,取消点赞已经先处理,需要重新放入队列
|
||||
// int i = this.coreAtlasManagementDetailsLikeMapper.deleteById(coreAtlasManagementDetailsLike.getId());
|
||||
// if (i == 0) {
|
||||
// if (Boolean.TRUE.equals(message.getMessageProperties().getRedelivered())) {
|
||||
// log.info("当前数据: {}已重新放入队列过,不再重新放入队列!", coreAtlasManagementDetailsLike.getMark());
|
||||
// // 拒绝消息,并且不再重新进入队列
|
||||
// //public void basicReject(long deliveryTag, boolean requeue)
|
||||
// channel.basicReject(message.getMessageProperties().getDeliveryTag(), false);
|
||||
// } else {
|
||||
// log.info("重新放入队列的数据: {}", coreAtlasManagementDetailsLike.getMark());
|
||||
// //设置消息重新回到队列处理
|
||||
// // requeue表示是否重新回到队列,true重新入队
|
||||
// channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, true);
|
||||
// }
|
||||
// } else {
|
||||
// // 修改图集照片或视频的点赞数-1
|
||||
// CoreAtlasManagementDetails coreAtlasManagementDetails =
|
||||
// this.coreAtlasManagementDetailsService.getById(coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId());
|
||||
// if (Objects.isNull(coreAtlasManagementDetails)) {
|
||||
// log.error("取消赞图集作品信息为空, 不做任何操作");
|
||||
// // 确认收到消息,只确认当前消费者的一个消息收到
|
||||
// channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
// return;
|
||||
// }
|
||||
// coreAtlasManagementDetails.setLikeNum(coreAtlasManagementDetails.getLikeNum() - 1);
|
||||
// this.coreAtlasManagementDetailsService.updateById(coreAtlasManagementDetails);
|
||||
// // 修改图集的点赞数-1
|
||||
// CoreAtlasManagement coreAtlasManagement = this.coreAtlasManagementService.
|
||||
// getById(coreAtlasManagementDetails.getCoreAtlasManagementId());
|
||||
// if (Objects.isNull(coreAtlasManagement)) {
|
||||
// log.error("取消赞图集信息为空, 不做任何操作");
|
||||
// // 确认收到消息,只确认当前消费者的一个消息收到
|
||||
// channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
// return;
|
||||
// }
|
||||
// coreAtlasManagement.setLikeNum(coreAtlasManagement.getLikeNum() - 1);
|
||||
// this.coreAtlasManagementService.updateById(coreAtlasManagement);
|
||||
// redisService.hdel(AtlasManagementRedisEnum.ATLAS_MANAGEMENT_DETAILS_LIKE_DETAILS.
|
||||
// getValue() + ":" + coreAtlasManagementDetailsLike.getCoreAtlasManagementDetailsId(),
|
||||
// String.valueOf(coreAtlasManagementDetailsLike.getUserId()));
|
||||
// // 确认收到消息,只确认当前消费者的一个消息收到
|
||||
// channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
// log.info("取消赞消息处理完成: {}" + coreAtlasManagementDetailsLike.getMark());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
+10
-37
@@ -1,64 +1,39 @@
|
||||
package com.yida.data.school.atlas.service.impl;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.apply.enums.DelFlagType;
|
||||
import com.yida.data.common.core.entity.atlas.CoreAtlasAccessRecords;
|
||||
import com.yida.data.common.core.entity.atlas.CoreAtlasManagement;
|
||||
import com.yida.data.common.core.entity.atlas.CoreAtlasManagementDetails;
|
||||
import com.yida.data.common.core.entity.atlas.CoreAtlasManagementDetailsComment;
|
||||
import com.yida.data.common.core.entity.atlas.CoreAtlasManagementDetailsCommentReply;
|
||||
import com.yida.data.common.core.entity.atlas.CoreAtlasManagementDetailsLike;
|
||||
import com.yida.data.common.core.entity.atlas.*;
|
||||
import com.yida.data.common.core.enums.AtlasManagementRedisEnum;
|
||||
import com.yida.data.common.core.enums.EnableStatusEnum;
|
||||
import com.yida.data.common.core.enums.LikeMarkEnum;
|
||||
import com.yida.data.common.core.enums.WorkTypeEnum;
|
||||
import com.yida.data.rabbit.constant.RabbitConstant;
|
||||
import com.yida.data.rabbit.util.RabbitUtil;
|
||||
import com.yida.data.school.atlas.mapper.CoreAtlasAccessRecordsMapper;
|
||||
import com.yida.data.school.atlas.mapper.CoreAtlasManagementDetailsCommentMapper;
|
||||
import com.yida.data.school.atlas.mapper.CoreAtlasManagementDetailsCommentReplyMapper;
|
||||
import com.yida.data.school.atlas.mapper.CoreAtlasManagementDetailsLikeMapper;
|
||||
import com.yida.data.school.atlas.mapper.CoreAtlasManagementDetailsMapper;
|
||||
import com.yida.data.school.atlas.mapper.CoreAtlasManagementMapper;
|
||||
import com.yida.data.school.atlas.mapper.*;
|
||||
import com.yida.data.school.atlas.service.AppAtlasService;
|
||||
import com.yida.data.school.atlas.service.CoreAtlasManagementDetailsService;
|
||||
import com.yida.data.school.atlas.service.CoreAtlasManagementService;
|
||||
import com.yida.data.school.dto.atlas.AtlasSelectPageDTO;
|
||||
import com.yida.data.school.dto.atlas.app.AppAtlasInfoDTO;
|
||||
import com.yida.data.school.dto.atlas.app.AppAtlasWorkCommentReplySaveDTO;
|
||||
import com.yida.data.school.dto.atlas.app.AppAtlasWorkCommentReplySelectDTO;
|
||||
import com.yida.data.school.dto.atlas.app.AppAtlasWorkCommentSaveDTO;
|
||||
import com.yida.data.school.dto.atlas.app.AppAtlasWorkCommentSelectDTO;
|
||||
import com.yida.data.school.dto.atlas.app.AppAtlasWorkInfoDTO;
|
||||
import com.yida.data.school.dto.atlas.app.AppAtlasWorkLikeDTO;
|
||||
import com.yida.data.school.dto.atlas.app.AppAtlasWorkListDTO;
|
||||
import com.yida.data.school.dto.atlas.app.*;
|
||||
import com.yida.data.school.vo.atlas.AtlasSelectPageVO;
|
||||
import com.yida.data.school.vo.atlas.app.AppAtlasInfoVO;
|
||||
import com.yida.data.school.vo.atlas.app.AppAtlasWorkBaseVO;
|
||||
import com.yida.data.school.vo.atlas.app.AppAtlasWorkCommentPageVO;
|
||||
import com.yida.data.school.vo.atlas.app.AppAtlasWorkCommentReplyPageVO;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* 学校图集app接口service层
|
||||
*
|
||||
@@ -70,8 +45,6 @@ import lombok.RequiredArgsConstructor;
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class AppAtlasServiceImpl implements AppAtlasService {
|
||||
|
||||
private final RabbitUtil rabbitUtil;
|
||||
|
||||
private final RedisService redisService;
|
||||
|
||||
private final CoreAtlasManagementService coreAtlasManagementService;
|
||||
@@ -247,8 +220,8 @@ public class AppAtlasServiceImpl implements AppAtlasService {
|
||||
+ ":" + appAtlasWorkLikeDTO.getAtlasDetailsId(),
|
||||
String.valueOf(appAtlasWorkLikeDTO.getUserId()), coreAtlasManagementDetailsLike);
|
||||
// 发送mq点赞消息
|
||||
rabbitUtil.convertAndSendMsg(RabbitConstant.ATLAS_LIKE_EXCHANGE, RabbitConstant.ATLAS_LIKE_KEY,
|
||||
coreAtlasManagementDetailsLike);
|
||||
// rabbitUtil.convertAndSendMsg(RabbitConstant.ATLAS_LIKE_EXCHANGE, RabbitConstant.ATLAS_LIKE_KEY,
|
||||
// coreAtlasManagementDetailsLike);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@@ -275,8 +248,8 @@ public class AppAtlasServiceImpl implements AppAtlasService {
|
||||
redisService.hashIncrement(AtlasManagementRedisEnum.ATLAS_MANAGEMENT_LIKE_NUM.getValue(),
|
||||
String.valueOf(appAtlasWorkLikeDTO.getAtlasId()), -1L);
|
||||
// 发送mq取消点赞消息
|
||||
rabbitUtil.convertAndSendMsg(RabbitConstant.ATLAS_LIKE_EXCHANGE, RabbitConstant.ATLAS_LIKE_KEY,
|
||||
detailsLike);
|
||||
// rabbitUtil.convertAndSendMsg(RabbitConstant.ATLAS_LIKE_EXCHANGE, RabbitConstant.ATLAS_LIKE_KEY,
|
||||
// detailsLike);
|
||||
});
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
+37
-37
@@ -1,37 +1,37 @@
|
||||
package com.yida.data.school.news.config;
|
||||
|
||||
import com.rabbitmq.client.Channel;
|
||||
import com.yida.data.rabbit.constant.RabbitConstant;
|
||||
import com.yida.data.school.dto.news.SysNoticeSaveDTO;
|
||||
import com.yida.data.school.news.service.EduNoticeSystemService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@RequiredArgsConstructor
|
||||
public class NewsRabbitReceiver {
|
||||
|
||||
private final EduNoticeSystemService eduNoticeSystemService;
|
||||
|
||||
@RabbitListener(bindings = @QueueBinding(
|
||||
value = @Queue(RabbitConstant.MSG_NOTICE_SYS_SAVE_QUEUE),
|
||||
exchange = @Exchange(RabbitConstant.MSG_NOTICE_SYS_SAVE_KEY)
|
||||
))
|
||||
public void receivePosition(SysNoticeSaveDTO notice, Channel channel, Message message) {
|
||||
long deliveryTag = message.getMessageProperties().getDeliveryTag();
|
||||
try {
|
||||
log.info("接收消息:[{}]", notice);
|
||||
eduNoticeSystemService.saveNotice(notice);
|
||||
channel.basicAck(deliveryTag, false);
|
||||
} catch (Exception e) {
|
||||
log.error("保存系统通知失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//package com.yida.data.school.news.config;
|
||||
//
|
||||
//import com.rabbitmq.client.Channel;
|
||||
//import com.yida.data.rabbit.constant.RabbitConstant;
|
||||
//import com.yida.data.school.dto.news.SysNoticeSaveDTO;
|
||||
//import com.yida.data.school.news.service.EduNoticeSystemService;
|
||||
//import lombok.RequiredArgsConstructor;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.amqp.core.Message;
|
||||
//import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
//import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
//import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//
|
||||
//@Slf4j
|
||||
//@Configuration
|
||||
//@RequiredArgsConstructor
|
||||
//public class NewsRabbitReceiver {
|
||||
//
|
||||
// private final EduNoticeSystemService eduNoticeSystemService;
|
||||
//
|
||||
// @RabbitListener(bindings = @QueueBinding(
|
||||
// value = @Queue(RabbitConstant.MSG_NOTICE_SYS_SAVE_QUEUE),
|
||||
// exchange = @Exchange(RabbitConstant.MSG_NOTICE_SYS_SAVE_KEY)
|
||||
// ))
|
||||
// public void receivePosition(SysNoticeSaveDTO notice, Channel channel, Message message) {
|
||||
// long deliveryTag = message.getMessageProperties().getDeliveryTag();
|
||||
// try {
|
||||
// log.info("接收消息:[{}]", notice);
|
||||
// eduNoticeSystemService.saveNotice(notice);
|
||||
// channel.basicAck(deliveryTag, false);
|
||||
// } catch (Exception e) {
|
||||
// log.error("保存系统通知失败", e);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
+9
-10
@@ -8,36 +8,35 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yida.data.common.core.entity.notice.EduNoticeSystem;
|
||||
import com.yida.data.common.core.entity.notice.EduNoticeSystemUser;
|
||||
import com.yida.data.msg.dto.WebsocketMsgDTO;
|
||||
import com.yida.data.rabbit.constant.RabbitConstant;
|
||||
import com.yida.data.rabbit.util.RabbitUtil;
|
||||
import com.yida.data.school.dto.news.SysNoticeSaveDTO;
|
||||
import com.yida.data.school.news.mapper.EduNoticeSystemMapper;
|
||||
import com.yida.data.school.news.service.EduNoticeSystemService;
|
||||
import com.yida.data.school.news.service.EduNoticeSystemUserService;
|
||||
import com.yida.data.school.vo.news.SysNoticeInfoVO;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
@RequiredArgsConstructor
|
||||
public class EduNoticeSystemServiceImpl extends ServiceImpl<EduNoticeSystemMapper, EduNoticeSystem> implements
|
||||
EduNoticeSystemService {
|
||||
EduNoticeSystemService {
|
||||
|
||||
private final EduNoticeSystemUserService eduNoticeSystemUserService;
|
||||
private final RabbitUtil rabbitUtil;
|
||||
// private final RabbitUtil rabbitUtil;
|
||||
|
||||
@Override
|
||||
public IPage<SysNoticeInfoVO> listNoticePage(Long userId, Integer pageNum, Integer pageSize) {
|
||||
IPage<SysNoticeInfoVO> res = baseMapper
|
||||
.listNoticePage(Page.of(pageNum, pageSize), userId);
|
||||
.listNoticePage(Page.of(pageNum, pageSize), userId);
|
||||
if (CollUtil.isNotEmpty(res.getRecords())) {
|
||||
eduNoticeSystemUserService.update(Wrappers.<EduNoticeSystemUser>lambdaUpdate()
|
||||
.in(EduNoticeSystemUser::getId,
|
||||
res.getRecords().stream().map(SysNoticeInfoVO::getMsgId).collect(Collectors.toList()))
|
||||
.set(EduNoticeSystemUser::getReadFlag, 1));
|
||||
.in(EduNoticeSystemUser::getId,
|
||||
res.getRecords().stream().map(SysNoticeInfoVO::getMsgId).collect(Collectors.toList()))
|
||||
.set(EduNoticeSystemUser::getReadFlag, 1));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -62,7 +61,7 @@ public class EduNoticeSystemServiceImpl extends ServiceImpl<EduNoticeSystemMappe
|
||||
WebsocketMsgDTO msg = new WebsocketMsgDTO();
|
||||
msg.setUserId(userId);
|
||||
msg.setContent(dto.getContent());
|
||||
rabbitUtil.convertAndSendMsg(RabbitConstant.MSG_EXCHANGE, RabbitConstant.MSG_WEBSOCKET_KEY, msg);
|
||||
// rabbitUtil.convertAndSendMsg(RabbitConstant.MSG_EXCHANGE, RabbitConstant.MSG_WEBSOCKET_KEY, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
package com.yida.data.school.transaction.controller;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.annotation.ControllerLog;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.apply.EduApply;
|
||||
import com.yida.data.common.core.entity.apply.EduStudentApply;
|
||||
import com.yida.data.common.core.entity.constant.CachePrefixConstant;
|
||||
import com.yida.data.common.core.entity.constant.FebsConstant;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.school.transaction.service.EduStudentApplyService;
|
||||
import com.yida.data.school.vo.transcation.EduApplyVO;
|
||||
import com.yida.data.school.vo.transcation.StudentApplyImportProgressVO;
|
||||
import com.yida.data.school.vo.transcation.StudentApplyStatusVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import java.util.UUID;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Api(tags = "交易-学生应用关系")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/transaction/studentApply")
|
||||
@RestController
|
||||
public class EduStudentApplyController {
|
||||
|
||||
private final EduStudentApplyService eduStudentApplyService;
|
||||
|
||||
private final RedisService redisService;
|
||||
|
||||
|
||||
@ApiOperation("分页查询学生开通应用")
|
||||
@GetMapping("/listStudentApply")
|
||||
@ControllerLog(operation = "分页查询学生开通应用")
|
||||
public ResultBean<IPage<EduStudentApply>> listApply(
|
||||
@ApiParam("学生名字") @RequestParam(required = false) String studentName,
|
||||
@ApiParam("学号") @RequestParam(required = false) String studentNumber,
|
||||
@ApiParam("学校ID") @RequestParam(required = false) Long schoolId,
|
||||
@ApiParam("校区ID") @RequestParam(required = false) Long campusId,
|
||||
@ApiParam("学段ID") @RequestParam(required = false) Long sectionId,
|
||||
@ApiParam("年级ID") @RequestParam(required = false) Long gradeId,
|
||||
@ApiParam("班级ID") @RequestParam(required = false) Long classId,
|
||||
@ApiParam("当前页码") @RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@ApiParam("页面大小") @RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
Page<EduStudentApply> page = new Page<>();
|
||||
page.setCurrent(pageNum);
|
||||
page.setSize(pageSize);
|
||||
|
||||
return ResultBean.buildSuccess(
|
||||
eduStudentApplyService
|
||||
.listStudentApply(studentName, studentNumber, schoolId, sectionId, campusId, gradeId, classId, page));
|
||||
}
|
||||
|
||||
@ApiOperation("获取开通应用详情")
|
||||
@GetMapping("/getStudentApply")
|
||||
@ControllerLog(operation = "获取开通应用详情")
|
||||
public ResultBean<EduStudentApply> getStudentApply(@ApiParam("主键ID") Long id) {
|
||||
return ResultBean.buildSuccess(eduStudentApplyService.getById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("删除开通应用")
|
||||
@GetMapping("/deleteStudentApply")
|
||||
@ControllerLog(operation = "删除学生开通应用")
|
||||
public ResultBean deleteStudentApply(@ApiParam("主键ID") Long id) {
|
||||
eduStudentApplyService.update(Wrappers.lambdaUpdate(new EduStudentApply())
|
||||
.eq(EduStudentApply::getId, id)
|
||||
.set(EduStudentApply::getDelFlag, 1));
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("保存学生开通应用")
|
||||
@PostMapping("/saveStudentApply")
|
||||
@ControllerLog(operation = "保存学生开通应用")
|
||||
public ResultBean insertApply(@ApiParam("开通应用") @RequestBody EduStudentApply eduStudentApply) {
|
||||
eduStudentApplyService.save(eduStudentApply);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("查询学生是否拥有该应用权限")
|
||||
@GetMapping("/hasApply")
|
||||
public ResultBean<Boolean> listApplyCode(@ApiParam("学生id") Long studentId,
|
||||
@ApiParam("应用编码") String applyCode) {
|
||||
return ResultBean.buildSuccess(eduStudentApplyService.count(Wrappers.lambdaQuery(new EduStudentApply())
|
||||
.eq(EduStudentApply::getStudentId, studentId)
|
||||
.eq(EduStudentApply::getApplyCode, applyCode)
|
||||
.ge(EduStudentApply::getEndTime, LocalDateTime.now())
|
||||
.le(EduStudentApply::getStartTime, LocalDateTime.now())) > 0);
|
||||
}
|
||||
|
||||
@ApiOperation("查询学生的应用状态")
|
||||
@GetMapping("/getApplyStatus")
|
||||
public ResultBean<StudentApplyStatusVO> getApplyStatus(@ApiParam("学生id") Long studentId,
|
||||
@ApiParam("应用编码") String applyCode) {
|
||||
return ResultBean.buildSuccess(eduStudentApplyService.getStudentApplyStatus(studentId, applyCode));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("下载学生开通应用导入模板")
|
||||
@PostMapping("/downloadTemplate")
|
||||
public void downloadTemplate(HttpServletResponse response) throws Exception {
|
||||
eduStudentApplyService.downloadTemplate(response);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("导入学生开通应用信息")
|
||||
@PostMapping("/importStudentApplyInfo")
|
||||
public ResultBean<StudentApplyImportProgressVO> importStudentApplyInfo(@RequestParam(value = "file") MultipartFile file)
|
||||
throws Exception {
|
||||
String redisKey = UUID.randomUUID().toString();
|
||||
StudentApplyImportProgressVO progressVO = new StudentApplyImportProgressVO();
|
||||
progressVO.setRedisKey(redisKey);
|
||||
progressVO.setFinish(0);
|
||||
progressVO.setTotalNum(0);
|
||||
progressVO.setCurrentNum(0);
|
||||
redisService.hset(CachePrefixConstant.IMPORT_STUDENT_APPLY_PROGRESS, redisKey, progressVO);
|
||||
eduStudentApplyService.importStudentApplyInfo(file, redisKey);
|
||||
return ResultBean.buildSuccess(progressVO);
|
||||
}
|
||||
|
||||
@ApiOperation("获取导入学生开通应用信息进度")
|
||||
@GetMapping("/getImportStudentApplyInfoProgress")
|
||||
public ResultBean<StudentApplyImportProgressVO> getImportStudentApplyInfoProgress(@RequestParam("redisKey") String redisKey) {
|
||||
return ResultBean.buildSuccess(eduStudentApplyService.getImportStudentApplyInfoProgress(redisKey));
|
||||
}
|
||||
|
||||
@ApiOperation("删除缓存导入进度")
|
||||
@GetMapping("/deleteRedisStudentApplyImportProgress")
|
||||
public ResultBean deleteRedisStudentApplyImportProgress(@RequestParam("redisKey") String redisKey) {
|
||||
redisService.hdel(CachePrefixConstant.IMPORT_STUDENT_APPLY_PROGRESS, redisKey);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package com.yida.data.school.transaction.controller;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.apply.EduStudentApply;
|
||||
import com.yida.data.common.core.entity.constant.CachePrefixConstant;
|
||||
import com.yida.data.school.transaction.service.EduStudentApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Api(tags = "交易-学生应用关系(不鉴权)")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/in/transaction/studentApply")
|
||||
@RestController
|
||||
public class InEduStudentApplyController {
|
||||
|
||||
private final EduStudentApplyService eduStudentApplyService;
|
||||
private final RedisService redisService;
|
||||
|
||||
@ApiOperation("查询学生的应用编码列表")
|
||||
@GetMapping("/listApply")
|
||||
public ResultBean<Map<Long, List<String>>> listApplyCode(@RequestParam("studentIds") Long[] studentIds) {
|
||||
List<EduStudentApply> applyCodeList = eduStudentApplyService.list(Wrappers.lambdaQuery(new EduStudentApply())
|
||||
.in(EduStudentApply::getStudentId, studentIds)
|
||||
.ge(EduStudentApply::getEndTime, LocalDateTime.now())
|
||||
.le(EduStudentApply::getStartTime, LocalDateTime.now()));
|
||||
Map<Long, List<String>> res = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(applyCodeList)) {
|
||||
Map<Long, List<EduStudentApply>> collect = applyCodeList.stream().collect(Collectors.groupingBy(EduStudentApply::getStudentId));
|
||||
for (Map.Entry<Long, List<EduStudentApply>> entry : collect.entrySet()) {
|
||||
List<String> applyCode = entry.getValue().stream().map(x -> x.getApplyCode()).distinct().collect(Collectors.toList());
|
||||
res.put(entry.getKey(), applyCode);
|
||||
redisService.hset(CachePrefixConstant.STUDENT_APPLY, entry.getKey().toString(), applyCode);
|
||||
}
|
||||
}
|
||||
return ResultBean.buildSuccess(res);
|
||||
}
|
||||
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package com.yida.data.school.transaction.listener;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yida.data.common.core.entity.apply.EduStudentApply;
|
||||
import com.yida.data.common.service.CommonService;
|
||||
import com.yida.data.school.transaction.service.EduStudentApplyService;
|
||||
import com.yida.data.school.vo.transcation.StudentApplyImportVO;
|
||||
import com.yida.data.user.dto.ImportStudentDormDTO;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class importStudentApplyListener extends AnalysisEventListener<StudentApplyImportVO> {
|
||||
|
||||
|
||||
private EduStudentApplyService eduStudentApplyService;
|
||||
|
||||
|
||||
private List<StudentApplyImportVO> list = new ArrayList<>();
|
||||
|
||||
private String key;
|
||||
|
||||
|
||||
public importStudentApplyListener(EduStudentApplyService eduStudentApplyService, String key) {
|
||||
this.eduStudentApplyService = eduStudentApplyService;
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(StudentApplyImportVO data, AnalysisContext context) {
|
||||
if (null == data) {
|
||||
log.info("excel导入失败:{}", data.toString());
|
||||
}
|
||||
list.add(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext context) {
|
||||
saveData();
|
||||
}
|
||||
|
||||
public void saveData() {
|
||||
eduStudentApplyService.insertStudentApplyData(list, key);
|
||||
}
|
||||
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.yida.data.school.transaction.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.entity.apply.EduStudentApply;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EduStudentApplyMapper extends BaseMapper<EduStudentApply> {
|
||||
|
||||
List<EduStudentApply> getStudentApplyStatus(@Param("studentId") Long studentId,
|
||||
@Param("applyCode") String applyCode);
|
||||
|
||||
IPage<EduStudentApply> listStudentApply(@Param("studentName") String studentName,
|
||||
@Param("studentNumber") String studentNumber,
|
||||
@Param("schoolId") Long schoolId, @Param("sectionId") Long sectionId,@Param("campusId") Long campusId,
|
||||
@Param("gradeId") Long gradeId, @Param("classId") Long classId, Page page);
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.yida.data.school.transaction.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.apply.EduStudentApply;
|
||||
import com.yida.data.school.vo.transcation.StudentApplyImportErrorVO;
|
||||
import com.yida.data.school.vo.transcation.StudentApplyImportProgressVO;
|
||||
import com.yida.data.school.vo.transcation.StudentApplyImportVO;
|
||||
import com.yida.data.school.vo.transcation.StudentApplyStatusVO;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
public interface EduStudentApplyService extends IService<EduStudentApply> {
|
||||
|
||||
StudentApplyStatusVO getStudentApplyStatus(Long studentId, String applyCode);
|
||||
|
||||
IPage<EduStudentApply> listStudentApply(String studentName,
|
||||
String studentNumber,
|
||||
Long schoolId,
|
||||
Long sectionId,
|
||||
Long campusId,
|
||||
Long gradeId,
|
||||
Long classId,
|
||||
Page<EduStudentApply> page);
|
||||
|
||||
/**
|
||||
* 下载学生开通应用模板
|
||||
*
|
||||
* @param response
|
||||
* @throws Exception
|
||||
*/
|
||||
void downloadTemplate(HttpServletResponse response) throws Exception;
|
||||
|
||||
@Async
|
||||
void importStudentApplyInfo(MultipartFile file, String redisKey) throws IOException;
|
||||
|
||||
void insertStudentApplyData(List<StudentApplyImportVO> studentApplyImportVOList, String redisKey);
|
||||
|
||||
StudentApplyImportProgressVO getImportStudentApplyInfoProgress( String redisKey);
|
||||
|
||||
}
|
||||
+57
-58
@@ -29,7 +29,6 @@ import com.yida.data.common.core.utils.Asserts;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.common.core.utils.WxPayUtil;
|
||||
import com.yida.data.common.service.CommonService;
|
||||
import com.yida.data.rabbit.util.RabbitUtil;
|
||||
import com.yida.data.school.dto.transaction.EduApplyProductOrderDTO;
|
||||
import com.yida.data.school.transaction.mapper.EduApplyProductOrderMapper;
|
||||
import com.yida.data.school.transaction.mapper.EduApplyProductOrderStudentMapper;
|
||||
@@ -65,11 +64,11 @@ import java.util.stream.Collectors;
|
||||
@Transactional
|
||||
@RefreshScope
|
||||
public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrderMapper, EduApplyProductOrder> implements
|
||||
EduProductOrderService {
|
||||
EduProductOrderService {
|
||||
|
||||
private static final String WX_CALL = "product/in/productOrder/wxCall";
|
||||
private static final ExecutorService ORDER_SUCCESS_POOL = new ThreadPoolExecutor(10, 20, 1,
|
||||
TimeUnit.MINUTES, new LinkedBlockingQueue<>());
|
||||
TimeUnit.MINUTES, new LinkedBlockingQueue<>());
|
||||
@Resource
|
||||
private EduStudentApplyService eduStudentApplyService;
|
||||
@Resource
|
||||
@@ -84,8 +83,8 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
private RemoteStudentService remoteStudentService;
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
@Resource
|
||||
private RabbitUtil rabbitUtil;
|
||||
// @Resource
|
||||
// private RabbitUtil rabbitUtil;
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
@Resource
|
||||
@@ -100,7 +99,7 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
@Override
|
||||
@Transactional
|
||||
public PayInfoVO createOrder(Long productId, Long[] studentIds, Integer payType, CurrentUser currentUser,
|
||||
String ip) {
|
||||
String ip) {
|
||||
boolean flag = false;
|
||||
|
||||
log.info("params:[{}],[{}],[{}]", productId, studentIds, payType);
|
||||
@@ -138,11 +137,11 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
for (Long studentId : studentIds) {
|
||||
EduApplyProductOrderStudent orderStudent = new EduApplyProductOrderStudent();
|
||||
BeanUtils.copyProperties(remoteStudentService.getClassInfoByStudent(studentId, currentUser.getMobile()).getData(),
|
||||
orderStudent);
|
||||
orderStudent);
|
||||
orderStudentList.add(orderStudent);
|
||||
// 订单未超时 不允许再次下单
|
||||
EduApplyProductOrder studentOrder =
|
||||
(EduApplyProductOrder) redisService.get(CachePrefixConstant.STUDENT_ORDER + studentId.toString() + "." + product.getProductId().toString());
|
||||
(EduApplyProductOrder) redisService.get(CachePrefixConstant.STUDENT_ORDER + studentId.toString() + "." + product.getProductId().toString());
|
||||
// 未支付订单 学生与下单人的关系
|
||||
EduApplyProductOrderStudent existOrderStudent = null;
|
||||
// 可能数据不同步,查询数据库
|
||||
@@ -150,13 +149,13 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
existOrderStudent = baseMapper.selectNotPayOrderStudent(studentId, product.getProductId());
|
||||
} else {
|
||||
existOrderStudent = eduApplyProductOrderStudentMapper
|
||||
.selectOne(Wrappers.<EduApplyProductOrderStudent>lambdaQuery()
|
||||
.eq(EduApplyProductOrderStudent::getStudentId, studentId)
|
||||
.eq(EduApplyProductOrderStudent::getOrderId, studentOrder.getOrderId()));
|
||||
.selectOne(Wrappers.<EduApplyProductOrderStudent>lambdaQuery()
|
||||
.eq(EduApplyProductOrderStudent::getStudentId, studentId)
|
||||
.eq(EduApplyProductOrderStudent::getOrderId, studentOrder.getOrderId()));
|
||||
}
|
||||
if (existOrderStudent != null) {
|
||||
throw new FebsException(String.format("%s已经为%s下单,等待支付中", existOrderStudent.getStudentParentType(),
|
||||
existOrderStudent.getStudentName()));
|
||||
existOrderStudent.getStudentName()));
|
||||
}
|
||||
// 计算每个学生的价格
|
||||
String studentFamily = orderStudent.getStudentFamilyType();
|
||||
@@ -178,7 +177,7 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
order.setOrderCode(String.valueOf(GuuidUtil.getUUID()));
|
||||
// 流水号
|
||||
order.setTransactionNumber(generateSerialNumber(orderStudentList.get(0).getSchoolId(),
|
||||
product.getProductCode()));
|
||||
product.getProductCode()));
|
||||
// 下单人信息
|
||||
order.setPhone(currentUser.getMobile());
|
||||
order.setCreateId(currentUser.getUserId());
|
||||
@@ -208,14 +207,14 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
// 发起支付
|
||||
String res = null;
|
||||
ParentInfoVO parent = remoteStudentService.getParentWithStudent(currentUser.getMobile(),
|
||||
null, currentUser.getDeptId()).getData();
|
||||
null, currentUser.getDeptId()).getData();
|
||||
EduPayWxConfig config = commonService.getPayWxConfigBySchool(product.getSchoolId());
|
||||
if (order.getPraccticalMoney() > 0D) {
|
||||
try {
|
||||
switch (payType) {
|
||||
case 0:
|
||||
res = WxPayUtil.placeOrderJs(config, order, parent.getWxPublicOpenId(), ip,
|
||||
apiUrl + WX_CALL);
|
||||
apiUrl + WX_CALL);
|
||||
break;
|
||||
case 1:
|
||||
res = WxPayUtil.placeOrderH5(config, order, ip, apiUrl + WX_CALL);
|
||||
@@ -233,7 +232,7 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
// 添加学生的订单缓存
|
||||
for (EduApplyProductOrderStudent orderStudent : orderStudentList) {
|
||||
redisService.set(
|
||||
CachePrefixConstant.STUDENT_ORDER + orderStudent.getStudentId().toString() + "." + product.getProductId().toString(),
|
||||
CachePrefixConstant.STUDENT_ORDER + orderStudent.getStudentId().toString() + "." + product.getProductId().toString(),
|
||||
order, 900L);
|
||||
}
|
||||
if (order.getPraccticalMoney() == 0D) {
|
||||
@@ -254,7 +253,7 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
// 进行了减库存操作 还原库存
|
||||
redisService.lock(LockPrefixConstant.PRODUCT_STOCK_EDIT_LOCK + product.getProductId());
|
||||
product = (EduProduct) redisService.hget(CachePrefixConstant.PRODUCT,
|
||||
productId.toString());
|
||||
productId.toString());
|
||||
product.setStock(product.getStock() + studentIds.length);
|
||||
redisService.hset(CachePrefixConstant.PRODUCT, productId.toString(), product);
|
||||
redisService.unlock(LockPrefixConstant.PRODUCT_STOCK_EDIT_LOCK + product.getProductId());
|
||||
@@ -276,12 +275,12 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
*/
|
||||
@Override
|
||||
public IPage<EduApplyProductOrder> selectPageListProductOrderService(Page page,
|
||||
EduApplyProductOrderDTO eduApplyProductOrder) {
|
||||
EduApplyProductOrderDTO eduApplyProductOrder) {
|
||||
List<Long> schoolIds = new ArrayList<>();
|
||||
|
||||
if (Objects.isNull(eduApplyProductOrder.getSchoolId())) {
|
||||
List<Dept> deptList =
|
||||
remoteDeptService.getSchoolByArea(eduApplyProductOrder.getAreaId(), null).getData();
|
||||
remoteDeptService.getSchoolByArea(eduApplyProductOrder.getAreaId(), null).getData();
|
||||
if (CollUtil.isNotEmpty(deptList)) {
|
||||
schoolIds = deptList.stream().map(Dept::getDeptId).collect(Collectors.toList());
|
||||
} else {
|
||||
@@ -295,8 +294,8 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
if (CollUtil.isNotEmpty(listOrder.getRecords())) {
|
||||
for (EduApplyProductOrder order : listOrder.getRecords()) {
|
||||
order.setOrderStudentList(
|
||||
eduApplyProductOrderStudentMapper.selectList(Wrappers.lambdaQuery(new EduApplyProductOrderStudent())
|
||||
.eq(EduApplyProductOrderStudent::getOrderId, order.getOrderId())));
|
||||
eduApplyProductOrderStudentMapper.selectList(Wrappers.lambdaQuery(new EduApplyProductOrderStudent())
|
||||
.eq(EduApplyProductOrderStudent::getOrderId, order.getOrderId())));
|
||||
}
|
||||
}
|
||||
return listOrder;
|
||||
@@ -331,11 +330,11 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
case "1":
|
||||
try {
|
||||
WxPayUtil.refund(config, refund.getOrderCode(),
|
||||
refund.getRefundReason(),
|
||||
refund.getRefundCode(),
|
||||
Double.valueOf(order.getPraccticalMoney() * 100).longValue(),
|
||||
Double.valueOf(order.getPraccticalMoney() * 100).longValue(),
|
||||
apiUrl + WX_CALL);
|
||||
refund.getRefundReason(),
|
||||
refund.getRefundCode(),
|
||||
Double.valueOf(order.getPraccticalMoney() * 100).longValue(),
|
||||
Double.valueOf(order.getPraccticalMoney() * 100).longValue(),
|
||||
apiUrl + WX_CALL);
|
||||
} catch (Exception e) {
|
||||
log.info("退款失败,msg:[{}],stack:[{}]", e.getMessage(), e.getStackTrace());
|
||||
throw new FebsException("退款失败");
|
||||
@@ -396,12 +395,12 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
public EduApplyProductOrder selectEduProductOrder(Long orderId) {
|
||||
EduApplyProductOrder eduApplyProductOrder = eduApplyProductOrderMapper.selectById(orderId);
|
||||
List<EduApplyProductOrderStudent> eduApplyProductOrderStudents = eduApplyProductOrderStudentMapper
|
||||
.selectList(Wrappers.lambdaQuery(new EduApplyProductOrderStudent())
|
||||
.eq(EduApplyProductOrderStudent::getOrderId, orderId));
|
||||
.selectList(Wrappers.lambdaQuery(new EduApplyProductOrderStudent())
|
||||
.eq(EduApplyProductOrderStudent::getOrderId, orderId));
|
||||
eduApplyProductOrder.setOrderStudentList(eduApplyProductOrderStudents);
|
||||
if ("2".equals(eduApplyProductOrder.getPayStatus())) {
|
||||
eduApplyProductOrder.setRefund(eduApplyProductRefundMapper.selectOne(Wrappers.<EduApplyProductRefund>lambdaQuery()
|
||||
.eq(EduApplyProductRefund::getOrderCode, eduApplyProductOrder.getOrderCode())));
|
||||
.eq(EduApplyProductRefund::getOrderCode, eduApplyProductOrder.getOrderCode())));
|
||||
}
|
||||
return eduApplyProductOrder;
|
||||
}
|
||||
@@ -412,7 +411,7 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
EduApplyProductOrder order = baseMapper.getOrderByCode(orderCode);
|
||||
//EduProduct product = eduProductMapper.selectById(order.getProductId());
|
||||
if (order != null && order.getPraccticalMoney() > 0D && PayWay.WEIXIN.getValue().equals(order.getPayWay()) && "0,1"
|
||||
.contains(order.getOrderStatus())) {
|
||||
.contains(order.getOrderStatus())) {
|
||||
boolean flag = false;
|
||||
EduPayWxConfig config = commonService.getPayWxConfigBySchool(order.getSchoolId());
|
||||
while (LocalDateTimeUtil.between(order.getCreateDate(), LocalDateTime.now()).getSeconds() < 900L) {
|
||||
@@ -427,10 +426,10 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
case "SUCCESS":
|
||||
case "ACCEPT":
|
||||
paySuccessUpdate(orderCode,
|
||||
DateUtil.parseLocalDateTime(resJson.getStr("success_time"), "yyyy-MM" +
|
||||
"-dd'T" +
|
||||
"'HH:mm" +
|
||||
":ssXXX"));
|
||||
DateUtil.parseLocalDateTime(resJson.getStr("success_time"), "yyyy-MM" +
|
||||
"-dd'T" +
|
||||
"'HH:mm" +
|
||||
":ssXXX"));
|
||||
flag = true;
|
||||
break;
|
||||
// 未完成支付,订单作废
|
||||
@@ -473,14 +472,14 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
public void paySuccessUpdate(String orderCode, LocalDateTime successTime) {
|
||||
// 从缓存中拿订单
|
||||
EduApplyProductOrder order =
|
||||
(EduApplyProductOrder) redisService.get(CachePrefixConstant.ORDER + orderCode);
|
||||
(EduApplyProductOrder) redisService.get(CachePrefixConstant.ORDER + orderCode);
|
||||
if (order == null) {
|
||||
order = getOne(Wrappers.lambdaQuery(new EduApplyProductOrder()).eq(EduApplyProductOrder::getOrderCode, orderCode));
|
||||
// TODO: 2021/6/9 订单已完成进入退款
|
||||
}
|
||||
// 获取商品信息
|
||||
EduProduct product = (EduProduct) redisService.hget(CachePrefixConstant.PRODUCT,
|
||||
order.getProductId().toString());
|
||||
order.getProductId().toString());
|
||||
if (product == null) {
|
||||
product = eduProductMapper.getInfo(order.getProductId());
|
||||
redisService.hset(CachePrefixConstant.PRODUCT, order.getProductId().toString(), product);
|
||||
@@ -493,8 +492,8 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
List<EduProductApply> applyList = product.getApplyList();
|
||||
// 该笔订单包含的学生
|
||||
List<EduApplyProductOrderStudent> studentList = eduApplyProductOrderStudentMapper.selectList(
|
||||
Wrappers.lambdaQuery(new EduApplyProductOrderStudent())
|
||||
.eq(EduApplyProductOrderStudent::getOrderId, order.getOrderId()));
|
||||
Wrappers.lambdaQuery(new EduApplyProductOrderStudent())
|
||||
.eq(EduApplyProductOrderStudent::getOrderId, order.getOrderId()));
|
||||
// 包含的实际商品
|
||||
List<EduRealProduct> realProductList = product.getRealProductList();
|
||||
// 学生-应用关联关系
|
||||
@@ -520,7 +519,7 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
msg.put("studentId", orderStudent.getStudentId().toString());
|
||||
msg.put("identityId", realProduct.getProductValue());
|
||||
// 发送通知
|
||||
rabbitUtil.sendMsg(realProduct.getService(), realProduct.getProductType(), JSONUtil.toJsonStr(msg));
|
||||
// rabbitUtil.sendMsg(realProduct.getService(), realProduct.getProductType(), JSONUtil.toJsonStr(msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -542,10 +541,10 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
String successTime = jsonObject.getStr("success_time");
|
||||
// 拿订单
|
||||
EduApplyProductOrder order =
|
||||
getOne(Wrappers.lambdaQuery(new EduApplyProductOrder()).eq(EduApplyProductOrder::getOrderCode, orderCode));
|
||||
getOne(Wrappers.lambdaQuery(new EduApplyProductOrder()).eq(EduApplyProductOrder::getOrderCode, orderCode));
|
||||
EduApplyProductRefund refund =
|
||||
eduApplyProductRefundMapper.selectOne(
|
||||
Wrappers.lambdaQuery(new EduApplyProductRefund()).eq(EduApplyProductRefund::getRefundCode, refundCode));
|
||||
eduApplyProductRefundMapper.selectOne(
|
||||
Wrappers.lambdaQuery(new EduApplyProductRefund()).eq(EduApplyProductRefund::getRefundCode, refundCode));
|
||||
if ("SUCCESS".equals(refundStatus)) {
|
||||
// 更新订单和退款单状态
|
||||
order.setOrderStatus("4");
|
||||
@@ -570,7 +569,7 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
String packge = "prepay_id=" + prepayId;
|
||||
String code = config.getWxPublicId() + "\n" + timestamp + "\n" + nonceStr + "\n" + packge + "\n";
|
||||
Sign sign = SecureUtil.sign(SignAlgorithm.SHA256withRSA, config.getApiCreditPrivateKeyNoHead(),
|
||||
null);
|
||||
null);
|
||||
byte[] res = sign.sign(code.getBytes());
|
||||
String signRes = Base64.encode(res);
|
||||
PayInfoVO infoVO = new PayInfoVO();
|
||||
@@ -597,7 +596,7 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
// 主动查询是否已经支付了
|
||||
try {
|
||||
JSONObject resJson =
|
||||
JSONUtil.parseObj(WxPayUtil.queryOrder(config, order.getOrderCode()));
|
||||
JSONUtil.parseObj(WxPayUtil.queryOrder(config, order.getOrderCode()));
|
||||
log.info("resJson:[{}]", resJson);
|
||||
if (resJson.containsKey("code") && "ORDER_NOT_EXIST".equals(resJson.getStr("code"))) {
|
||||
// 订单不存在 取消订单
|
||||
@@ -610,10 +609,10 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
case "SUCCESS":
|
||||
case "ACCEPT":
|
||||
paySuccessUpdate(order.getOrderCode(),
|
||||
DateUtil.parseLocalDateTime(resJson.getStr("success_time"), "yyyy-MM" +
|
||||
"-dd'T" +
|
||||
"'HH:mm" +
|
||||
":ssXXX"));
|
||||
DateUtil.parseLocalDateTime(resJson.getStr("success_time"), "yyyy-MM" +
|
||||
"-dd'T" +
|
||||
"'HH:mm" +
|
||||
":ssXXX"));
|
||||
continue;
|
||||
// 未完成支付还需要关闭订单
|
||||
case "NOTPAY":
|
||||
@@ -635,7 +634,7 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
redisService.lock(LockPrefixConstant.PRODUCT_STOCK_EDIT_LOCK + order.getProductId());
|
||||
// 获取库存
|
||||
Integer stock = (Integer) redisService
|
||||
.get(CachePrefixConstant.PRODUCT_STOCK + order.getProductId());
|
||||
.get(CachePrefixConstant.PRODUCT_STOCK + order.getProductId());
|
||||
if (stock == null) {
|
||||
EduProduct product = eduProductMapper.selectById(order.getProductId());
|
||||
stock = product.getStock();
|
||||
@@ -643,9 +642,9 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
}
|
||||
// 修改库存缓存
|
||||
redisService.incr(CachePrefixConstant.PRODUCT_STOCK + order.getProductId(),
|
||||
Long.valueOf(order.getOrderStudentList().size()));
|
||||
Long.valueOf(order.getOrderStudentList().size()));
|
||||
eduProductMapper.updateProductStock(order.getProductId(),
|
||||
-Long.valueOf(order.getOrderStudentList().size()));
|
||||
-Long.valueOf(order.getOrderStudentList().size()));
|
||||
redisService.unlock(LockPrefixConstant.PRODUCT_STOCK_EDIT_LOCK + order.getProductId());
|
||||
}
|
||||
}
|
||||
@@ -671,7 +670,7 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
// 查询退款进度
|
||||
EduPayWxConfig config = commonService.getPayWxConfigBySchool(refundOrder.getSchoolId());
|
||||
JSONObject resJson =
|
||||
JSONUtil.parseObj(WxPayUtil.queryRefund(config, refundOrder.getRefundCode()));
|
||||
JSONUtil.parseObj(WxPayUtil.queryRefund(config, refundOrder.getRefundCode()));
|
||||
log.info("refund,data:[{}]", resJson);
|
||||
String status = resJson.getStr("status");
|
||||
switch (status) {
|
||||
@@ -682,20 +681,20 @@ public class EduProductOrderServiceImpl extends ServiceImpl<EduApplyProductOrder
|
||||
eduApplyProductOrderMapper.updateById(order);
|
||||
// 更新退款状态
|
||||
EduApplyProductRefund refund =
|
||||
eduApplyProductRefundMapper.selectById(refundOrder.getRefundId());
|
||||
eduApplyProductRefundMapper.selectById(refundOrder.getRefundId());
|
||||
refund.setRefundTime(DateUtil.parseLocalDateTime(resJson.getStr("success_time"),
|
||||
"yyyy-MM-dd'T'HH:mm:ssXXX"));
|
||||
"yyyy-MM-dd'T'HH:mm:ssXXX"));
|
||||
eduApplyProductRefundMapper.updateById(refund);
|
||||
if ("2".equals(order.getOrderStatus())) {
|
||||
// 更新商品库存
|
||||
// 获取锁
|
||||
redisService.lock(LockPrefixConstant.PRODUCT_STOCK_EDIT_LOCK + order.getProductId());
|
||||
Long num =
|
||||
eduApplyProductOrderStudentMapper
|
||||
.selectCount(Wrappers.lambdaQuery(new EduApplyProductOrderStudent())
|
||||
.eq(EduApplyProductOrderStudent::getOrderId, order.getOrderId()));
|
||||
eduApplyProductOrderStudentMapper
|
||||
.selectCount(Wrappers.lambdaQuery(new EduApplyProductOrderStudent())
|
||||
.eq(EduApplyProductOrderStudent::getOrderId, order.getOrderId()));
|
||||
Integer stock = (Integer) redisService
|
||||
.get(CachePrefixConstant.PRODUCT_STOCK + order.getProductId());
|
||||
.get(CachePrefixConstant.PRODUCT_STOCK + order.getProductId());
|
||||
if (stock == null) {
|
||||
EduProduct product = eduProductMapper.selectById(order.getProductId());
|
||||
stock = product.getStock();
|
||||
|
||||
+245
@@ -0,0 +1,245 @@
|
||||
package com.yida.data.school.transaction.service.impl;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.common.ResultMsgType;
|
||||
import com.yida.data.common.core.entity.CurrentUser;
|
||||
import com.yida.data.common.core.entity.apply.EduStudentApply;
|
||||
import com.yida.data.common.core.entity.constant.CachePrefixConstant;
|
||||
import com.yida.data.common.core.entity.system.Dept;
|
||||
import com.yida.data.common.core.entity.user.EduStudent;
|
||||
import com.yida.data.common.core.enums.ImportTemplateTypeEnum;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.common.core.utils.FileUtil;
|
||||
import com.yida.data.common.service.CommonService;
|
||||
import com.yida.data.school.transaction.listener.importStudentApplyListener;
|
||||
import com.yida.data.school.transaction.mapper.EduStudentApplyMapper;
|
||||
import com.yida.data.school.transaction.service.EduStudentApplyService;
|
||||
import com.yida.data.school.vo.transcation.StudentApplyImportErrorVO;
|
||||
import com.yida.data.school.vo.transcation.StudentApplyImportProgressVO;
|
||||
import com.yida.data.school.vo.transcation.StudentApplyImportVO;
|
||||
import com.yida.data.school.vo.transcation.StudentApplyStatusVO;
|
||||
import com.yida.data.user.dto.ListStudentDTO;
|
||||
import com.yida.data.user.dto.StudentErrorExportDTO;
|
||||
import com.yida.data.user.dto.WelcomeInviteImportDTO;
|
||||
import com.yida.data.user.feign.RemoteStudentService;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import org.springframework.util.StopWatch;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EduStudentApplyServiceImpl extends ServiceImpl<EduStudentApplyMapper, EduStudentApply> implements
|
||||
EduStudentApplyService {
|
||||
|
||||
private final CommonService commonService;
|
||||
|
||||
private final RedisService redisService;
|
||||
|
||||
private final RemoteStudentService remoteStudentService;
|
||||
|
||||
@Value("${febs.uploadUrl}")
|
||||
private String uploadUrl;
|
||||
|
||||
@Override
|
||||
public StudentApplyStatusVO getStudentApplyStatus(Long studentId, String applyCode) {
|
||||
StudentApplyStatusVO applyStatus = new StudentApplyStatusVO();
|
||||
List<EduStudentApply> list = list(Wrappers.lambdaQuery(new EduStudentApply()).eq(EduStudentApply::getStudentId,
|
||||
studentId)
|
||||
.eq(EduStudentApply::getApplyCode, applyCode)
|
||||
.ge(EduStudentApply::getEndTime, LocalDateTime.now())
|
||||
.le(EduStudentApply::getStartTime, LocalDateTime.now()));
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
List<EduStudentApply> applyList = baseMapper.getStudentApplyStatus(studentId, applyCode);
|
||||
if (CollUtil.isNotEmpty(applyList)) {
|
||||
applyStatus.setStatus(2);
|
||||
applyStatus.setDeadLine(applyList.get(0).getEndTime().toLocalDate().plusDays(1L));
|
||||
} else {
|
||||
applyStatus.setStatus(0);
|
||||
}
|
||||
} else {
|
||||
applyStatus.setStatus(1);
|
||||
}
|
||||
return applyStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<EduStudentApply> listStudentApply(String studentName, String studentNumber, Long schoolId, Long sectionId,
|
||||
Long campusId,
|
||||
Long gradeId, Long classId, Page<EduStudentApply> page) {
|
||||
IPage<EduStudentApply> eduStudentApplyIPage = this.baseMapper
|
||||
.listStudentApply(studentName, studentNumber, schoolId, sectionId, campusId, gradeId, classId, page);
|
||||
return eduStudentApplyIPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadTemplate(HttpServletResponse response) throws Exception {
|
||||
|
||||
String fileName = "学生开通应用导入模板.xls";
|
||||
// 获取导入文件模板
|
||||
ClassPathResource classPathResource = new ClassPathResource("template/" + fileName);
|
||||
InputStream inputStream = classPathResource.getInputStream();
|
||||
FileUtil.download(FileUtil.inputStreamToFile(inputStream), fileName, false, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importStudentApplyInfo(MultipartFile file, String redisKey) throws IOException {
|
||||
log.info("开始导入学生开通应用数据");
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
stopWatch.start();
|
||||
EasyExcel.read(file.getInputStream(), StudentApplyImportVO.class,
|
||||
new importStudentApplyListener(this, redisKey))
|
||||
.sheet(0).headRowNumber(1).doRead();
|
||||
stopWatch.stop();
|
||||
log.info("导入学生开通应用数据总共耗时: {}", stopWatch.getTotalTimeSeconds() + "秒");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertStudentApplyData(List<StudentApplyImportVO> studentApplyImportVOList, String redisKey) {
|
||||
StudentApplyImportProgressVO progressVO = new StudentApplyImportProgressVO();
|
||||
progressVO.setFinish(0);
|
||||
progressVO.setTotalNum(studentApplyImportVOList.size());
|
||||
progressVO.setCurrentNum(0);
|
||||
progressVO.setRedisKey(redisKey);
|
||||
redisService.hset(CachePrefixConstant.IMPORT_STUDENT_APPLY_PROGRESS, redisKey, progressVO);
|
||||
|
||||
List<StudentApplyImportErrorVO> errorVOList = new ArrayList<>();
|
||||
List<EduStudentApply> saveData = new ArrayList<>();
|
||||
Integer index = 1;
|
||||
|
||||
for (StudentApplyImportVO studentApplyImportVO : studentApplyImportVOList) {
|
||||
index++;
|
||||
String baseMag = "第" + index + "行,";
|
||||
StudentApplyImportErrorVO studentApplyImportErrorVO = checkImportDataIsNull(index, studentApplyImportVO);
|
||||
if (studentApplyImportErrorVO != null) {
|
||||
errorVOList.add(studentApplyImportErrorVO);
|
||||
continue;
|
||||
}
|
||||
Dept dept = commonService.getSchoolByName(studentApplyImportVO.getSchoolName());
|
||||
if (ObjectUtil.isNull(dept)) {
|
||||
StudentApplyImportErrorVO errorVO = new StudentApplyImportErrorVO();
|
||||
errorVO.setErrorMsg(baseMag + "学校名称不匹配");
|
||||
errorVOList.add(errorVO);
|
||||
continue;
|
||||
}
|
||||
// 根据学校ID、学号查询学生信息 检测学号与学生姓名是否匹配
|
||||
EduStudent student = new EduStudent();
|
||||
student.setSchoolId(dept.getDeptId());
|
||||
student.setStuNumber(studentApplyImportVO.getStudentNumber());
|
||||
List<EduStudent> currentStudentList = remoteStudentService.listBaseStudentNoJoin(student).getData();
|
||||
if (CollUtil.isEmpty(currentStudentList)) {
|
||||
StudentApplyImportErrorVO errorVO = new StudentApplyImportErrorVO();
|
||||
errorVO.setErrorMsg(baseMag + "学生学号有误");
|
||||
errorVOList.add(errorVO);
|
||||
continue;
|
||||
}
|
||||
if (!ObjectUtil.equal(studentApplyImportVO.getStudentName(), currentStudentList.get(0).getStuName())) {
|
||||
StudentApplyImportErrorVO errorVO = new StudentApplyImportErrorVO();
|
||||
errorVO.setErrorMsg(baseMag + "学生姓名与学号不匹配");
|
||||
errorVOList.add(errorVO);
|
||||
continue;
|
||||
}
|
||||
EduStudentApply eduStudentApply = new EduStudentApply();
|
||||
eduStudentApply.setStudentId(currentStudentList.get(0).getId());
|
||||
eduStudentApply.setApplyCode(studentApplyImportVO.getApplyCode());
|
||||
eduStudentApply
|
||||
.setStartTime(LocalDateTimeUtil
|
||||
.parse(studentApplyImportVO.getStartTime() + " 00:00:00", "yyyy-MM-dd HH:mm:ss"));
|
||||
eduStudentApply
|
||||
.setEndTime(LocalDateTimeUtil
|
||||
.parse(studentApplyImportVO.getEndTime() + " 00:00:00", "yyyy-MM-dd HH:mm:ss"));
|
||||
saveData.add(eduStudentApply);
|
||||
|
||||
progressVO.setCurrentNum(index - 1);
|
||||
redisService.hset(CachePrefixConstant.IMPORT_STUDENT_APPLY_PROGRESS, redisKey, progressVO);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(saveData)) {
|
||||
super.saveBatch(saveData);
|
||||
}
|
||||
|
||||
productErrorExcel(errorVOList, progressVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StudentApplyImportProgressVO getImportStudentApplyInfoProgress(String redisKey) {
|
||||
return (StudentApplyImportProgressVO) redisService
|
||||
.hget(CachePrefixConstant.IMPORT_STUDENT_APPLY_PROGRESS, redisKey);
|
||||
}
|
||||
|
||||
|
||||
public void productErrorExcel(List<StudentApplyImportErrorVO> errorVOList, StudentApplyImportProgressVO progressVO) {
|
||||
// 错误信息文件名称
|
||||
if (CollUtil.isNotEmpty(errorVOList)) {
|
||||
String fileName = FileUtil.getLocalUploadAddress() + UUID.randomUUID().toString() + ".xlsx";
|
||||
EasyExcel.write(fileName, StudentApplyImportErrorVO.class)
|
||||
.sheet("错误信息")
|
||||
.doWrite(errorVOList);
|
||||
// 上传到媒资
|
||||
String url = FileUtil.uploadFileToMediaServer(uploadUrl, new File(fileName));
|
||||
progressVO.setErrorPageUrl(url);
|
||||
}
|
||||
progressVO.setFinish(1);
|
||||
redisService.hset(CachePrefixConstant.IMPORT_STUDENT_APPLY_PROGRESS, progressVO.getRedisKey(), progressVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测插入数据是否为空
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public StudentApplyImportErrorVO checkImportDataIsNull(Integer index, StudentApplyImportVO studentApplyImportVO) {
|
||||
StudentApplyImportErrorVO studentApplyImportErrorVO = null;
|
||||
String baseMag = "第" + index + "行,";
|
||||
if (ObjectUtil.isNull(studentApplyImportVO.getSchoolName())) {
|
||||
studentApplyImportErrorVO = new StudentApplyImportErrorVO();
|
||||
studentApplyImportErrorVO.setErrorMsg(baseMag + "学校名称为空");
|
||||
}
|
||||
if (ObjectUtil.isNull(studentApplyImportVO.getStudentName())) {
|
||||
studentApplyImportErrorVO = new StudentApplyImportErrorVO();
|
||||
studentApplyImportErrorVO.setErrorMsg(baseMag + "学生姓名为空");
|
||||
}
|
||||
if (ObjectUtil.isNull(studentApplyImportVO.getStudentNumber())) {
|
||||
studentApplyImportErrorVO = new StudentApplyImportErrorVO();
|
||||
studentApplyImportErrorVO.setErrorMsg(baseMag + "学生学号为空");
|
||||
}
|
||||
if (ObjectUtil.isNull(studentApplyImportVO.getApplyCode())) {
|
||||
studentApplyImportErrorVO = new StudentApplyImportErrorVO();
|
||||
studentApplyImportErrorVO.setErrorMsg(baseMag + "开通应用为空");
|
||||
}
|
||||
if (ObjectUtil.isNull(studentApplyImportVO.getStartTime())) {
|
||||
studentApplyImportErrorVO = new StudentApplyImportErrorVO();
|
||||
studentApplyImportErrorVO.setErrorMsg(baseMag + "有效开始时间为空");
|
||||
}
|
||||
if (ObjectUtil.isNull(studentApplyImportVO.getStartTime())) {
|
||||
studentApplyImportErrorVO = new StudentApplyImportErrorVO();
|
||||
studentApplyImportErrorVO.setErrorMsg(baseMag + "有效结束时间为空");
|
||||
}
|
||||
return studentApplyImportErrorVO;
|
||||
}
|
||||
}
|
||||
+42
-42
@@ -1,42 +1,42 @@
|
||||
package com.yida.data.school.visitor.configure;
|
||||
|
||||
import com.rabbitmq.client.Channel;
|
||||
import com.yida.data.common.core.entity.WxPublicQr;
|
||||
import com.yida.data.rabbit.constant.RabbitConstant;
|
||||
import com.yida.data.school.visitor.service.EduVisitorRecordService;
|
||||
import java.io.IOException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class VisitorRabbitReceiver {
|
||||
|
||||
private final EduVisitorRecordService eduVisitorRecordService;
|
||||
|
||||
/**
|
||||
* 访客扫描邀请码
|
||||
*/
|
||||
@RabbitListener(bindings = @QueueBinding(
|
||||
value = @Queue(RabbitConstant.VISITOR_INVITE_CODE_QUEUE),
|
||||
exchange = @Exchange(RabbitConstant.WXPUBLIC_QR_EXCHANGE)
|
||||
))
|
||||
public void visitorScanInviteCode(WxPublicQr wxPublicQr, Channel channel, Message message) throws IOException {
|
||||
boolean success = true;
|
||||
try {
|
||||
eduVisitorRecordService.scanInviteCodeCall(wxPublicQr);
|
||||
} catch (Exception e) {
|
||||
success = false;
|
||||
log.error("消费消息失败", e);
|
||||
} finally {
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), success);
|
||||
}
|
||||
}
|
||||
}
|
||||
//package com.yida.data.school.visitor.configure;
|
||||
//
|
||||
//import com.rabbitmq.client.Channel;
|
||||
//import com.yida.data.common.core.entity.WxPublicQr;
|
||||
//import com.yida.data.rabbit.constant.RabbitConstant;
|
||||
//import com.yida.data.school.visitor.service.EduVisitorRecordService;
|
||||
//import java.io.IOException;
|
||||
//import lombok.RequiredArgsConstructor;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.amqp.core.Message;
|
||||
//import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
//import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
//import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//@Slf4j
|
||||
//@Component
|
||||
//@RequiredArgsConstructor
|
||||
//public class VisitorRabbitReceiver {
|
||||
//
|
||||
// private final EduVisitorRecordService eduVisitorRecordService;
|
||||
//
|
||||
// /**
|
||||
// * 访客扫描邀请码
|
||||
// */
|
||||
// @RabbitListener(bindings = @QueueBinding(
|
||||
// value = @Queue(RabbitConstant.VISITOR_INVITE_CODE_QUEUE),
|
||||
// exchange = @Exchange(RabbitConstant.WXPUBLIC_QR_EXCHANGE)
|
||||
// ))
|
||||
// public void visitorScanInviteCode(WxPublicQr wxPublicQr, Channel channel, Message message) throws IOException {
|
||||
// boolean success = true;
|
||||
// try {
|
||||
// eduVisitorRecordService.scanInviteCodeCall(wxPublicQr);
|
||||
// } catch (Exception e) {
|
||||
// success = false;
|
||||
// log.error("消费消息失败", e);
|
||||
// } finally {
|
||||
// channel.basicAck(message.getMessageProperties().getDeliveryTag(), success);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.yida.data.school.transaction.mapper.EduStudentApplyMapper">
|
||||
<select id="getStudentApplyStatus"
|
||||
resultType="com.yida.data.common.core.entity.apply.EduStudentApply">
|
||||
select *
|
||||
from edu_student_apply
|
||||
where student_id = #{studentId}
|
||||
and apply_code = #{applyCode}
|
||||
order by end_time desc
|
||||
</select>
|
||||
<select id="listStudentApply" resultType="com.yida.data.common.core.entity.apply.EduStudentApply">
|
||||
SELECT esa.*,
|
||||
CONCAT(
|
||||
school.DEPT_NAME,
|
||||
'/',
|
||||
section.DEPT_NAME,
|
||||
'/',
|
||||
campus.DEPT_NAME,
|
||||
'/',
|
||||
grade.DEPT_NAME,
|
||||
'/',
|
||||
class.DEPT_NAME
|
||||
) deptName,es.stu_name studentName
|
||||
from edu_student_apply esa
|
||||
LEFT JOIN edu_student es ON esa.student_id = es.id
|
||||
LEFT JOIN t_dept school ON es.school_id = school.DEPT_ID
|
||||
LEFT JOIN edu_user_dept section ON es.section_id = section.DEPT_ID
|
||||
LEFT JOIN edu_user_dept campus ON es.campus_id = campus.DEPT_ID
|
||||
LEFT JOIN edu_user_dept grade ON es.grade_id = grade.DEPT_ID
|
||||
LEFT JOIN edu_user_dept class ON es.class_id = class.DEPT_ID
|
||||
WHERE esa.del_flag = 0
|
||||
<if test="studentName!=null and studentName!=''">
|
||||
and es.stu_name LIKE CONCAT('%',#{studentName},'%')
|
||||
</if>
|
||||
<if test="studentNumber!=null and studentNumber!=''">
|
||||
and es.stu_number LIKE CONCAT('%',#{studentNumber},'%')
|
||||
</if>
|
||||
<if test="schoolId!=null">
|
||||
and es.school_id LIKE CONCAT('%',#{schoolId},'%')
|
||||
</if>
|
||||
<if test="sectionId!=null">
|
||||
and es.section_id LIKE CONCAT('%',#{sectionId},'%')
|
||||
</if>
|
||||
<if test="campusId!=null">
|
||||
and es.campus_id LIKE CONCAT('%',#{campusId},'%')
|
||||
</if>
|
||||
<if test="gradeId!=null">
|
||||
and es.grade_id LIKE CONCAT('%',#{gradeId},'%')
|
||||
</if>
|
||||
<if test="classId!=null">
|
||||
and es.class_id LIKE CONCAT('%',#{classId},'%')
|
||||
</if>
|
||||
order by create_date desc
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user