pref_mail@163.com
1 year ago
22 changed files with 553 additions and 31 deletions
@ -0,0 +1,47 @@
|
||||
package com.logpm.basicdata.entity; |
||||
|
||||
import cn.hutool.db.meta.Table; |
||||
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.tenant.mp.TenantEntity; |
||||
@Data |
||||
@TableName("logpm_basicdata_tripartite_warehouse") |
||||
@ApiModel(value = "三方仓库", description = "三方仓库") |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class BasicdataTripartiteWarehouseEntity extends TenantEntity { |
||||
|
||||
/** 预留1 */ |
||||
@ApiModelProperty(name = "预留1",notes = "") |
||||
private String reserve1 ; |
||||
/** 预留2 */ |
||||
@ApiModelProperty(name = "预留2",notes = "") |
||||
private String reserve2 ; |
||||
/** 预留3 */ |
||||
@ApiModelProperty(name = "预留3",notes = "") |
||||
private String reserve3 ; |
||||
/** 预留4 */ |
||||
@ApiModelProperty(name = "预留4",notes = "") |
||||
private String reserve4 ; |
||||
/** 预留5 */ |
||||
@ApiModelProperty(name = "预留5",notes = "") |
||||
private String reserve5 ; |
||||
/** 三方仓库编码 */ |
||||
@ApiModelProperty(name = "三方仓库编码",notes = "") |
||||
private String warehouseCode ; |
||||
/** 三方仓库名称 */ |
||||
@ApiModelProperty(name = "三方仓库名称",notes = "") |
||||
private String warehouseName ; |
||||
/** 关联仓库编码 */ |
||||
@ApiModelProperty(name = "关联仓库编码",notes = "") |
||||
private String associationCode ; |
||||
/** 地址 */ |
||||
@ApiModelProperty(name = "地址",notes = "") |
||||
private String address ; |
||||
/** 品牌 */ |
||||
@ApiModelProperty(name = "品牌",notes = "") |
||||
private String brand ; |
||||
|
||||
} |
@ -0,0 +1,59 @@
|
||||
/* |
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are met: |
||||
* |
||||
* Redistributions of source code must retain the above copyright notice, |
||||
* this list of conditions and the following disclaimer. |
||||
* Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* Neither the name of the dreamlu.net developer nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* Author: Chill 庄骞 (smallchill@163.com) |
||||
*/ |
||||
package com.logpm.basicdata.feign; |
||||
|
||||
|
||||
import com.logpm.basicdata.entity.BasicdataTripartiteWarehouseEntity; |
||||
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; |
||||
import org.springblade.common.constant.ModuleNameConstant; |
||||
import org.springblade.core.mp.support.BladePage; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springframework.cloud.openfeign.FeignClient; |
||||
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.RequestParam; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 三方 |
||||
* |
||||
* @author pref |
||||
* @since 2023-09-25 |
||||
*/ |
||||
@FeignClient( |
||||
value = ModuleNameConstant.APPLICATION_BASICDATA_NAME |
||||
) |
||||
public interface IBasicdataTripartiteWarehouseClient { |
||||
|
||||
String API_PREFIX = "tripartiteWarehouse/client"; |
||||
String GETWAREHOUSE = API_PREFIX + "/warehouse"; |
||||
|
||||
|
||||
/** |
||||
* 通过三方仓库名称 查询 汇通仓库的编码 |
||||
* @param warehouseName 三方仓库名称 |
||||
* @param warehouseCode 三方仓库编码 |
||||
* @return BasicdataTripartiteWarehouseEntity |
||||
*/ |
||||
@GetMapping(GETWAREHOUSE) |
||||
BasicdataTripartiteWarehouseEntity getWarehouse(@RequestParam("warehouseName") String warehouseName, @RequestParam("warehouseCode") String warehouseCode); |
||||
|
||||
|
||||
} |
||||
|
@ -0,0 +1,43 @@
|
||||
package com.logpm.factory.oupai.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; |
||||
@Data |
||||
@TableName("op_push_package_system") |
||||
@ApiModel(value = "欧派包件推送老系统", description = "欧派包件推送老系统") |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class OpPushPackageSystemEntity extends BaseEntity { |
||||
|
||||
/** 预留1 */ |
||||
@ApiModelProperty(name = "预留1",notes = "") |
||||
private String reserve1 ; |
||||
/** 预留2 */ |
||||
@ApiModelProperty(name = "预留2",notes = "") |
||||
private String reserve2 ; |
||||
/** 预留3 */ |
||||
@ApiModelProperty(name = "预留3",notes = "") |
||||
private String reserve3 ; |
||||
/** 预留4 */ |
||||
@ApiModelProperty(name = "预留4",notes = "") |
||||
private String reserve4 ; |
||||
/** 预留5 */ |
||||
@ApiModelProperty(name = "预留5",notes = "") |
||||
private String reserve5 ; |
||||
/** 包条码 */ |
||||
@ApiModelProperty(name = "包条码",notes = "") |
||||
private String code ; |
||||
/** 仓库名称 */ |
||||
@ApiModelProperty(name = "仓库名称",notes = "") |
||||
private String warehouseName ; |
||||
/** 仓库编码 */ |
||||
@ApiModelProperty(name = "仓库编码",notes = "") |
||||
private String warehouseCode ; |
||||
/** 推送状态 0 未推送 1 已推送 */ |
||||
@ApiModelProperty(name = "推送状态 0 未推送 1 已推送",notes = "") |
||||
private Integer pushStatus ; |
||||
|
||||
} |
@ -0,0 +1,31 @@
|
||||
package com.logpm.basicdata.feign; |
||||
|
||||
import com.logpm.basicdata.entity.BasicdataTripartiteWarehouseEntity; |
||||
import com.logpm.basicdata.service.IBasicdataTripartiteWarehouseService; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
import springfox.documentation.annotations.ApiIgnore; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 三方仓库查询 |
||||
*/ |
||||
@ApiIgnore() |
||||
@RestController |
||||
@AllArgsConstructor |
||||
public class BasicdataTripartiteWarehouseClient implements IBasicdataTripartiteWarehouseClient { |
||||
|
||||
private final IBasicdataTripartiteWarehouseService basicdataTripartiteWarehouseService; |
||||
|
||||
@Override |
||||
public BasicdataTripartiteWarehouseEntity getWarehouse(String warehouseName, String warehouseCode) { |
||||
|
||||
// 暂时 先用名称进行匹配
|
||||
List<BasicdataTripartiteWarehouseEntity> list = basicdataTripartiteWarehouseService.lambdaQuery().eq(BasicdataTripartiteWarehouseEntity::getWarehouseName, warehouseName).list(); |
||||
if (list.isEmpty()) { |
||||
return null; |
||||
} |
||||
return list.get(0); |
||||
} |
||||
} |
@ -0,0 +1,10 @@
|
||||
package com.logpm.basicdata.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.logpm.basicdata.entity.BasicdataTripartiteMallEntity; |
||||
import com.logpm.basicdata.entity.BasicdataTripartiteWarehouseEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
@Mapper |
||||
public interface BasicdataTripartiteWarehouseMapper extends BaseMapper<BasicdataTripartiteWarehouseEntity> { |
||||
} |
@ -0,0 +1,7 @@
|
||||
<?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.basicdata.mapper.BasicdataTripartiteWarehouseMapper"> |
||||
|
||||
|
||||
|
||||
</mapper> |
@ -0,0 +1,40 @@
|
||||
/* |
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are met: |
||||
* |
||||
* Redistributions of source code must retain the above copyright notice, |
||||
* this list of conditions and the following disclaimer. |
||||
* Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* Neither the name of the dreamlu.net developer nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* Author: Chill 庄骞 (smallchill@163.com) |
||||
*/ |
||||
package com.logpm.basicdata.service; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.logpm.basicdata.entity.BasicdataTripartiteWarehouseEntity; |
||||
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; |
||||
import com.logpm.basicdata.excel.BasicdataWarehouseExcel; |
||||
import com.logpm.basicdata.vo.BasicdataWarehouseVO; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.core.tool.api.R; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 三方仓库服务类 |
||||
* |
||||
* @author pref |
||||
* @since 2023-09-25 |
||||
*/ |
||||
public interface IBasicdataTripartiteWarehouseService extends BaseService<BasicdataTripartiteWarehouseEntity> { |
||||
|
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.logpm.basicdata.service.impl; |
||||
|
||||
import com.logpm.basicdata.entity.BasicdataTripartiteWarehouseEntity; |
||||
import com.logpm.basicdata.mapper.BasicdataTripartiteWarehouseMapper; |
||||
import com.logpm.basicdata.service.IBasicdataTripartiteWarehouseService; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@Service |
||||
@AllArgsConstructor |
||||
public class BasicdataTripartiteWarehouseServiceImpl extends BaseServiceImpl<BasicdataTripartiteWarehouseMapper, BasicdataTripartiteWarehouseEntity> implements IBasicdataTripartiteWarehouseService { |
||||
} |
@ -0,0 +1,10 @@
|
||||
package com.logpm.factory.oupai.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.logpm.factory.oupai.entity.FactoryLogEntity; |
||||
import com.logpm.factory.oupai.entity.OpPushPackageSystemEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
@Mapper |
||||
public interface OpPushPackageSystemMapper extends BaseMapper<OpPushPackageSystemEntity> { |
||||
} |
@ -0,0 +1,8 @@
|
||||
<?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.factory.oupai.mapper.OpPushPackageSystemMapper"> |
||||
|
||||
|
||||
|
||||
|
||||
</mapper> |
@ -0,0 +1,135 @@
|
||||
package com.logpm.factory.oupai.receiver; |
||||
|
||||
import cn.hutool.http.HttpRequest; |
||||
import com.alibaba.fastjson.JSON; |
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
||||
import com.logpm.basicdata.entity.BasicdataTripartiteWarehouseEntity; |
||||
import com.logpm.basicdata.feign.IBasicdataTripartiteWarehouseClient; |
||||
import com.logpm.factory.oupai.entity.OpPushPackageSystemEntity; |
||||
import com.logpm.factory.oupai.service.IOpPushPackageSystemService; |
||||
import com.logpm.factory.pan.service.IPanFactoryDataService; |
||||
import com.logpm.oldproject.entity.WarehouseEntity; |
||||
import com.logpm.oldproject.feign.IWarehouseClient; |
||||
import com.rabbitmq.client.Channel; |
||||
import jodd.util.StringUtil; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.common.constant.RabbitConstant; |
||||
import org.springframework.amqp.core.Message; |
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler; |
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.io.IOException; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
|
||||
/** |
||||
* 推送老系统 |
||||
* |
||||
* @author pref |
||||
*/ |
||||
@Slf4j |
||||
@RabbitListener(queues = RabbitConstant.OUPAI_OLD_RECEIVING_QUEUE) |
||||
@Component |
||||
public class OpOldReceivingDataHandler { |
||||
|
||||
@Autowired |
||||
private IPanFactoryDataService panFactoryDataService; |
||||
|
||||
@Autowired |
||||
private IBasicdataTripartiteWarehouseClient basicdataTripartiteWarehouseClient; |
||||
@Autowired |
||||
private IWarehouseClient warehouseClient; |
||||
@Autowired |
||||
private IOpPushPackageSystemService opPushPackageSystemService; |
||||
|
||||
@RabbitHandler |
||||
public void opOldReceivingDataHandler(Map map, Message message, Channel channel) throws IOException { |
||||
// 如果手动ACK,消息会被监听消费,但是消息在队列中依旧存在,如果 未配置 acknowledge-mode 默认是会在消费完毕后自动ACK掉
|
||||
log.info("##################opReceivingDataHandler: 处理欧派收货数据到新系统"); |
||||
String jsonStr = (String) map.get("messageData"); |
||||
JSONObject object = JSONObject.parseObject(jsonStr); |
||||
String orderPackageCode = object.getString("orderPackageCode"); |
||||
String warehouseName = object.getString("warehouse_name"); |
||||
|
||||
OpPushPackageSystemEntity opPushPackageSystemEntity = new OpPushPackageSystemEntity(); |
||||
opPushPackageSystemEntity.setWarehouseName(warehouseName); |
||||
opPushPackageSystemEntity.setCode(orderPackageCode); |
||||
opPushPackageSystemEntity.setPushStatus(0); |
||||
opPushPackageSystemService.save(opPushPackageSystemEntity); |
||||
//真正的处理需要的数据
|
||||
try { |
||||
// 保存数据
|
||||
// 需要查询映射表 如果映射表没有值 这个字段为null
|
||||
BasicdataTripartiteWarehouseEntity warehouse = basicdataTripartiteWarehouseClient.getWarehouse(warehouseName, null); |
||||
if (ObjectUtils.isNotNull(warehouse)) { |
||||
WarehouseEntity warehouseEntity = warehouseClient.findByCode(warehouse.getAssociationCode()); |
||||
// 请求老系统的登录接口
|
||||
|
||||
String authCode = oldLogin("账号", "密码", warehouseEntity.getId()); |
||||
// 推送数据
|
||||
if (StringUtil.isNotBlank(authCode)) { |
||||
boolean isSuccess = sendPackageData(authCode, orderPackageCode, warehouseName); |
||||
if (isSuccess) { |
||||
// 请求成功 修改推送数据的状态 修改未1
|
||||
opPushPackageSystemEntity.setPushStatus(1); |
||||
} else { |
||||
opPushPackageSystemEntity.setPushStatus(2); |
||||
} |
||||
} |
||||
} |
||||
|
||||
} catch (Exception e) { |
||||
log.error("##################opReceivingDataHandler: 处理欧派收货数据到新系统,orderPackageCode:{},warehouseName{}", |
||||
orderPackageCode, warehouseName); |
||||
log.error(e.getMessage()); |
||||
opPushPackageSystemEntity.setPushStatus(2); |
||||
|
||||
} |
||||
|
||||
opPushPackageSystemService.updateById(opPushPackageSystemEntity); |
||||
} |
||||
|
||||
private boolean sendPackageData(String authCode, String orderPackageCode, String warehouseName) { |
||||
// 构建请求头
|
||||
Map<String, Object> map = new HashMap<>(); |
||||
map.put("type", "1"); |
||||
map.put("unitNo", orderPackageCode); |
||||
map.put("mctsTruckNo", ""); |
||||
map.put("area", ""); |
||||
map.put("user_id", ""); |
||||
map.put("pick_up_id", ""); |
||||
map.put("origin", "按件入库"); |
||||
|
||||
|
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* 登录老系统 |
||||
* |
||||
* @param name 账号 |
||||
* @param pwd 密码 |
||||
* @param warhouseId 仓库ID |
||||
* @return 成功token |
||||
*/ |
||||
private String oldLogin(String name, String pwd, Integer warhouseId) { |
||||
|
||||
|
||||
String url = ""; |
||||
String body = HttpRequest.post(url).execute().body(); |
||||
|
||||
|
||||
JSONObject authCode = JSON.parseObject(body); |
||||
|
||||
if ("200".equals(authCode.getString("code"))) { |
||||
|
||||
return authCode.getJSONObject("data").getString("token"); |
||||
|
||||
} |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,8 @@
|
||||
package com.logpm.factory.oupai.service; |
||||
|
||||
import com.logpm.factory.oupai.entity.OpPushPackageSystemEntity; |
||||
import com.logpm.factory.oupai.entity.OpSignPackageEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
public interface IOpPushPackageSystemService extends BaseService<OpPushPackageSystemEntity> { |
||||
} |
@ -0,0 +1,11 @@
|
||||
package com.logpm.factory.oupai.service.impl; |
||||
|
||||
import com.logpm.factory.oupai.entity.OpOrderStatusLogEntity; |
||||
import com.logpm.factory.oupai.entity.OpPushPackageSystemEntity; |
||||
import com.logpm.factory.oupai.mapper.OpOrderStatusLogMapper; |
||||
import com.logpm.factory.oupai.mapper.OpPushPackageSystemMapper; |
||||
import com.logpm.factory.oupai.service.IOpPushPackageSystemService; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
|
||||
public class OpPushPackageSystemService extends BaseServiceImpl<OpPushPackageSystemMapper, OpPushPackageSystemEntity> implements IOpPushPackageSystemService { |
||||
} |
Loading…
Reference in new issue