22 changed files with 506 additions and 41 deletions
@ -0,0 +1,81 @@
|
||||
package com.logpm.factory.snm.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
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("mt_factory_order") |
||||
@ApiModel(value = "MtFactoryOrder对象", description = "梦天工厂订单") |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class MtFactoryOrder extends BaseEntity { |
||||
|
||||
@JsonProperty("总单编号") |
||||
@ApiModelProperty(value = "总单编号") |
||||
private String mainOrderCode; |
||||
|
||||
@JsonProperty("订单编号") |
||||
@ApiModelProperty(value = "订单编号") |
||||
private String orderCode; |
||||
|
||||
@JsonProperty("客户姓名") |
||||
@ApiModelProperty(value = "客户姓名") |
||||
private String customName; |
||||
|
||||
@JsonProperty("客户电话") |
||||
@ApiModelProperty(value = "客户电话") |
||||
private String customPhone; |
||||
|
||||
@JsonProperty("客户地址") |
||||
@ApiModelProperty(value = "客户地址") |
||||
private String customAddress; |
||||
|
||||
@JsonProperty("经销商编号") |
||||
@ApiModelProperty(value = "经销商编码") |
||||
private String dealerCode; |
||||
|
||||
@JsonProperty("经销商名称") |
||||
@ApiModelProperty(value = "经销商名称") |
||||
private String dealerName; |
||||
|
||||
@JsonProperty("专卖店编号") |
||||
@ApiModelProperty(value = "专卖店编号") |
||||
private String exclusiveCode; |
||||
|
||||
@JsonProperty("专卖店名称") |
||||
@ApiModelProperty(value = "专卖店名称") |
||||
private String exclusiveName; |
||||
|
||||
@JsonProperty("收货人") |
||||
@ApiModelProperty(value = "收货人") |
||||
private String consignee; |
||||
|
||||
@JsonProperty("收货人电话") |
||||
@ApiModelProperty(value = "收货人电话") |
||||
private String consigneePhone; |
||||
|
||||
@JsonProperty("收货地址") |
||||
@ApiModelProperty(value = "收货人地址") |
||||
private String consigneeAddress; |
||||
|
||||
@JsonProperty("出库方式") |
||||
@ApiModelProperty(value = "出库方式") |
||||
private String outboundType; |
||||
|
||||
@JsonProperty("品牌") |
||||
@ApiModelProperty(value = "品牌") |
||||
private String brand; |
||||
|
||||
@JsonProperty("生产单号") |
||||
@ApiModelProperty(value = "生产单号") |
||||
private String produceOrderCode; |
||||
|
||||
@JsonProperty("包件数") |
||||
@ApiModelProperty(value = "包件数") |
||||
private String quantity; |
||||
|
||||
} |
@ -0,0 +1,57 @@
|
||||
package com.logpm.factory.snm.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
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("mt_factory_order_main") |
||||
@ApiModel(value = "MtFactoryOrderMain对象", description = "梦天工厂订单主对象") |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class MtFactoryOrderMain extends BaseEntity { |
||||
|
||||
@JsonProperty("发货单编号") |
||||
@ApiModelProperty(value = "发货单编号") |
||||
private String invoiceOrderCode; |
||||
|
||||
@JsonProperty("中心仓编号") |
||||
@ApiModelProperty(value = "中心仓编号") |
||||
private String centerWarehouseCode; |
||||
|
||||
@JsonProperty("中心仓") |
||||
@ApiModelProperty(value = "中心仓") |
||||
private String centerWarehouseName; |
||||
|
||||
@JsonProperty("仓库类型") |
||||
@ApiModelProperty(value = "仓库类型") |
||||
private String warehouseType; |
||||
|
||||
@JsonProperty("送货车号") |
||||
@ApiModelProperty(value = "送货车号") |
||||
private String sendCarNumber; |
||||
|
||||
@JsonProperty("送货司机") |
||||
@ApiModelProperty(value = "送货车司机") |
||||
private String sendCarDriver; |
||||
|
||||
@JsonProperty("送货司机电话") |
||||
@ApiModelProperty(value = "送货车司机电话") |
||||
private String sendCarDriverPhone; |
||||
|
||||
@JsonProperty("确认发车人") |
||||
@ApiModelProperty(value = "确认发车人") |
||||
private String reallyMan; |
||||
|
||||
@JsonProperty("确认发车时间") |
||||
@ApiModelProperty(value = "确认发车时间") |
||||
private String reallyDate; |
||||
|
||||
@JsonProperty("备注") |
||||
@ApiModelProperty(value = "备注") |
||||
private String remark; |
||||
|
||||
} |
@ -0,0 +1,54 @@
|
||||
package com.logpm.factory.snm.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
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("mt_package_info") |
||||
@ApiModel(value = "MtPackageInfo对象", description = "梦天工厂包件信息") |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class MtPackageInfo extends BaseEntity { |
||||
|
||||
|
||||
@JsonProperty("出库人") |
||||
@ApiModelProperty(value = "出库人") |
||||
private String outboundMan; |
||||
|
||||
@JsonProperty("出库时间") |
||||
@ApiModelProperty(value = "出库时间") |
||||
private String outboundDate; |
||||
|
||||
@JsonProperty("包装编号") |
||||
@ApiModelProperty(value = "包装编号") |
||||
private String packageCode; |
||||
|
||||
@JsonProperty("包装类型") |
||||
@ApiModelProperty(value = "包装类型") |
||||
private String packageType; |
||||
|
||||
@JsonProperty("大类") |
||||
@ApiModelProperty(value = "大类") |
||||
private String bigType; |
||||
|
||||
@JsonProperty("小类") |
||||
@ApiModelProperty(value = "小类") |
||||
private String smallType; |
||||
|
||||
@JsonProperty("油漆颜色") |
||||
@ApiModelProperty(value = "油漆颜色") |
||||
private String color; |
||||
|
||||
@JsonProperty("型号") |
||||
@ApiModelProperty(value = "型号") |
||||
private String model; |
||||
|
||||
@JsonProperty("门扇尺寸") |
||||
@ApiModelProperty(value = "尺寸") |
||||
private String size; |
||||
|
||||
} |
@ -0,0 +1,124 @@
|
||||
/* |
||||
* 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.factory.mt.controller; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import com.logpm.factory.mt.dto.MtFactoryDataDTO; |
||||
import com.logpm.factory.snm.bean.Resp; |
||||
import com.logpm.factory.snm.entity.OrderStatusLog; |
||||
import com.logpm.factory.snm.service.IMtFactoryDataService; |
||||
import com.logpm.factory.snm.service.IOrderStatusLogService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.log4j.Log4j2; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springframework.validation.annotation.Validated; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
|
||||
/** |
||||
* 梦天数据 控制器 |
||||
* |
||||
* @author zhy |
||||
* @since 2023-06-06 |
||||
*/ |
||||
@Log4j2 |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/factory/mt") |
||||
@Api(value = "工厂数据", tags = "工厂数据接口") |
||||
public class MtFactoryDataController extends BladeController { |
||||
|
||||
private final IOrderStatusLogService orderStatusLogService; |
||||
private final IMtFactoryDataService mtFactoryDataService; |
||||
|
||||
/** |
||||
* 工厂数据推送接口 |
||||
*/ |
||||
@ResponseBody |
||||
@PostMapping("/data") |
||||
@ApiOperationSupport(order = 1) |
||||
@ApiOperation(value = "通常数据推送", notes = "传入factoryOrderDTO") |
||||
public R data(@Validated @RequestBody MtFactoryDataDTO mtFactoryDataDTO, HttpServletRequest request) { |
||||
log.info("############data: "); |
||||
String corpId = request.getHeader("corpId"); |
||||
|
||||
//先保存原始请求数据
|
||||
OrderStatusLog orderStatusLog = new OrderStatusLog(); |
||||
orderStatusLog.setArgs(JSONObject.toJSONString(mtFactoryDataDTO)); |
||||
orderStatusLog.setStatus(1); |
||||
orderStatusLog.setType(3); |
||||
orderStatusLog.setBrand("梦天"); |
||||
orderStatusLogService.save(orderStatusLog); |
||||
|
||||
//数据存入数据库
|
||||
boolean flag = mtFactoryDataService.dealWithData(mtFactoryDataDTO); |
||||
|
||||
|
||||
// //判断数据是否已存入
|
||||
// String orderNo = factoryOrderDTO.getOrderNo();
|
||||
// QueryWrapper<PanFactoryOrder> queryWrapper = new QueryWrapper<>();
|
||||
// queryWrapper.eq("order_no",orderNo);
|
||||
// PanFactoryOrder one = factoryOrderService.getOne(queryWrapper);
|
||||
// if(!Objects.isNull(one)){
|
||||
// log.warn("############data: 订单数据已存在 orderNo={}",orderNo);
|
||||
// return Resp.fail(400,"订单数据已存在");
|
||||
// }
|
||||
//
|
||||
// PanFactoryOrder factoryOrder = new PanFactoryOrder();
|
||||
// BeanUtil.copyProperties(factoryOrderDTO,factoryOrder);
|
||||
// factoryOrder.setCorpid(corpId);
|
||||
// //保存订单数据
|
||||
// factoryOrderService.save(factoryOrder);
|
||||
//
|
||||
// List<PanPackageInfoDTO> packageInfos = factoryOrderDTO.getORDER_ATTRIBUTES();
|
||||
//
|
||||
// for (PanPackageInfoDTO dto:packageInfos){
|
||||
// PanPackageInfo packageInfo = new PanPackageInfo();
|
||||
// BeanUtil.copyProperties(dto,packageInfo);
|
||||
// packageInfo.setOrderId(factoryOrder.getId());
|
||||
// //保存包件信息数据
|
||||
// //因为需要先保存包件明细需要包件的id
|
||||
// packageInfoService.save(packageInfo);
|
||||
//
|
||||
// //再存入包件明细
|
||||
// List<PanPackageList> PanPackagelist = new ArrayList<>();
|
||||
// List<PanPackageListDTO> order_attributes_line = dto.getORDER_ATTRIBUTES_LINE();
|
||||
// for (PanPackageListDTO panPackageListDTO:order_attributes_line){
|
||||
// PanPackageList panPackageList = new PanPackageList();
|
||||
// BeanUtil.copyProperties(panPackageListDTO,panPackageList);
|
||||
// panPackageList.setPackageId(packageInfo.getId());
|
||||
// PanPackagelist.add(panPackageList);
|
||||
// }
|
||||
// packageListService.saveBatch(PanPackagelist);
|
||||
// }
|
||||
//
|
||||
// //修改保存数据的状态
|
||||
// panOrderStatusLog.setStatus(0);
|
||||
// panOrderStatusLogService.saveOrUpdate(panOrderStatusLog);
|
||||
//
|
||||
// //开启异步线程处理数据
|
||||
// syncDataService.handlerPanDataToHt();
|
||||
|
||||
return Resp.fail(400,"fail"); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,18 @@
|
||||
package com.logpm.factory.mt.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
import com.logpm.factory.snm.entity.MtFactoryOrderMain; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class MtFactoryDataDTO extends MtFactoryOrderMain { |
||||
|
||||
@JsonProperty("发货单明细") |
||||
private List<MtFactoryOrderDTO> orderList = new ArrayList<>(); |
||||
|
||||
} |
@ -0,0 +1,18 @@
|
||||
package com.logpm.factory.mt.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
import com.logpm.factory.snm.entity.MtFactoryOrder; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class MtFactoryOrderDTO extends MtFactoryOrder { |
||||
|
||||
@JsonProperty("包装明细") |
||||
private List<MtPackageInfoDTO> packageInfos = new ArrayList<>(); |
||||
|
||||
} |
@ -0,0 +1,10 @@
|
||||
package com.logpm.factory.mt.dto; |
||||
|
||||
import com.logpm.factory.snm.entity.MtPackageInfo; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class MtPackageInfoDTO extends MtPackageInfo { |
||||
} |
@ -0,0 +1,7 @@
|
||||
package com.logpm.factory.snm.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.logpm.factory.snm.entity.MtFactoryOrderMain; |
||||
|
||||
public interface MtFactoryOrderMainMapper extends BaseMapper<MtFactoryOrderMain> { |
||||
} |
@ -0,0 +1,20 @@
|
||||
<?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.snm.mapper.MtFactoryOrderMainMapper"> |
||||
|
||||
<!-- 通用查询映射结果 --> |
||||
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">--> |
||||
<!-- <result column="id" property="id"/>--> |
||||
<!-- <result column="req_args" property="reqArgs"/>--> |
||||
<!-- <result column="res_body" property="resBody"/>--> |
||||
<!-- <result column="type" property="type"/>--> |
||||
<!-- <result column="create_user" property="createUser"/>--> |
||||
<!-- <result column="create_time" property="createTime"/>--> |
||||
<!-- <result column="update_user" property="updateUser"/>--> |
||||
<!-- <result column="update_time" property="updateTime"/>--> |
||||
<!-- <result column="status" property="status"/>--> |
||||
<!-- <result column="is_deleted" property="isDeleted"/>--> |
||||
<!-- <result column="create_dept" property="createDept"/>--> |
||||
<!-- </resultMap>--> |
||||
|
||||
</mapper> |
@ -1,6 +1,6 @@
|
||||
<?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.snm.mapper.PanOrderStatusLogMapper"> |
||||
<mapper namespace="com.logpm.factory.snm.mapper.OrderStatusLogMapper"> |
||||
|
||||
<!-- 通用查询映射结果 --> |
||||
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">--> |
@ -0,0 +1,12 @@
|
||||
package com.logpm.factory.snm.service; |
||||
|
||||
import com.logpm.factory.mt.dto.MtFactoryDataDTO; |
||||
|
||||
/** |
||||
* 工厂推送数据接口 |
||||
*/ |
||||
public interface IMtFactoryDataService { |
||||
|
||||
boolean dealWithData(MtFactoryDataDTO mtFactoryDataDTO); |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
package com.logpm.factory.snm.service; |
||||
|
||||
import com.logpm.factory.snm.entity.MtFactoryOrderMain; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
public interface IMtFactoryOrderMainService extends BaseService<MtFactoryOrderMain> { |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
package com.logpm.factory.snm.service; |
||||
|
||||
import com.logpm.factory.snm.entity.OrderStatusLog; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
public interface IOrderStatusLogService extends BaseService<OrderStatusLog> { |
||||
|
||||
} |
@ -1,8 +0,0 @@
|
||||
package com.logpm.factory.snm.service; |
||||
|
||||
import com.logpm.factory.snm.entity.PanOrderStatusLog; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
public interface IPanOrderStatusLogService extends BaseService<PanOrderStatusLog> { |
||||
|
||||
} |
@ -0,0 +1,39 @@
|
||||
package com.logpm.factory.snm.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.logpm.factory.mt.dto.MtFactoryDataDTO; |
||||
import com.logpm.factory.snm.entity.MtFactoryOrderMain; |
||||
import com.logpm.factory.snm.service.IMtFactoryDataService; |
||||
import com.logpm.factory.snm.service.IMtFactoryOrderMainService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.Objects; |
||||
|
||||
@Slf4j |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class MtFactoryDataServiceImpl implements IMtFactoryDataService { |
||||
|
||||
private final IMtFactoryOrderMainService mtFactoryOrderMainService; |
||||
|
||||
@Transactional |
||||
@Override |
||||
public boolean dealWithData(MtFactoryDataDTO mtFactoryDataDTO) { |
||||
log.info("#############dealWithData: 处理梦天工厂数据 开始"); |
||||
String invoiceOrderCode = mtFactoryDataDTO.getInvoiceOrderCode();//发货单编码
|
||||
//先判断该发货单编码是否已经存在
|
||||
QueryWrapper<MtFactoryOrderMain> queryWrapper = new QueryWrapper<>(); |
||||
queryWrapper.eq("invoice_order_code",invoiceOrderCode); |
||||
MtFactoryOrderMain mtFactoryOrderMain = mtFactoryOrderMainService.getOne(queryWrapper); |
||||
if(Objects.isNull(mtFactoryOrderMain)){ |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.logpm.factory.snm.service.impl; |
||||
|
||||
import com.logpm.factory.snm.entity.MtFactoryOrderMain; |
||||
import com.logpm.factory.snm.mapper.MtFactoryOrderMainMapper; |
||||
import com.logpm.factory.snm.service.IMtFactoryOrderMainService; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@AllArgsConstructor |
||||
@Service |
||||
public class MtFactoryOrderMainServiceImpl extends BaseServiceImpl<MtFactoryOrderMainMapper, MtFactoryOrderMain> implements IMtFactoryOrderMainService { |
||||
|
||||
|
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.logpm.factory.snm.service.impl; |
||||
|
||||
import com.logpm.factory.snm.entity.OrderStatusLog; |
||||
import com.logpm.factory.snm.mapper.OrderStatusLogMapper; |
||||
import com.logpm.factory.snm.service.IOrderStatusLogService; |
||||
import lombok.AllArgsConstructor; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@AllArgsConstructor |
||||
@Service |
||||
public class OrderStatusLogServiceImpl extends BaseServiceImpl<OrderStatusLogMapper, OrderStatusLog> implements IOrderStatusLogService { |
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(OrderStatusLogServiceImpl.class); |
||||
|
||||
|
||||
} |
@ -1,19 +0,0 @@
|
||||
package com.logpm.factory.snm.service.impl; |
||||
|
||||
import com.logpm.factory.snm.entity.PanOrderStatusLog; |
||||
import com.logpm.factory.snm.mapper.PanOrderStatusLogMapper; |
||||
import com.logpm.factory.snm.service.IPanOrderStatusLogService; |
||||
import lombok.AllArgsConstructor; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@AllArgsConstructor |
||||
@Service |
||||
public class PanOrderStatusLogServiceImpl extends BaseServiceImpl<PanOrderStatusLogMapper, PanOrderStatusLog> implements IPanOrderStatusLogService { |
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PanOrderStatusLogServiceImpl.class); |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue