追溯查询代码备份
parent
d588b27bb2
commit
8f18729614
@ -1,9 +1,9 @@
|
||||
package com.glxp.api.dao.trace;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.glxp.api.entity.trace.TraceRecordDetailEntity;
|
||||
import com.glxp.api.entity.trace.TraceProductDetailEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface TraceRecordDetailMapper extends BaseMapper<TraceRecordDetailEntity> {
|
||||
public interface TraceRecordDetailMapper extends BaseMapper<TraceProductDetailEntity> {
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
package com.glxp.api.service.trace;
|
||||
|
||||
import cn.hutool.core.lang.UUID;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.common.util.ResultVOUtils;
|
||||
import com.glxp.api.config.rabbit.TopicRabbitConfig;
|
||||
import com.glxp.api.entity.trace.MqTraceMessage;
|
||||
import com.glxp.api.util.DateUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RabbitPushService {
|
||||
|
||||
@Resource
|
||||
private final RabbitTemplate rabbitTemplate;
|
||||
|
||||
public BaseResponse send(MqTraceMessage mqTraceMessage) {
|
||||
rabbitTemplate.convertAndSend("topicExchange", TopicRabbitConfig.trace, mqTraceMessage);
|
||||
return ResultVOUtils.success("发送成功");
|
||||
}
|
||||
|
||||
public BaseResponse sendCommon(String key) {
|
||||
String messageId = String.valueOf(UUID.randomUUID());
|
||||
Map<String, Object> messageMap = new HashMap<>();
|
||||
messageMap.put("messageId", messageId);
|
||||
messageMap.put("messageData", key);
|
||||
messageMap.put("createTime", DateUtil.formatDate(new Date()));
|
||||
rabbitTemplate.convertAndSend("topicExchange", TopicRabbitConfig.common, messageMap);
|
||||
return ResultVOUtils.success("发送成功");
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.glxp.api.service.trace;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.glxp.api.dao.trace.TraceRecordDetailMapper;
|
||||
import com.glxp.api.entity.trace.TraceProductDetailEntity;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class TraceProductDetailService extends ServiceImpl<TraceRecordDetailMapper, TraceProductDetailEntity> {
|
||||
|
||||
@Resource
|
||||
TraceRecordDetailMapper traceRecordDetailMapper;
|
||||
|
||||
public TraceProductDetailEntity findUniqueByCode(Integer traceType, String udiCode) {
|
||||
List<TraceProductDetailEntity> traceRecordDetailEntities = traceRecordDetailMapper.selectList(new QueryWrapper<TraceProductDetailEntity>()
|
||||
.eq("traceType", traceType)
|
||||
.eq("udiCode", udiCode).last("limit 1"));
|
||||
if (CollUtil.isNotEmpty(traceRecordDetailEntities))
|
||||
return traceRecordDetailEntities.get(0);
|
||||
else return null;
|
||||
}
|
||||
|
||||
public TraceProductDetailEntity findUniqueByData(Integer traceType, String ylqxzcrbarmc, String cpmctymc, String ggxh, String nameCode, String batchNo) {
|
||||
List<TraceProductDetailEntity> traceRecordDetailEntities = traceRecordDetailMapper.selectList(new QueryWrapper<TraceProductDetailEntity>()
|
||||
.eq("traceType", traceType)
|
||||
.eq("ylqxzcrbarmc", ylqxzcrbarmc)
|
||||
.eq("cpmctymc", cpmctymc)
|
||||
.eq("ggxh", ggxh)
|
||||
.eq("nameCode", nameCode)
|
||||
.eq("batchNo", batchNo)
|
||||
.last("limit 1"));
|
||||
if (CollUtil.isNotEmpty(traceRecordDetailEntities))
|
||||
return traceRecordDetailEntities.get(0);
|
||||
else return null;
|
||||
}
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.glxp.api.service.trace;
|
||||
|
||||
import com.glxp.api.entity.trace.TraceRecordDetailEntity;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
public interface TraceRecordDetailService extends IService<TraceRecordDetailEntity>{
|
||||
|
||||
|
||||
}
|
@ -1,13 +1,35 @@
|
||||
package com.glxp.api.service.trace;
|
||||
|
||||
import com.glxp.api.entity.trace.TraceRecordEntity;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.api.req.trace.TraceRecordRequest;
|
||||
import com.glxp.api.res.trace.TraceRecordResponse;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.glxp.api.dao.trace.TraceRecordMapper;
|
||||
import com.glxp.api.entity.trace.TraceRecordLogEntity;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public interface TraceRecordService extends IService<TraceRecordEntity> {
|
||||
@Service
|
||||
public class TraceRecordService extends ServiceImpl<TraceRecordMapper, TraceRecordLogEntity> {
|
||||
|
||||
|
||||
@Resource
|
||||
TraceRecordMapper traceRecordMapper;
|
||||
|
||||
public List<TraceRecordResponse> filterTraces(TraceRecordRequest traceRecordRequest) {
|
||||
if (traceRecordRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (traceRecordRequest.getPage() != null) {
|
||||
int offset = (traceRecordRequest.getPage() - 1) * traceRecordRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, traceRecordRequest.getLimit());
|
||||
}
|
||||
return traceRecordMapper.filterTraces(traceRecordRequest);
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<TraceRecordResponse> filterTraces(TraceRecordRequest traceRecordRequest);
|
||||
}
|
||||
|
@ -1,12 +0,0 @@
|
||||
package com.glxp.api.service.trace.impl;
|
||||
|
||||
import com.glxp.api.service.trace.TraceRecordDetailService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.glxp.api.dao.trace.TraceRecordDetailMapper;
|
||||
import com.glxp.api.entity.trace.TraceRecordDetailEntity;
|
||||
|
||||
@Service
|
||||
public class TraceRecordDetailServiceImpl extends ServiceImpl<TraceRecordDetailMapper, TraceRecordDetailEntity> implements TraceRecordDetailService {
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package com.glxp.api.service.trace.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.api.req.trace.TraceRecordRequest;
|
||||
import com.glxp.api.res.trace.TraceRecordResponse;
|
||||
import com.glxp.api.service.trace.TraceRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.glxp.api.dao.trace.TraceRecordMapper;
|
||||
import com.glxp.api.entity.trace.TraceRecordEntity;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class TraceRecordServiceImpl extends ServiceImpl<TraceRecordMapper, TraceRecordEntity> implements TraceRecordService {
|
||||
|
||||
|
||||
@Resource
|
||||
TraceRecordMapper traceRecordMapper;
|
||||
|
||||
@Override
|
||||
public List<TraceRecordResponse> filterTraces(TraceRecordRequest traceRecordRequest) {
|
||||
if (traceRecordRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (traceRecordRequest.getPage() != null) {
|
||||
int offset = (traceRecordRequest.getPage() - 1) * traceRecordRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, traceRecordRequest.getLimit());
|
||||
}
|
||||
return traceRecordMapper.filterTraces(traceRecordRequest);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue