Commit 132bd33a by 罗承锋

修改协议数据获取方法

parent 8abd77cb
......@@ -2,6 +2,8 @@ package com.winsun.controller;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.netflix.discovery.converters.Auto;
import com.winsun.auth.core.annotion.Permission;
import com.winsun.auth.core.common.model.ResponseData;
import com.winsun.bean.*;
import com.winsun.mapper.*;
......@@ -14,15 +16,17 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @Author xiangli
......@@ -46,6 +50,10 @@ public class codeManagerController {
@Autowired
@Qualifier("redisStringTemplate")
private RedisTemplate redisTemplate;
@Autowired
private ProductMapper productMapper;
@Autowired
private UniversityInfoMapper universityInfoMapper;
@ResponseBody
@RequestMapping(value = "sendCodes", method = RequestMethod.POST)
......@@ -149,4 +157,164 @@ public class codeManagerController {
}
return ResponseData.success();
}
/**
* 业务预受理表参数
* @param request
* @param response
* @param callback
* @return
* @throws IOException
*/
@PostMapping("findReportMap")
public ResponseData<Map<String,Object>> findReportMap(HttpServletRequest request, HttpServletResponse response, String callback) throws IOException {
String prices = null;
String byStr = null;
String mealStr = null;
String month = null;
String expenses = "";
String product_price = ""; // 资费
String identifying = ""; // 提速包:
String identifying_price = ""; // 提速包资费
String identifyingStr = ""; // 提速包
String tyMeal = "";
String university_domain_name = ""; // 后缀
boolean speed_up = true;
boolean product_price_CB = false;
boolean new_clothes_CB = false;
boolean setMealCB = false;
String isFromRh = request.getParameter("isFromRh"); // 融合
String productId = request.getParameter("productId"); // 产品id
String setMealIndex = request.getParameter("setMealIndex");//产品下标
String sl = request.getParameter("sl"); // 宽带提速速率
// 校验参数
if (StringUtils.isBlank(isFromRh) || StringUtils.isBlank(productId)) {
return ResponseData.error("签名页参数缺失");
}
if (StringUtils.isBlank(productId)) {
return ResponseData.error("请重新选择产品");
}
Product product = productMapper.selectById(productId);
if (product == null) {
return ResponseData.error("未找到产品信息,请重写进入下单");
}
UniversityInfo universityInfo = universityInfoMapper.selectById(product.getUniversityId());
if (universityInfo == null) {
return ResponseData.error("未找到大学宽带信息,请重写进入下单");
}
String[] rateArry = product.getProductRate().split(","); // 年月(包年,包月)
String[] mealArry = product.getProductMeal().split(","); // 套餐 (4M,8M,20M等)
String[] priceArry = product.getProductPrice().split(","); // 金额(300,30)
if("true".equals(isFromRh)) {
rateArry = product.getProductRhRate().split(","); // 年月(包年,包月)
priceArry = product.getProductPrice().split(","); // 金额(300,30)
}
Integer index = 0;
if(StringUtils.isNotBlank(setMealIndex)){
index = Integer.parseInt(setMealIndex);
}
byStr = rateArry[index];
mealStr = mealArry[index];
prices = priceArry[index];
if(byStr.equals("包年")){
month = "12";
}else{
month = "1";
}
new_clothes_CB = true;
tyMeal = "预付费校园";
setMealCB = true;
// 融合/提速 提速包:
String regEx="[^0-9]";
Pattern p = Pattern.compile(regEx);
identifying = universityInfo.getIdentifying().toString();
expenses = universityInfo.getExpenses();
if(StringUtils.isNotBlank(expenses)){
expenses = expenses.replace("M","");
}
university_domain_name = universityInfo.getUniversityDomainName();
if(StringUtils.isNotBlank(university_domain_name)){
university_domain_name = university_domain_name.replace("@","");
}
product_price_CB = true;
if(identifying.contains("免费")){
identifying_price = "0";
identifyingStr = identifying;
}else{
Matcher m = p.matcher(identifying);
identifying_price = m.replaceAll("").trim();
if(StringUtils.isNotBlank(identifying)){
identifyingStr = identifying.substring(0,8);
}
}
if(StringUtils.isNotBlank(sl)){
new_clothes_CB = false;
}
// 单宽
if(StringUtils.isBlank(isFromRh) && StringUtils.isBlank(sl)){
identifying_price = "";
identifyingStr = "";
tyMeal = "";
setMealCB = false;
product_price_CB = false;
speed_up = false;
expenses = "";
university_domain_name = "";
}
// 返回的参数
Map<String, Object> mapData = new HashMap<>();
mapData.put("channel_number",""); // 渠道工号
mapData.put("student_name",""); // 姓名
mapData.put("student_number",""); // 学号
mapData.put("contact_number",""); // 联系方式
mapData.put("id_card",""); // 身份证号码
mapData.put("universityName",product.getProductUniversity()); //学校:
mapData.put("department",""); // 系
mapData.put("setClass",""); // 班级
mapData.put("dormitory",""); // 宿舍
mapData.put("setMealCB",setMealCB); // 我要办理天翼@_@套餐 checkbox
mapData.put("tyMeal",tyMeal); // 我要办理天翼@_@套餐
mapData.put("setMealIndex",setMealIndex); // 套餐下标
mapData.put("upgradeCB",false); // 我要办理老用户套餐升级: checkbox
mapData.put("upgrade",""); // 我要办理老用户套餐升级:
mapData.put("original_package",""); // 原套餐:
mapData.put("new_package",""); // 转新套餐:
mapData.put("new_clothes_CB",new_clothes_CB); // 新装 checkbox
mapData.put("change_CB",false); // 变更 checkbox
mapData.put("product_price",prices); // 资费
mapData.put("month",month); // 包年/包月 12/1
mapData.put("product_other",""); // (其他)
mapData.put("speed_up",speed_up); // 我要办理宽带提速: checkbox
mapData.put("product_price_CB",product_price_CB); // 在原基础宽带资费外每月低消/加价 checkbox
mapData.put("product_price_up",identifying_price); // 在原基础宽带资费外每月低消/加价____元
mapData.put("expenses",expenses); // 宽带提速 ______M
mapData.put("university_domain_name",university_domain_name); // 账号为______@______后缀
mapData.put("phone_CB",false); // 只为手机号 checkbox
mapData.put("phone_TD",""); // 只为手机号____退订
mapData.put("phone_TD_price",""); // 退订每月____元
mapData.put("phone_product_meal",""); // 提速至____M
mapData.put("acceleration_package_CB",false); // 办理加速包 checkbox
mapData.put("business_number",""); // 办理加速包 手机号为:
mapData.put("identifying",identifying); // 办理加速包:
mapData.put("identifying_price",identifying_price); // 办理__元
mapData.put("identifyingStr",identifyingStr); // 办理加速包
mapData.put("university_package_number",""); // 揽装工号:
mapData.put("remarks",""); // 其他备注:
return ResponseData.success(mapData);
}
}
......@@ -1733,170 +1733,7 @@ public class OrderController extends BaseController {
return resultStr;
}
@Permission(menuname = "业务预受理表参数返回", method = RequestMethod.GET, value = "findReportMap")
public void findReportMap(HttpServletRequest request,HttpServletResponse response,String callback) throws IOException {
String prices = null;
String byStr = null;
String mealStr = null;
String month = null;
String expenses = "";
String product_price = ""; // 资费
String identifying = ""; // 提速包:
String identifying_price = ""; // 提速包资费
String identifyingStr = ""; // 提速包
String tyMeal = "";
String university_domain_name = ""; // 后缀
boolean speed_up = false;
boolean product_price_CB = false;
boolean new_clothes_CB = false;
boolean setMealCB = false;
Map<String, Object> QueUniversityData ;
String isFromRh = request.getParameter("isFromRh"); // 融合
String partner = request.getParameter("partner"); // 合伙人id
String productTitle = request.getParameter("productTitle"); // 宽带标题
String universityRegion = request.getParameter("universityRegion"); // 县份
String universityName = request.getParameter("universityName"); // 学校名
String setMeal = request.getParameter("setMeal");
String setMealIndex = request.getParameter("setMealIndex");
String sl = request.getParameter("sl"); // 宽带提速速率
String ex = request.getParameter("ex"); // 宽带速率
Map<String, Object> QueProductIdData = orderMapper.queExiteProductNameData(productTitle, universityRegion, universityName).get(0);
QueUniversityData = orderMapper.queUniversityNameData(universityName, universityRegion).get(0);
if(QueUniversityData != null && QueUniversityData.size()>1){
QueUniversityData = orderMapper.queProductNameDataToUniversityNameData(productTitle, universityRegion, universityName).get(0);
}
String[] rateArry = ((String) QueProductIdData.get("product_rate")).split(","); // 年月(包年,包月)
String[] mealArry = ((String)QueProductIdData.get("product_meal")).split(","); // 套餐 (4M,8M,20M等)
String[] priceArry = ((String) QueProductIdData.get("product_price")).split(","); // 金额(300,30)
if(StringUtils.isNotBlank(isFromRh) && isFromRh=="true") {
rateArry = ((String) QueProductIdData.get("product_rh_rate")).split(","); // 年月(包年,包月)
priceArry = ((String) QueProductIdData.get("product_rh_price")).split(","); // 金额(300,30)
}
Integer index = 0;
if(StringUtils.isNotBlank(setMealIndex)){
index = Integer.parseInt(setMealIndex);
}
byStr = rateArry[index];
mealStr = mealArry[index];
prices = priceArry[index];
if(byStr.equals("包年")){
month = "12";
}else{
month = "1";
}
new_clothes_CB = true;
tyMeal = "预付费校园";
setMealCB = true;
// 融合/提速 提速包:
String regEx="[^0-9]";
Pattern p = Pattern.compile(regEx);
identifying = QueUniversityData.get("identifying").toString();
expenses = (String) QueUniversityData.get("expenses");
if(StringUtils.isNotBlank(expenses)){
expenses = expenses.replace("M","");
}
university_domain_name = (String)QueUniversityData.get("university_domain_name");
if(StringUtils.isNotBlank(university_domain_name)){
university_domain_name = university_domain_name.replace("@","");
}
product_price_CB = true;
if(identifying.contains("免费")){
identifying_price = "0";
identifyingStr = identifying;
}else{
Matcher m = p.matcher(identifying);
identifying_price = m.replaceAll("").trim();
if(StringUtils.isNotBlank(identifying)){
identifyingStr = identifying.substring(0,8);
}
}
if(StringUtils.isNotBlank(sl)){
new_clothes_CB = false;
}
// 单宽
if(StringUtils.isBlank(isFromRh) && StringUtils.isBlank(sl)){
identifying_price = "";
identifyingStr = "";
tyMeal = "";
setMealCB = false;
product_price_CB = false;
expenses = "";
university_domain_name = "";
}
String seal = "";
// String url = "D:\\Projects\\wxProject\\gdtel-xyzx-hhr\\WebContent\\images\\seal\\seal.png";
String url = this.getClass().getResource("/").getPath();
int num = url.indexOf("gdtel-xyzx-hhr");
url = url.substring(0,num);
url = url + "gdtel-xyzx-hhr/images/seal/seal.png";
// 获取协议印章图片
seal = getPhoto(url);
// 返回的参数
Map<String, Object> mapData = new HashMap<>();
mapData.put("channel_number",""); // 渠道工号
mapData.put("student_name",""); // 姓名
mapData.put("student_number",""); // 学号
mapData.put("contact_number",""); // 联系方式
mapData.put("id_card",""); // 身份证号码
mapData.put("universityName",universityName); //学校:
mapData.put("department",""); // 系
mapData.put("setClass",""); // 班级
mapData.put("dormitory",""); // 宿舍
mapData.put("setMealCB",setMealCB); // 我要办理天翼@_@套餐 checkbox
mapData.put("tyMeal",tyMeal); // 我要办理天翼@_@套餐
mapData.put("setMealIndex",setMealIndex); // 套餐下标
mapData.put("upgradeCB",false); // 我要办理老用户套餐升级: checkbox
mapData.put("upgrade",""); // 我要办理老用户套餐升级:
mapData.put("original_package",""); // 原套餐:
mapData.put("new_package",""); // 转新套餐:
mapData.put("new_clothes_CB",new_clothes_CB); // 新装 checkbox
mapData.put("change_CB",""); // 变更 checkbox
mapData.put("product_price",prices); // 资费
mapData.put("month",month); // 包年/包月 12/1
mapData.put("product_other",""); // (其他)
mapData.put("speed_up",speed_up); // 我要办理宽带提速: checkbox
mapData.put("product_price_CB",product_price_CB); // 在原基础宽带资费外每月低消/加价 checkbox
mapData.put("product_price_up",identifying_price); // 在原基础宽带资费外每月低消/加价____元
mapData.put("expenses",expenses); // 宽带提速 ______M
mapData.put("university_domain_name",university_domain_name); // 账号为______@______后缀
mapData.put("phone_CB",false); // 只为手机号 checkbox
mapData.put("phone_TD",""); // 只为手机号____退订
mapData.put("phone_TD_price",""); // 退订每月____元
mapData.put("phone_product_meal",""); // 提速至____M
mapData.put("acceleration_package_CB",false); // 办理加速包 checkbox
mapData.put("business_number",""); // 办理加速包 手机号为:
mapData.put("identifying",identifying); // 办理加速包:
mapData.put("identifying_price",identifying_price); // 办理__元
mapData.put("identifyingStr",identifyingStr); // 办理加速包
mapData.put("university_package_number",""); // 揽装工号:
mapData.put("remarks",""); // 其他备注:
mapData.put("seal",seal); // 印章
response.setContentType("text/json; charset=utf-8");
response.setHeader("Access-Control-Allow-Origin", "*");
PrintWriter writer = response.getWriter();
//需要把jsonp生成的参数带回前台,jsonp才能解析
writer.print(callback + "("+ JSON.toJSONString(mapData)+")");
writer.close();
}
//path 为图片在服务器的绝对路径
public String getPhoto(String url) {
try {
......
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