Browse Source

调整配置项目,删除创建错误的类

training
pref_mail@163.com 2 years ago
parent
commit
c4007fd2c3
  1. 2
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageEntity.java
  2. 43
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/OpPushPackageSystemEntity.java
  3. 10
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpPushPackageSystemMapper.java
  4. 8
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpPushPackageSystemMapper.xml
  5. 53
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpOldReceivingDataHandler.java
  6. 4
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpReceivingDataHandler.java
  7. 8
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOpPushPackageSystemService.java
  8. 11
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OpPushPackageSystemService.java
  9. 3
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java
  10. 33
      blade-service/logpm-factory/src/main/java/com/logpm/factory/props/OldSystemProperties.java
  11. 46
      blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java

2
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageEntity.java

@ -98,6 +98,8 @@ public class FactoryPackageEntity extends BaseEntity {
/** 推送状态 1推送 0未推送 */
@ApiModelProperty(name = "推送状态 1推送 0未推送",notes = "")
private Integer pushStatus ;
@ApiModelProperty(name = "老系统推送状态 1推送 0未推送 2 推送失败",notes = "")
private Integer oldPushStatus;
/** 转发状态 1转送 0未转送 */
@ApiModelProperty(name = "转发状态 1转送 0未转送 2 转送失败",notes = "")
private Integer turnStatus ;

43
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/OpPushPackageSystemEntity.java

@ -1,43 +0,0 @@
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 ;
}

10
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpPushPackageSystemMapper.java

@ -1,10 +0,0 @@
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> {
}

8
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpPushPackageSystemMapper.xml

@ -1,8 +0,0 @@
<?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>

53
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpOldReceivingDataHandler.java

