Commit fad81c9b by 黄森林

单宽接口

parent 5c8a8d98
...@@ -7,8 +7,10 @@ import com.winsun.bean.OrderView; ...@@ -7,8 +7,10 @@ import com.winsun.bean.OrderView;
import com.winsun.bean.Product; import com.winsun.bean.Product;
import com.winsun.bean.School; import com.winsun.bean.School;
import com.winsun.bean.UniversityInfo; import com.winsun.bean.UniversityInfo;
import com.winsun.constant.Constant;
import com.winsun.constant.OrderStatus; import com.winsun.constant.OrderStatus;
import com.winsun.mapper.*; import com.winsun.mapper.*;
import com.winsun.utils.IDCardUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -17,8 +19,11 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -17,8 +19,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -42,13 +47,17 @@ public class DankuanController { ...@@ -42,13 +47,17 @@ public class DankuanController {
private static UniversityInfoMapper universityInfoMapper; private static UniversityInfoMapper universityInfoMapper;
private static OrderViewMapper orderViewMapper;
@Autowired @Autowired
public DankuanController(ProductMapper productMapper, SchoolMapper schoolMapper, AppMapper appMapper, UniversityInfoMapper universityInfoMapper) { public DankuanController(ProductMapper productMapper, SchoolMapper schoolMapper, AppMapper appMapper,
UniversityInfoMapper universityInfoMapper, OrderViewMapper orderViewMapper) {
DankuanController.productMapper = productMapper; DankuanController.productMapper = productMapper;
DankuanController.schoolMapper = schoolMapper; DankuanController.schoolMapper = schoolMapper;
DankuanController.appMapper = appMapper; DankuanController.appMapper = appMapper;
DankuanController.universityInfoMapper = universityInfoMapper; DankuanController.universityInfoMapper = universityInfoMapper;
DankuanController.orderViewMapper = orderViewMapper;
} }
/** /**
...@@ -72,38 +81,40 @@ public class DankuanController { ...@@ -72,38 +81,40 @@ public class DankuanController {
return ResponseData.success(product); return ResponseData.success(product);
} }
@RequestMapping("/DomainName") @RequestMapping("/selectUniversity")
public ResponseData<String> getDomainName(@RequestParam("schoolName") String schoolName) { public ResponseData<UniversityInfo> selectUniversity(@RequestParam("universityId") String universityId) {
//空,直接返回 UniversityInfo universityInfo = universityInfoMapper.selectById(universityId);
if (StringUtils.isBlank(schoolName)) { return ResponseData.success(universityInfo);
return ResponseData.error("请输入学校名称");
}
EntityWrapper<UniversityInfo> universityInfowrapper = new EntityWrapper<>();
universityInfowrapper.setSqlSelect("university_domain_name as domainName", schoolName);
universityInfowrapper.eq("university_name", schoolName);
List<Map<String, Object>> universityInfos = universityInfoMapper.selectMaps(universityInfowrapper);
if (CollectionUtils.isEmpty(universityInfos)) {
return ResponseData.error("查找不到学校相应数据");
}
if (universityInfos.get(0).get("domainName") == null) {
return ResponseData.error("查找不到学校相应数据");
}
return ResponseData.success(universityInfos.get(0).get("domainName").toString());
} }
@RequestMapping("/createProductOrder") @RequestMapping("/createProductOrder")
public ResponseData<String> createProductOrder(@RequestParam("orderName") String orderName, @RequestParam("orderPhone") String orderPhone, public ResponseData<OrderView> createProductOrder(@RequestParam("orderName") String orderName, @RequestParam("orderPhone") String orderPhone,
@RequestParam("orderNumber") String orderNumber, @RequestParam("orderCustomerStudentId") String orderCustomerStudentId, @RequestParam("orderNumber") String orderNumber, @RequestParam("orderCustomerStudentId") String orderCustomerStudentId,
@RequestParam("orderCustomerAccount") String orderCustomerAccount, @RequestParam("orderCustomerPwd") String orderCustomerPwd, @RequestParam("orderCustomerAccount") String orderCustomerAccount, @RequestParam("orderCustomerPwd") String orderCustomerPwd,
@RequestParam("orderSetMeal") String orderSetMeal, @RequestParam("productId") String productId, @RequestParam("orderSetMeal") String orderSetMeal, @RequestParam("productId") String productId,
@RequestParam("webOrderAmount") String webOrderAmount) { @RequestParam("webOrderAmount") String webOrderAmount) {
if(!IDCardUtil.IDCardValidate(orderNumber)){
return ResponseData.error("您的身份证输入有误,请重新输入!");
}
if (orderPhone.length() != 11) {
return ResponseData.error("联系号码有误,请重新输入");
}
Wrapper<OrderView> wrapper = new EntityWrapper<>();
wrapper.eq(StringUtils.isNotBlank(orderNumber), "orderNumber", orderNumber);
wrapper.ne( "status", OrderStatus.INVALID.getId());
List<OrderView> orderViews = orderViewMapper.selectList(wrapper);
OrderView orderV = new OrderView();
if(orderViews.size()!= 0){
orderV.setOrderId(orderViews.get(0).getOrderId());
orderV.setOrderseq(orderViews.get(0).getOrderseq());
return ResponseData.error(orderV,"当前身份证号已有订单存在!");
}
SimpleDateFormat yyyyMMdd = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat yyyyMMdd = new SimpleDateFormat("yyyyMMdd");
Date date = new Date(); Date date = new Date();
String format = yyyyMMdd.format(date); String format = yyyyMMdd.format(date);
String s = String.valueOf((int) ((Math.random() * 9 + 1) * 1000)); String s = String.valueOf((int) ((Math.random() * 9 + 1) * 1000));
String orderSeq = "YRYM" + format + s; String orderSeq = "YRYM" + format + s;
Product product = productMapper.selectById(productId); Product product = productMapper.selectById(productId);
Wrapper<Object> wrapper = new EntityWrapper<>();
OrderView orderView = new OrderView(); OrderView orderView = new OrderView();
orderView.setOrdername(orderName); orderView.setOrdername(orderName);
orderView.setOrderphone(orderPhone); orderView.setOrderphone(orderPhone);
...@@ -120,13 +131,112 @@ public class DankuanController { ...@@ -120,13 +131,112 @@ public class DankuanController {
orderView.setOrderRegion(product.getProductRegion()); orderView.setOrderRegion(product.getProductRegion());
orderView.setPaytype("1"); orderView.setPaytype("1");
orderView.setWeborderamount(webOrderAmount); orderView.setWeborderamount(webOrderAmount);
if(Integer.parseInt(webOrderAmount) == 0){ if(webOrderAmount.equals("0")){
orderView.setIpay("0"); orderView.setIpay("0");
}else { }else {
orderView.setIpay("1"); orderView.setIpay("1");
} }
orderView.setOrderreqtranseq("xyzxyql"); orderView.setOrderreqtranseq("xyzxyql");
orderView.setOrderCustomerType("学生"); orderView.setOrderCustomerType("学生");
return null; Integer insert = orderViewMapper.insert(orderView);
if(insert == 1){
orderV.setOrderId(orderView.getOrderId());
orderV.setOrderseq(orderView.getOrderseq());
return ResponseData.success(orderV,"订单提交完成!");
}
return ResponseData.error("提交失败!");
} }
/* *//**
* @author ljh
* @Description:支付请求
*//*
private void JsoupMethodZhifu(HttpServletRequest request, HttpServletResponse response) throws Exception {
// TODO Auto-generated method stub
log.info("----------首先发送支付请求接口----------");
Map<String, String> map = new HashMap<String, String>();
//查询订单信息
//给MAP数组添加数据
map.put("CLIENTNUMBER", Constant.CLIENTNUMBER);
map.put("ORDERSEQ", orderMap.get("orderSeq"));
log.info("----------宽带价格prices:" + prices);
if (Constant.PRODUCTSKU479Str.indexOf(prices) != -1) {
map.put("PRODUCTSKU", Constant.PRODUCTSKU479);
} else {
map.put("PRODUCTSKU", Constant.PRODUCTSKU481);
}
map.put("ORDERDATE", orderMap.get("orderDate"));
String pricesStr = orderMap.get("prices").replace("元", "");
// pricesStr = "0.01";
map.put("ORDERAMOUNT", pricesStr);
map.put("ORDERNAME", orderMap.get("orderName"));
map.put("ORDERPHONE", orderMap.get("orderPhone"));
map.put("ORDERNUMBER", orderMap.get("orderNumber"));
if (Constant.Payment1.equals(radioValue)) {
String MERCHANTURL = Constant.TOMCATURL + "/gdtel-xyzx-hhr/vPageJump/toPaymentSuccessPage.do?orderSeq=" + orderMap.get("orderSeq");
map.put("MERCHANTURL", MERCHANTURL);
}
if (orderMap.get("upStatus") != null && orderMap.get("upStatus").equals("1")) {
//支付成功后融合回调
map.put("BACKDROPURL", Constant.TOMCATURL + "/gdtel-xyzx-hhr/paymentCon/toSubmisOrderPreserRH.do");
} else {
//单宽回调地址
map.put("BACKDROPURL", Constant.TOMCATURL + "/gdtel-xyzx-hhr/paymentCon/toSubmisOrderPreser.do");
}
String str = "ORDERSEQ=" + orderMap.get("orderSeq") + "&ORDERDATE=" + orderMap.get("orderDate") + "&ORDERAMOUNT=" + pricesStr + "&KEY=" + Constant.KEY;
*//* 将值转换为大写 *//*
map.put("MAC", SignUtil.exChange(SignUtil.md5EncodeSignature(str)));
int PAYTYPE = 1; // 支付类型
int IPAY = 1; // 支付平台
log.info("----------支付渠道(0翼支付网厅,1支付宝,3微信):" + radioValue);
if (Constant.Payment3.equals(radioValue)) {
PAYTYPE = 5;
IPAY = 3;
}
map.put("PAYTYPE", String.valueOf(PAYTYPE));
map.put("IPAY", String.valueOf(IPAY));
log.info("----------支付请求参数:" + map);
//定义Document对象
Document doc = null;
String result = "";
String qrcode = "";
//Jsoup用post提交,超时6秒钟,
doc = Jsoup.connect("https://gzdxpay.mini189.cn/web/order-pay.action").data(map).timeout(20000).ignoreContentType(true).post();
//获取回调信息
String i = doc.text().trim();
System.out.println(i);
//解析json格式
JSONObject json = JSONObject.fromObject(i);
//获取jsonp格式中的result(短链接,返回到前端)
log.info("----------调用穗易付接口返回的结果:" + json);
result = (String) json.get("result");
qrcode = (String) json.get("qrcode");
String ORDERSEQ = (String) json.get("ORDERSEQ");
String msg = (String) json.get("msg");
if (StringUtils.isNotBlank(msg) && msg.equals("success")) {
//获取的短链接地址,使用redirect方式返回前端。(流程图中的步骤8,301跳转)
orderMap.put("payType", PAYTYPE + "");
log.info("====默认受理未付费,之后可通过提交订单到智能平台后再更新状态====");
orderMap.put("Status", "100");
log.info("====保存到本地数据库 ====");
if (StringUtils.isNotBlank(ORDERSEQ)) {
Map<String, Object> queOrderMaps = orderService.queryorderSeq(ORDERSEQ); // 保存前查询订单号是否存在,存在即为更新
if (BeanUtil.isNotBlank(queOrderMaps)) {
saveOrderInfo(request, orderMap, ORDERSEQ);
} else {
saveOrderInfo(request, orderMap, "");
}
}
response.sendRedirect(result);
}
}*/
} }
package com.winsun.constant;
/**
* @author ljh
* @Description:常量类
* @Title: Constant
* @date 2018年5月16日下午6:55:54
* @version 1.0
*/
public class Constant {
/* 默认一页显示10条数据 */
public final static Integer PAGENUM = 2;
/* 默认第一页 */
public final static Integer FROMPAGE = 0;
/*用户状态*/
public final static String USERQIDONG = "1";//启用
public final static String USERJINYONG = "0";//禁用
/*支付参数*/
public final static String CLIENTNUMBER = "xyzxyql"; //商户标识,由穗易付平台统一分配
public final static String KEY = "E805F0305C455BA7C5BAE3796C6500BD"; //商户标识,由穗易付平台统一分配
public final static String USERNAME = "apitest"; //智能平台提供测试的账号
public final static String USERNAMEKEY = "46b97294d4dac3f62ee42f3ab2804f68"; //智能平台提供的测试key
public final static String ZHENGSHIAUCCON = "ruany"; //智能平台提供的正式账号
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://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内网服务器地址
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 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"; //服务器地址
// public final static String INTRANETURL = "http://127.0.0.1:8080"; //服务器地址
public final static String PRODUCTSKU481 = "481"; //产品sku:校园宽带300元/年
public final static String PRODUCTSKU479 = "479"; //产品sku:校园宽带30元/月
public final static String PRODUCTSKU479Str = "30元"; //产品sku:校园宽带30元/月
public final static String PRODUCTSKU481Str = "300元"; //产品sku:校园宽带30元/月
public final static String Payment0 = "0"; //支付方式:为翼支付网厅
public final static String Payment1 = "1"; //支付方式:为支付宝
public final static String Payment3 = "3"; //支付方式:为微信支付
public static final String VALIDATECODE_SESSION_KEY = "validatecode"; // 验证码 session key
/*宽带图片*/
public final static String KUANDAIIMAGE = "kuandai";//封面图
public final static String IMGBDURL = "/static/images/temp/";//图片存放位置
public final static String KDIMGBDURL = "/static/images/kuandai/";//图片存放位置
public final static String ORDERSTATUS1 = "1"; // 待提交
public final static String ORDERSTATUS2 = "2"; // 待受理
public final static String ORDERSTATUS3 = "3"; // 受理成功【待收费】
public final static String ORDERSTATUS4 = "4"; // 归档
public final static String ORDERSTATUS5 = "5"; // 作废
public final static String ORDERSTATUS9 = "9"; // 已收费【待竣工】
public final static String ORDERSTATUS10 = "10"; // 受理异常
public final static String ORDERSTATUS100= "100"; // 未支付
public final static String ROLE1 = "1"; // 用户权限:1管理员 2测试人员 3工作人员 4学校人员
public final static String ROLE2 = "2"; // 用户权限:1管理员 2测试人员 3工作人员 4学校人员
public final static String ROLE3 = "3"; // 用户权限:1管理员 2测试人员 3工作人员 4学校人员
public final static String ROLE4 = "4"; // 用户权限:1管理员 2测试人员 3工作人员 4学校人员
}
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