8 changed files with 170 additions and 2 deletions
@ -0,0 +1,48 @@ |
|||||||
|
package com.logpm.factorydata.jinpai.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import org.springblade.core.mp.base.BaseEntity; |
||||||
|
|
||||||
|
/** |
||||||
|
* 金牌自定义回传 实体类 |
||||||
|
* |
||||||
|
* @author zhaoqiaobo |
||||||
|
* @create 2024-04-26 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@TableName("jp_custom_push") |
||||||
|
@ApiModel(value = "金牌自定义回传", description = "金牌自定义回传") |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class CustomPushEntity extends BaseEntity { |
||||||
|
|
||||||
|
@ApiModelProperty(name = "订单号", notes = "") |
||||||
|
private String orderCode; |
||||||
|
|
||||||
|
@ApiModelProperty(name = "节点 到站:1030100 入库:105040", notes = "") |
||||||
|
private String nodeCode; |
||||||
|
|
||||||
|
@ApiModelProperty(name = "包件码", notes = "") |
||||||
|
private String packageCode; |
||||||
|
|
||||||
|
@ApiModelProperty(name = "状态 1已发送 0未发送", notes = "") |
||||||
|
private Integer sendStatus; |
||||||
|
|
||||||
|
@ApiModelProperty(name = "内容", notes = "") |
||||||
|
private String content; |
||||||
|
|
||||||
|
@ApiModelProperty(name = "预留1", notes = "") |
||||||
|
private String reserve1; |
||||||
|
@ApiModelProperty(name = "预留2", notes = "") |
||||||
|
private String reserve2; |
||||||
|
@ApiModelProperty(name = "预留3", notes = "") |
||||||
|
private String reserve3; |
||||||
|
@ApiModelProperty(name = "预留4", notes = "") |
||||||
|
private String reserve4; |
||||||
|
@ApiModelProperty(name = "预留5", notes = "") |
||||||
|
private String reserve5; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,62 @@ |
|||||||
|
package com.logpm.factorydata.jinpai.job; |
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.logpm.factorydata.jinpai.entity.CustomPushEntity; |
||||||
|
import com.logpm.factorydata.jinpai.service.CustomPushService; |
||||||
|
import com.xxl.job.core.biz.model.ReturnT; |
||||||
|
import com.xxl.job.core.handler.annotation.XxlJob; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springblade.common.constant.factorydata.FactoryDataConstants; |
||||||
|
import org.springblade.common.enums.BooleanZeroOneEnums; |
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 自动回推金牌工厂 |
||||||
|
* |
||||||
|
* @author zhaoqiaobo |
||||||
|
* @create 2024-04-02 |
||||||
|
*/ |
||||||
|
@AllArgsConstructor |
||||||
|
@Component |
||||||
|
@Slf4j |
||||||
|
public class AuthPushJob { |
||||||
|
|
||||||
|
private final CustomPushService customPushService; |
||||||
|
private final RabbitTemplate rabbitTemplate; |
||||||
|
|
||||||
|
/** |
||||||
|
* 自定义回传工厂节点作业数据 |
||||||
|
* |
||||||
|
* @param param |
||||||
|
* @return |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
@XxlJob("customPushFactoryData") |
||||||
|
public ReturnT<String> customPushFactoryData(String param) throws Exception { |
||||||
|
// 查出数据,回推工厂
|
||||||
|
List<CustomPushEntity> list = customPushService.list(Wrappers.<CustomPushEntity>lambdaQuery() |
||||||
|
.select(CustomPushEntity::getId, CustomPushEntity::getContent) |
||||||
|
.eq(CustomPushEntity::getSendStatus, 0) |
||||||
|
.orderByAsc(CustomPushEntity::getNodeCode) |
||||||
|
.last("limit 1")); |
||||||
|
if (CollUtil.isNotEmpty(list)) { |
||||||
|
CustomPushEntity customPushEntity = list.get(0); |
||||||
|
if (StrUtil.isNotEmpty(customPushEntity.getContent())) { |
||||||
|
rabbitTemplate.convertAndSend(FactoryDataConstants.Mq.RoutingKeys.JP_NODE_DATA_PUSH, |
||||||
|
FactoryDataConstants.Mq.RoutingKeys.JP_NODE_DATA_PUSH, customPushEntity.getContent()); |
||||||
|
CustomPushEntity updateEntity = new CustomPushEntity(); |
||||||
|
updateEntity.setId(customPushEntity.getId()); |
||||||
|
updateEntity.setSendStatus(BooleanZeroOneEnums.YES.getCode()); |
||||||
|
customPushService.updateById(updateEntity); |
||||||
|
} |
||||||
|
} |
||||||
|
return ReturnT.SUCCESS; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package com.logpm.factorydata.jinpai.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.logpm.factorydata.jinpai.entity.CustomPushEntity; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* 金牌自定义回传 mapper |
||||||
|
* |
||||||
|
* @author zqb |
||||||
|
* @since 2024-03-26 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface CustomPushMapper extends BaseMapper<CustomPushEntity> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,5 @@ |
|||||||
|
<?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.logpm.factorydata.jinpai.mapper.CustomPushMapper"> |
||||||
|
|
||||||
|
</mapper> |
@ -0,0 +1,14 @@ |
|||||||
|
package com.logpm.factorydata.jinpai.service; |
||||||
|
|
||||||
|
import com.logpm.factorydata.jinpai.entity.CustomPushEntity; |
||||||
|
import org.springblade.core.mp.base.BaseService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 金牌自定义回传 服务类 |
||||||
|
* |
||||||
|
* @Author zqb |
||||||
|
* @Date 2024/4/26 |
||||||
|
**/ |
||||||
|
public interface CustomPushService extends BaseService<CustomPushEntity> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,22 @@ |
|||||||
|
package com.logpm.factorydata.jinpai.service.impl; |
||||||
|
|
||||||
|
import com.logpm.factorydata.jinpai.entity.CustomPushEntity; |
||||||
|
import com.logpm.factorydata.jinpai.mapper.CustomPushMapper; |
||||||
|
import com.logpm.factorydata.jinpai.service.CustomPushService; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
/** |
||||||
|
* 金牌自定义回传 业务实现类 |
||||||
|
* |
||||||
|
* @Author zqb |
||||||
|
* @Date 2024/4/26 |
||||||
|
**/ |
||||||
|
@Slf4j |
||||||
|
@Service |
||||||
|
@AllArgsConstructor |
||||||
|
public class CustomPushServiceImpl extends BaseServiceImpl<CustomPushMapper, CustomPushEntity> implements CustomPushService { |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue