Commit 6646cc48 by 伍思炜

智能平台对接开发

parent fca73a8f
......@@ -387,6 +387,12 @@ public class DankuanController {
dataMapping.put("order_payment_time", new Date());
dataMapping.put("status", "已支付");
orderViewMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(dataMapping), wrapper);
Wrapper<Order> orderWrapper = new EntityWrapper<>();
orderWrapper.eq("kd_order_id",orderseq);
Map<String, Object> orderMapping = new HashMap<>();
orderMapping.put("order_status", "未下单");
//orderMapping.put("order_payment_time", new Date());
orderMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(orderMapping),orderWrapper);
Wrapper<Order> objectEntityWrapper = new EntityWrapper<>();
objectEntityWrapper.eq("kd_order_id", orderseq);
Map<String, Object> stringObjectMap = orderMapper.selectKdOrder(orderseq);
......
......@@ -119,7 +119,11 @@
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<!-- <dependency>-->
<dependency>
<groupId>com.winsun.framework</groupId>
<artifactId>winsun-core-service</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.github.ulisesbocchio</groupId>-->
<!-- <artifactId>jasypt-spring-boot-starter</artifactId>-->
<!-- </dependency>-->
......
package com.winsun.bean;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import lombok.Data;
/**
* 移动订单拓展信息
*/
@Data
@TableName("hhr_order_card_address")
public class OrderCardAddress {
/**
* 对应移动订单表中的id
*/
@TableField(value = "order_id")
private String orderId;
@TableField(value = "card_address")
private String cardAddress;
}
package com.winsun.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.winsun.bean.OrderCardAddress;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;
@Mapper
@Component
public interface OrderCardAddressMapper extends BaseMapper<OrderCardAddress> {
@Select("select card_address from hhr_order_card_address where order_id = #{orderId}")
String selectByOrderId(Object orderId);
}
......@@ -67,7 +67,7 @@ public interface OrderMapper extends BaseMapper<Order> {
" create_time FROM hhr_order where id= #{id} ")
Map<String, Object> selectOrderById(String id);
@Select("SELECT u.*,s.service_qrcode,s.kdsl,s.net_type,s.is_xb,s.jilt_kd,s.jilt_kdy,s.net_phone " +
@Select("SELECT u.*,s.* " +
"FROM hhr_user u LEFT JOIN hhr_user_school us ON u.id=us.user_id " +
"LEFT JOIN hhr_school s ON us.school_id=s.id WHERE u.id= #{hehuoren_id} ")
Map<String, Object> findPartnerById(String hehuoren_id);
......
......@@ -30,6 +30,7 @@ public class SalesListServiceImpl extends ServiceImpl<SalesListMapper, SalesList
* 添加销售清单
* @return
*/
@Override
public ResponseData<String> addSalesList(SalesList salesList) {
// 获取4个月内记录号码数据是否重复
......
package com.winsun.utils;
import javax.crypto.Cipher;
import java.security.*;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
public class RSAUtils {
private static final String KEY_ALGORITHM = "RSA";
private static final String SIGNATURE_ALGORITHM = "MD5withRSA";
private static final String PUBLIC_KEY = "RSAPublicKey";
private static final String PRIVATE_KEY = "RSAPrivateKey";
public static byte[] decryptBASE64(String key) {
return Base64.getDecoder().decode(key);
}
public static String encryptBASE64(byte[] bytes) {
return Base64.getEncoder().encodeToString(bytes);
}
/**
* 用私钥对信息生成数字签名
*
* @param data 加密数据字节数组
* @param privateKey 私钥
* @return base64数字签名
* @throws Exception 异常
*/
public static String sign(byte[] data, String privateKey) throws Exception {
// 解密由base64编码的私钥
byte[] keyBytes = decryptBASE64(privateKey);
// 构造PKCS8EncodedKeySpec对象
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes);
// KEY_ALGORITHM 指定的加密算法
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
// 取私钥匙对象
PrivateKey priKey = keyFactory.generatePrivate(pkcs8KeySpec);
// 用私钥对信息生成数字签名
Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM);
signature.initSign(priKey);
signature.update(data);
return encryptBASE64(signature.sign());
}
/**
* 校验数字签名
*
* @param data 加密数据字节数组
* @param publicKey 公钥
* @param sign base64数字签名
* @return 校验成功返回true 失败返回false
* @throws Exception 异常
*/
public static boolean verify(byte[] data, String publicKey, String sign)
throws Exception {
// 解密由base64编码的公钥
byte[] keyBytes = decryptBASE64(publicKey);
// 构造X509EncodedKeySpec对象
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes);
// KEY_ALGORITHM 指定的加密算法
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
// 取公钥匙对象
PublicKey pubKey = keyFactory.generatePublic(keySpec);
Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM);
signature.initVerify(pubKey);
signature.update(data);
// 验证签名是否正常
return signature.verify(decryptBASE64(sign));
}
/**
* 通过私钥解密
*
* @param data 加密数据字节数组
* @param privateKey 私钥
* @return 解密后数据字节数组
* @throws Exception 异常
**/
public static byte[] decryptByPrivateKey(byte[] data, String privateKey)
throws Exception {
// 对密钥解密
byte[] keyBytes = decryptBASE64(privateKey);
// 取得私钥
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
Key key = keyFactory.generatePrivate(pkcs8KeySpec);
// 对数据解密
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
cipher.init(Cipher.DECRYPT_MODE, key);
return cipher.doFinal(data);
}
/**
* 通过私钥解密
*
* @param data 加密数据
* @param privateKey 私钥
* @return 解密后数据字节数组
* @throws Exception 异常
*/
public static byte[] decryptByPrivateKey(String data, String privateKey)
throws Exception {
return decryptByPrivateKey(decryptBASE64(data), privateKey);
}
/**
* 通过公钥解密
*
* @param data 加密数据字节数组
* @param publicKey 公钥
* @return 解密后数据字节数组
* @throws Exception 异常
*/
public static byte[] decryptByPublicKey(byte[] data, String publicKey)
throws Exception {
// 对密钥解密
byte[] keyBytes = decryptBASE64(publicKey);
// 取得公钥
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
Key key = keyFactory.generatePublic(x509KeySpec);
// 对数据解密
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
cipher.init(Cipher.DECRYPT_MODE, key);
return cipher.doFinal(data);
}
/**
* 通过公钥加密
*
* @param data 加密前数据
* @param publicKey 公钥
* @return 加密后数据字节数组
* @throws Exception 异常
*/
public static byte[] encryptByPublicKey(String data, String publicKey)
throws Exception {
// 对公钥解密
byte[] keyBytes = decryptBASE64(publicKey);
// 取得公钥
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
Key key = keyFactory.generatePublic(x509KeySpec);
// 对数据加密
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
cipher.init(Cipher.ENCRYPT_MODE, key);
return cipher.doFinal(data.getBytes());
}
/**
* 通过私钥加密
*
* @param data 加密前数据字节数组
* @param privateKey 私钥
* @return 加密后数据字节数组
* @throws Exception 异常
*/
public static byte[] encryptByPrivateKey(byte[] data, String privateKey)
throws Exception {
// 对密钥解密
byte[] keyBytes = decryptBASE64(privateKey);
// 取得私钥
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
Key key = keyFactory.generatePrivate(pkcs8KeySpec);
// 对数据加密
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
cipher.init(Cipher.ENCRYPT_MODE, key);
return cipher.doFinal(data);
}
/**
* 取得私钥
*
* @param keyMap keyMap
* @return 私钥
* @throws Exception 异常
*/
public static String getPrivateKey(Map<String, Key> keyMap) {
Key key = keyMap.get(PRIVATE_KEY);
return encryptBASE64(key.getEncoded());
}
/**
* 取得公钥
*
* @param keyMap keyMap
* @return 公钥
* @throws Exception 异常
*/
public static String getPublicKey(Map<String, Key> keyMap) {
Key key = keyMap.get(PUBLIC_KEY);
return encryptBASE64(key.getEncoded());
}
/**
* 初始化密钥
*
* @return keyMap
* @throws Exception 异常
*/
public static Map<String, Key> initKey() throws Exception {
KeyPairGenerator keyPairGen = KeyPairGenerator
.getInstance(KEY_ALGORITHM);
keyPairGen.initialize(1024);
KeyPair keyPair = keyPairGen.generateKeyPair();
Map<String, Key> keyMap = new HashMap(2);
keyMap.put(PUBLIC_KEY, keyPair.getPublic());// 公钥
keyMap.put(PRIVATE_KEY, keyPair.getPrivate());// 私钥
return keyMap;
}
}
\ No newline at end of file
......@@ -163,6 +163,9 @@ public class OrderController extends BaseController {
@Autowired
private ISalesListService salesListService;
@Autowired
private OrderCardAddressMapper orderCardAddressMapper;
/**
* 查询订单历史状态
*/
......@@ -1736,6 +1739,7 @@ public class OrderController extends BaseController {
int ysm = Integer.parseInt(partnerById.get("ysm").toString());
Map<String, Object> ysmById = orderMapper.findYsmById(ysm);
map1.put("orderId",orderData.getId());
map1.put("ysmUser", ysmById.get("user_name"));
map1.put("sign", ysmById.get("sign"));
......@@ -2214,11 +2218,13 @@ public class OrderController extends BaseController {
log.info("移动下单前已有参数:" + JSONObject.fromObject(map).toString());
Map<String, String> return_data = new HashMap<>();
return_data.put("code", "");
return_data.put("route", "提交单"); //[提交下单] [订单保存] [提交审核] 默认为提交下单
return_data.put("route", "提交单"); //[提交下单] [订单保存] [提交审核] 默认为提交下单
return_data.put("微信openId", "");
return_data.put("微信appId", "");
map.put("return_data", return_data);
String cardAddress = orderCardAddressMapper.selectByOrderId(map.get("orderId"));
Map<String, Object> order_data = new HashMap<>();
Map<String, Object> attachment = new HashMap<>(); // 附件
......@@ -2233,7 +2239,7 @@ public class OrderController extends BaseController {
customerInformation.put("客户证件号码", (String) map.get("idCard"));
customerInformation.put("客户证件姓名", (String) map.get("userName"));
customerInformation.put("联系电话", (String) map.get("linkPhone"));
customerInformation.put("客户证件地址", "");
customerInformation.put("客户证件地址", cardAddress);
customerInformation.put("客户证件类型", "身份证");
customerInformation.put("通讯地址", (String) map.get("address"));
order_data.put("客户信息", customerInformation);
......@@ -2259,7 +2265,7 @@ public class OrderController extends BaseController {
orderingProducts.put("产品SKU", "");
orderingProducts.put("产品名称", map.get("cardType"));
orderingProducts.put("受理内容", "");
orderingProducts.put("付费类型", "");
orderingProducts.put("付费类型", "预付费");
// 属性列表
AttributeList roadbandRate = new AttributeList();
......@@ -2280,14 +2286,15 @@ public class OrderController extends BaseController {
orderingProducts.put("属性列表", attributeList);
order_data.put("业务类型", "移动业务"); //业务类型
order_data.put("业务类型", "预付费礼包业务"); //业务类型
order_data.put("办理类型", "新装主卡"); //业务类型
List<Map<String, Object>> mobileAccessList = new ArrayList<>(); //移动接入
Map<String, Object> mobileAccess = new HashMap<>();
mobileAccess.put("订购类型", "新装");
mobileAccess.put("UIM实物串号", map.get("iccId"));
mobileAccess.put("号码类型", "主卡");
mobileAccess.put("移动接入号", map.get("orderNumber"));
mobileAccess.put("移动接入号", "");
mobileAccessList.add(mobileAccess);
order_data.put("移动接入", mobileAccessList);
......@@ -2295,6 +2302,7 @@ public class OrderController extends BaseController {
realNameInformation.put("姓名", "主卡");
realNameInformation.put("身份证号", map.get("idCard"));
realNameInformation.put("ICCID", map.get("iccId"));
realNameInformation.put("证件地址", cardAddress);
order_data.put("实名信息", realNameInformation);
......
package com.winsun.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.enums.SqlLike;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
......@@ -10,6 +11,7 @@ import com.winsun.auth.core.common.model.ResponseData;
import com.winsun.auth.core.shiro.ShiroUser;
import com.winsun.auth.core.util.IOUtils;
import com.winsun.bean.BroadBandOrder;
import com.winsun.bean.Order;
import com.winsun.bean.OrderView;
import com.winsun.constant.OrderStatus;
import com.winsun.mapper.OrderMapper;
......@@ -26,6 +28,8 @@ import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletOutputStream;
......@@ -128,4 +132,15 @@ public class OrderViewController extends BaseController {
return ResponseData.success("导出成功");
}
@Permission(menuname = "智能平台异步调用修改订单状态", value = "updateSatatus", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody
@Transactional
public void updateOrderViewStatus(@RequestBody JSONObject requestBean){
Order order = new Order();
if (StringUtils.isNotBlank(requestBean.getString("order_id"))){
order.setOrderId(requestBean.getString("order_id"));
order.setOrderStatus("已完成");
}
}
}
......@@ -16,7 +16,7 @@ public class WrapperUtil {
}
public static void wrapperLe(EntityWrapper<Order> wrapper, Map<String, Object> map, String str, String str2){
if (map.containsKey(str) && StringUtils.isNotBlank(map.get(str).toString())){
wrapper.ge(str2, map.get(str).toString());
wrapper.le(str2, map.get(str).toString());
}
}
......
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