@ -3,12 +3,14 @@ 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.conditions.query.QueryWrapper;
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.oupai.entity.FactoryPackageEntity;
import com.logpm.factory.oupai.service.IFactoryPackageService;
import com.logpm.factory.pan.service.IPanFactoryDataService;
import com.logpm.factory.props.OldSystemProperties;
import com.logpm.oldproject.entity.WarehouseEntity;
import com.logpm.oldproject.feign.IWarehouseClient;
import com.rabbitmq.client.Channel;
@ -44,7 +46,10 @@ public class OpOldReceivingDataHandler {
@Autowired
private IWarehouseClient warehouseClient;
@Autowired
private IOpPushPackageSystemService opPushPackageSystemService;
private OldSystemProperties oldSystemProperties;
@Autowired
private IFactoryPackageService factoryPackageService;
@RabbitHandler
public void opOldReceivingDataHandler(Map map, Message message, Channel channel) throws IOException {
@ -55,11 +60,16 @@ public class OpOldReceivingDataHandler {
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);
QueryWrapper warehouseQueryWrapper = new QueryWrapper();
warehouseQueryWrapper.eq("code", orderPackageCode);
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 查询包件数据 start >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
FactoryPackageEntity packageEntity = factoryPackageService.getOne(warehouseQueryWrapper);
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 查询包件数据 end >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> packageEntity {}", packageEntity);
//真正的处理需要的数据
try {
// 保存数据
@ -69,15 +79,15 @@ public class OpOldReceivingDataHandler {
WarehouseEntity warehouseEntity = warehouseClient.findByCode(warehouse.getAssociationCode());
// 请求老系统的登录接口
String authCode = oldLogin("账号", "密码", warehouseEntity.getId());
String authCode = oldLogin(warehouseEntity.getId());
// 推送数据
if (StringUtil.isNotBlank(authCode)) {
boolean isSuccess = sendPackageData(authCode, orderPackageCode, warehouseName);
if (isSuccess) {
// 请求成功 修改推送数据的状态 修改未1
opPushPackageSystemEntity.setPushStatus(1);
packageEntity.setOldPushStatus(1);
} else {
opPushPackageSystemEntity.setPushStatus(2);
packageEntity.setOldPushStatus(2);
}
}
}
@ -86,11 +96,12 @@ public class OpOldReceivingDataHandler {
log.error("##################opReceivingDataHandler: 处理欧派收货数据到新系统,orderPackageCode:{},warehouseName{}",
orderPackageCode, warehouseName);
log.error(e.getMessage());
opPushPackageSystemEntity.setPushStatus(2);
packageEntity.setOldPushStatus(2);
// opPushPackageSystemEntity.setPushStatus(2);
}
factoryPackageService.updateById(packageEntity);
opPushPackageSystemService.updateById(opPushPackageSystemEntity);
}
private boolean sendPackageData(String authCode, String orderPackageCode, String warehouseName) {
@ -105,29 +116,33 @@ public class OpOldReceivingDataHandler {
map.put("origin", "按件入库");
return false;
}
/**
* 登录老系统
*
* @param name 账号
* @param pwd 密码
* @param warhouseId 仓库ID
* @return 成功token
*/
private String oldLogin(String name, String pwd, Integer warhouseId) {
private String oldLogin(Integer warhouseId) {
String url = "";
String body = HttpRequest.post(url).execute().body();
String url = oldSystemProperties.getUrl() + "api/fakeLogin";
Map<String, Object> map = new HashMap<>();
map.put("pwd", oldSystemProperties.getPwd());
map.put("user_id", oldSystemProperties.getUserId());
map.put("warehouse_id", warhouseId);
String body = HttpRequest.post(url).form(map).execute().body();
JSONObject authCode = JSON.parseObject(body);
if ("200".equals(authCode.getString("code"))) {
return authCode.getJSONObject("data").getString("token");
return authCode.getJSONObject("data").getJSONObject("token").getString("token");
}
return null;

4
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpReceivingDataHandler.java

@ -29,14 +29,14 @@ public class OpReceivingDataHandler {
private IPanFactoryDataService panFactoryDataService;
@RabbitHandler
public void opReceivingDataHandler(Map map, Message message, Channel channel) throws IOException {
public void opReceivingDataHandler(Map map, Message message, Channel channel) {
// 如果手动ACK,消息会被监听消费,但是消息在队列中依旧存在,如果 未配置 acknowledge-mode 默认是会在消费完毕后自动ACK掉
log.info("##################opReceivingDataHandler: 处理欧派收货数据到新系统");
String jsonStr = (String) map.get("messageData");
JSONObject object = JSONObject.parseObject(jsonStr);
String orderPackageCode = object.getString("orderPackageCode");
String receivingTime = object.getString("receivingTime");
//真正处理需要的数据
//真正处理需要的数据
try {
panFactoryDataService.handleDataToPlatform(orderPackageCode, receivingTime);

8
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOpPushPackageSystemService.java

@ -1,8 +0,0 @@
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> {
}

11
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OpPushPackageSystemService.java

@ -1,11 +0,0 @@
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 {
}

3
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java

@ -159,9 +159,6 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
}
JSONObject jo = new JSONObject();
jo.put("orderPackageCode",code);
jo.put("warehouse_name",warehouseName);

33
blade-service/logpm-factory/src/main/java/com/logpm/factory/props/OldSystemProperties.java

@ -0,0 +1,33 @@
package com.logpm.factory.props;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* FactoryProperties
*
* @author pref
*/
@Data
@ConfigurationProperties(prefix = "old")
@Component
public class OldSystemProperties {
/**
* 请求地址
*/
private String url;
/**
* 默认账号
*/
private String pwd;
/**
* 默认用户
*/
private String userId;
}

46
blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java

@ -1,5 +1,6 @@
package com.logpm.factory;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.alibaba.excel.EasyExcel;
@ -24,7 +25,9 @@ import com.logpm.factory.mt.service.IMtFactoryDataService;
import com.logpm.factory.mt.service.IMtFactoryOrderMainService;
import com.logpm.factory.mt.service.IMtPushDataService;
import com.logpm.factory.mt.service.impl.MtFactoryDataServiceImpl;
import com.logpm.factory.oupai.entity.FactoryPackageEntity;
import com.logpm.factory.oupai.entity.OpOrderStatusLogEntity;
import com.logpm.factory.oupai.service.IFactoryPackageService;
import com.logpm.factory.oupai.service.IOuPaiFactoryService;
import com.logpm.factory.pan.service.IPanFactoryDataService;
import com.logpm.factory.snm.vo.MTOrderPackageRelationVO;
@ -70,6 +73,9 @@ public class TestService {
@Autowired
private IPanFactoryDataService panFactoryDataService;
@Autowired
private IFactoryPackageService factoryPackageService;
@Autowired
private IOssClient ossClient;
@ -205,6 +211,46 @@ public class TestService {
}
@Test
public void test5(){
// String s = oldLogin("", 30);
// System.out.println(s);
QueryWrapper warehouseQueryWrapper = new QueryWrapper();
warehouseQueryWrapper.eq("code","P00842309083496137");
FactoryPackageEntity packageEntity = factoryPackageService.getOne(warehouseQueryWrapper);
System.out.println(packageEntity);
}
private String oldLogin(String name, Integer warhouseId) {
Map<String, Object> map = new HashMap<>();
map.put("pwd", "huitongys-2022");
map.put("user_id", 1080);
map.put("warehouse_id", warhouseId);
String url = "http://twms.version1.huitongys.com/api/fakeLogin";
String body = HttpRequest.post(url).form(map).
execute().body();
JSONObject authCode = JSON.parseObject(body);
if ("200".equals(authCode.getString("code"))) {
return authCode.getJSONObject("data").getJSONObject("token").getString("token");
}
return null;
}
@NotNull
private MultipartFile getMultipartFile(String logPath) throws FileNotFoundException {
File file = new File(logPath);

Loading…
Cancel
Save