Commit 8169ec66 by 伍思炜

新智能平台对接开发

parent 33859558
package com.winsun.controller;
import com.alibaba.druid.support.json.JSONUtils;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.winsun.bean.AttributeList;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.winsun.bean.Order;
import com.winsun.constant.Constant;
import com.winsun.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
public class TestController
{
@RequestMapping(value = "testPost", method = RequestMethod.POST)
public AttributeList testPost(@RequestBody JSONObject requestBean)
{
System.out.println(requestBean);
AttributeList responseBean = new AttributeList();
responseBean.setName("123");
responseBean.setValue("succ");
return responseBean;
public class TestController {
@Autowired
private OrderMapper orderMapper;
@RequestMapping(value = "testPost", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody
public String testPost(@RequestBody JSONObject requestBean) {
Order order = new Order();
order.setOrderId((String) requestBean.get("orderId"));
order = orderMapper.selectOne(order);
Map<Object, Object> imgUrlMap = new HashMap<>();
imgUrlMap.put("身份证正面", order.getIdCardz() != null ? Constant.SYSTEMURL + order.getIdCardz().replace("manager", "app") : "");
imgUrlMap.put("身份证反面", order.getIdCardf() != null ? Constant.SYSTEMURL + order.getIdCardf().replace("manager", "app") : "");
imgUrlMap.put("手持身份证", order.getIdCardzs() != null ? Constant.SYSTEMURL + order.getIdCardzs().replace("manager", "app") : "null");
imgUrlMap.put("学生证", order.getStudenCard() != null ? Constant.SYSTEMURL + order.getStudenCard().replace("manager", "app") : "");
String imgUrlJSON = JSONUtils.toJSONString(imgUrlMap);
return imgUrlJSON;
}
}
\ No newline at end of file
......@@ -41,6 +41,7 @@ public class Constant {
// public final static String INTRANETURL = "http://10.3.1.21:8080"; //Linux内网服务器地址
public final static String TOMCATURL = "http://yrym.winsun-aly.com"; //省windows外网服务器地址
public final static String INTRANETURL = "http://172.51.229.10:8081"; //省windows内网服务器地址
public final static String SYSTEMURL = "https://dx.dianyuanjiangli.com/"; //一人一码服务地址
// public final static String TOMCATURL = "http://ue189.com:8529"; //服务器地址
// public final static String INTRANETURL = "http://ue189.com:8529"; //服务器地址
// public final static String TOMCATURL = "http://127.0.0.1:8080"; //服务器地址
......
......@@ -94,7 +94,7 @@ public interface OrderMapper extends BaseMapper<Order> {
List<BroadBandOrder> selectBroadBandOrderList(Page<BroadBandOrder> page, BroadBandOrder broadBandOrder);
//List<Map<String, Object>> selectBroadBandOrderList2(BroadBandOrder bao,String startTime,String endTime);
List<Map<String, Object>> selectBroadBandOrderList2(BroadBandOrder bao,String startTime,String endTime);
/**
* 查询重复订单
......@@ -169,7 +169,8 @@ public interface OrderMapper extends BaseMapper<Order> {
@Select("SELECT * FROM hhr_order WHERE user_type = '5' and order_status = '未下单'")
List<Map<String,Object>> selectDKList();
@Select("SELECT * FROM hhr_order WHERE user_type = '5' and kd_order_id = 'vpsg0u4l4y8tkp1aimlh'")
@Select("SELECT * FROM hhr_order WHERE user_type = '5' and kd_order_id = 'dl6w7nvh8u34zx29w5uh'")
Map<String,Object> selectDKList2();
......
......@@ -595,4 +595,5 @@
order by create_time desc
</select>
</mapper>
\ No newline at end of file
......@@ -48,10 +48,13 @@ import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.ResourceAccessException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import javax.net.ssl.SSLHandshakeException;
......@@ -800,6 +803,7 @@ public class OrderController extends BaseController {
/**
* 移动订单清单写到 Excel文件
*
* @param map
*/
public void ExportOrderView(Map<String, Object> map) {
......@@ -818,25 +822,25 @@ public class OrderController extends BaseController {
wrapper.in("hehuoren_id", userIds);
}
wrapper.isNull("kd_order_id");
map.put("createTimeStart","123");
WrapperUtil.wrapperGe(wrapper, map,"createTimeStart","create_time");
WrapperUtil.wrapperLe(wrapper, map,"createTimeEnd","create_time");
WrapperUtil.wrapperGe(wrapper, map,"successTimeStart","success_time");
WrapperUtil.wrapperLe(wrapper, map,"successTimeEnd","success_time");
WrapperUtil.wrapperGe(wrapper, map,"kuaidiTimeStart","kuaidi_time");
WrapperUtil.wrapperLe(wrapper, map,"kuaidiTimeEnd","kuaidi_time");
WrapperUtil.wrapperEq(wrapper, map,"userType","user_type");
WrapperUtil.wrapperEq(wrapper, map,"orderNumber","order_number");
WrapperUtil.wrapperEq(wrapper, map,"hehuorenArea","hehuoren_area");
WrapperUtil.wrapperEq(wrapper, map,"customerName","customer_name");
WrapperUtil.wrapperEq(wrapper, map,"businessNumber","business_number");
WrapperUtil.wrapperEq(wrapper, map,"contactNumber","contact_number");
WrapperUtil.wrapperEq(wrapper, map,"hehuorenSchool","hehuoren_school");
WrapperUtil.wrapperLike(wrapper, map,"hehuorenName","hehuoren_name");
WrapperUtil.wrapperLike(wrapper, map,"businessPackage","business_package");
WrapperUtil.wrapperEq(wrapper, map,"orderStatus","order_status");
WrapperUtil.wrapperEq(wrapper, map,"isDelivery","is_delivery");
map.put("createTimeStart", "123");
WrapperUtil.wrapperGe(wrapper, map, "createTimeStart", "create_time");
WrapperUtil.wrapperLe(wrapper, map, "createTimeEnd", "create_time");
WrapperUtil.wrapperGe(wrapper, map, "successTimeStart", "success_time");
WrapperUtil.wrapperLe(wrapper, map, "successTimeEnd", "success_time");
WrapperUtil.wrapperGe(wrapper, map, "kuaidiTimeStart", "kuaidi_time");
WrapperUtil.wrapperLe(wrapper, map, "kuaidiTimeEnd", "kuaidi_time");
WrapperUtil.wrapperEq(wrapper, map, "userType", "user_type");
WrapperUtil.wrapperEq(wrapper, map, "orderNumber", "order_number");
WrapperUtil.wrapperEq(wrapper, map, "hehuorenArea", "hehuoren_area");
WrapperUtil.wrapperEq(wrapper, map, "customerName", "customer_name");
WrapperUtil.wrapperEq(wrapper, map, "businessNumber", "business_number");
WrapperUtil.wrapperEq(wrapper, map, "contactNumber", "contact_number");
WrapperUtil.wrapperEq(wrapper, map, "hehuorenSchool", "hehuoren_school");
WrapperUtil.wrapperLike(wrapper, map, "hehuorenName", "hehuoren_name");
WrapperUtil.wrapperLike(wrapper, map, "businessPackage", "business_package");
WrapperUtil.wrapperEq(wrapper, map, "orderStatus", "order_status");
WrapperUtil.wrapperEq(wrapper, map, "isDelivery", "is_delivery");
wrapper.orderBy("create_time", false);
List<Map<String, Object>> Orders = orderMapper.selectMaps(wrapper);
//ServletOutputStream os = null;
......@@ -1437,7 +1441,7 @@ public class OrderController extends BaseController {
}
ShiroUser user = getShiroUser();
// 当前是否有数据权限
boolean hasDataPermission = user.getRoleNames().stream().anyMatch(data -> StringUtils.equalsAny(data, "活动上单员", "数据管理员", "超级管理员", "快递公司","县分管理员(订单)"));
boolean hasDataPermission = user.getRoleNames().stream().anyMatch(data -> StringUtils.equalsAny(data, "活动上单员", "数据管理员", "超级管理员", "快递公司", "县分管理员(订单)"));
if (!hasDataPermission) {
return ResponseData.error("无数据权限!");
}
......@@ -2196,6 +2200,8 @@ public class OrderController extends BaseController {
map.put("imgUrl3", (String) map.get("idCardUrl3"));
map.put("imgUrl4", (String) map.get("idCardUrl4"));
str = sendAitransOrder(map, 0);
//ResponseEntity<String> response = sendAitransOrder2(map, 0);
//str = response.getBody();
} catch (Exception e) {
e.printStackTrace();
}
......@@ -2204,6 +2210,127 @@ public class OrderController extends BaseController {
}
// 保存卡品认证信息
public ResponseEntity<String> sendAitransOrder2(Map<String, Object> map, int count) throws NoSuchAlgorithmException, UnsupportedEncodingException {
log.info("移动下单前已有参数:" + JSONObject.fromObject(map).toString());
Map<String, String> return_data = new HashMap<>();
return_data.put("code", "");
return_data.put("route", "提交订单"); //[提交下单] [订单保存] [提交审核] 默认为提交下单
return_data.put("微信openId", "");
return_data.put("微信appId", "");
map.put("return_data", return_data);
Map<String, Object> order_data = new HashMap<>();
Map<String, Object> attachment = new HashMap<>(); // 附件
attachment.put("身份证照1", map.get("imgUrl1"));
attachment.put("身份证照2", map.get("imgUrl2"));
attachment.put("身份证照3", map.get("imgUrl3"));
attachment.put("身份证照4", map.get("imgUrl4"));
order_data.put("附件", attachment);
Map<String, Object> customerInformation = new HashMap<>(); //客户信息
customerInformation.put("联系人", (String) map.get("userName"));
customerInformation.put("客户证件号码", (String) map.get("idCard"));
customerInformation.put("客户证件姓名", (String) map.get("userName"));
customerInformation.put("联系电话", (String) map.get("linkPhone"));
customerInformation.put("客户证件地址", "");
customerInformation.put("客户证件类型", "身份证");
customerInformation.put("通讯地址", (String) map.get("address"));
order_data.put("客户信息", customerInformation);
order_data.put("订单来源单号", (String) map.get("orderNum")); // 订单来源单号,必填; 与订单来源对应,用于业务上记录订单的来源订单编号
order_data.put("订单备注", "");
order_data.put("付费类型", "预付费"); //预付费、后付费、其他 选填
Map<String, Object> packageInformation = new HashMap<>(); //揽装信息
packageInformation.put("揽装工号", "44094951");
order_data.put("揽装信息", packageInformation);
HashMap<String, Object> invoiceInformation = new HashMap<>(); //发票信息
invoiceInformation.put("发票抬头", ""); //若发票投递方式为不需要,可以不填值,但必须有参数
invoiceInformation.put("发票投递方式", "不需要"); // 必填 一次性发票,分月发票,不需要
invoiceInformation.put("电子邮箱", ""); //若发票投递方式为不需要,可以不填值,但必须有参数
order_data.put("发票信息", invoiceInformation);
order_data.put("接口下单账号", "xyzx"); //接口下单账号
HashMap<String, Object> orderingProducts = new HashMap<>(); //订购产品
orderingProducts.put("产品SKU", "");
orderingProducts.put("产品名称", map.get("cardType"));
orderingProducts.put("受理内容", "");
orderingProducts.put("付费类型", "");
// 属性列表
AttributeList roadbandRate = new AttributeList();
AttributeList userCategory = new AttributeList();
userCategory.setName("用户类别");
userCategory.setValue("学生");
AttributeList studentID = new AttributeList();
studentID.setName("学生证号");
studentID.setValue((String) map.get("idCard"));
AttributeList userType = new AttributeList();
userType.setName("用户类型");
userType.setValue((String) map.get("cardType"));
AttributeList[] attributeList = new AttributeList[]{roadbandRate, userCategory, studentID, userType}; //属性列表
orderingProducts.put("属性列表", attributeList);
order_data.put("业务类型", "移动业务"); //业务类型
List<Map<String, Object>> mobileAccessList = new ArrayList<>(); //移动接入
Map<String, Object> mobileAccess = new HashMap<>();
mobileAccess.put("订购类型", "新装");
mobileAccess.put("UIM实物串号", map.get("iccId"));
mobileAccess.put("号码类型", "主卡");
mobileAccess.put("移动接入号", map.get("orderNumber"));
mobileAccessList.add(mobileAccess);
order_data.put("移动接入", mobileAccessList);
Map<String, Object> realNameInformation = new HashMap<>(); //实名信息
realNameInformation.put("姓名", "主卡");
realNameInformation.put("身份证号", map.get("idCard"));
realNameInformation.put("ICCID", map.get("iccId"));
order_data.put("实名信息", realNameInformation);
String order_dataJSON = com.alibaba.fastjson.JSONObject.toJSONString(order_data);
ResponseEntity<String> responese = null;
try {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
headers.add("Content-Type", "application/json;charset=utf-8");
//签名
/*
headers.add("Hmac", znptSignUtils.macSHA1(order_dataJSON));*/
org.springframework.http.HttpEntity<Object> httpEntity = new org.springframework.http.HttpEntity<>(order_dataJSON, headers);
RestTemplate restTemplate = new RestTemplate();
restTemplate.setMessageConverters(Collections.singletonList(new StringHttpMessageConverter(Charset.forName("UTF-8"))));
log.info("提交参数:" + order_dataJSON);
com.winsun.constant.Constant.trustEveryone();
responese = restTemplate.postForEntity("http://localhost:11092/ciop/testPost"/*"https://faas.mini189.cn/function/id-generator-snowflake"+".dev-fn"*/, httpEntity, String.class);
log.info("移动下单接口,返回信息:" + responese);
System.out.println(responese);
} catch (ResourceAccessException e) {
count++;
if (count < 20) {
responese = sendAitransOrder2(map, count);
} else {
log.error("单宽带(预付费、移动、融合、续约、增值)下单接口异常尝试20次失误。请检查接口");
}
} catch (Exception e) {
log.error("[HTTP] [CREATE_ORDER] 预付费下单接口异常");
e.printStackTrace();
}
return responese;
}
public String sendAitransOrder(Map<String, Object> map, int count) throws NoSuchAlgorithmException, UnsupportedEncodingException {
// HttpHost proxy = new HttpHost("172.18.101.170", 3128);
RequestConfig defaultRequestConfig = RequestConfig.custom().setSocketTimeout(600000).setConnectTimeout(600000)
......
......@@ -104,7 +104,7 @@ public class OrderViewController extends BaseController {
return ResponseData.success(page, "查询成功!");
}
@Permission(menuname = "导出宽带订单", value = "download", method = RequestMethod.POST)
/*@Permission(menuname = "导出宽带订单", value = "download", method = RequestMethod.POST)
public ResponseData<String> downloadOrderView(BroadBandOrder broadBandOrder){
ShiroUser user = getShiroUser();
if (!user.getRoleNames().stream().anyMatch(roleName -> StringUtils.equalsAny(roleName, "超级管理员", "系统管理员", "县分管理员(订单)", "修改身份证", "合伙人"))) {
......@@ -126,6 +126,6 @@ public class OrderViewController extends BaseController {
return ResponseData.error("导出失败");
}
return ResponseData.success("导出成功");
}
}*/
}
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