Commit 6d65758e authored by Allen Chen's avatar Allen Chen

commit

parent 1152dda6
...@@ -3,20 +3,29 @@ package org.ta.pddserver.controller; ...@@ -3,20 +3,29 @@ package org.ta.pddserver.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.ta.pddserver.entity.GDAttachmentEntity;
import org.ta.pddserver.entity.GDTicketEntity;
import org.ta.pddserver.model.api.request.LogOrderListRequest;
import org.ta.pddserver.model.api.request.TicketListRequest;
import org.ta.pddserver.model.pddgd.request.GDTicketReplyRequest; import org.ta.pddserver.model.pddgd.request.GDTicketReplyRequest;
import org.ta.pddserver.model.pddgd.response.GDTicketReplyRepsonse; import org.ta.pddserver.model.pddgd.response.GDTicketReplyRepsonse;
import org.ta.pddserver.model.pddgd.response.GDTicketRepsonse; import org.ta.pddserver.model.pddgd.response.GDTicketRepsonse;
import org.ta.pddserver.model.pddjy.request.JYBaseRequestModel; import org.ta.pddserver.model.pddjy.request.JYBaseRequestModel;
import org.ta.pddserver.service.impl.GDAttachmentImpl;
import org.ta.pddserver.service.impl.GDTicketImpl;
import org.ta.pddserver.utils.ImageUtils; import org.ta.pddserver.utils.ImageUtils;
import org.ta.pddserver.utils.JsonResponse;
import org.ta.pddserver.utils.PddHttpTool; import org.ta.pddserver.utils.PddHttpTool;
import org.ta.pddserver.utils.PddSignTool; import org.ta.pddserver.utils.PddSignTool;
import java.io.IOException; import java.io.IOException;
import java.util.Date; import java.util.*;
import java.util.List;
import java.util.UUID;
@Slf4j @Slf4j
@RestController @RestController
...@@ -95,4 +104,35 @@ public class PddGDController { ...@@ -95,4 +104,35 @@ public class PddGDController {
return respObj; return respObj;
} }
@Resource
GDTicketImpl gdTicketImpl;
@Resource
GDAttachmentImpl gdAttachmentImpl;
/*工单列表*/
@PostMapping("/ticketList")
public JSONObject ticketList(HttpServletRequest request, @RequestBody TicketListRequest ticketListRequest) {
return JsonResponse.generateLocalCommonSuccessResponse( gdTicketImpl.getListByRequest(ticketListRequest));
}
/*工单详情*/
@PostMapping("/ticketInfo")
public Map<String, Object> ticketInfo(HttpServletRequest request, @RequestBody TicketListRequest ticketListRequest) {
Map<String, Object> map = new HashMap<>();
GDTicketEntity gdTicketEntity = gdTicketImpl.getByTicketId((long) ticketListRequest.getTicket_id());
if(gdTicketEntity == null){
return JsonResponse.generateLocalCommonFailedResponse("-1", "信息获取失败,请检查上传信息");
}
List<GDAttachmentEntity> list = gdAttachmentImpl.getListByTicketId(ticketListRequest.getTicket_id());
map.put("ticket", gdTicketEntity);
map.put("attachment", list);
return JsonResponse.generateLocalCommonSuccessResponse(map);
}
} }
...@@ -34,7 +34,7 @@ public class GDTicketEntity { ...@@ -34,7 +34,7 @@ public class GDTicketEntity {
* 更新时间 * 更新时间
*/ */
@TableField(value = "updated_at") @TableField(value = "updated_at")
private Integer updated_at; private Long updated_at;
/** /**
* 工单创建来源 * 工单创建来源
* 0:平台 1:消费者 2:商家 * 0:平台 1:消费者 2:商家
......
...@@ -2,8 +2,15 @@ package org.ta.pddserver.mapper; ...@@ -2,8 +2,15 @@ package org.ta.pddserver.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.ta.pddserver.entity.GDAttachmentEntity; import org.ta.pddserver.entity.GDAttachmentEntity;
import java.util.List;
@Mapper @Mapper
public interface GDAttachmentMapper extends BaseMapper<GDAttachmentEntity> { public interface GDAttachmentMapper extends BaseMapper<GDAttachmentEntity> {
@Select("SELECT * FROM `gd_attachment` WHERE `ticketId` = ${ticketId}")
List<GDAttachmentEntity> getListByTicketId(@Param("ticketId") int ticketId);
} }
...@@ -4,6 +4,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -4,6 +4,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.ta.pddserver.entity.GDTicketEntity; import org.ta.pddserver.entity.GDTicketEntity;
import org.ta.pddserver.model.api.request.CollectOutMailDetailIoRequest;
import org.ta.pddserver.model.api.request.TicketListRequest;
import org.ta.pddserver.model.api.response.CollectOutMailDetailIoListResponse;
import org.ta.pddserver.model.api.response.TicketListResponse;
import java.util.List; import java.util.List;
...@@ -12,4 +16,11 @@ public interface GDTicketMapper extends BaseMapper<GDTicketEntity> { ...@@ -12,4 +16,11 @@ public interface GDTicketMapper extends BaseMapper<GDTicketEntity> {
@Select("SELECT * FROM `gd_ticket` WHERE `ticket_id` = #{ticketId};") @Select("SELECT * FROM `gd_ticket` WHERE `ticket_id` = #{ticketId};")
GDTicketEntity findByTicketId(Long ticketId); GDTicketEntity findByTicketId(Long ticketId);
@Select("SELECT count(t.uid) FROM ( SELECT `uid` FROM `gd_ticket` WHERE `source` LIKE '%${source}%' AND `title` LIKE '%${title}%' AND `create_type` LIKE '%${create_type}%' AND `compensate_state` LIKE '%${compensate_state}%' AND `type_id` LIKE '%${type_id}%' AND `sign_state` LIKE '%${sign_state}%' AND `urgent_type` LIKE '%${urgent_type}%' AND `state` LIKE '%${state}%' AND `area_name` LIKE '%${area_name}%') t")
Integer countUsable(TicketListRequest param);
@Select("SELECT `source`, `title`, `create_type`,`compensate_state`, `type_id`, `sign_state`, `urgent_type`, `state`, `area_name` , `pre_delivery_id`, `ticket_id`, `create_at` FROM `gd_ticket` WHERE `source` LIKE '%${source}%' AND `title` LIKE '%${title}%' AND `create_type` LIKE '%${create_type}%' AND `compensate_state` LIKE '%${compensate_state}%' AND `type_id` LIKE '%${type_id}%' AND `sign_state` LIKE '%${sign_state}%' AND `urgent_type` LIKE '%${urgent_type}%' AND `state` LIKE '%${state}%' AND `area_name` LIKE '%${area_name}%' ORDER BY `ticket_id` DESC LIMIT #{offset}, #{size}; ")
List<TicketListResponse> getListByRequest(TicketListRequest param);
} }
package org.ta.pddserver.model.api.request;
import lombok.Data;
import org.ta.pddserver.model.common.PageTool;
@Data
public class CollectMailDetailRequest extends PageTool {
private String mailNo;
}
...@@ -11,12 +11,25 @@ public class FinishUnpackRequest { ...@@ -11,12 +11,25 @@ public class FinishUnpackRequest {
private String orderCode; private String orderCode;
private int code;
private String logisticsOrderCode; private String logisticsOrderCode;
private String status; private String status;
private String goodsType;
private String action; private String action;
private List<PackageInfo> packageInfo;
/**
* 包裹详情
*/
@Data
public static class PackageInfo {
private String orderCode;
private Long length; private Long length;
private Long width; private Long width;
...@@ -25,6 +38,7 @@ public class FinishUnpackRequest { ...@@ -25,6 +38,7 @@ public class FinishUnpackRequest {
private Long weight; private Long weight;
private Long actualWeight; }
} }
...@@ -11,6 +11,8 @@ public class InBoundRequest { ...@@ -11,6 +11,8 @@ public class InBoundRequest {
private String orderCode; private String orderCode;
private String action;
private String status; private String status;
private Long length; private Long length;
...@@ -23,8 +25,6 @@ public class InBoundRequest { ...@@ -23,8 +25,6 @@ public class InBoundRequest {
private Long actualWeight; private Long actualWeight;
private String action;
private Integer code; private Integer code;
private String goodsType; private String goodsType;
......
package org.ta.pddserver.model.api.request;
import lombok.Data;
import org.ta.pddserver.model.common.PageTool;
@Data
public class TicketListRequest extends PageTool {
private String source;
private String title;
private int create_type;
private int compensate_state;
private int type_id;
private int sign_state;
private int urgent_type;
private int state;
private String area_name;
private int ticket_id;
}
...@@ -9,5 +9,5 @@ public class CollectOutMailDetailResponse { ...@@ -9,5 +9,5 @@ public class CollectOutMailDetailResponse {
private String expressCode; private String expressCode;
private String logisticsOrderCode;
} }
package org.ta.pddserver.model.api.response;
import lombok.Data;
@Data
public class TicketListResponse {
private String source;
private String title;
private int create_type;
private int compensate_state;
private int type_id;
private int sign_state;
private int urgent_type;
private int state;
private String area_name;
private String pre_delivery_id;
private int ticket_id;
private int create_at;
}
...@@ -5,7 +5,7 @@ public enum StatusEnum { ...@@ -5,7 +5,7 @@ public enum StatusEnum {
SIGNED(10, "签收"), SIGNED(10, "签收"),
REJECTED(11, "拒签"), REJECTED(11, "拒签"),
DESTROY(12, "销毁"), DESTROY(12, "销毁"),
UNINBOUND(19, "未入库"), UNINBOUND(15, "未入库"),
INBOUND(20, "入库"), INBOUND(20, "入库"),
PARTINBOUND(21, "部分入库"), PARTINBOUND(21, "部分入库"),
FULLINBOUND(22, "全部入库"), FULLINBOUND(22, "全部入库"),
...@@ -13,11 +13,13 @@ public enum StatusEnum { ...@@ -13,11 +13,13 @@ public enum StatusEnum {
UNPACK(30, "通知拆包"), UNPACK(30, "通知拆包"),
UNPACKBEGINPICK(31, "开始拣货"), UNPACKBEGINPICK(31, "开始拣货"),
UNPACKFINISHPICK(32, "拣货完成"), UNPACKFINISHPICK(32, "拣货完成"),
FINISHUNPACK(39, "拆包完成"), FINISHUNPACK(35, "拆包完成"),
FINISHUNPACKERROR(36, "拆包完成异常"),
OUTBOUND(40, "通知出库"), OUTBOUND(40, "通知出库"),
BEGINPICK(50, "开始拣货"), BEGINPICK(50, "开始拣货"),
PICKERROR(51, "开始拣货异常"), BEGINPICKERROR(51, "开始拣货异常"),
FINISHPICK(59, "拣货完成"), FINISHPICK(55, "拣货完成"),
FINISHPICKERROR(56, "拣货完成异常"),
FINISHOUTBOUND(60, "出库"), FINISHOUTBOUND(60, "出库"),
UNKNOWN(-1, "未知"); UNKNOWN(-1, "未知");
......
...@@ -7,8 +7,13 @@ import org.ta.pddserver.entity.GDAttachmentEntity; ...@@ -7,8 +7,13 @@ import org.ta.pddserver.entity.GDAttachmentEntity;
import org.ta.pddserver.mapper.GDAttachmentMapper; import org.ta.pddserver.mapper.GDAttachmentMapper;
import org.ta.pddserver.service.GDAttachmentService; import org.ta.pddserver.service.GDAttachmentService;
import java.util.List;
@Service @Service
public class GDAttachmentImpl extends ServiceImpl<GDAttachmentMapper, GDAttachmentEntity> implements GDAttachmentService { public class GDAttachmentImpl extends ServiceImpl<GDAttachmentMapper, GDAttachmentEntity> implements GDAttachmentService {
public List<GDAttachmentEntity> getListByTicketId(int ticketId) {
return baseMapper.getListByTicketId(ticketId);
}
} }
\ No newline at end of file
...@@ -5,8 +5,15 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -5,8 +5,15 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.ta.pddserver.entity.GDTicketEntity; import org.ta.pddserver.entity.GDTicketEntity;
import org.ta.pddserver.mapper.GDTicketMapper; import org.ta.pddserver.mapper.GDTicketMapper;
import org.ta.pddserver.model.api.request.TicketListRequest;
import org.ta.pddserver.model.api.response.LogOrderListResponse;
import org.ta.pddserver.model.api.response.TicketListResponse;
import org.ta.pddserver.service.GDTicketService; import org.ta.pddserver.service.GDTicketService;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service @Service
public class GDTicketImpl extends ServiceImpl<GDTicketMapper, GDTicketEntity> implements GDTicketService { public class GDTicketImpl extends ServiceImpl<GDTicketMapper, GDTicketEntity> implements GDTicketService {
...@@ -14,4 +21,15 @@ public class GDTicketImpl extends ServiceImpl<GDTicketMapper, GDTicketEntity> im ...@@ -14,4 +21,15 @@ public class GDTicketImpl extends ServiceImpl<GDTicketMapper, GDTicketEntity> im
public GDTicketEntity getByTicketId(Long ticketId) { public GDTicketEntity getByTicketId(Long ticketId) {
return this.baseMapper.findByTicketId(ticketId); return this.baseMapper.findByTicketId(ticketId);
} }
public Object getListByRequest(TicketListRequest param) {
Integer count = baseMapper.countUsable(param);
param.checkPage(count,20);
List<TicketListResponse> list = baseMapper.getListByRequest(param);
Map<String, Object> map = new HashMap<>();
map.put("total", count);
map.put("list", list);
map.put("page", param.getPage());
return map;
}
} }
\ No newline at end of file
...@@ -3,11 +3,14 @@ package org.ta.pddserver.xxl; ...@@ -3,11 +3,14 @@ package org.ta.pddserver.xxl;
import jakarta.annotation.PostConstruct; import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.ta.pddserver.entity.GDAttachmentEntity;
import org.ta.pddserver.entity.GDTicketEntity; import org.ta.pddserver.entity.GDTicketEntity;
import org.ta.pddserver.model.pddgd.response.GDTicketRepsonse; import org.ta.pddserver.model.pddgd.response.GDTicketRepsonse;
import org.ta.pddserver.service.impl.GDAttachmentImpl;
import org.ta.pddserver.service.impl.GDTicketImpl; import org.ta.pddserver.service.impl.GDTicketImpl;
import org.ta.pddserver.utils.PddGDUtil; import org.ta.pddserver.utils.PddGDUtil;
...@@ -21,6 +24,8 @@ public class GDOperator { ...@@ -21,6 +24,8 @@ public class GDOperator {
@Resource @Resource
GDTicketImpl gdTicketImpl; GDTicketImpl gdTicketImpl;
@Autowired
private GDAttachmentImpl gDAttachmentImpl;
@Scheduled(fixedRate = 1000 * 60 * 5, initialDelay = 1000) // 每5分钟执行一次 @Scheduled(fixedRate = 1000 * 60 * 5, initialDelay = 1000) // 每5分钟执行一次
public void getGdTickets() { public void getGdTickets() {
...@@ -31,6 +36,48 @@ public class GDOperator { ...@@ -31,6 +36,48 @@ public class GDOperator {
if (gdTicketEntity == null) { if (gdTicketEntity == null) {
// todo 保存 // todo 保存
// 主体、绑定两个表 // 主体、绑定两个表
gdTicketEntity.setTicket_id(gdTicketRepsonse.getTicket_id());
gdTicketEntity.setCreate_type(gdTicketRepsonse.getCreate_type());
gdTicketEntity.setReceive_address(gdTicketRepsonse.getReceive_address());
gdTicketEntity.setSend_address(gdTicketRepsonse.getSend_address());
gdTicketEntity.setPre_delivery_id(gdTicketRepsonse.getPre_delivery_id());
gdTicketEntity.setHandle_result(gdTicketRepsonse.getHandle_result());
gdTicketEntity.setExpress_company_id((long)gdTicketRepsonse.getExpress_company_id());
gdTicketEntity.setCompensate_state((int)gdTicketRepsonse.getCompensate_state());
gdTicketEntity.setCompensate_amount(gdTicketRepsonse.getCompensate_amount().intValue());
gdTicketEntity.setSign_state((int)gdTicketRepsonse.getSign_state());
gdTicketEntity.setExpress_dealer(gdTicketRepsonse.getExpress_dealer());
gdTicketEntity.setExpress_dealer_contact(gdTicketRepsonse.getExpress_dealer_contact());
gdTicketEntity.setRetreat_count(gdTicketRepsonse.getRetreat_count());
gdTicketEntity.setReceive_name(gdTicketRepsonse.getReceive_name());
gdTicketEntity.setReceive_contact(gdTicketRepsonse.getReceive_contact());
gdTicketEntity.setCreated_at(gdTicketRepsonse.getCreated_at());
gdTicketEntity.setUpdated_at(gdTicketRepsonse.getUpdated_at());
gdTicketEntity.setTitle(gdTicketRepsonse.getTitle());
gdTicketEntity.setDescription(gdTicketRepsonse.getDescription());
gdTicketEntity.setSource(gdTicketRepsonse.getSource());
gdTicketEntity.setWaybill_no(gdTicketRepsonse.getWaybill_no());
gdTicketEntity.setUrgent_type(gdTicketRepsonse.getUrgent_type());
gdTicketEntity.setType_id(gdTicketRepsonse.getType_id());
gdTicketEntity.setStatus(gdTicketRepsonse.getStatus());
gdTicketEntity.setCabinet_code(gdTicketRepsonse.getCabinet_code());
gdTicketEntity.setMail_order_sn(gdTicketRepsonse.getMail_order_sn());
gdTicketEntity.setPay_amount(gdTicketRepsonse.getPay_amount());
gdTicketEntity.setArea_name(gdTicketRepsonse.getArea_name());
gdTicketImpl.save(gdTicketEntity);
//
List<GDTicketRepsonse.ExpressAttachment> expressAttachmentList = gdTicketRepsonse.getExpress_attachment();
for(GDTicketRepsonse.ExpressAttachment expressAttachmentLists: expressAttachmentList){
GDAttachmentEntity gdAttachmentEntity = new GDAttachmentEntity();
gdAttachmentEntity.setTickId(gdTicketEntity.getTicket_id());
gdAttachmentEntity.setUrl(expressAttachmentLists.getUrl());
gdAttachmentEntity.setWaybill_no(gdTicketEntity.getWaybill_no());
gDAttachmentImpl.save(gdAttachmentEntity);
}
} }
} }
} }
......
spring: spring:
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://192.168.2.222:3306/pdd_api?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT url: jdbc:mysql://192.168.2.222:3306/pdd_api?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT
# username: root username: root
# password: root password: root
url: jdbc:mysql://lyhj-mysql.mysql.rds.aliyuncs.com:3306/pdd_test?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT # url: jdbc:mysql://lyhj-mysql.mysql.rds.aliyuncs.com:3306/pdd_test?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT
username: pdd # username: pdd
password: pdd123 # password: pdd123
hikari: hikari:
minimum-idle: 5 # 最小空闲连接数 minimum-idle: 5 # 最小空闲连接数
maximum-pool-size: 10 # 最大活跃连接数 maximum-pool-size: 10 # 最大活跃连接数
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment