Commit 7d4153e2 by chaizheng

大搜车工单需求

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@26578 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 086357dc
......@@ -3,6 +3,7 @@ package com.glsx.ordercenter.thread;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.glsx.common.utils.HttpUtils;
import com.glsx.common.utils.PropertiesUtil;
import com.glsx.gps.utils.HttpUtil;
import com.glsx.ordercenter.constants.BizConstants;
......@@ -48,7 +49,8 @@ public class DscCancelOrderFeedBackTask implements Runnable{
String api = PropertiesUtil.getProperty("dasouche.cancel.order.api");
String appKey = PropertiesUtil.getProperty("dasouche.appKey");
String appSecret = PropertiesUtil.getProperty("dasouche.appSecret");
DaSouCheRequest daSouCheRequest = new DaSouCheRequest(api,appKey,new Date().getTime());
Long times = System.currentTimeMillis()/1000;
DaSouCheRequest daSouCheRequest = new DaSouCheRequest(api,appKey,times);
DscOrderFeedBackDto dscOrderFeedBackDto = new DscOrderFeedBackDto();
dscOrderFeedBackDto.setIzayoiSerialNum(Long.toString(new Date().getTime()));
......@@ -78,7 +80,6 @@ public class DscCancelOrderFeedBackTask implements Runnable{
order.setCancelTime(new Date());
sysOrderMapper.updateByPrimaryKeySelective(order);
}
//发送邮件
}
try {
String sign = SoucheSignature.sign(map,appSecret);
......@@ -89,9 +90,10 @@ public class DscCancelOrderFeedBackTask implements Runnable{
logger.error("大搜车撤单反馈生成签名sign发生异常!");
}
try {
String result = HttpUtil.postData(daSouCheUrl,JSON.toJSONString(daSouCheRequest), ContentType.APPLICATION_JSON);
HttpUtils httpUtils = new HttpUtils();
String result = httpUtils.postJson(daSouCheUrl,JSON.toJSONString(daSouCheRequest));
logger.info("大搜车撤单反馈接口返回:"+result);
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
logger.error("请求大搜车撤单反馈接口发生异常!");
}
......
......@@ -6,12 +6,10 @@ import com.glsx.gps.utils.HttpUtil;
import com.glsx.ordercenter.dto.req.DaSouCheRequest;
import com.glsx.ordercenter.dto.DscInstallOrderBackDeviceDto;
import com.glsx.ordercenter.dto.DscOrderFeedBackDto;
import com.glsx.ordercenter.mapper.DictionaryDataMapper;
import com.glsx.ordercenter.mapper.SysOrderDeviceMapper;
import com.glsx.ordercenter.mapper.SysOrderFileMapper;
import com.glsx.ordercenter.mapper.SysOrderMapper;
import com.glsx.ordercenter.mapper.*;
import com.glsx.ordercenter.pojo.SysOrder;
import com.glsx.ordercenter.pojo.SysOrderDevice;
import com.glsx.ordercenter.pojo.SysOrderDeviceSupplier;
import com.glsx.ordercenter.pojo.SysOrderFile;
import com.glsx.ordercenter.utils.DaSouCheUtil;
import com.souche.api.SoucheApiException;
......@@ -36,12 +34,12 @@ public class DscInstallOrderFeedBackTask implements Runnable{
private SysOrderMapper sysOrderMapper;
private DictionaryDataMapper dictionaryDataMapper;
private SysOrderFileMapper sysOrderFileMapper;
private SysOrderDeviceMapper sysOrderDeviceMapper;
private SysOrderDeviceSupplierMapper sysOrderDeviceSupplierMapper;
@Override
public void run() {
String daSouCheUrl = PropertiesUtil.getProperty("dasouche.valiate.url");
......@@ -61,37 +59,42 @@ public class DscInstallOrderFeedBackTask implements Runnable{
List<SysOrder> orderList = sysOrderMapper.queryOrderByWorkOrderNo(workOrderNo);
logger.info("--------order------"+orderList.size());
if(!CollectionUtils.isEmpty(orderList)){
for(SysOrder order : orderList){
SysOrderDevice orderDevice = new SysOrderDevice();
orderDevice.setOrderId(order.getId());
List<SysOrderDevice> deviceList = sysOrderDeviceMapper.getOrderDeviceList(orderDevice);
logger.info("-------device----------"+deviceList.size());
if (!CollectionUtils.isEmpty(deviceList)){
List<SysOrderFile> imgList = sysOrderFileMapper.selectByOrderId(order.getId());
List<String> imgPaths = imgList.stream().map(e -> e.getFilePath()).collect(Collectors.toList());
for (SysOrderDevice d :deviceList){
DscInstallOrderBackDeviceDto deviceDTO = new DscInstallOrderBackDeviceDto();
deviceDTO.setDevNo(d.getDeviceNo());
deviceDTO.setDevSupplier("博实结");
String dev_type = d.getDeviceType();
if("sys_order_service_item_gps".equals(dev_type)){
deviceDTO.setDevType(1);
}else if ("sys_order_service_item_gps_wireless".equals(dev_type)){
deviceDTO.setDevType(2);
}else {
continue;
}
deviceDTO.setDevModel(d.getDeviceNo());//设备型号
deviceDTO.setDevPosition(d.getInstallLocation());
if(!CollectionUtils.isEmpty(imgList)){
deviceDTO.setImgUrl(JSON.toJSONString(imgPaths));
}else{
deviceDTO.setImgUrl("null");
try {
for(SysOrder order : orderList){
SysOrderDevice orderDevice = new SysOrderDevice();
orderDevice.setOrderId(order.getId());
List<SysOrderDevice> deviceList = sysOrderDeviceMapper.getOrderDeviceList(orderDevice);
logger.info("-------device----------"+deviceList.size());
if (!CollectionUtils.isEmpty(deviceList)){
List<SysOrderFile> imgList = sysOrderFileMapper.selectByOrderId(order.getId());
List<String> imgPaths = imgList.stream().map(e -> e.getFilePath()).collect(Collectors.toList());
for (SysOrderDevice d :deviceList){
DscInstallOrderBackDeviceDto deviceDTO = new DscInstallOrderBackDeviceDto();
deviceDTO.setDevNo(d.getDeviceNo());
String dev_type = d.getDeviceType();
if("sys_order_service_item_gps".equals(dev_type)){
deviceDTO.setDevType(1);
}else if ("sys_order_service_item_gps_wireless".equals(dev_type)){
deviceDTO.setDevType(2);
}else {
continue;
}
SysOrderDeviceSupplier supplier = sysOrderDeviceSupplierMapper.getDeviceSupplierByType(order.getId(),deviceDTO.getDevType()+"");
deviceDTO.setDevSupplier(supplier.getChooseSupplier());
deviceDTO.setDevModel(""); //设备型号
deviceDTO.setDevPosition(d.getInstallLocation());
if(!CollectionUtils.isEmpty(imgList)){
deviceDTO.setImgUrl(JSON.toJSONString(imgPaths));
}else{
deviceDTO.setImgUrl("null");
}
deviceDTO.setDevOwner(1);
deviceDtoList.add(deviceDTO);
}
deviceDTO.setDevOwner(1);
deviceDtoList.add(deviceDTO);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
dscOrderFeedBackDto.setData(deviceDtoList);
......@@ -135,14 +138,6 @@ public class DscInstallOrderFeedBackTask implements Runnable{
this.sysOrderMapper = sysOrderMapper;
}
public DictionaryDataMapper getDictionaryDataMapper() {
return dictionaryDataMapper;
}
public void setDictionaryDataMapper(DictionaryDataMapper dictionaryDataMapper) {
this.dictionaryDataMapper = dictionaryDataMapper;
}
public SysOrderFileMapper getSysOrderFileMapper() {
return sysOrderFileMapper;
}
......@@ -158,4 +153,12 @@ public class DscInstallOrderFeedBackTask implements Runnable{
public void setSysOrderDeviceMapper(SysOrderDeviceMapper sysOrderDeviceMapper) {
this.sysOrderDeviceMapper = sysOrderDeviceMapper;
}
public SysOrderDeviceSupplierMapper getSysOrderDeviceSupplierMapper() {
return sysOrderDeviceSupplierMapper;
}
public void setSysOrderDeviceSupplierMapper(SysOrderDeviceSupplierMapper sysOrderDeviceSupplierMapper) {
this.sysOrderDeviceSupplierMapper = sysOrderDeviceSupplierMapper;
}
}
......@@ -9,6 +9,7 @@ import com.glsx.ordercenter.dto.req.DaSouCheRequest;
import com.glsx.ordercenter.mapper.DictionaryDataMapper;
import com.glsx.ordercenter.mapper.SysOrderDeviceMapper;
import com.glsx.ordercenter.mapper.SysOrderFileMapper;
import com.glsx.ordercenter.mapper.SysOrderMapper;
import com.glsx.ordercenter.pojo.SysOrder;
import com.glsx.ordercenter.pojo.SysOrderDevice;
import com.glsx.ordercenter.pojo.SysOrderFile;
......@@ -25,7 +26,6 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class DscRemoveOrderFeedBackTask implements Runnable{
......@@ -35,12 +35,11 @@ public class DscRemoveOrderFeedBackTask implements Runnable{
private String workOrderNo;
private DictionaryDataMapper dictionaryDataMapper;
private SysOrderFileMapper sysOrderFileMapper;
private SysOrderMapper sysOrderMapper;
private SysOrderDeviceMapper sysOrderDeviceMapper;
@Override
public void run() {
String daSouCheUrl = PropertiesUtil.getProperty("dasouche.valiate.url");
......@@ -52,10 +51,6 @@ public class DscRemoveOrderFeedBackTask implements Runnable{
dscOrderFeedBackDto.setIzayoiSerialNum(Long.toString(new Date().getTime()));
/**
* 处理有多个单
* 每个单可能有几个设备
*/
List<Object> deviceDtoList = new ArrayList<>();
logger.info("--------order------"+orderList.size());
if(!CollectionUtils.isEmpty(orderList)){
......@@ -65,12 +60,9 @@ public class DscRemoveOrderFeedBackTask implements Runnable{
List<SysOrderDevice> deviceList = sysOrderDeviceMapper.getOrderDeviceList(orderDevice);
logger.info("-------device----------"+deviceList.size());
if (!CollectionUtils.isEmpty(deviceList)){
List<SysOrderFile> imgList = sysOrderFileMapper.selectByOrderId(order.getId());
List<String> imgPaths = imgList.stream().map(e -> e.getFilePath()).collect(Collectors.toList());
for (SysOrderDevice d :deviceList){
DscInstallOrderBackDeviceDto deviceDTO = new DscInstallOrderBackDeviceDto();
deviceDTO.setDevNo(d.getDeviceNo());
deviceDTO.setDevSupplier("博实结");
String dev_type = d.getDeviceType();
if("sys_order_service_item_gps".equals(dev_type)){
deviceDTO.setDevType(1);
......@@ -80,8 +72,6 @@ public class DscRemoveOrderFeedBackTask implements Runnable{
deviceDTO.setDevType(3);
}
deviceDTO.setRemoved(1); //是否拆除,1:拆除,2:未拆除
deviceDtoList.add(deviceDTO);
}
}
......@@ -95,17 +85,17 @@ public class DscRemoveOrderFeedBackTask implements Runnable{
try {
String sign = SoucheSignature.sign(map,appSecret);
daSouCheRequest.setSign(sign);
logger.info("请求大搜车安装反馈参数:"+JSON.toJSONString(daSouCheRequest));
logger.info("请求大搜车拆除单反馈参数:"+JSON.toJSONString(daSouCheRequest));
} catch (SoucheApiException e) {
e.printStackTrace();
logger.error("大搜车安装单反馈生成签名sign发生异常!");
logger.error("大搜车拆除单反馈生成签名sign发生异常!");
}
try {
String result = HttpUtil.postData(daSouCheUrl,JSON.toJSONString(daSouCheRequest), ContentType.APPLICATION_JSON);
logger.info("大搜车安装单反馈接口返回:"+result);
logger.info("大搜车拆除单反馈接口返回:"+result);
} catch (IOException e) {
e.printStackTrace();
logger.error("请求大搜车安装单反馈接口发生异常!");
logger.error("请求大搜车拆除单反馈接口发生异常!");
}
}
......@@ -128,22 +118,6 @@ public class DscRemoveOrderFeedBackTask implements Runnable{
this.workOrderNo = workOrderNo;
}
public DictionaryDataMapper getDictionaryDataMapper() {
return dictionaryDataMapper;
}
public void setDictionaryDataMapper(DictionaryDataMapper dictionaryDataMapper) {
this.dictionaryDataMapper = dictionaryDataMapper;
}
public SysOrderFileMapper getSysOrderFileMapper() {
return sysOrderFileMapper;
}
public void setSysOrderFileMapper(SysOrderFileMapper sysOrderFileMapper) {
this.sysOrderFileMapper = sysOrderFileMapper;
}
public SysOrderDeviceMapper getSysOrderDeviceMapper() {
return sysOrderDeviceMapper;
}
......@@ -151,4 +125,12 @@ public class DscRemoveOrderFeedBackTask implements Runnable{
public void setSysOrderDeviceMapper(SysOrderDeviceMapper sysOrderDeviceMapper) {
this.sysOrderDeviceMapper = sysOrderDeviceMapper;
}
public SysOrderMapper getSysOrderMapper() {
return sysOrderMapper;
}
public void setSysOrderMapper(SysOrderMapper sysOrderMapper) {
this.sysOrderMapper = sysOrderMapper;
}
}
......@@ -6,13 +6,8 @@ import com.glsx.gps.utils.HttpUtil;
import com.glsx.ordercenter.dto.DscRepairOrderBackDeviceDto;
import com.glsx.ordercenter.dto.req.DaSouCheRequest;
import com.glsx.ordercenter.dto.DscOrderFeedBackDto;
import com.glsx.ordercenter.mapper.DictionaryDataMapper;
import com.glsx.ordercenter.mapper.SysOrderDeviceMapper;
import com.glsx.ordercenter.mapper.SysOrderFileMapper;
import com.glsx.ordercenter.mapper.SysOrderMapper;
import com.glsx.ordercenter.pojo.SysOrder;
import com.glsx.ordercenter.pojo.SysOrderDevice;
import com.glsx.ordercenter.pojo.SysOrderFile;
import com.glsx.ordercenter.mapper.*;
import com.glsx.ordercenter.pojo.*;
import com.glsx.ordercenter.utils.DaSouCheUtil;
import com.souche.api.SoucheApiException;
import com.souche.api.util.SoucheSignature;
......@@ -42,6 +37,11 @@ public class DscRepairOrderFeedBackTask implements Runnable{
private SysOrderDeviceMapper sysOrderDeviceMapper;
private SysOrderRepairMapper sysOrderRepairMapper;
private SysOrderDeviceSupplierMapper sysOrderDeviceSupplierMapper;
@Override
public void run() {
String daSouCheUrl = PropertiesUtil.getProperty("dasouche.valiate.url");
......@@ -59,46 +59,63 @@ public class DscRepairOrderFeedBackTask implements Runnable{
*
*/
List<Object> deviceDtoList = new ArrayList<>();
//获取所有工单,包含衍生单
List<SysOrder> orderList = sysOrderMapper.queryOrderByWorkOrderNo(workOrderNo);
logger.info("--------order------"+orderList.size());
if(!CollectionUtils.isEmpty(orderList)){
for(SysOrder order : orderList){
SysOrderDevice orderDevice = new SysOrderDevice();
orderDevice.setOrderId(order.getId());
List<SysOrderDevice> deviceList = sysOrderDeviceMapper.getOrderDeviceList(orderDevice);
logger.info("-------device----------"+deviceList.size());
if (!CollectionUtils.isEmpty(deviceList)){
List<SysOrderFile> imgList = sysOrderFileMapper.selectByOrderId(order.getId());
List<String> imgPaths = imgList.stream().map(e -> e.getFilePath()).collect(Collectors.toList());
for (SysOrderDevice d :deviceList){
DscRepairOrderBackDeviceDto deviceDTO = new DscRepairOrderBackDeviceDto();
deviceDTO.setDevNo(d.getDeviceNo());
if(order.getRepairType().equals(0)){ //检修类型, 1,更换设备。0,无需更换
deviceDTO.setRepairScheme(1); //1:仅维修 2:设备更换 3:重新安装
}else if(order.getRepairType().equals(1)){
deviceDTO.setRepairScheme(1);
}
deviceDTO.setReplacedDevNo(""); //有更换则传,只检修则不传
deviceDTO.setDevSupplier("博实结");
String dev_type = d.getDeviceType();
if("sys_order_service_item_gps".equals(dev_type)){
deviceDTO.setDevType(1);
}else if ("sys_order_service_item_gps_wireless".equals(dev_type)){
deviceDTO.setDevType(2);
}else {
deviceDTO.setDevType(3);
if(!CollectionUtils.isEmpty(orderList)&&orderList.size()>1){
try {
SysOrderRepair orderRepair = new SysOrderRepair();
orderRepair.setId(orderList.get(0).getId());
//获取工单sys_order对应的衍生单sys_order_repair
// List<SysOrderRepair> orderRepairsList = sysOrderRepairMapper.getOrderRepairList(orderRepair);
//注意这里遍历时起始索引为1,跳过第一个主单
for(int i=1;i<orderList.size();i++){
SysOrder order = orderList.get(i);
int repairType = (int)order.getRepairType();
SysOrderDevice orderDevice = new SysOrderDevice();
orderDevice.setOrderId(order.getId());
List<SysOrderDevice> deviceList = sysOrderDeviceMapper.getOrderDeviceList(orderDevice);
logger.info("-------device----------"+deviceList.size());
if (!CollectionUtils.isEmpty(deviceList)){
List<SysOrderFile> imgList = sysOrderFileMapper.selectByOrderId(order.getId());
List<String> imgPaths = imgList.stream().map(e -> e.getFilePath()).collect(Collectors.toList());
for (SysOrderDevice d :deviceList){
DscRepairOrderBackDeviceDto deviceDTO = new DscRepairOrderBackDeviceDto();
deviceDTO.setDevNo(d.getDeviceNo());
if(repairType==0){
deviceDTO.setRepairScheme(3); //1:仅维修 2:设备更换 3:重新安装
}else if(repairType==1){
deviceDTO.setRepairScheme(2);
deviceDTO.setReplacedDevNo(""); //替换前的设备号
}else if(repairType==2){
deviceDTO.setRepairScheme(3);
deviceDTO.setReplacedDevNo(""); //有更换则传,只检修则不传
}
String dev_type = d.getDeviceType();
if("sys_order_service_item_gps".equals(dev_type)){
deviceDTO.setDevType(1);
}else if ("sys_order_service_item_gps_wireless".equals(dev_type)){
deviceDTO.setDevType(2);
}else {
deviceDTO.setDevType(3);
}
SysOrderDeviceSupplier supplier = sysOrderDeviceSupplierMapper.getDeviceSupplierByType(order.getId(),deviceDTO.getDevType()+"");
deviceDTO.setDevSupplier(supplier.getChooseSupplier());
deviceDTO.setDevModel(d.getDeviceType()); //设备型号
deviceDTO.setDevPosition(d.getInstallLocation());
if(!CollectionUtils.isEmpty(imgList)){
deviceDTO.setImgUrl(JSON.toJSONString(imgPaths));
}else{
deviceDTO.setImgUrl("null");
}
deviceDTO.setDevOwner(1);
deviceDtoList.add(deviceDTO);
}
deviceDTO.setDevModel(d.getDeviceType()); //设备型号
deviceDTO.setDevPosition(d.getInstallLocation());
if(!CollectionUtils.isEmpty(imgList)){
deviceDTO.setImgUrl(JSON.toJSONString(imgPaths));
}else{
deviceDTO.setImgUrl("null");
}
deviceDTO.setDevOwner(1);
deviceDtoList.add(deviceDTO);
}
}
} catch (Exception e){
e.printStackTrace();
}
}
dscOrderFeedBackDto.setData(deviceDtoList);
......@@ -164,4 +181,20 @@ public class DscRepairOrderFeedBackTask implements Runnable{
this.sysOrderDeviceMapper = sysOrderDeviceMapper;
}
public SysOrderDeviceSupplierMapper getSysOrderDeviceSupplierMapper() {
return sysOrderDeviceSupplierMapper;
}
public void setSysOrderDeviceSupplierMapper(SysOrderDeviceSupplierMapper sysOrderDeviceSupplierMapper) {
this.sysOrderDeviceSupplierMapper = sysOrderDeviceSupplierMapper;
}
public SysOrderRepairMapper getSysOrderRepairMapper() {
return sysOrderRepairMapper;
}
public void setSysOrderRepairMapper(SysOrderRepairMapper sysOrderRepairMapper) {
this.sysOrderRepairMapper = sysOrderRepairMapper;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!