Commit 523af857 by 董有沛
parents 9197a272 586d0b54
......@@ -108,7 +108,7 @@ public class DankuanController {
* @throws Exception
*/
@RequestMapping("/createProductOrder")
public ResponseData<OrderView> createProductOrder(@RequestParam("orderName") String orderName, @RequestParam("orderPhone") String orderPhone,
public ResponseData<Object> createProductOrder(@RequestParam("orderName") String orderName, @RequestParam("orderPhone") String orderPhone,
@RequestParam("orderNumber") String orderNumber, @RequestParam("orderCustomerStudentId") String orderCustomerStudentId,
@RequestParam("orderCustomerAccount") String orderCustomerAccount, @RequestParam("orderCustomerPwd") String orderCustomerPwd,
@RequestParam("orderSetMeal") String orderSetMeal, @RequestParam("productId") String productId,
......@@ -179,15 +179,18 @@ public class DankuanController {
orderView.setCustomerId("xyzxyql");
orderView.setOrderCustomerType("学生");
if (webOrderAmount.equals("0")) {
ResponseData<OrderView> res = createOrder(orderView, partner, orderSeq);
ResponseData<Object> res = createOrder(orderView, partner, orderSeq);
if (!res.isSuccess()) {
return res;
}
Order order =(Order) res.getData();
orderV.setOrderRf2(order.getId());
}
Integer insert = orderViewMapper.insert(orderView);
if (insert == 1) {
orderV.setOrderId(orderView.getOrderId());
orderV.setOrderSeq(orderView.getOrderSeq());
orderV.setWebOrderAmount(webOrderAmount);
return ResponseData.success(orderV, "订单提交完成!");
}
return ResponseData.error("提交失败!");
......@@ -201,7 +204,7 @@ public class DankuanController {
* @return
* @throws Exception
*/
public ResponseData<OrderView> createOrder(OrderView orderView, String userId, String orderseq) throws Exception {
public ResponseData<Object> createOrder(OrderView orderView, String userId, String orderseq) throws Exception {
String uuid = UUID.randomUUID().toString();
String id = uuid.split("-")[0] + uuid.split("-")[1];
Order order = new Order();
......@@ -262,7 +265,7 @@ public class DankuanController {
JSONArray saleList = saleJsonObject.getJSONArray("list");
JSONObject itmeJson = JSONObject.parseObject(saleList.get(0).toString());
saleId = itmeJson.getString("saleId");*/
JSONObject submitOrderJsonObject = getOrderInfo(schoolMap, orderView, currentTimeStr, productId, saleId, "", "", "", "");
JSONObject submitOrderJsonObject = getOrderInfo(schoolMap, orderView, currentTimeStr, productId, saleId, "", "00000", "0元", "00000");
String orderNum = (String) submitOrderJsonObject.get("orderNumber");
if (StringUtils.isNotBlank(orderNum)) {
Wrapper<OrderView> wrapper = new EntityWrapper<>();
......@@ -279,7 +282,7 @@ public class DankuanController {
} else {
return ResponseData.error("智能平台订单创建失败,如有疑问请联系客服!");
}
return ResponseData.success(orderView, "智能平台订单创建成功");
return ResponseData.success(order, "智能平台订单创建成功");
}
/**
......@@ -318,7 +321,6 @@ public class DankuanController {
orderViewMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(dataMapping), wrapper);
wrapper.eq("orderSeq", orderseq);
orderMap = orderViewMapper.selectList(wrapper).get(0);
// 根据学校名称,获取该学校信息
......@@ -455,7 +457,7 @@ public class DankuanController {
//单宽回调后端接口地址
// map.put("BACKDROPURL", Constant.TOMCATURL + "/dankuan/toSubmisOrderPreser");
map.put("BACKDROPURL", "http://yrym.winsun-aly.com/gdtel-xyzx-hhr/paymentCon/toSubmisOrderPreser.do");
map.put("BACKDROPURL", "http://167460x6b0.51mypc.cn/ciop/dankuan/toSubmisOrderPreser.do");
String str = "ORDERSEQ=" + orderView.getOrderSeq() + "&ORDERDATE=" + ft.format(orderdate) + "&ORDERAMOUNT=" + orderView.getWebOrderAmount() + "&KEY=" + Constant.KEY;//商户标识
......@@ -699,13 +701,6 @@ public class DankuanController {
qParams.add(new BasicNameValuePair("addressCity", "广州市")); //报装地址城市,必填
signMap.put("addressCity", "广州市");
qParams.add(new BasicNameValuePair("deliveryProvince", "广东省"));// 配送地址-省,必填
signMap.put("deliveryProvince", "广东省");
qParams.add(new BasicNameValuePair("deliveryCity", "广州市"));// 配送地址-市,必填
signMap.put("deliveryCity", "广州市");
String addressDistrict = null;
String address = null;
String addressID = null;
......@@ -755,19 +750,11 @@ public class DankuanController {
signMap.put("addressDistrict", addressDistrict);
qParams.add(new BasicNameValuePair("address", address)); //报装详细地址,必填
signMap.put("address", address);
qParams.add(new BasicNameValuePair("deliveryDistrict", addressDistrict));// 配送地址-区,必填
signMap.put("deliveryDistrict", addressDistrict);
qParams.add(new BasicNameValuePair("deliveryAddress", address));// 配送地址-详细地址,必填
signMap.put("deliveryAddress", address);
qParams.add(new BasicNameValuePair("deliveryContact", orderMap.getOrderName())); //报装联系人,必填
signMap.put("deliveryContact", orderMap.getOrderName());
qParams.add(new BasicNameValuePair("deliveryContactPhone", orderMap.getOrderPhone())); //报装联系电话,必填
signMap.put("deliveryContactPhone", orderMap.getOrderPhone());
qParams.add(new BasicNameValuePair("invoiced", "0")); //是否需要发票 0:否 1:是,必填
signMap.put("invoiced", "0");
qParams.add(new BasicNameValuePair("invoiceTitle", "")); //若需要发票,发票抬头,必填
......@@ -816,34 +803,13 @@ public class DankuanController {
paymentMap.put("bank", "");//缴费银行,缴费方式为“银行划账”时必填 :[中国银行|中国工商银行|中国农业银行|民生银行|招商银行|中信银行|商业银行|广东发展银行|光大银行|华夏银行|兴业银行|浦发银行|广州农村商业银行|广州银行|深圳发展银行|交通银行|中国建设银行|邮政储蓄]
paymentMap.put("bankNumber", "");//银行账号,缴费方式为“银行划账”时必填
paymentMap.put("bankOwner", "");////银行账号持有人,缴费方式为“银行划账”时必填
String payPlatform = orderMap.getIPay();
if (StringUtils.isNotBlank(payPlatform)) {
if ("1".equals(payPlatform)) {
paymentMap.put("payPlatform", "支付宝");//支付平台,缴费方式为“穗易付”时必填
} else {
paymentMap.put("payPlatform", "微信");//支付平台,缴费方式为“穗易付”时必填
}
} else {
paymentMap.put("payPlatform", "穗易付");//支付平台,缴费方式为“穗易付”时必填
}
if (StringUtils.isNotBlank(UPTRANSEQ)) {
paymentMap.put("electronicPayNumber", UPTRANSEQ);//支付流水号,缴费方式为“穗易付”时必填
} else {
paymentMap.put("electronicPayNumber", "");//支付流水号,缴费方式为“穗易付”时必填
}
if (StringUtils.isNotBlank(ORDERREQTRANSEQ)) {
paymentMap.put("payOrderNumber", ORDERREQTRANSEQ);// 穗易付订单号,若选择穗易付,此项必填
} else {
paymentMap.put("payOrderNumber", "");// 穗易付订单号,若选择穗易付,此项必填
}
if (StringUtils.isNotBlank(ORDERAMOUNT)) {
paymentMap.put("payAmount", ORDERAMOUNT);//缴费金额(打款金额),缴费方式为“代理商打款”或“穗易付”时必填
} else {
paymentMap.put("payAmount", "");//缴费金额(打款金额),缴费方式为“代理商打款”或“穗易付”时必填
}
paymentMap.put("payPlatform", "");
paymentMap.put("electronicPayNumber", "");//支付流水号,缴费方式为“穗易付”时必填
paymentMap.put("payOrderNumber", "");// 穗易付订单号,若选择穗易付,此项必填
paymentMap.put("alipayUserid", "");//用户ID,缴费方式为“支付宝支付”时必填
paymentMap.put("alipayNumber", "");//支付宝账号,缴费方式为“支付宝支付”时必填
paymentMap.put("alipayAuthNumber", "");//授权协议号,缴费方式为“支付宝支付”时必填
paymentMap.put("payAmount", "");//缴费金额(打款金额),缴费方式为“代理商打款”或“穗易付”时必填
paymentList.add(paymentMap);
//产品自定义属性;暂时默认属性名称只能传“日租卡号码”
Map<String, String> propertyMap = new HashMap<String, String>();
......
......@@ -77,7 +77,7 @@ public class RongHeController {
* @return
*/
@RequestMapping("/rhData")
public ResponseData<Map<String, Object>> getRhData(@RequestParam("hhrId") String hhrId,@RequestParam("phone") String phone) {
public ResponseData<Map<String, Object>> getRhData(@RequestParam("hhrId") String hhrId, @RequestParam("phone") String phone) {
//空,直接返回
if (StringUtils.isEmpty(hhrId)) {
return ResponseData.error("请输入合伙人id");
......@@ -102,17 +102,18 @@ public class RongHeController {
/**
* 支付平台异步更新后台地址,主要对订单进去保存和提交订单到智能平台上
*
* @return
* @throws Exception
*/
@RequestMapping("/createRongHeOrder")
public ResponseData<OrderView> createRongHeOrder(
public ResponseData<Object> createRongHeOrder(
@RequestParam("orderName") String orderName, @RequestParam("orderPhone") String orderPhone,
@RequestParam("orderNumber") String orderNumber, @RequestParam("orderCustomerStudentId") String orderCustomerStudentId,
@RequestParam("orderCustomerAccount") String orderCustomerAccount, @RequestParam("orderCustomerPwd") String orderCustomerPwd,
@RequestParam("orderSetMeal") String orderSetMeal, @RequestParam("productId") String productId,
@RequestParam("webOrderAmount") String webOrderAmount, @RequestParam("partner") String partner,
@RequestParam("banLiPhone") String banLiPhone ) throws Exception {
@RequestParam("banLiPhone") String banLiPhone, @RequestParam("rhTime") String rhTime) throws Exception {
Wrapper<OrderView> orderViewWrapper = new EntityWrapper<>();
orderViewWrapper.eq(StringUtils.isNotBlank(orderNumber), "orderNumber", orderNumber);
......@@ -166,6 +167,7 @@ public class RongHeController {
orderView.setStatus(OrderStatus.NOTPAID.getId());
orderView.setOrderRegion(product.getProductRegion()); // 区域
orderView.setPayType("1"); // 支付方式
orderView.setOrderRf2(rhTime);
orderView.setWebOrderAmount(webOrderAmount); // 产品价格
if (webOrderAmount.equals("0")) {
orderView.setIPay("0"); // 支付平台
......@@ -174,31 +176,32 @@ public class RongHeController {
}
orderView.setCustomerId("xyzxyql"); // 接入商
orderView.setOrderCustomerType("学生"); // 用户类别
if (webOrderAmount.equals("0")) {
ResponseData<OrderView> res = createOrder(productId,orderView, partner, orderSeq);
ResponseData<Object> res = createOrder(productId, orderView, partner, rhTime);
if (!res.isSuccess()) {
return res;
}
Order order =(Order) res.getData();
orderV.setOrderRf2(order.getId());
}
Integer insert = orderViewMapper.insert(orderView);
if (insert == 1) {
Wrapper<OrderView> ovWrapper = new EntityWrapper<>();
ovWrapper.eq(StringUtils.isNotBlank(orderNumber), "orderNumber", orderNumber);
ovWrapper.eq("orderSeq", orderSeq);
List<OrderView> list = orderViewMapper.selectList(ovWrapper);
orderV.setOrderId(list.get(0).getOrderId());
orderV.setOrderId(orderView.getOrderId());
orderV.setOrderSeq(orderSeq);
orderV.setWebOrderAmount(webOrderAmount);
return ResponseData.success(orderV, "订单提交完成!");
}
return ResponseData.error("提交失败!");
}
public ResponseData<OrderView> createOrder(String productId,OrderView orderView, String userId, String orderseq) throws Exception {
public ResponseData<Object> createOrder(String productId, OrderView orderView, String userId, String rhTime) throws Exception {
String uuid = UUID.randomUUID().toString();
String id = uuid.split("-")[0] + uuid.split("-")[1];
Order order = new Order();
order.setId(id);
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd");
Date parse = simpleDateFormat1.parse(rhTime);
order.setRhTime(parse);
order.setOrderNumber(orderView.getOrderSeq());
order.setOrderStatus(OrderStatus.NOTPAID.getName());
order.setHehuorenId(userId);
......@@ -227,73 +230,16 @@ public class RongHeController {
// 根据学校名称,获取该学校信息
Product product = productMapper.selectById(productId);
Wrapper<UniversityInfo> uiWrapper = new EntityWrapper<>();
uiWrapper.eq("university_id",product.getUniversityId());
uiWrapper.eq("university_id", product.getUniversityId());
List<Map<String, Object>> list1 = universityInfoMapper.selectMaps(uiWrapper);
Map<String, Object> schoolMap = list1.get(0);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String currentTimeStr = simpleDateFormat.format(new Date());
//单宽带
String saleId1 = "4907";
//提速包
String saleId2 = null;
String productName = "校园融合套餐";
log.info("----------根据返回参数获取产品ID:" + productId);
String saleId = null; // 销售id
JSONObject saleJsonObject = getSaleId(productId, currentTimeStr); // 获取销售ID
log.info("----------调用智能平台的获取销售品接口返回值:" + saleJsonObject);
log.info("----111--" + (saleJsonObject.toString().indexOf("list") == -1));
if (saleJsonObject.toString().indexOf("list") == -1) {
return ResponseData.error("没有找到销售品接口返回值");
}
String expenses = "";
if (schoolMap.get("identifying") != null) {
expenses = schoolMap.get("identifying").toString();
}
JSONArray saleList = saleJsonObject.getJSONArray("list");
log.info("----saleList---:" + saleList);
for (int i = 0; i < saleList.size(); i++) {
JSONObject itmeJson = saleList.getJSONObject(i);
// 判断获取的全部产品与订单产品符合的拿取对应的ID
if (itmeJson.getString("propertyName").indexOf("提速包") != -1) {
if (itmeJson.getString("name").equals(expenses)) {
// 获取对应产品ID
saleId2 = itmeJson.getString("saleId");
}
} else if (itmeJson.getString("propertyName").indexOf("增值业务") != -1) {
if (itmeJson.getString("name").equals(expenses)) {
// 获取对应产品ID
saleId2 = itmeJson.getString("saleId");
}
}
}
JSONObject submitOrderJsonObject = getOrderInfo(schoolMap, orderView, currentTimeStr, productId, saleId1,saleId2, "", "", "", "");
String orderNum = (String) submitOrderJsonObject.get("orderNumber");
if (StringUtils.isNotBlank(orderNum)) {
Wrapper<OrderView> wrapper = new EntityWrapper<>();
wrapper.eq("orderSeq", orderseq);
Map<String, Object> dataMapping1 = new HashMap<>();
dataMapping1.put("orderSeqTHD", orderNum);
dataMapping1.put("status", "已支付");
orderViewMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(dataMapping1), wrapper);
order.setOrderStatus("审核中");
order.setOrderId(orderNum);
order.setThStatus(submitOrderJsonObject.get("status").toString());
orderMapper.insert(order);
appMapper.inserOrderHis(id, "待审核!", new Date(), orderView.getOrderName());
} else {
return ResponseData.error("智能平台订单创建失败,如有疑问请联系客服!");
}
return ResponseData.success(orderView, "智能平台订单创建成功");
order.setOrderStatus("未下单");
orderMapper.insert(order);
appMapper.inserOrderHis(id, "待下单!", new Date(), orderView.getOrderName());
return ResponseData.success(order, "订单创建成功");
}
@RequestMapping(value = "toSubmisOrderPreser", method = {RequestMethod.GET, RequestMethod.POST}, produces = "text/plain;charset=UTF-8")
public void toSubmisOrderPreser(HttpServletRequest request) throws Exception {
OrderView orderMap = null;
Map<String, Object> schoolMap = null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String currentTimeStr = simpleDateFormat.format(new Date());
log.info("----------异步通知后返回入口----------");
String orderseq = request.getParameter("ORDERSEQ");//orderseq
String uptranseq = request.getParameter("UPTRANSEQ"); // 穗易付平台,支付流水号uptranseq
String orderamount = request.getParameter("ORDERAMOUNT");//orderamount 价格
......@@ -315,86 +261,22 @@ public class RongHeController {
dataMapping.put("order_payment_time", new Date());
dataMapping.put("status", "已支付");
orderViewMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(dataMapping), wrapper);
wrapper.eq("orderSeq", orderseq);
orderMap = orderViewMapper.selectList(wrapper).get(0);
// 根据学校名称,获取该学校信息
Wrapper<UniversityInfo> wrapper1 = new EntityWrapper<>();
wrapper1.eq("university_name", orderMap.getOrderUniversityName());
wrapper1.eq("university_region", orderMap.getOrderRegion());
schoolMap = universityInfoMapper.selectMaps(wrapper1).get(0);
if (StringUtils.isBlank(orderMap.getOrderseqThd())) {
// 1、获取产品ID
JSONObject productJsonObject = getProductId(currentTimeStr);
log.info("----------调用智能平台的产品接口返回参数:" + productJsonObject);
// 2、获取销售品ID
if (productJsonObject.toString().indexOf("list") == -1) {
return;
}
JSONArray list = productJsonObject.getJSONArray("list");
String productId = null; // 产品id
orderamount = orderamount.replace("元", "");
orderamount = orderamount.replace(".00", "");
String productName = "校园宽带" + orderamount + "元";
if (orderamount.equals("0.01")) {
productName = "校园宽带30元";
} else if (orderamount.equals("0.02")) {
productName = "校园宽带300元";
}
log.info("------" + productName);
//productName = "校园宽带30元";
for (int i = 0; i < list.size(); i++) {
JSONObject itmeJson = JSONObject.parseObject(list.get(i).toString());
// 判断获取的全部产品与订单产品符合的拿取对应的ID
if (itmeJson.getString("name").indexOf(productName) != -1) {
productId = itmeJson.getString("id"); // 获取对应产品ID
break;
}
}
log.info("----------根据返回参数获取产品ID:" + productId);
String saleId = null; // 销售id
JSONObject saleJsonObject = getSaleId(productId, currentTimeStr); // 获取销售ID
log.info("----------调用智能平台的获取销售品接口返回值:" + saleJsonObject);
JSONArray saleList = saleJsonObject.getJSONArray("list");
JSONObject itmeJson = JSONObject.parseObject(saleList.get(0).toString());
saleId = itmeJson.getString("saleId");
// 3、提交订单到智能平台
JSONObject submitOrderJsonObject = getOrderInfo(schoolMap, orderMap, currentTimeStr, productId, saleId,"", orderseq, uptranseq, orderamount, orderreqtranseq);
log.info("----------调用单宽带接口(提交订单至智能平台)并返回参数信息---status:" + submitOrderJsonObject.get("status") + " msg:" + submitOrderJsonObject.get("msg") + " orderNum:" + submitOrderJsonObject.get("orderNumber"));
// 4、查询智能订单是否存在
String orderNum = (String) submitOrderJsonObject.get("orderNumber");
if (StringUtils.isNotBlank(orderNum)) {
/* 5、更新数据库 */
Map<String, Object> dataMapping1 = new HashMap<>();
dataMapping1.put("orderSeqTHD", orderNum);
dataMapping1.put("status", "已支付");
orderViewMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(dataMapping1), wrapper);
Wrapper<Order> objectEntityWrapper = new EntityWrapper<>();
objectEntityWrapper.eq("order_number", orderseq);
Map<String, Object> dataMapping2 = new HashMap<>();
dataMapping2.put("order_status", "审核中");
dataMapping2.put("order_id", orderNum);
dataMapping2.put("th_status", submitOrderJsonObject.get("status"));
orderMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(dataMapping2), objectEntityWrapper);
List<Order> orders = orderMapper.selectList(objectEntityWrapper);
appMapper.inserOrderHis(orders.get(0).getId(), "支付完成,待审核!", new Date(), orders.get(0).getCustomerName());
}
} else {
log.info("---单宽支付接口推送---" + orderseq + "---" + uptranseq + "---" + orderamount + "---" + orderreqtranseq);
}
Wrapper<Order> objectEntityWrapper = new EntityWrapper<>();
objectEntityWrapper.eq("order_number", orderseq);
Map<String, Object> dataMapping2 = new HashMap<>();
dataMapping2.put("order_status", "未下单");
orderMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(dataMapping2), objectEntityWrapper);
List<Order> orders = orderMapper.selectList(objectEntityWrapper);
appMapper.inserOrderHis(orders.get(0).getId(), "支付完成,未下单!", new Date(), orders.get(0).getCustomerName());
}
@RequestMapping(value = "orderPay", method = {RequestMethod.GET, RequestMethod.POST}, produces = "text/plain;charset=UTF-8")
@ResponseBody
public String toPaymentPlatformPage(@RequestParam("orderId") String orderId, @RequestParam("ipay") String ipay, @RequestParam("userId") String userId, HttpServletRequest request, HttpServletResponse response) throws Exception {
JsoupMethodZhifu(orderId, ipay, userId, request, response);
public String toPaymentPlatformPage(@RequestParam("orderId") String orderId, @RequestParam("ipay") String ipay,
@RequestParam("userId") String userId, HttpServletRequest request,
HttpServletResponse response, @RequestParam("rhTime") String rhTime) throws Exception {
JsoupMethodZhifu(orderId, ipay, userId, request, response, rhTime);
return null;
}
......@@ -404,12 +286,13 @@ public class RongHeController {
return ResponseData.success(universityInfo);
}
/**
* @author ljh
* @Description:支付请求
*/
public void JsoupMethodZhifu(String orderId, String ipay, String userId,
HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpServletRequest request, HttpServletResponse response, String rhTime) throws Exception {
log.info("----------首先发送支付请求接口----------");
//查询订单信息
OrderView orderView = orderViewMapper.selectById(orderId);
......@@ -442,13 +325,14 @@ public class RongHeController {
if (Constant.Payment1.equals(ipay)) {
//支付成功回调的页面
// String MERCHANTURL = Constant.TOMCATURL + "/dankuan/toPaymentSuccessPage?id=" + userId +"orderId="+id;
String MERCHANTURL = "https://www.baidu.com";
map.put("MERCHANTURL", MERCHANTURL);
/* String MERCHANTURL = Constant.TOMCATURL + "/dankuan/toSubmisOrderPreser?id=" + userId +"orderId="+id;*/
/* String MERCHANTURL = "http://167460x6b0.51mypc.cn/ciop/rongHe/toSubmisOrderPreser?id=" + userId +"orderId="+id;*/
String MERCHANTURL = "www.baidu.com";
map.put("MERCHANTURL", MERCHANTURL);
}
//单宽回调后端接口地址
// map.put("BACKDROPURL", Constant.TOMCATURL + "/dankuan/toSubmisOrderPreser");
map.put("BACKDROPURL", "http://yrym.winsun-aly.com/gdtel-xyzx-hhr/paymentCon/toSubmisOrderPreser.do");
map.put("BACKDROPURL", "http://167460x6b0.51mypc.cn/ciop/rongHe/toSubmisOrderPreser.do");
String str = "ORDERSEQ=" + orderView.getOrderSeq() + "&ORDERDATE=" + ft.format(orderdate) + "&ORDERAMOUNT=" + orderView.getWebOrderAmount() + "&KEY=" + Constant.KEY;//商户标识
//* 将值转换为大写 *//*
......@@ -486,7 +370,6 @@ public class RongHeController {
Order order = new Order();
order.setId(id);
order.setOrderNumber(orderView.getOrderSeq());
order.setOrderStatus(OrderStatus.NOTPAID.getName());
order.setHehuorenId(userId);
order.setCustomerName(orderView.getOrderName());
order.setContactNumber(orderView.getOrderPhone());
......@@ -509,6 +392,10 @@ public class RongHeController {
SysUser user = sysUserMapper.selectById(userId1.get(0));
order.setSupervisorName(user.getName());
order.setLzgh(school.getLzgh());
order.setOrderStatus("未下单");
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd");
Date parse = simpleDateFormat1.parse(rhTime);
order.setRhTime(parse);
orderMapper.insert(order);
appMapper.inserOrderHis(id, "支付请求提交!", new Date(), orderView.getOrderName());
response.sendRedirect(result);
......@@ -993,7 +880,7 @@ public class RongHeController {
log.info("---------plaintext---------:" + plaintext);
String sign = MD5Utils.md5(plaintext).toUpperCase();//md5加密
qParams.add(new BasicNameValuePair("sign", sign));//签名,必填
log.info("---------sign---------:" + sign );
log.info("---------sign---------:" + sign);
JSONObject resultDataJson = null;
try {
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
......@@ -1005,7 +892,7 @@ public class RongHeController {
log.info("融合下单接口,返回信息:" + httpResult);
resultDataJson = JSONObject.parseObject(httpResult);
} catch (Exception e) {
log.error("融合下单接口接口异常");
log.error("融合下单接口接口异常");
e.printStackTrace();
} finally {
httpPost.releaseConnection();
......
package com.winsun.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.winsun.auth.core.base.controller.BaseController;
import com.winsun.auth.core.common.model.ResponseData;
import com.winsun.bean.YxtAddress;
import com.winsun.bean.YxtCoupon;
import com.winsun.mapper.YxtAddressMapper;
import com.winsun.mapper.YxtCouponMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 兑换券校检
*
* @Author: xiangli
* @Date:
*/
@Slf4j
@RestController
@RequestMapping("/yxtCard")
public class YxtCardController extends BaseController {
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@Autowired
private YxtCouponMapper yxtCouponMapper;
@Autowired
private YxtAddressMapper yxtAddressMapper;
/**
* 进入院线通兑换券销售界面
* @return
*/
@RequestMapping("/getCardCount")
public ResponseData<Map<String, Object>> getCardCount() {
Wrapper<YxtCoupon> yxtCouponWrapper = new EntityWrapper<>();
yxtCouponWrapper.eq("state",1);
yxtCouponWrapper.eq("shelf_state",1);
Integer cardNum = yxtCouponMapper.selectCount(yxtCouponWrapper);
Wrapper<YxtCoupon> yxtCouponWrapper1 = new EntityWrapper<>();
yxtCouponWrapper1.eq("state",2);
Integer salesNum = yxtCouponMapper.selectCount(yxtCouponWrapper1);
Map<String, Object> map = new Hashtable<>();
map.put("cardNum",cardNum);
map.put("salesNum",salesNum);
map.put("nMoney",25.0);
return ResponseData.success(map);
}
/**
* 进入院线通实体票下单界面
* @return
*/
@RequestMapping("/enterPay")
public ResponseData<String> enterPay(){
/*String code = request.getParameter("code");
String result = WxInterfacesUtil.getAccess_tokenByCode(code);
if (StringUtils.isNotBlank(result)) {
JSONObject obj = JSONObject.fromObject(result);
String openId = String.valueOf(obj.get("openid"));
// code重复使用时,从session拿出第一次保存openId赋予openId
if("null".equals(openId) && !"null".equals(String.valueOf(request.getSession().getAttribute("openId")))){
openId = String.valueOf(request.getSession().getAttribute("openId"));
}
// code重复使用时,openId为"null",不更新session
if(!"null".equals(openId)){
request.getSession().setAttribute("openId", openId);
}
request.setAttribute("openId", openId);
System.out.println("openId:" +openId);
}*/
String openId = "isOk";
return ResponseData.success(openId);
}
/**
* 获取用户地址
* @return
*/
@RequestMapping("/getUserAddress")
public ResponseData<List<YxtAddress>> getUserAddress(@RequestParam("userId") String userId,@RequestParam("addressId") String addressId){
Wrapper<YxtAddress> wrapper = new EntityWrapper<>();
if(StringUtils.isNotBlank(addressId)){
wrapper.eq(StringUtils.isNotBlank(userId),"id",addressId);
}else{
wrapper.eq("user_id",userId);
}
List<YxtAddress> list = yxtAddressMapper.selectList(wrapper);
return ResponseData.success(list);
}
/**
* 获取用户地址
* @return
*/
@RequestMapping("/addAddress")
public ResponseData<List<YxtAddress>> addAddress(@RequestParam("address") String address){
HashMap hashMap = JSON.parseObject(address, HashMap.class);
YxtAddress yxtAddress = new YxtAddress();
String userId = hashMap.get("userId").toString();
yxtAddress.setUserId(userId);
String consignee = hashMap.get("consignee").toString();
if(StringUtils.isBlank(consignee)){
return ResponseData.error("收货人不能为空!!!");
}
yxtAddress.setConsignee(consignee);
String phone = hashMap.get("phone").toString();
if(StringUtils.isBlank(phone)){
return ResponseData.error("联系电话不能为空!!!");
}
yxtAddress.setPhone(phone);
String area = hashMap.get("area").toString();
if(StringUtils.isBlank(area)){
return ResponseData.error("地址不能为空!!!");
}
yxtAddress.setArea(area);
yxtAddress.setDetailAddress(hashMap.get("detailAddress").toString());
yxtAddress.setUpdateDate(new Date());
Integer num = yxtAddressMapper.insert(yxtAddress);
if(num==1){
return ResponseData.success();
}
return ResponseData.error("新增地址失败!!!");
}
}
......@@ -20,36 +20,36 @@ public class LzKpi implements Serializable {
*
*/
@TableId(value = "id", type = IdType.AUTO)
private int id;
private Integer id;
/**
*
*/
@TableId(value = "report_daily")
private int reportDaily;
private Integer reportDaily;
/**
*
*/
@TableId(value = "collective_sales")
private int collectiveSales;
private Integer collectiveSales;
/**
*
*/
@TableId(value = "weekly_meeting")
private int weeklyMeeting;
private Integer weeklyMeeting;
/**
*
*/
@TableId(value = "organ_training")
private int organTraining;
private Integer organTraining;
/**
*
*/
@TableId(value = "design_plan")
private int designPlan;
private Integer designPlan;
/**
*
*/
private int kpi;
private Integer kpi;
/**
*
*/
......
......@@ -42,22 +42,22 @@ public class LzWage implements Serializable {
* 放号薪酬
*/
@TableField("recharge_wage")
private double rechargeWage;
private Double rechargeWage;
/**
* kpi总值
*/
@TableField("kpi")
private double kpi;
private Double kpi;
/**
* kpi薪酬
*/
@TableField("kpi_wage")
private double kpiWage;
private Double kpiWage;
/**
* 总薪酬
*/
@TableField("wage")
private double wage;
private Double wage;
}
......@@ -44,7 +44,7 @@ public class ManagerKpi implements Serializable {
*应发绩效
*/
@TableField("yf_performance")
private double yfPerformance;
private Double yfPerformance;
/**
*kpi总分
*/
......@@ -74,21 +74,21 @@ public class ManagerKpi implements Serializable {
* 2018年5月至今累计佣金
*/
@TableField("total_bonus")
private double totalBonus;
private Double totalBonus;
/**
* 2018年5月至今累计分成
*/
@TableField("total_fund")
private double totalFund;
private Double totalFund;
/**
*秋营达标奖
*/
@TableField("autumn_bonus")
private double autumnBonus;
private Double autumnBonus;
/**
*应发提成
*/
@TableField("yf_bonus")
private double yfBonus;
private Double yfBonus;
}
......@@ -315,6 +315,8 @@ public class Order implements Serializable{
*/
private String parentName;
private Date rhTime;
......
package com.winsun.bean;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableName;
import lombok.Data;
import java.util.Date;
@Data
@TableName("hhr_sales_order")
public class SalesOrder {
......@@ -114,41 +113,41 @@ public class SalesOrder {
/**
* 总激励
*/
private double allBonus;
private Double allBonus;
/**
* 未发放激励
*/
private double nonSendBonus;
private Double nonSendBonus;
/**
* 已发放激励
*/
private double sendBonus;
private Double sendBonus;
/**
* 最近充值金额
*/
private double recentlyAmount;
private Double recentlyAmount;
/**
* 最近充值激励
*/
private double recentlyBonus;
private Double recentlyBonus;
/**
* 累计充值金额
*/
private double monthAmount;
private Double monthAmount;
/**
* 累计充值激励
*/
private double monthBonus;
private Double monthBonus;
/**
* 本金激励
*/
private double capitalBonus;
private Double capitalBonus;
}
......@@ -43,7 +43,7 @@ public class YxtOrder implements Serializable {
*金额
*/
@TableField("total_price")
private double totalPrice;
private Double totalPrice;
/**
*订单状态 (1:未付款 2:付款成功 3:付款失败 4:已取消订单)
*/
......@@ -68,7 +68,7 @@ public class YxtOrder implements Serializable {
*兑换券单价
*/
@TableField("unit_price")
private double unitPrice;
private Double unitPrice;
/**
*订单类型
*/
......
......@@ -57,182 +57,182 @@ public class ZjlWage implements Serializable {
*岗位工资
*/
@TableField("position_wage")
private double positionWage;
private Double positionWage;
/**
*绩效奖金(绩效工资+提成)
*/
@TableField("performance_bonus")
private double performanceBonus;
private Double performanceBonus;
/**
*专项奖
*/
@TableField("special_bonus")
private double specialBonus;
private Double specialBonus;
/**
*年终奖
*/
@TableField("year_end_bonus")
private double yearEndBonus;
private Double yearEndBonus;
/**
*节日费(元旦,春节,五一,十一)
*/
@TableField("festival_fee")
private double festivalFee;
private Double festivalFee;
/**
*高温补贴(6-10月)
*/
@TableField("high_subsidy")
private double highSubsidy;
private Double highSubsidy;
/**
*通讯补贴
*/
@TableField("correspondence_subsidy")
private double correspondenceSubsidy;
private Double correspondenceSubsidy;
/**
*餐费补贴
*/
@TableField("table_money_subsidy")
private double tableMoneySubsidy;
private Double tableMoneySubsidy;
/**
*交通补贴
*/
@TableField("traffic_subsidy")
private double trafficSubsidy;
private Double trafficSubsidy;
/**
*专项奖(秋营奖励)
*/
@TableField("special_bonus_autumn")
private double specialBonusAutumn;
private Double specialBonusAutumn;
/**
*其他补扣补退
*/
@TableField("other_subsidy")
private double otherSubsidy;
private Double otherSubsidy;
/**
*应发合计
*/
@TableField("total_yf")
private double totalYf;
private Double totalYf;
/**
*个人养老保险
*/
@TableField("endowment_insurance_personal")
private double endowmentInsurancePersonal;
private Double endowmentInsurancePersonal;
/**
*个人缴纳失业保险
*/
@TableField("unenployment_insurance_personal")
private double unenploymentInsurancePersonal;
private Double unenploymentInsurancePersonal;
/**
*个人缴纳医疗保险
*/
@TableField("medicare_personal")
private double medicarePersonal;
private Double medicarePersonal;
/**
*个人保险小计
*/
@TableField("total_insurance")
private double totalInsurance;
private Double totalInsurance;
/**
*个人缴纳住房公积金
*/
@TableField("reserved_fund")
private double reservedFund;
private Double reservedFund;
/**
*个税
*/
@TableField("reserved_fund_tax")
private double reservedFundTax;
private Double reservedFundTax;
/**
*年终奖个税
*/
@TableField("year_end_bonus_tax")
private double yearEndBonusTax;
private Double yearEndBonusTax;
/**
*个人其他补交补退
*/
@TableField("other_fee_personal")
private double otherFeePersonal;
private Double otherFeePersonal;
/**
*个人工会费
*/
@TableField("dues_personal")
private double duesPersonal;
private Double duesPersonal;
/**
*个人缴交小计
*/
@TableField("total_fee_personal")
private double totalFeePersonal;
private Double totalFeePersonal;
/**
*实发合计
*/
@TableField("total_sf")
private double totalSf;
private Double totalSf;
/**
*单位养老保险
*/
@TableField("endowment_insurance_unit")
private double endowmentInsuranceUnit;
private Double endowmentInsuranceUnit;
/**
*单位失业保险
*/
@TableField("unenployment_insurance_unit")
private double unenploymentInsuranceUnit;
private Double unenploymentInsuranceUnit;
/**
*单位医疗保险
*/
@TableField("medicare_unit")
private double medicareUnit;
private Double medicareUnit;
/**
*单位工伤保险
*/
@TableField("employment_injury_insurance_unit")
private double employmentInjuryInsuranceUnit;
private Double employmentInjuryInsuranceUnit;
/**
*单位生育保险
*/
@TableField("birth_insurance_unit")
private double birthInsuranceUnit;
private Double birthInsuranceUnit;
/**
*重大疾病保险
*/
@TableField("illness_insurance_unit")
private double illnessInsuranceUnit;
private Double illnessInsuranceUnit;
/**
*单位公积金
*/
@TableField("reserved_fund_unit")
private double reservedFundUnit;
private Double reservedFundUnit;
/**
*工会计提
*/
@TableField("labor_union_fee_unit")
private double laborUnionFeeUnit;
private Double laborUnionFeeUnit;
/**
*商业意外险
*/
@TableField("accident_insurance_unit")
private double accidentInsuranceUnit;
private Double accidentInsuranceUnit;
/**
*残保金
*/
@TableField("disability_insurance_unit")
private double disabilityInsuranceUnit;
private Double disabilityInsuranceUnit;
/**
*单位其他补交补退
*/
@TableField("other_fee_unit")
private double otherFeeUnit;
private Double otherFeeUnit;
/**
*单位缴交小计
*/
@TableField("total_fee_unit")
private double totalFeeUnit;
private Double totalFeeUnit;
/**
*总个人人工成本合计
*/
@TableField("total_cast_personal")
private double totalCastPersonal;
private Double totalCastPersonal;
/**
*附加信息
*/
......@@ -242,97 +242,97 @@ public class ZjlWage implements Serializable {
*邮电人才服务管理费(200/人)
*/
@TableField("manage_fee")
private double manageFee;
private Double manageFee;
/**
*单位总成本(含支出税点)
*/
@TableField("total_cast_unit")
private double totalCastUnit;
private Double totalCastUnit;
/**
*个人缴纳养老保险2
*/
@TableField("endowment_insurance_personal2")
private double endowmentInsurancePersonal2;
private Double endowmentInsurancePersonal2;
/**
*个人缴纳失业保险2
*/
@TableField("unenployment_insurance_personal2")
private double unenploymentInsurancePersonal2;
private Double unenploymentInsurancePersonal2;
/**
*个人缴纳医疗保险2
*/
@TableField("medicare_personal2")
private double medicarePersonal2;
private Double medicarePersonal2;
/**
*个人缴纳住房公积金2
*/
@TableField("resvered_fund_personal2")
private double resveredFundPersonal2;
private Double resveredFundPersonal2;
/**
*单位养老保险2
*/
@TableField("endowment_insurance_unit2")
private double endowmentInsuranceUnit2;
private Double endowmentInsuranceUnit2;
/**
*单位失业保险2
*/
@TableField("unenployment_insurance_unit2")
private double unenploymentInsuranceUnit2;
private Double unenploymentInsuranceUnit2;
/**
*单位医疗保险2
*/
@TableField("medicare_unit2")
private double medicareUnit2;
private Double medicareUnit2;
/**
*单位工伤保险2
*/
@TableField("employment_injury_insurance_unit2")
private double employmentInjuryInsuranceUnit2;
private Double employmentInjuryInsuranceUnit2;
/**
*单位生育保险2
*/
@TableField("birth_insurance_unit2")
private double birthInsuranceUnit2;
private Double birthInsuranceUnit2;
/**
*重大疾病保险企业缴纳2
*/
@TableField("illness_insurance_unit2")
private double illnessInsuranceUnit2;
private Double illnessInsuranceUnit2;
/**
*单位住房公积金2
*/
@TableField("reserved_insurance_unit2")
private double reservedInsuranceUnit2;
private Double reservedInsuranceUnit2;
/**
*合并计税
*/
@TableField("total_insurance_unit2")
private double totalInsuranceUnit2;
private Double totalInsuranceUnit2;
/**
*本月计税工资
*/
@TableField("wage")
private double wage;
private Double wage;
/**
*本月抵税扣除
*/
@TableField("wage_tax")
private double wageTax;
private Double wageTax;
/**
*本月工资抵税
*/
@TableField("wage_tax_after")
private double wageTaxAfter;
private Double wageTaxAfter;
/**
*年终奖应税
*/
@TableField("last_year_end_bonus")
private double lastYearEndBonus;
private Double lastYearEndBonus;
/**
*年终奖个税计算
*/
@TableField("last_year_end_bonus_tax")
private double lastYearEndBonusTax;
private Double lastYearEndBonusTax;
/**
*银行账号
*/
......@@ -342,11 +342,11 @@ public class ZjlWage implements Serializable {
*督导成本
*/
@TableField("manager_cast")
private double managerCast;
private Double managerCast;
/**
*学子公司成本
*/
@TableField("xz_company_cast")
private double xzCompanyCast;
private Double xzCompanyCast;
}
......@@ -27,7 +27,7 @@ public class Constant {
public final static String ZHANGSHIKEY = "3df143292455bfea88bc613c53004d36"; //智能平台提供的正式key
// public final static String ZHENGSHIAUCCON = "xiaoykd"; //智能平台提供的正式账号
// public final static String ZHANGSHIKEY = "d345040accff0421d03f760a03e5cbd9"; //智能平台提供的正式key
public final static String ZHANGSHIURL = "https://ismartbak.mini189.cn/api/"; //智能平台提供的正式key
public final static String ZHANGSHIURL = "https://ismart.mini189.cn/api/"; //智能平台提供的正式key
public final static String PRODUCTCATEGORY = "单宽带"; //只能平台提供的key
// public final static String TOMCATURL = "http://183.57.78.132:8080"; //Linux外网服务器地址
// public final static String INTRANETURL = "http://10.3.1.21:8080"; //Linux内网服务器地址
......
......@@ -142,7 +142,7 @@ public class PackageNewClothes {
, @RequestParam("customerName") String customerName, @RequestParam("partner") String partner
, @RequestParam(value = "idCardzs") String idCardzs, @RequestParam(value = "idCardz") String idCardz, @RequestParam(value = "idCardf") String idCardf
, @RequestParam(value = "remarks", required = false) String remarks, @RequestParam(value = "kapin") String kapin
, @RequestParam(value = "idCard") String idCard, @RequestParam(value = "userSchool") String userSchool,@RequestParam(value = "isFromRh") String isFromRh) {
, @RequestParam(value = "idCard") String idCard, @RequestParam(value = "userSchool") String userSchool,@RequestParam(value = "isFromRh", required = false) String isFromRh) {
if (contactNumber.length() != 11) {
return ResponseData.error("联系号码有误,请重新输入");
}
......@@ -175,6 +175,9 @@ public class PackageNewClothes {
Order order = new Order();
String uuid = UUID.randomUUID().toString();
String id=uuid.split("-")[0]+uuid.split("-")[1];
if(isFromRh.equals("true")){
order.setUserBussinessType("5");
}
order.setId(id);
order.setIdCard(idCard);
order.setOrderStatus("待处理");
......@@ -247,7 +250,7 @@ public class PackageNewClothes {
, @RequestParam(value = "parentName") String parentName, @RequestParam(value = "idCardf") String idCardf
, @RequestParam(value = "remarks", required = false) String remarks, @RequestParam(value = "kapin") String kapin
, @RequestParam(value = "idCard") String idCard, @RequestParam(value = "studentNumber") String studentNumber
, @RequestParam(value = "userSchool") String userSchool, @RequestParam(value = "isFromRh") String isFromRh) {
, @RequestParam(value = "userSchool") String userSchool, @RequestParam(value = "isFromRh", required = false) String isFromRh) {
if (contactNumber.length() != 11) {
return ResponseData.error("联系号码有误,请重新输入");
......@@ -282,6 +285,9 @@ public class PackageNewClothes {
String uuid = UUID.randomUUID().toString();
String id=uuid.split("-")[0]+uuid.split("-")[1];
order.setId(id);
if(isFromRh.equals("true")){
order.setUserBussinessType("5");
}
order.setIdCard(idCard);
order.setOrderStatus("待处理");
order.setUserSchool(userSchool);
......@@ -348,7 +354,7 @@ public class PackageNewClothes {
, @RequestParam("studentCard") String studentCard, @RequestParam("cardId") String cardId, @RequestParam(value = "addRess", required = false) String addRess
, @RequestParam("customerName") String customerName, @RequestParam("partner") String partner, @RequestParam("businessNumber") String businessNumber
, @RequestParam(value = "remarks", required = false) String remarks, @RequestParam(value = "kapin") String kapin
, @RequestParam(value = "idCard") String idCard, @RequestParam(value = "userSchool") String userSchool, @RequestParam(value = "isFromRh") String isFromRh) {
, @RequestParam(value = "idCard") String idCard, @RequestParam(value = "userSchool") String userSchool, @RequestParam(value = "isFromRh", required = false) String isFromRh) {
if (contactNumber.length() != 11) {
return ResponseData.error("联系号码有误,请重新输入");
}
......@@ -404,6 +410,9 @@ public class PackageNewClothes {
Order order = new Order();
String uuid = UUID.randomUUID().toString();
String id=uuid.split("-")[0]+uuid.split("-")[1];
if(isFromRh.equals("true")){
order.setUserBussinessType("5");
}
order.setId(id);
order.setIdCard(idCard);
order.setXbOrderId(map.get("orderCode").toString());
......
......@@ -102,10 +102,10 @@ public class LzSalaryController extends BaseController {
wage.setUserId(Integer.valueOf(sysUserList.get(0).getId()));
wage.setMonth(hashMap.get("month").toString());
wage.setRechargeNum(Integer.valueOf(hashMap.get("rechargeNum").toString()));
wage.setRechargeWage(Integer.valueOf(hashMap.get("rechargeWage").toString()));
wage.setKpi(Integer.valueOf(hashMap.get("kpi").toString()));
wage.setKpiWage(Integer.valueOf(hashMap.get("kpiWage").toString()));
wage.setWage(Integer.valueOf(hashMap.get("wage").toString()));
wage.setRechargeWage(Double.valueOf(hashMap.get("rechargeWage").toString()));
wage.setKpi(Double.valueOf(hashMap.get("kpi").toString()));
wage.setKpiWage(Double.valueOf(hashMap.get("kpiWage").toString()));
wage.setWage(Double.valueOf(hashMap.get("wage").toString()));
lzWageMpapper.insert(wage);
return ResponseData.success("添加成功!");
}
......
......@@ -36,7 +36,7 @@ public class OrderTask {
}
@Scheduled(cron = "0 15 10 * * ? ")
@Scheduled(cron = "0 0 0 * * ? ")
//@Scheduled(cron = "0/5 * * * * ? ")
//@Scheduled(fixedRate=1000*60)
@PostMapping("/orderTask")
......
package com.winsun.TimingTask;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.winsun.bean.Order;
import com.winsun.bean.OrderView;
import com.winsun.bean.UniversityInfo;
import com.winsun.constant.Constant;
import com.winsun.mapper.*;
import com.winsun.utils.BeanUtil;
import com.winsun.utils.MD5Utils;
import com.winsun.utils.MyBatisPlusUpdateUtils;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONArray;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
@Slf4j
@RestController
@Configuration
@EnableScheduling
public class RhZhiNenTask {
@Autowired
private UniversityInfoMapper universityInfoMapper;
@Autowired
private OrderViewMapper orderViewMapper;
@Autowired
private OrderMapper orderMapper;
//@Scheduled(cron = "0 0 0 * * ? ")
@Scheduled(cron = "0/5 * * * * ? ")
//@Scheduled(fixedRate=1000*60)
@PostMapping("/rhZhiNenTask")
public void general() throws Exception {
Wrapper<Order> wrapper = new EntityWrapper<>();
wrapper.eq("order_status","未下单");
List<Map<String, Object>> orders = orderMapper.selectMaps(wrapper);
for (Map<String, Object> order :orders){
if(StringUtils.isNotBlank(order.get("rhTime").toString())){
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date rhTime=simpleDateFormat1.parse(order.get("rhTime").toString());
Date date=new Date();
if(rhTime.getTime() <= date.getTime()){
Wrapper<OrderView> wrapperOV = new EntityWrapper<>();
wrapperOV.eq("orderSeq",order.get("kdOrderId").toString());
Map<String, Object> orderMap = orderViewMapper.selectMaps(wrapperOV).get(0);
Wrapper<UniversityInfo> wrapperUI = new EntityWrapper<>();
wrapperUI.eq("university_name",(String) orderMap.get("orderUniversityName"));
wrapperUI.eq("university_region", (String) orderMap.get("orderRegion"));
// 根据学校名称,获取该学校信息
List<Map<String, Object>> list1 = universityInfoMapper.selectMaps(wrapperUI);
Map<String, Object> schoolMap = list1.get(0);
if (orderMap.get("orderUniversityName").toString().equals("广州华立科技职业学院")) {
if ("中国电信校园高速宽带".equals(orderMap.get("productName").toString())) {
schoolMap.put("universityPackageNumber", "56119011");
} else {
schoolMap.put("universityPackageNumber", "56119015");
}
}else if(orderMap.get("orderUniversityName").toString().equals("广州大学华软软件学院")){
if ("中国电信校园高速宽带".equals(orderMap.get("productName").toString())) {
schoolMap.put("university_package_number", "16001253");
} else {
schoolMap.put("university_package_number", "16001405");
}
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String currentTimeStr = simpleDateFormat.format(new Date());
String UPTRANSEQ = "";
if(orderMap.get("uptranseq")!=null){
UPTRANSEQ = orderMap.get("uptranseq").toString();
}
// 穗易付平台,支付流水号
String ORDERAMOUNT = "";
if(orderMap.get("webOrderAmount").toString().equals("0")){
ORDERAMOUNT = "0元";
}else {
ORDERAMOUNT = orderMap.get("webOrderAmount").toString();
}
String ORDERREQTRANSEQ = "";
if(orderMap.get("orderReqtranSeq")!=null){
ORDERREQTRANSEQ = orderMap.get("orderReqtranSeq").toString(); // 穗易付订单号
}
String productId = "1329";
//单宽带
String saleId1 = "4907";
//提速包
String saleId2 = null;
if(!orderMap.get("webOrderAmount").toString().equals("0")){
JSONObject saleJsonObject = getSaleId(productId, currentTimeStr);
if (saleJsonObject.toString().indexOf("list") == -1) {
return;
}
String prices = orderMap.get("webOrderAmount").toString();
prices = prices.replace(".00","").replace("元", "") + ".000";
String expenses = "";
if (schoolMap.get("identifying") != null) {
expenses = schoolMap.get("identifying").toString();
}
System.out.println("----expenses---prices---:" + expenses + "------" + prices);
com.alibaba.fastjson.JSONArray saleList = saleJsonObject.getJSONArray("list");
System.out.println("----saleList---:" + saleList);
for (int i = 0; i < saleList.size(); i++) {
net.sf.json.JSONObject itmeJson = net.sf.json.JSONObject.fromObject(saleList.get(i));
// 判断获取的全部产品与订单产品符合的拿取对应的ID
if (itmeJson.getString("propertyName").indexOf("单宽带") != -1) {
if (itmeJson.getString("price").equals(prices)) {
// 获取对应产品ID
saleId1 = itmeJson.getString("saleId");
}
} else if (itmeJson.getString("propertyName").indexOf("提速包") != -1) {
if (itmeJson.getString("name").equals(expenses)) {
// 获取对应产品ID
saleId2 = itmeJson.getString("saleId");
}
} else if (itmeJson.getString("propertyName").indexOf("增值业务") != -1) {
if (itmeJson.getString("name").equals(expenses)) {
// 获取对应产品ID
saleId2 = itmeJson.getString("saleId");
}
}
}
}else {
JSONObject saleJsonObject = getSaleId(productId, currentTimeStr); // 获取销售ID
log.info("----------调用智能平台的获取销售品接口返回值:" + saleJsonObject);
System.out.println("----111--" + (saleJsonObject.toString().indexOf("list") == -1));
if (saleJsonObject.toString().indexOf("list") == -1) {
return ;
}
String expenses = "";
if (schoolMap.get("identifying") != null) {
expenses = schoolMap.get("identifying").toString();
}
com.alibaba.fastjson.JSONArray saleList = saleJsonObject.getJSONArray("list");
System.out.println("----saleList---:" + saleList);
for (int i = 0; i < saleList.size(); i++) {
net.sf.json.JSONObject itmeJson = net.sf.json.JSONObject.fromObject(saleList.get(i));
// 判断获取的全部产品与订单产品符合的拿取对应的ID
if (itmeJson.getString("propertyName").indexOf("提速包") != -1) {
if (itmeJson.getString("name").equals(expenses)) {
// 获取对应产品ID
saleId2 = itmeJson.getString("saleId");
}
} else if (itmeJson.getString("propertyName").indexOf("增值业务") != -1) {
if (itmeJson.getString("name").equals(expenses)) {
// 获取对应产品ID
saleId2 = itmeJson.getString("saleId");
}
}
}
}
List<NameValuePair> qParams = new ArrayList<NameValuePair>();
RequestConfig defaultRequestConfig = RequestConfig.custom().setSocketTimeout(500000)
.setConnectTimeout(500000).setConnectionRequestTimeout(500000).build();
CloseableHttpClient httpclient = HttpClients.custom().setDefaultRequestConfig(defaultRequestConfig)
.build();
HttpEntity entity = null;
HttpPost httpPost = new HttpPost(Constant.ZHANGSHIURL + "create-order.action");
RequestConfig requestConfig = RequestConfig.copy(defaultRequestConfig).build();
httpPost.setConfig(requestConfig);
Map<String, String> signMap = new HashMap<String, String>();
qParams.add(new BasicNameValuePair("service", "order.combined.create"));// api标识,必填且唯一
signMap.put("service", "order.combined.create");
qParams.add(new BasicNameValuePair("userName", Constant.ZHENGSHIAUCCON));//用户名,必填
signMap.put("userName", Constant.ZHENGSHIAUCCON);
qParams.add(new BasicNameValuePair("timeStamp", currentTimeStr));//时间戳(YYYYMMDDHHMMSS) ,必填
signMap.put("timeStamp", currentTimeStr);
qParams.add(new BasicNameValuePair("productCategory", "融合产品"));// 业务类型,必填且唯一
signMap.put("productCategory", "融合产品");
qParams.add(new BasicNameValuePair("transactType", "新宽旧移"));// 办理类型,必填[新宽新移][新宽旧移][旧宽新移][旧宽旧移]
signMap.put("transactType", "新宽旧移");
/* if(orderMap.get("webOrderAmount").toString().equals("0")){
qParams.add(new BasicNameValuePair("ctNumber", (String) order.get("businessNumber")));// 电信号码,办理类型,若选择[新宽旧移]或[旧宽旧移],此项必填
signMap.put("ctNumber", (String) order.get("businessNumber"));
}else {
qParams.add(new BasicNameValuePair("ctNumber", (String) orderMap.get("orderCustomerRemarks")));// 电信号码,办理类型,若选择[新宽旧移]或[旧宽旧移],此项必填
signMap.put("ctNumber", (String) orderMap.get("orderCustomerRemarks"));
}
qParams.add(new BasicNameValuePair("ctNumber", (String) order.get("businessNumber")));// 电信号码,办理类型,若选择[新宽旧移]或[旧宽旧移],此项必填
signMap.put("ctNumber", (String) order.get("businessNumber"));
*/
qParams.add(new BasicNameValuePair("addressProvince", "广东省"));// 报装地址-省 办理类型,若选择[新宽新移][新宽旧移],此项必填
signMap.put("addressProvince", "广东省");
qParams.add(new BasicNameValuePair("addressCity", "广州市"));// 报装地址-市 办理类型,若选择[新宽新移][新宽旧移],此项必填
signMap.put("addressCity", "广州市");
String addressDistrict = null;
String address = null;
String addressID = null;
String landId = null;
String universityTerminalType = null;
String universityUserCategory = null;
String universityUserType = null;
String universityMonthlyRentType = null;
String universityChargingAttribute = null;
String universityOnlineNumber = null;
String universityOneManTerminal = null;
String universityIsFtthHub = null;
String universityExteriorLines = null;
String universityChargeMode = null;
if (BeanUtil.isNotBlank(schoolMap)) {
addressDistrict = (String) schoolMap.get("universityRegion");
address = (String) schoolMap.get("universityInstalledAddress");
addressID = (String) schoolMap.get("universityInstalledAddressId");
landId = (String) schoolMap.get("universityPackageNumber");
universityTerminalType = (String) schoolMap.get("universityTerminalType");
universityUserCategory = (String) schoolMap.get("universityUserCategory");
universityUserType = (String) schoolMap.get("universityUserType");
universityMonthlyRentType = (String) schoolMap.get("universityMonthlyRentType");
universityChargingAttribute = (String) schoolMap.get("universityChargingAttribute");
universityOnlineNumber = (String) schoolMap.get("universityOnlineNumber");
universityOneManTerminal = (String) schoolMap.get("universityOneManTerminal");
universityIsFtthHub = (String) schoolMap.get("universityIsFtthHub");
universityExteriorLines = (String) schoolMap.get("universityExteriorLines");
universityChargeMode = (String) schoolMap.get("universityChargeMode");
} else {
addressDistrict = "测试区";
address = "广东省广州市测试区测试街道1号";
addressID = "00000";
landId = "20180621";
universityTerminalType = "测试";
universityUserCategory = "测试";
universityUserType = "测试";
universityMonthlyRentType = "测试";
universityChargingAttribute = "测试";
universityOnlineNumber = "0";
universityOneManTerminal = "否";
universityIsFtthHub = "否";
universityExteriorLines = "测试";
universityChargeMode = "测试";
}
qParams.add(new BasicNameValuePair("addressDistrict", addressDistrict));// 报装地址-区 办理类型,若选择[新宽新移][新宽旧移],此项必填
signMap.put("addressDistrict", addressDistrict);
qParams.add(new BasicNameValuePair("address", address));// 报装地址-详细地址 办理类型,若选择[新宽新移][新宽旧移],此项必填
signMap.put("address", address);
qParams.add(new BasicNameValuePair("addressId", addressID));// 报装地址-地址ID,选填
signMap.put("addressId", addressID);
qParams.add(new BasicNameValuePair("govEntCustomer", "0"));//是否政企客户下单 0:否 1:是,必填
signMap.put("govEntCustomer", "0");
qParams.add(new BasicNameValuePair("agentName", ""));//若是政企客户下单,代办人姓名,必填
signMap.put("agentName", "");
qParams.add(new BasicNameValuePair("agentCardNum", ""));//若是政企客户下单,代办人身份证号码,必填
signMap.put("agentCardNum", "");
qParams.add(new BasicNameValuePair("customerName", (String) orderMap.get("orderName")));// 客户姓名,必填
signMap.put("customerName", (String) orderMap.get("orderName"));
qParams.add(new BasicNameValuePair("customerPhone", (String) orderMap.get("orderPhone")));// 客户电话|代办人电话,必填
signMap.put("customerPhone", (String) orderMap.get("orderPhone"));
qParams.add(new BasicNameValuePair("customerCardType", "身份证"));// 证件类型,必填且只能为身份证
signMap.put("customerCardType", "身份证");
qParams.add(new BasicNameValuePair("customerCardNum", (String) orderMap.get("orderNumber")));// 证件号码,必填
signMap.put("customerCardNum", (String) orderMap.get("orderNumber"));
qParams.add(new BasicNameValuePair("landId", landId));// 揽装工号,必填
signMap.put("landId", landId);
qParams.add(new BasicNameValuePair("comarketingLanId", ""));// 协销工号,选填
signMap.put("comarketingLanId", "");
qParams.add(new BasicNameValuePair("groupComarketingLanId", ""));//集团协销工号,选填
signMap.put("groupComarketingLanId", "");
qParams.add(new BasicNameValuePair("orderOutNum", (String) orderMap.get("orderSeq")));//外部订单编号,选填!;
// 通过API接口下单,必须传入一个外部接入商的订单编号,该编号与智能营销系统编号一一对应
signMap.put("orderOutNum", (String) orderMap.get("orderSeq"));
qParams.add(new BasicNameValuePair("orderSource", "校园宽带自助受理"));// 订单来源 ,选填
signMap.put("orderSource", "校园宽带自助受理");
qParams.add(new BasicNameValuePair("orderSourceNum", (String) orderMap.get("orderSeq")));// 订单来源单号,选填;与订单来源对应,用于业务上记录订单的来源订单编号
signMap.put("orderSourceNum", (String) orderMap.get("orderSeq"));
qParams.add(new BasicNameValuePair("salePointCode", ""));// 销售点编码,选填
signMap.put("salePointCode", "");
qParams.add(new BasicNameValuePair("personCode", ""));// 人员编码,必填
signMap.put("personCode", "");
qParams.add(new BasicNameValuePair("deliveryProvince", "广东省"));// 配送地址-省,必填
signMap.put("deliveryProvince", "广东省");
qParams.add(new BasicNameValuePair("deliveryCity", "广州市"));// 配送地址-市,必填
signMap.put("deliveryCity", "广州市");
qParams.add(new BasicNameValuePair("deliveryDistrict", addressDistrict));// 配送地址-区,必填
signMap.put("deliveryDistrict", addressDistrict);
qParams.add(new BasicNameValuePair("deliveryAddress", address));// 配送地址-详细地址,必填
signMap.put("deliveryAddress", address);
qParams.add(new BasicNameValuePair("deliveryContact", (String) orderMap.get("orderName")));// 联系人,必填
signMap.put("deliveryContact", (String) orderMap.get("orderName"));
qParams.add(new BasicNameValuePair("deliveryContactPhone", (String) orderMap.get("orderPhone")));// 联系电话,必填
signMap.put("deliveryContactPhone", (String) orderMap.get("orderPhone"));
qParams.add(new BasicNameValuePair("deliveryContactPhone2", ""));// 联系电话2,选填
signMap.put("deliveryContactPhone2", "");
qParams.add(new BasicNameValuePair("invoiced", "0"));// 是否需要发票,必填
// 0:不需要;1:一次性发票;2:分月发票
signMap.put("invoiced", "0");
qParams.add(new BasicNameValuePair("invoiceTitle", ""));// 发票抬头,若需要发票必填
signMap.put("invoiceTitle", "");
qParams.add(new BasicNameValuePair("invoiceDeliveryAddress", ""));// 电子邮箱,若需要发票必填
signMap.put("invoiceDeliveryAddress", "");
qParams.add(new BasicNameValuePair("deliveryType", "不需配送"));// 发货类型,必填,填写[同德仓发货][不需配送][代理商自行发货]
signMap.put("deliveryType", "不需配送");
qParams.add(new BasicNameValuePair("deliveryCompany", ""));// 配送公司,选填,同德仓发货必填;填写只能填顺丰速运或者如风达或者京东快递或者EMS
signMap.put("deliveryCompany", "");
qParams.add(new BasicNameValuePair("gift", ""));// 礼品,选填,请通过礼品列表接口获取
signMap.put("gift", "");
qParams.add(new BasicNameValuePair("giftNum", ""));// 礼品数量,选填,若礼品填写则必填且为正整数
signMap.put("giftNum", "");
qParams.add(new BasicNameValuePair("acceptPriority", "7"));//受理优先级 为0-10范围内的整数! 选填
signMap.put("acceptPriority", "7");
List<Map<String, Object>> productList = new ArrayList<Map<String, Object>>();// 产品信息
List<Map<String, Object>> inPropertyList = new ArrayList<Map<String, Object>>();// 产品属性
List<Map<String, Object>> paymentList = new ArrayList<Map<String, Object>>();// 销售品信息(费用项)
List<Map<String, Object>> addPropertyList = new ArrayList<Map<String, Object>>();// 自定义产品属性
// 下单产品
Map<String, Object> productMap = new HashMap<String, Object>();
// 产品(一个订单只能有一种产品且数量为1)
productMap.put("productId", productId);// 产品id,必填,请通过产品列表接口获取
// 产品都必须传一个产品对应的唯一的收费项
Map<String, Object> paymentListMap = new HashMap<String, Object>();
paymentListMap.put("id", "4455");// 收费项ID,选填;请通过销售品列表接口获取,若不填表示终端补收款
paymentListMap.put("saleName", "校园融合套餐");// 销售品名称,选填,若id不填写此项必填写,且只能为终端补收款
paymentListMap.put("payType", "2");// 缴费方式,
//必填(例:payType:3)1:银行划账2:现金支付3:代理商打款4:穗易付6:支付宝划扣7:货到付款8:装维上门收取9:第三方托收11:代理商代扣
//单宽带
Map<String, Object> paymentListMap2 = new HashMap<String, Object>();
paymentListMap2.put("id", saleId1);// 收费项ID,选填;请通过销售品列表接口获取,若不填表示终端补收款
paymentListMap2.put("saleName", "");// 销售品名称,选填,若id不填写此项必填写,且只能为终端补收款
if(orderMap.get("webOrderAmount").toString().equals("0")){
paymentListMap2.put("payType", "2");
}else {
paymentListMap2.put("payType", "4");// 缴费方式,必填(例:payType:3)3:代理商打款4:穗易付7:货到付款
}
paymentListMap2.put("payAmount", ORDERAMOUNT);// 打款金额(支付金额),若选择代理商打款、者穗易付、货到付款,此项必填
String payPlatform = (String) orderMap.get("ipay");
if (StringUtils.isNotBlank(payPlatform)) {
if ("1".equals(payPlatform)) {
paymentListMap2.put("payPlatform", "支付宝");//支付平台,缴费方式为“穗易付”时必填
} else {
paymentListMap2.put("payPlatform", "微信");//支付平台,缴费方式为“穗易付”时必填
}
} else {
paymentListMap2.put("payPlatform", "穗易付");//支付平台,缴费方式为“穗易付”时必填
}
paymentListMap2.put("electronicPayNumber", UPTRANSEQ);// 支付流水号,若选择穗易付,此项必填
paymentListMap2.put("payOrderNumber", ORDERREQTRANSEQ);// 穗易付订单号,若选择穗易付,此项必填
//提速包
Map<String, Object> paymentListMap3 = new HashMap<String, Object>();
paymentListMap3.put("id", saleId2);// 收费项ID,选填;请通过销售品列表接口获取,若不填表示终端补收款
paymentListMap3.put("saleName", "");// 销售品名称,选填,若id不填写此项必填写,且只能为终端补收款
paymentListMap3.put("saleAmount", "");// 售价,选填
paymentListMap3.put("payType", "2");// 缴费方式,必填(例:payType:3)3:代理商打款4:穗易付7:货到付款
paymentListMap3.put("payAmount", "0");// 打款金额(支付金额),若选择代理商打款、者穗易付、货到付款,此项必填
paymentList.add(paymentListMap);
paymentList.add(paymentListMap2);
paymentList.add(paymentListMap3);
productMap.put("payment", paymentList);
// 产品属性 必填主卡号码属性,name=主卡号码,value=11位数字或者随机;
Map<String, Object> inPropertyListMap = new HashMap<String, Object>();
inPropertyListMap.put("name", "主卡号码");
if(orderMap.get("webOrderAmount").toString().equals("0")){
inPropertyListMap.put("value", (String) order.get("businessNumber"));
}else {
inPropertyListMap.put("value", orderMap.get("orderCustomerRemarks"));
}
inPropertyList.add(inPropertyListMap);
productMap.put("inpProperties", inPropertyList);
// 产品附加扩展属性 选填(若有购买终端,请填写在此:name:终端型号1;value:终端值)
// Map<String, Object> appendPropertyListMap1 = new HashMap<String, Object>();
// appendPropertyListMap1.put("name", "终端型号1");
// appendPropertyListMap1.put("value", "华为荣耀5A全网通白色");
// appendPropertyList.add(appendPropertyListMap1);
// Map<String, Object> appendPropertyListMap2 = new HashMap<String, Object>();
// appendPropertyListMap2.put("name", "终端型号2");
// appendPropertyListMap2.put("value", "华为P9全网通32G金色");
// appendPropertyList.add(appendPropertyListMap2);
// Map<String, Object> appendPropertyListMap3 = new HashMap<String, Object>();
// appendPropertyListMap3.put("name", "终端型号3");
// appendPropertyListMap3.put("value", "华为P9全网通32G金色");
// appendPropertyList.add(appendPropertyListMap3);
//
// productMap.put("appendProperties", appendPropertyList);
// 产品自定义属性;选填,没有则为null
// 注:若填写请属性名和属性值都填写,若只填写其中一项则无效
//产品自定义属性;暂时默认属性名称只能传“日租卡号码”
Map<String, Object> propertyMap = new HashMap<String, Object>();
propertyMap.put("name", "宽带速率");
String setMeal = (String) orderMap.get("orderSetMeal");
if (StringUtils.isNotBlank(setMeal)) {
setMeal = setMeal.replace("包月", "");
setMeal = setMeal.replace("包年", "");
}
propertyMap.put("value", setMeal);
Map<String, Object> propertyMap1 = new HashMap<String, Object>();
propertyMap1.put("name", "学校名称");
propertyMap1.put("value", (String) orderMap.get("orderUniversityName"));
Map<String, Object> propertyMap2 = new HashMap<String, Object>();
propertyMap2.put("name", "允许上网终端类型");
propertyMap2.put("value", universityTerminalType);
Map<String, Object> propertyMap3 = new HashMap<String, Object>();
propertyMap3.put("name", "用户类别");
propertyMap3.put("value", universityUserCategory);
Map<String, Object> propertyMap4 = new HashMap<String, Object>();
propertyMap4.put("name", "用户类型");
propertyMap4.put("value", universityUserType);
Map<String, Object> propertyMap5 = new HashMap<String, Object>();
propertyMap5.put("name", "月租类型");
propertyMap5.put("value", universityMonthlyRentType);
Map<String, Object> propertyMap6 = new HashMap<String, Object>();
propertyMap6.put("name", "计费属性");
propertyMap6.put("value", universityChargingAttribute);
Map<String, Object> propertyMap7 = new HashMap<String, Object>();
propertyMap7.put("name", "一人一号多终端");
propertyMap7.put("value", universityOneManTerminal);
Map<String, Object> propertyMap8 = new HashMap<String, Object>();
propertyMap8.put("name", "外线方式");
propertyMap8.put("value", universityExteriorLines);
Map<String, Object> propertyMap9 = new HashMap<String, Object>();
propertyMap9.put("name", "是否FTTH+HUB");
propertyMap9.put("value", universityIsFtthHub);
Map<String, Object> propertyMap16 = new HashMap<String, Object>();
propertyMap16.put("name", "宽带提速速率");
propertyMap16.put("value", schoolMap.get("speed"));
Map<String, Object> propertyMap10 = new HashMap<String, Object>();
propertyMap10.put("name", "多媒体账号");
propertyMap10.put("value", (String) orderMap.get("orderCustomerAccount"));
Map<String, Object> propertyMap11 = new HashMap<String, Object>();
propertyMap11.put("name", "多媒体账号密码");
propertyMap11.put("value", (String) orderMap.get("orderCustomerPwd"));
Map<String, Object> propertyMap12 = new HashMap<String, Object>();
propertyMap12.put("name", "学生证号");
propertyMap12.put("value", (String) orderMap.get("orderCustomerStudentId"));
Map<String, Object> propertyMap13 = new HashMap<String, Object>();
propertyMap13.put("name", "宽带首月费用类型");
propertyMap13.put("value", universityChargeMode);
Map<String, Object> propertyMap14 = new HashMap<String, Object>();
propertyMap14.put("name", "最大在线数");
propertyMap14.put("value", universityOnlineNumber);
Map<String, Object> propertyMap15 = new HashMap<String, Object>();
propertyMap15.put("name", "地址ID");
propertyMap15.put("value", addressID);
addPropertyList.add(propertyMap);
addPropertyList.add(propertyMap1);
addPropertyList.add(propertyMap2);
addPropertyList.add(propertyMap3);
addPropertyList.add(propertyMap4);
addPropertyList.add(propertyMap5);
addPropertyList.add(propertyMap6);
addPropertyList.add(propertyMap7);
addPropertyList.add(propertyMap8);
addPropertyList.add(propertyMap9);
addPropertyList.add(propertyMap10);
addPropertyList.add(propertyMap11);
addPropertyList.add(propertyMap12);
addPropertyList.add(propertyMap13);
addPropertyList.add(propertyMap14);
addPropertyList.add(propertyMap15);
addPropertyList.add(propertyMap16);
productMap.put("addProperties", addPropertyList);
productList.add(productMap);
// 将对象装换为json字符串
String productJson = JSONArray.fromObject(productList).toString();
try {
qParams.add(new BasicNameValuePair("productJson", URLEncoder.encode(productJson, "UTF-8")));// 产品信息,必填
signMap.put("productJson", URLEncoder.encode(productJson, "UTF-8"));
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
List<String> keys = new ArrayList<String>();
keys.addAll(signMap.keySet());
Collections.sort(keys);// key按字符串升序
String value, plaintext = "";
for (String key : keys) {
value = signMap.get(key);
plaintext = plaintext.concat(value);
}
plaintext = plaintext.concat(Constant.ZHANGSHIKEY);
log.info("---------plaintext---------:" + plaintext);
qParams.add(new BasicNameValuePair("sign", MD5Utils.md5(plaintext).toUpperCase()));//签名,必填
log.info("---------sign---------:" +MD5Utils.md5(plaintext).toUpperCase());
net.sf.json.JSONObject resultDataJson = null;
try {
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
httpPost.setEntity(new UrlEncodedFormEntity(qParams, "UTF-8"));
log.info("提交参数:" + EntityUtils.toString(httpPost.getEntity(), "UTF-8"));
HttpResponse response = httpclient.execute(httpPost);
entity = response.getEntity();
String httpResult = EntityUtils.toString(entity, "UTF-8");
log.info("融合下单接口,返回信息:" + httpResult);
resultDataJson = net.sf.json.JSONObject.fromObject(httpResult);
} catch (Exception e) {
System.out.println("融合下单接口接口异常");
e.printStackTrace();
} finally {
httpPost.releaseConnection();
}
net.sf.json.JSONObject queryOrderJsonObject = null;
String orderNum = (String) resultDataJson.get("orderNumber");
if(orderMap.get("webOrderAmount").toString().equals("0")){
if (StringUtils.isNotBlank(orderNum)) {
queryOrderJsonObject = getQueryOrderInfo(orderNum, currentTimeStr);
log.info("----------调用查询智能订单接口并返回参数信息:" + queryOrderJsonObject);
/* 5、插入数据到数据库 */
String state = queryOrderJsonObject.getString("state");
String order_id = queryOrderJsonObject.getString("bizEntity");
String th_status = queryOrderJsonObject.getString("stateName");
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("th_status",th_status);
hashMap.put("order_id",order_id);
hashMap.put("order_status","待审核");
Wrapper<Order> wrapperO = new EntityWrapper<>();
wrapperO.eq("kd_order_id",orderMap.get("orderSeq").toString());
orderMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(hashMap),wrapperO);
if (StringUtils.isNotBlank(state)) {
HashMap<String, Object> hashMap1 = new HashMap<>();
hashMap1.put("status",QueOrderNum(state));
hashMap1.put("orderSeqTHD",orderNum);
orderViewMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(hashMap1),wrapperOV);
return ; // 成功
} else {
log.info("----------将智能订单状态更新至数据库error:" + state);
}
}
}else {
if (StringUtils.isNotBlank(orderNum)) {
queryOrderJsonObject = getQueryOrderInfo(orderNum, currentTimeStr);
log.info("----------调用查询智能订单接口并返回参数信息:" + queryOrderJsonObject);
/* 5、更新数据库 */
String state = queryOrderJsonObject.getString("state");
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("order_id",orderNum);
hashMap.put("order_status","待审核");
Wrapper<Order> wrapperO = new EntityWrapper<>();
wrapperO.eq("kd_order_id",orderMap.get("orderSeq").toString());
orderMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(hashMap),wrapperO);
if (StringUtils.isNotBlank(state)) {
HashMap<String, Object> hashMap1 = new HashMap<>();
hashMap1.put("status",QueOrderNum(state));
hashMap1.put("orderSeqTHD",orderNum);
orderViewMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(hashMap1),wrapperOV);
log.info("----------将智能订单状态更新至数据库success:" + state);
} else {
log.info("----------将智能订单状态更新至数据库error:" + state);
}
}
}
}
}
}
}
private String QueOrderNum(String orderNum) {
// TODO Auto-generated method stub
if (orderNum.equals("12")) {
return "1"; // 待提交
} else if (orderNum.equals("11")) {
return "4"; // 归档
} else if (orderNum.equals("13") || orderNum.equals("18")) {
return "5"; // 作废(作废、分销商作废)
} else if (orderNum.equals("9")) {
return "3"; // 受理成功【待收费】
} else if (orderNum.equals("10")) {
return "9"; // 已收费【待竣工】
} else if (orderNum.equals("14")) {
return "10"; // 受理异常
} else {
return "2"; // 待受理(未受理、未受理【待跟进】、待疑难支撑审核、待分局审核、待分销商审核)
}
}
private net.sf.json.JSONObject getQueryOrderInfo(String orderNum, String currentTimeStr) throws Exception {
List<NameValuePair> qParams = new ArrayList<NameValuePair>();
RequestConfig defaultRequestConfig = RequestConfig.custom().setSocketTimeout(50000)
.setConnectTimeout(50000).setConnectionRequestTimeout(50000).build();
CloseableHttpClient httpclient = HttpClients.custom().setDefaultRequestConfig(defaultRequestConfig)
.build();
HttpEntity entity = null;
HttpPost httpPost = new HttpPost(Constant.ZHANGSHIURL + "query.action");
RequestConfig requestConfig = RequestConfig.copy(defaultRequestConfig).build();
httpPost.setConfig(requestConfig);
Map<String, String> signMap = new HashMap<String, String>();//待签名参数
qParams.add(new BasicNameValuePair("service", "query.order.status"));//api标识,必填
signMap.put("service", "query.order.status");
qParams.add(new BasicNameValuePair("userName", Constant.ZHENGSHIAUCCON));//用户名,必填
signMap.put("userName", Constant.ZHENGSHIAUCCON);
qParams.add(new BasicNameValuePair("timeStamp", currentTimeStr));//时间戳(YYYYMMDDHHMMSS) ,必填
signMap.put("timeStamp", currentTimeStr);
qParams.add(new BasicNameValuePair("orderNumber", orderNum));//智能平台订单编号,非必填
signMap.put("outOrderNum", orderNum);
// qParams.add(new BasicNameValuePair("outOrderNum","13888888888"));//外部订单编号,非必填
// signMap.put("outOrderNum","13888888888");
List<String> keys = new ArrayList<String>();
keys.addAll(signMap.keySet());
Collections.sort(keys);//key按字符串升序
String value, plaintext = "";
for (String key : keys) {
value = signMap.get(key);
plaintext = plaintext.concat(value);
}
plaintext = plaintext.concat(Constant.ZHANGSHIKEY);
qParams.add(new BasicNameValuePair("sign",MD5Utils.md5(plaintext).toUpperCase()));//签名,必填
net.sf.json.JSONObject resultDataJson = null;
try {
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
httpPost.setEntity(new UrlEncodedFormEntity(qParams, "UTF-8"));
System.out.println("提交参数:" + EntityUtils.toString(httpPost.getEntity(), "UTF-8"));
HttpResponse response = httpclient.execute(httpPost);
entity = response.getEntity();
String httpResult = EntityUtils.toString(entity, "UTF-8");
resultDataJson = net.sf.json.JSONObject.fromObject(httpResult);
} catch (Exception e) {
System.out.println("接口异常");
e.printStackTrace();
} finally {
httpPost.releaseConnection();
}
return resultDataJson;
}
private static JSONObject getSaleId(String productId, String currentTimeStr) throws Exception {
List<NameValuePair> qParams = new ArrayList<NameValuePair>();
Map<String, String> signMap = new HashMap<String, String>();//待签名参数
RequestConfig defaultRequestConfig = RequestConfig.custom().setSocketTimeout(50000)
.setConnectTimeout(50000).setConnectionRequestTimeout(50000).build();
CloseableHttpClient httpclient = HttpClients.custom().setDefaultRequestConfig(defaultRequestConfig)
.build();
HttpEntity entity = null;
HttpPost httpPost = new HttpPost(Constant.ZHANGSHIURL + "query.action");
RequestConfig requestConfig = RequestConfig.copy(defaultRequestConfig).build();
httpPost.setConfig(requestConfig);
qParams.add(new BasicNameValuePair("service", "sale.query"));//api标识,必填
signMap.put("service", "sale.query");
qParams.add(new BasicNameValuePair("userName", Constant.ZHENGSHIAUCCON));//用户名,必填
signMap.put("userName", Constant.ZHENGSHIAUCCON);
qParams.add(new BasicNameValuePair("timeStamp", currentTimeStr));
signMap.put("timeStamp", currentTimeStr);
if (StringUtils.isNotBlank(productId)) {
qParams.add(new BasicNameValuePair("productId", productId));//产品ID
signMap.put("productId", productId);
}
List<String> keys = new ArrayList<String>();
keys.addAll(signMap.keySet());
Collections.sort(keys);//key按字符串升序
String value, plaintext = "";
for (String key : keys) {
value = signMap.get(key);
plaintext = plaintext.concat(value);
}
plaintext = plaintext.concat(Constant.ZHANGSHIKEY);
String sign = MD5Utils.md5(plaintext).toUpperCase();//md5加密
qParams.add(new BasicNameValuePair("sign", sign));//签名,必填
JSONObject resultDataJson = null;
try {
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
httpPost.setEntity(new UrlEncodedFormEntity(qParams, "UTF-8"));
log.info("提交参数:" + EntityUtils.toString(httpPost.getEntity(), "UTF-8"));
HttpResponse response = httpclient.execute(httpPost);
entity = response.getEntity();
String httpResult = EntityUtils.toString(entity, "UTF-8");
log.info("返回信息:" + httpResult);
resultDataJson = JSONObject.parseObject(httpResult);
} catch (Exception e) {
log.info("---接口异常");
e.printStackTrace();
} finally {
httpPost.releaseConnection();
}
return resultDataJson;
}
}
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