Commit 485d413a by 罗承锋

修改智能平台公共下单方法、添加一人一码用户数据同步、智能平台状态获取定时器、单宽进融签名

parent fd8530f1
...@@ -7,10 +7,12 @@ import com.netflix.discovery.converters.Auto; ...@@ -7,10 +7,12 @@ import com.netflix.discovery.converters.Auto;
import com.winsun.auth.core.annotion.Permission; import com.winsun.auth.core.annotion.Permission;
import com.winsun.auth.core.common.model.ResponseData; import com.winsun.auth.core.common.model.ResponseData;
import com.winsun.bean.*; import com.winsun.bean.*;
import com.winsun.constant.FilePath;
import com.winsun.constant.OrderStatus; import com.winsun.constant.OrderStatus;
import com.winsun.mapper.*; import com.winsun.mapper.*;
import com.winsun.outSideSystem.IntelligenceSendOrder; import com.winsun.outSideSystem.IntelligenceSendOrder;
import com.winsun.smsUtils.SendSmsAndMail; import com.winsun.smsUtils.SendSmsAndMail;
import com.winsun.utils.Base64ToImgUtils;
import com.winsun.utils.RandomUtil; import com.winsun.utils.RandomUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -126,6 +128,8 @@ public class SingleBroadToIntegrateController { ...@@ -126,6 +128,8 @@ public class SingleBroadToIntegrateController {
return ResponseData.error("该号码不在优惠清单中"); return ResponseData.error("该号码不在优惠清单中");
} }
}catch(Exception e) { }catch(Exception e) {
log.error(e.getMessage());
e.printStackTrace();
return ResponseData.error("获取验证码失败"); return ResponseData.error("获取验证码失败");
} }
return ResponseData.success(null, "获取验证码成功"); return ResponseData.success(null, "获取验证码成功");
...@@ -185,6 +189,8 @@ public class SingleBroadToIntegrateController { ...@@ -185,6 +189,8 @@ public class SingleBroadToIntegrateController {
// 正常下单保存到数据库中 // 正常下单保存到数据库中
log.info(JSONObject.toJSONString(toIntegrateOrderParam)); log.info(JSONObject.toJSONString(toIntegrateOrderParam));
String imgFilePath = "";
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
// 查询订单类型为(3、5、9、10)的 !异常单 // 查询订单类型为(3、5、9、10)的 !异常单
...@@ -255,9 +261,14 @@ public class SingleBroadToIntegrateController { ...@@ -255,9 +261,14 @@ public class SingleBroadToIntegrateController {
orderView.setExpenses(universityInfo.getExpenses()); // 套餐 orderView.setExpenses(universityInfo.getExpenses()); // 套餐
orderViewMapper.insert(orderView); orderViewMapper.insert(orderView);
Base64ToImgUtils base64ToImgUtils = new Base64ToImgUtils();
// TODO 获取签名图片地址 // 获取签名图片地址
if(StringUtils.isBlank(toIntegrateOrderParam.getImgUrl())){
return ResponseData.error("签名失败!");
}
if(StringUtils.isNotBlank(toIntegrateOrderParam.getImgUrl())){
imgFilePath = base64ToImgUtils.base64ToImg(toIntegrateOrderParam.getImgUrl(), FilePath.PATH.getValue()+FilePath.IMGURLPATH.getValue());
}
// 保存到hhr_order // 保存到hhr_order
Order order = new Order(); Order order = new Order();
String uuid = UUID.randomUUID().toString().replaceAll("-", ""); String uuid = UUID.randomUUID().toString().replaceAll("-", "");
...@@ -272,6 +283,7 @@ public class SingleBroadToIntegrateController { ...@@ -272,6 +283,7 @@ public class SingleBroadToIntegrateController {
order.setIdCard(toIntegrateOrderParam.getIdCard()); // 客户身份证 order.setIdCard(toIntegrateOrderParam.getIdCard()); // 客户身份证
order.setCreateTime(new Date()); // 订单创建时间 order.setCreateTime(new Date()); // 订单创建时间
order.setKapin("单宽进融"); // 卡品 order.setKapin("单宽进融"); // 卡品
order.setSignImg(imgFilePath); // 签名地址
order.setDmtNumber(dmt); // 宽带接入号 order.setDmtNumber(dmt); // 宽带接入号
order.setUserType("10"); // 订单类型-单宽进融 order.setUserType("10"); // 订单类型-单宽进融
order.setKdOrderId(orderView.getOrderSeq()); // 宽带id order.setKdOrderId(orderView.getOrderSeq()); // 宽带id
......
...@@ -9,7 +9,6 @@ import com.winsun.bean.*; ...@@ -9,7 +9,6 @@ import com.winsun.bean.*;
import com.winsun.constant.OrderStatus; import com.winsun.constant.OrderStatus;
import com.winsun.mapper.*; import com.winsun.mapper.*;
import com.winsun.smsUtils.SendSmsAndMail; import com.winsun.smsUtils.SendSmsAndMail;
import com.winsun.utils.MessageUtil;
import com.winsun.utils.MyBatisPlusUpdateUtils; import com.winsun.utils.MyBatisPlusUpdateUtils;
import com.winsun.utils.RandomUtil; import com.winsun.utils.RandomUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
......
...@@ -24,7 +24,7 @@ public class Constant { ...@@ -24,7 +24,7 @@ public class Constant {
public final static String USERNAME = "apitest"; //智能平台提供测试的账号 public final static String USERNAME = "apitest"; //智能平台提供测试的账号
public final static String USERNAMEKEY = "46b97294d4dac3f62ee42f3ab2804f68"; //智能平台提供的测试key public final static String USERNAMEKEY = "46b97294d4dac3f62ee42f3ab2804f68"; //智能平台提供的测试key
public final static String ZHENGSHIAUCCON = "ruany"; //智能平台提供的正式账号 public final static String ZHENGSHIAUCCON = "ruany"; //智能平台提供的正式账号
public final static String ZHANGSHIKEY = "3df143292455bfea88bc613c53004d36"; //智能平台提供的正式key public final static String ZHANGSHIKEY = "3df143292455bfea88bc613c53004d36"; //智能平台提供的正式key
// public final static String ZHENGSHIAUCCON = "xiaoykd"; //智能平台提供的正式账号 // public final static String ZHENGSHIAUCCON = "xiaoykd"; //智能平台提供的正式账号
// public final static String ZHANGSHIKEY = "d345040accff0421d03f760a03e5cbd9"; //智能平台提供的正式key // public final static String ZHANGSHIKEY = "d345040accff0421d03f760a03e5cbd9"; //智能平台提供的正式key
public final static String ZHANGSHIURL = "https://ismart.mini189.cn/api/"; //智能平台提供的正式key public final static String ZHANGSHIURL = "https://ismart.mini189.cn/api/"; //智能平台提供的正式key
......
...@@ -131,6 +131,7 @@ public class SysUser implements Serializable { ...@@ -131,6 +131,7 @@ public class SysUser implements Serializable {
@TableField(value = "deptidBelong") @TableField(value = "deptidBelong")
private String deptidBelong; private String deptidBelong;
@TableField(exist = false)
private String oldPassward; private String oldPassward;
@TableField(exist = false) @TableField(exist = false)
......
...@@ -44,4 +44,9 @@ public class ToIntegrateOrderParam { ...@@ -44,4 +44,9 @@ public class ToIntegrateOrderParam {
* 融合时间 * 融合时间
*/ */
private String rhTime; private String rhTime;
/**
* 签名图片
*/
private String imgUrl;
} }
...@@ -139,4 +139,13 @@ public interface OrderMapper extends BaseMapper<Order> { ...@@ -139,4 +139,13 @@ public interface OrderMapper extends BaseMapper<Order> {
* @return * @return
*/ */
int updateCompleteOrder(); int updateCompleteOrder();
/**
* 更新未下单并且融合时间小于当前时间的订单
* @return
*/
int updateNosendAndRhTimeLtNowOrder();
} }
...@@ -867,6 +867,13 @@ public class IntelligenceSendOrder { ...@@ -867,6 +867,13 @@ public class IntelligenceSendOrder {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date rhTime = null; Date rhTime = null;
Date date = new Date(); Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
Date today = calendar.getTime();
calendar.add(Calendar.DATE, 1);
if (order.getRhTime() == null) { if (order.getRhTime() == null) {
log.info("当前订单无融合时间,无法进行下单:" + JSONObject.toJSONString(order)); log.info("当前订单无融合时间,无法进行下单:" + JSONObject.toJSONString(order));
return; return;
...@@ -877,7 +884,8 @@ public class IntelligenceSendOrder { ...@@ -877,7 +884,8 @@ public class IntelligenceSendOrder {
log.error("融合日期转换错误" + JSONObject.toJSONString(order)); log.error("融合日期转换错误" + JSONObject.toJSONString(order));
return; return;
} }
if(rhTime.getTime() <= date.getTime()) { // 融合时间小于当前时间
if(today.getTime() > rhTime.getTime()) {
log.info("融合日期小于当前日期,改为待受理状态" + JSONObject.toJSONString(order)); log.info("融合日期小于当前日期,改为待受理状态" + JSONObject.toJSONString(order));
Wrapper<Order> wrapper = new EntityWrapper<>(); Wrapper<Order> wrapper = new EntityWrapper<>();
wrapper.eq("id", order.getId()); wrapper.eq("id", order.getId());
...@@ -887,6 +895,11 @@ public class IntelligenceSendOrder { ...@@ -887,6 +895,11 @@ public class IntelligenceSendOrder {
orderMapper.update(updateOrder, wrapper); orderMapper.update(updateOrder, wrapper);
return; return;
} }
// 融合时间大于等于 当前时间的第二天的0点
if (rhTime.getTime() >= calendar.getTime().getTime()) {
log.info("融合日期超过当前时间,不下单:" + JSONObject.toJSONString(order));
return;
}
} }
Map<String, Object> orderMap = null; Map<String, Object> orderMap = null;
...@@ -962,9 +975,9 @@ public class IntelligenceSendOrder { ...@@ -962,9 +975,9 @@ public class IntelligenceSendOrder {
if (schoolMap.get("identifying") != null) { if (schoolMap.get("identifying") != null) {
expenses = schoolMap.get("identifying").toString(); expenses = schoolMap.get("identifying").toString();
} }
System.out.println("----expenses---prices---:" + expenses + "------" + prices); log.info("----expenses---prices---:" + expenses + "------" + prices);
JSONArray saleList = saleJsonObject.getJSONArray("list"); JSONArray saleList = saleJsonObject.getJSONArray("list");
System.out.println("----saleList---:" + saleList); log.info("----saleList---:" + saleList);
for (int i = 0; i < saleList.size(); i++) { for (int i = 0; i < saleList.size(); i++) {
net.sf.json.JSONObject itmeJson = net.sf.json.JSONObject itmeJson =
net.sf.json.JSONObject.fromObject(saleList.get(i)); net.sf.json.JSONObject.fromObject(saleList.get(i));
...@@ -1019,13 +1032,13 @@ public class IntelligenceSendOrder { ...@@ -1019,13 +1032,13 @@ public class IntelligenceSendOrder {
} }
} }
List<NameValuePair> qParams = new ArrayList<NameValuePair>(); List<NameValuePair> qParams = new ArrayList<NameValuePair>();
// HttpHost proxy = new HttpHost("172.18.101.170", 3128); HttpHost proxy = new HttpHost("172.18.101.170", 3128);
RequestConfig defaultRequestConfig = RequestConfig defaultRequestConfig =
RequestConfig.custom() RequestConfig.custom()
.setSocketTimeout(500000) .setSocketTimeout(500000)
.setConnectTimeout(500000) .setConnectTimeout(500000)
.setConnectionRequestTimeout(500000) .setConnectionRequestTimeout(500000)
// .setProxy(proxy) .setProxy(proxy)
.build(); .build();
CloseableHttpClient httpclient = CloseableHttpClient httpclient =
HttpClients.custom().setDefaultRequestConfig(defaultRequestConfig).build(); HttpClients.custom().setDefaultRequestConfig(defaultRequestConfig).build();
...@@ -1273,7 +1286,7 @@ public class IntelligenceSendOrder { ...@@ -1273,7 +1286,7 @@ public class IntelligenceSendOrder {
|| ORDERAMOUNT.equals("0.01") || ORDERAMOUNT.equals("0.01")
|| ORDERAMOUNT.equals("0.02")) { || ORDERAMOUNT.equals("0.02")) {
paymentListMap2.put("payType", "2"); paymentListMap2.put("payType", "2");
} else if (orderMap.get("customeRid").toString().equals("xjzf")) { } else if (orderMap.get("customerId").toString().equals("xjzf")) {
paymentListMap2.put("payType", "2"); paymentListMap2.put("payType", "2");
} else { } else {
paymentListMap2.put("payType", "4"); // 缴费方式,必填(例:payType:3)3:代理商打款4:穗易付7:货到付款 paymentListMap2.put("payType", "4"); // 缴费方式,必填(例:payType:3)3:代理商打款4:穗易付7:货到付款
...@@ -1490,9 +1503,9 @@ public class IntelligenceSendOrder { ...@@ -1490,9 +1503,9 @@ public class IntelligenceSendOrder {
String state = queryOrderJsonObject.getString("state"); String state = queryOrderJsonObject.getString("state");
Wrapper<Order> orderWrapper = new EntityWrapper<>(); Wrapper<Order> orderWrapper = new EntityWrapper<>();
orderWrapper.eq("kd_order_id", orderNum); orderWrapper.eq("kd_order_id", orderMap.get("orderSeq").toString());
Order updateOrder = new Order(); Order updateOrder = new Order();
updateOrder.setOrderId(orderMap.get("orderSeq").toString()); updateOrder.setOrderId(orderNum);
updateOrder.setOrderStatus("审核中"); updateOrder.setOrderStatus("审核中");
orderMapper.update(updateOrder, orderWrapper); orderMapper.update(updateOrder, orderWrapper);
...@@ -1550,13 +1563,13 @@ public class IntelligenceSendOrder { ...@@ -1550,13 +1563,13 @@ public class IntelligenceSendOrder {
} }
// 3、提交订单到智能平台 // 3、提交订单到智能平台
List<NameValuePair> qParams = new ArrayList<NameValuePair>(); List<NameValuePair> qParams = new ArrayList<NameValuePair>();
// HttpHost proxy = new HttpHost("172.18.101.170", 3128); HttpHost proxy = new HttpHost("172.18.101.170", 3128);
RequestConfig defaultRequestConfig = RequestConfig defaultRequestConfig =
RequestConfig.custom() RequestConfig.custom()
.setSocketTimeout(500000) .setSocketTimeout(500000)
.setConnectTimeout(500000) .setConnectTimeout(500000)
.setConnectionRequestTimeout(500000) .setConnectionRequestTimeout(500000)
// .setProxy(proxy) .setProxy(proxy)
.build(); .build();
CloseableHttpClient httpclient = CloseableHttpClient httpclient =
HttpClients.custom().setDefaultRequestConfig(defaultRequestConfig).build(); HttpClients.custom().setDefaultRequestConfig(defaultRequestConfig).build();
...@@ -1794,7 +1807,7 @@ public class IntelligenceSendOrder { ...@@ -1794,7 +1807,7 @@ public class IntelligenceSendOrder {
HttpResponse response = httpclient.execute(httpPost); HttpResponse response = httpclient.execute(httpPost);
entity = response.getEntity(); entity = response.getEntity();
String httpResult = EntityUtils.toString(entity, "UTF-8"); String httpResult = EntityUtils.toString(entity, "UTF-8");
log.info("宽叠移定时器下单接口,返回信息:" + httpResult); log.info("宽叠移下单接口,返回信息:" + httpResult);
resultDataJson = net.sf.json.JSONObject.fromObject(httpResult); resultDataJson = net.sf.json.JSONObject.fromObject(httpResult);
} catch (SSLHandshakeException s) { } catch (SSLHandshakeException s) {
HttpResponse response = httpclient.execute(httpPost); HttpResponse response = httpclient.execute(httpPost);
...@@ -1845,12 +1858,26 @@ public class IntelligenceSendOrder { ...@@ -1845,12 +1858,26 @@ public class IntelligenceSendOrder {
} }
/** /**
* 查询智能平台状态 * 查询智能平台状态(两个参数只要填写一个,默认填写系统订单号即可)
* *
* @param systemOrderNum 系统订单号
* @param orderNum 智能平台订单号 * @param orderNum 智能平台订单号
* @return 返回结果为json字符串,若错误则返回空字符串 * @return 返回结果为json字符串,若错误则返回空字符串
* {
* msg=订单查询成功,
* wayBillNumber=,
* sourceBizEntity=1eue64bp0d5xl1jdkgms,
* stateName=收费【人工处理】,
* outBizEntity=1eue64bp0d5xl1jdkgms,
* orderStatus=受理成功【待收费】,
* remark=,
* state=48,
* bizEntity=THD20210110004759,
* deliveryNumber=,
* status=000001
* }
*/ */
public String queryStatus(String orderNum) { public String queryStatus(String systemOrderNum, String orderNum) {
ObjectMapper OBJECT_MAPPER = new ObjectMapper(); ObjectMapper OBJECT_MAPPER = new ObjectMapper();
List<BasicNameValuePair> qParams = new ArrayList<>(); List<BasicNameValuePair> qParams = new ArrayList<>();
Map<String, Object> signMap = new HashMap<>();//待签名参数 Map<String, Object> signMap = new HashMap<>();//待签名参数
...@@ -1870,8 +1897,16 @@ public class IntelligenceSendOrder { ...@@ -1870,8 +1897,16 @@ public class IntelligenceSendOrder {
String timeStamp = DateUtil.format(new Date(), DateUtil.yyyyMMddHHmmss); String timeStamp = DateUtil.format(new Date(), DateUtil.yyyyMMddHHmmss);
qParams.add(new BasicNameValuePair("timeStamp", timeStamp)); qParams.add(new BasicNameValuePair("timeStamp", timeStamp));
signMap.put("timeStamp",timeStamp); signMap.put("timeStamp",timeStamp);
qParams.add(new BasicNameValuePair("orderNumber", orderNum));//智能平台订单编号,非必填
signMap.put("orderNumber", orderNum); if(StringUtils.isNotBlank(orderNum)) {
qParams.add(new BasicNameValuePair("orderNumber", orderNum));//智能平台订单编号,非必填
signMap.put("orderNumber", orderNum);
}
if (StringUtils.isNotBlank(systemOrderNum)) {
qParams.add(new BasicNameValuePair("outOrderNum",systemOrderNum));//外部订单编号,非必填
signMap.put("outOrderNum", systemOrderNum);
}
try{ try{
List<String> keys = new ArrayList<>(); List<String> keys = new ArrayList<>();
keys.addAll(signMap.keySet()); keys.addAll(signMap.keySet());
...@@ -1895,8 +1930,10 @@ public class IntelligenceSendOrder { ...@@ -1895,8 +1930,10 @@ public class IntelligenceSendOrder {
// String 转化为 Map格式结果 // String 转化为 Map格式结果
HashMap<String, Object> mapData = new HashMap<>(); HashMap<String, Object> mapData = new HashMap<>();
mapData.putAll(OBJECT_MAPPER.readValue(httpResult, mapData.getClass())); mapData.putAll(OBJECT_MAPPER.readValue(httpResult, mapData.getClass()));
return JSONObject.toJSONString(mapData); log.info("智能平台请求状态返回数据:" + mapData);
if (mapData.get("status") == "000001") {
return JSONObject.toJSONString(mapData);
}
} catch (SocketTimeoutException e) { } catch (SocketTimeoutException e) {
e.printStackTrace(); e.printStackTrace();
} catch (Exception e) { } catch (Exception e) {
......
...@@ -37,49 +37,47 @@ ...@@ -37,49 +37,47 @@
<result column="yj_count" property="yjCount" /> <result column="yj_count" property="yjCount" />
<result column="yj_type" property="yjType" /> <result column="yj_type" property="yjType" />
<result column="tj_type" property="tjType" /> <result column="tj_type" property="tjType" />
<result column="xb_type" property="xbType" /> <result column="xb_type" property="xbType" />
<result column="net_number" property="netNumber" /> <result column="net_number" property="netNumber" />
<result column="net_password" property="netPassword" /> <result column="net_password" property="netPassword" />
<result column="userSchool" property="userSchool" /> <result column="userSchool" property="userSchool" />
<result column="check_fail" property="checkFail" /> <result column="check_fail" property="checkFail" />
<result column="expenses" property="expenses" /> <result column="expenses" property="expenses" />
<result column="identifying" property="identifying" /> <result column="identifying" property="identifying" />
<result column="kd_order_id" property="kdOrderId" /> <result column="kd_order_id" property="kdOrderId" />
<result column="gift_account" property="giftAccount" /> <result column="gift_account" property="giftAccount" />
<result column="gift_password" property="giftCypher" /> <result column="gift_password" property="giftCypher" />
<result column="hehuoren_area" property="hehuorenArea" /> <result column="hehuoren_area" property="hehuorenArea" />
<result column="hehuoren_name" property="hehuorenName" /> <result column="hehuoren_name" property="hehuorenName" />
<result column="hehuoren_school" property="hehuorenSchool" /> <result column="hehuoren_school" property="hehuorenSchool" />
<result column="hehuoren_phone" property="hehuorenPhone" /> <result column="hehuoren_phone" property="hehuorenPhone" />
<result column="supervisor_name" property="supervisorName" /> <result column="supervisor_name" property="supervisorName" />
<result column="th_status" property="thStatus" /> <result column="th_status" property="thStatus" />
<result column="rh_time" property="rhTime" /> <result column="rh_time" property="rhTime" />
<result column="orderSeq" property="orderSeq" /> <result column="orderSeq" property="orderSeq" />
<result column="productName" property="productName" /> <result column="productName" property="productName" />
<result column="order_set_meal" property="orderSetMeal" /> <result column="order_set_meal" property="orderSetMeal" />
<result column="order_university_name" property="orderUniversityName" /> <result column="order_university_name" property="orderUniversityName" />
<result column="orderName" property="orderName" /> <result column="orderName" property="orderName" />
<result column="orderDate" property="orderDate" /> <result column="orderDate" property="orderDate" />
<result column="status" property="status" /> <result column="status" property="status" />
<result column="order_region" property="orderRegion" /> <result column="order_region" property="orderRegion" />
<result column="ipay" property="iPay" /> <result column="ipay" property="iPay" />
<result column="payType" property="payType" /> <result column="payType" property="payType" />
<result column="webOrderAmount" property="webOrderAmount" /> <result column="webOrderAmount" property="webOrderAmount" />
<result column="order_payment_time" property="orderPaymentTime" /> <result column="order_payment_time" property="orderPaymentTime" />
<result column="orderReqtranSeq" property="orderReqtranSeq" /> <result column="orderReqtranSeq" property="orderReqtranSeq" />
<result column="customeRid" property="customerId" /> <result column="customeRid" property="customerId" />
<result column="orderPhone" property="orderPhone" /> <result column="orderPhone" property="orderPhone" />
<result column="order_customer_type" property="orderCustomerType" /> <result column="order_customer_type" property="orderCustomerType" />
<result column="order_customer_student_id" property="orderCustomerStudentId" /> <result column="order_customer_student_id" property="orderCustomerStudentId" />
<result column="order_customer_remarks" property="orderCustomerRemarks" /> <result column="order_customer_remarks" property="orderCustomerRemarks" />
<result column="order_customer_account" property="orderCustomerAccount" /> <result column="order_customer_account" property="orderCustomerAccount" />
<result column="order_customer_pwd" property="orderCustomerPwd" /> <result column="order_customer_pwd" property="orderCustomerPwd" />
<result column="uptranseq" property="uptranseq" /> <result column="uptranseq" property="uptranseq" />
<result column="expenses" property="expenses" /> <result column="expenses" property="expenses" />
<result column="order_rf2" property="orderRf2"></result> <result column="order_rf2" property="orderRf2"></result>
<result column="orderSeqTHD" property="orderseqThd" /> <result column="orderSeqTHD" property="orderseqThd" />
</resultMap> </resultMap>
<select id="selectBroadBandOrderList" resultMap="broadBandOrder"> <select id="selectBroadBandOrderList" resultMap="broadBandOrder">
...@@ -193,4 +191,9 @@ ...@@ -193,4 +191,9 @@
select * from hhr_order where order_status !='异常单' and kd_order_id = #{KdOrderID} select * from hhr_order where order_status !='异常单' and kd_order_id = #{KdOrderID}
</select> </select>
<!-- 更新未下单并且融合时间小于当前时间的订单 -->
<update id="updateNosendAndRhTimeLtNowOrder">
update hhr_order set order_status = "待受理" where DATE_FORMAT(rh_time, "%y-%m-%d") &lt; date_format(now(), "%y-%m-%d") and order_status = "未下单"
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -84,12 +84,10 @@ ...@@ -84,12 +84,10 @@
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>3.8.1</version> <version>2.5</version>
<configuration> <configuration>
<source>1.8</source> <skip>true</skip>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
......
...@@ -12,7 +12,7 @@ import org.springframework.cloud.netflix.eureka.EnableEurekaClient; ...@@ -12,7 +12,7 @@ import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
}) })
@RefreshScope @RefreshScope
@EnableEurekaClient @EnableEurekaClient
@MapperScan(basePackages = {"com.winsun.*.mapper","com.winsun.mapper","com.winsun.migration.mapper", "com.winsun.mapper.activity"}) @MapperScan(basePackages = {"com.winsun.item.modular.*.dao","com.winsun.mapper"})
public class MigrationApplication { public class MigrationApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -39,4 +39,6 @@ public class MigrationDataController { ...@@ -39,4 +39,6 @@ public class MigrationDataController {
migrationService.migrationActivityRecord(); migrationService.migrationActivityRecord();
return "成功!"; return "成功!";
} }
} }
...@@ -12,16 +12,19 @@ import org.springframework.stereotype.Component; ...@@ -12,16 +12,19 @@ import org.springframework.stereotype.Component;
@Slf4j @Slf4j
@Aspect @Aspect
public class DataSourceAspect { public class DataSourceAspect {
@Pointcut("execution(* com.winsun.migration.mapper.db1..*.*(..))" @Pointcut("execution(* com.winsun.migration.mapper.db1..*.*(..)) || " +
+ "|| execution(* com.winsun.mapper.*.*(..)) || execution(* com.winsun.mapper.activity.*.*(..))") "execution(* com.winsun.mapper.SysUserMapper.*(..)) || execution(* com.winsun.mapper.SchoolPackageMapper.*())")
private void db1Aspect() { private void db1Aspect() {
} }
@Pointcut("execution(* com.winsun.migration.mapper.db2..*.*(..))" @Pointcut("execution(* com.winsun.migration.mapper.db2..*.*(..))")
)
private void db2Aspect() { private void db2Aspect() {
} }
@Pointcut("execution(* com.winsun.migration.mapper.db3..*.*(..))")
private void db3Aspect() {
}
@Before("db1Aspect()") @Before("db1Aspect()")
public void db1() { public void db1() {
System.out.println("切换到新框架数据源"); System.out.println("切换到新框架数据源");
...@@ -30,7 +33,13 @@ public class DataSourceAspect { ...@@ -30,7 +33,13 @@ public class DataSourceAspect {
@Before("db2Aspect()") @Before("db2Aspect()")
public void db2() { public void db2() {
System.out.println("切换到旧框架数据源"); System.out.println("切换到合伙人");
DataSourceContextHolder.setDbType("dzqd"); DataSourceContextHolder.setDbType("dzqd");
} }
@Before("db3Aspect()")
public void db3() {
System.out.println("切换到一人一码");
DataSourceContextHolder.setDbType("yrym");
}
} }
...@@ -45,6 +45,12 @@ public class DataSourceConfig { ...@@ -45,6 +45,12 @@ public class DataSourceConfig {
return DataSourceBuilder.create().build(); return DataSourceBuilder.create().build();
} }
@Bean(name = "yrym")
@ConfigurationProperties(prefix = "spring.datasource.db3")
public DataSource dataSource3() {
return DataSourceBuilder.create().build();
}
/** /**
* 动态数据源配置 * 动态数据源配置
* *
...@@ -53,11 +59,13 @@ public class DataSourceConfig { ...@@ -53,11 +59,13 @@ public class DataSourceConfig {
@Bean @Bean
@Primary @Primary
public DataSource multipleDataSource(@Qualifier("schoolCenter") DataSource db1, public DataSource multipleDataSource(@Qualifier("schoolCenter") DataSource db1,
@Qualifier("xyjl") DataSource db2) { @Qualifier("xyjl") DataSource db2,
@Qualifier("yrym") DataSource db3) {
DynamicDataSource dynamicDataSource = new DynamicDataSource(); DynamicDataSource dynamicDataSource = new DynamicDataSource();
Map<Object, Object> targetDataSources = new HashMap<>(); Map<Object, Object> targetDataSources = new HashMap<>();
targetDataSources.put("schoolCenter", db1); targetDataSources.put("schoolCenter", db1);
targetDataSources.put("xyjl", db2); targetDataSources.put("xyjl", db2);
targetDataSources.put("yrym", db3);
dynamicDataSource.setTargetDataSources(targetDataSources); dynamicDataSource.setTargetDataSources(targetDataSources);
dynamicDataSource.setDefaultTargetDataSource(db2); // 程序默认数据源,这个要根据程序调用数据源频次,经常把常调用的数据源作为默认 dynamicDataSource.setDefaultTargetDataSource(db2); // 程序默认数据源,这个要根据程序调用数据源频次,经常把常调用的数据源作为默认
return dynamicDataSource; return dynamicDataSource;
...@@ -66,7 +74,7 @@ public class DataSourceConfig { ...@@ -66,7 +74,7 @@ public class DataSourceConfig {
@Bean("sqlSessionFactory") @Bean("sqlSessionFactory")
public SqlSessionFactory sqlSessionFactory() throws Exception { public SqlSessionFactory sqlSessionFactory() throws Exception {
MybatisSqlSessionFactoryBean sqlSessionFactory = new MybatisSqlSessionFactoryBean(); MybatisSqlSessionFactoryBean sqlSessionFactory = new MybatisSqlSessionFactoryBean();
sqlSessionFactory.setDataSource(multipleDataSource(dataSource1(), dataSource2())); sqlSessionFactory.setDataSource(multipleDataSource(dataSource1(), dataSource2(), dataSource3()));
MybatisConfiguration configuration = new MybatisConfiguration(); MybatisConfiguration configuration = new MybatisConfiguration();
configuration.setJdbcTypeForNull(JdbcType.NULL); configuration.setJdbcTypeForNull(JdbcType.NULL);
......
...@@ -15,28 +15,29 @@ import java.util.Map; ...@@ -15,28 +15,29 @@ import java.util.Map;
public interface NewDatabases { public interface NewDatabases {
@Select("select * from sys_user where id = 1") @Select("select * from sys_user where id = 1")
public List<Map<String, Object>> getUser(); List<Map<String, Object>> getUser();
@Insert({"insert into sys_user(id, account, password, salt, name, sex, phone, roleid, deptid, status, createtime, substName) " + @Insert({"insert into sys_user(id, account, password, salt, name, sex, phone, roleid, deptid, status, createtime, substName) " +
"value(#{id}, #{account}, #{password}, #{salt}, #{name}, #{sex}, #{phone}, #{roleid}, #{deptid}, #{status}, #{createtime}, #{substName} )"}) "value(#{id}, #{account}, #{password}, #{salt}, #{name}, #{sex}, #{phone}, #{roleid}, #{deptid}, #{status}, #{createtime}, #{substName} )"})
public int insert(SysUser user); int insert(SysUser user);
@Insert({"insert into hhr_user(id, id_card, ysm, wx_head_img_url, wx_nick_name, open_id, upload_state, grade, position, parent_id, parent_ids, is_active) " + @Insert({"insert into hhr_user(id, id_card, ysm, wx_head_img_url, wx_nick_name, open_id, upload_state, grade, position, parent_id, parent_ids, is_active) " +
"value(#{id}, #{idCard}, #{ysm}, #{wxHeadImgUrl}, #{wxNickName}, #{openId}, #{uploadState}, #{grade}, #{position}, #{parentId}, #{parentIds}, #{isActive})"}) "value(#{id}, #{idCard}, #{ysm}, #{wxHeadImgUrl}, #{wxNickName}, #{openId}, #{uploadState}, #{grade}, #{position}, #{parentId}, #{parentIds}, #{isActive})"})
public int insertHhr(HhrUser user); int insertHhr(HhrUser user);
@Insert({"insert into hhr_activity(id, `title`, `desc`, integral, image_url, activity_type, subclass, `range`, `status`, `sort`, create_time, creator, del_flag) " + @Insert({"insert into hhr_activity(id, `title`, `desc`, integral, image_url, activity_type, subclass, `range`, `status`, `sort`, create_time, creator, del_flag) " +
" value(#{id}, #{title}, #{desc}, #{integral}, #{imageUrl}, #{activityType}, #{subclass}, #{range}, #{status}, #{sort}, #{createTime}, #{creator}, #{delFlag})"}) " value(#{id}, #{title}, #{desc}, #{integral}, #{imageUrl}, #{activityType}, #{subclass}, #{range}, #{status}, #{sort}, #{createTime}, #{creator}, #{delFlag})"})
public int insertActivity(HhrActivity hhrActivity); int insertActivity(HhrActivity hhrActivity);
@Insert({"insert into hhr_activity_record(id, activity_id, record_integral, status, remark, image_url, message, create_time, create_id, creator, is_repeal) " + @Insert({"insert into hhr_activity_record(id, activity_id, record_integral, status, remark, image_url, message, create_time, create_id, creator, is_repeal) " +
" value(#{id}, #{activityId}, #{recordIntegral}, #{status}, #{remark}, #{imageUrl}, #{message}, #{createTime}, #{createId}, #{creator}, #{isRepeal})"}) " value(#{id}, #{activityId}, #{recordIntegral}, #{status}, #{remark}, #{imageUrl}, #{message}, #{createTime}, #{createId}, #{creator}, #{isRepeal})"})
public int insertActivityRecord(HhrActivityRecord hhrActivityRecord); int insertActivityRecord(HhrActivityRecord hhrActivityRecord);
@Insert({"insert into migration_log(table_name, object, `status`, message, create_time) " + @Insert({"insert into migration_log(table_name, object, `status`, message, create_time) " +
"value(#{tableName}, #{object}, #{status}, #{message}, now())"}) "value(#{tableName}, #{object}, #{status}, #{message}, now())"})
public int insertLog(@Param("tableName") String tableName, int insertLog(@Param("tableName") String tableName,
@Param("object") Object object, @Param("object") Object object,
@Param("status") String status, @Param("status") String status,
@Param("message") String message); @Param("message") String message);
} }
...@@ -33,6 +33,7 @@ public interface OldDatabases { ...@@ -33,6 +33,7 @@ public interface OldDatabases {
" ys.wx_head_img_url, " + " ys.wx_head_img_url, " +
" ys.wx_nick_name, " + " ys.wx_nick_name, " +
" ys.grade, " + " ys.grade, " +
" ys.register_time, " +
" ys.id_card, " + " ys.id_card, " +
" xsr.parent_user_id, " + " xsr.parent_user_id, " +
" xsr.position, " + " xsr.position, " +
......
...@@ -193,7 +193,7 @@ public class PackageController extends BaseController { ...@@ -193,7 +193,7 @@ public class PackageController extends BaseController {
@Permission(menuname = "上传背景图", value = "backgroundUpload", method = RequestMethod.POST) @Permission(menuname = "上传背景图", value = "backgroundUpload", method = RequestMethod.POST)
public ResponseData<String> backgroundUpload(@RequestParam(value = "file") MultipartFile file, @RequestParam(value = "id", required = false) String id) { public ResponseData<String> backgroundUpload(MultipartFile file, @RequestParam(value = "id", required = false) String id) {
if(!StringUtils.endsWithAny(file.getOriginalFilename(), "jpg", "jpeg", "png", "gif")) { if(!StringUtils.endsWithAny(file.getOriginalFilename(), "jpg", "jpeg", "png", "gif")) {
return ResponseData.error("上传失败,仅支持jpg、jpeg、png"); return ResponseData.error("上传失败,仅支持jpg、jpeg、png");
} }
...@@ -201,7 +201,7 @@ public class PackageController extends BaseController { ...@@ -201,7 +201,7 @@ public class PackageController extends BaseController {
return ResponseData.error("文件过大,无法上传"); return ResponseData.error("文件过大,无法上传");
} }
StringBuilder basePath = new StringBuilder(); StringBuilder basePath = new StringBuilder();
basePath.append("enclosure").append(File.separator).append(DEFAULTPATH).append(File.separator); basePath.append("enclosure").append(DEFAULTPATH).append(File.separator);
if (StringUtils.isBlank(id)) { if (StringUtils.isBlank(id)) {
EntityWrapper<Package> packagewrapper = new EntityWrapper<>(); EntityWrapper<Package> packagewrapper = new EntityWrapper<>();
packagewrapper.setSqlSelect("max(id) as id"); packagewrapper.setSqlSelect("max(id) as id");
...@@ -211,7 +211,7 @@ public class PackageController extends BaseController { ...@@ -211,7 +211,7 @@ public class PackageController extends BaseController {
Package aPackage = packageMapper.selectById(id); Package aPackage = packageMapper.selectById(id);
basePath.append(aPackage.getId()); basePath.append(aPackage.getId());
} }
File dir = new File(FilePattern.matcher(basePath.toString()).replaceAll("")); File dir = new File(basePath.toString());
if (!dir.exists()) { if (!dir.exists()) {
dir.mkdirs(); dir.mkdirs();
} }
......
...@@ -5,10 +5,15 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,10 +5,15 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.mapper.Wrapper;
import com.winsun.bean.Order; import com.winsun.bean.Order;
import com.winsun.bean.OrderHistory;
import com.winsun.mapper.OrderHistoryMapper;
import com.winsun.mapper.OrderMapper; import com.winsun.mapper.OrderMapper;
import com.winsun.outSideSystem.IntelligenceSendOrder;
import com.winsun.smsUtils.SendSmsAndMail;
import com.winsun.utils.MyBatisPlusUpdateUtils; import com.winsun.utils.MyBatisPlusUpdateUtils;
import com.winsun.utils.XbkUtil; import com.winsun.utils.XbkUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
...@@ -29,6 +34,11 @@ import java.util.Map; ...@@ -29,6 +34,11 @@ import java.util.Map;
public class OrderTask { public class OrderTask {
private static OrderMapper orderMapper; private static OrderMapper orderMapper;
@Autowired
private IntelligenceSendOrder intelligenceSendOrder;
@Autowired
private OrderHistoryMapper orderHistoryMapper;
@Autowired @Autowired
public OrderTask(OrderMapper orderMapper) { public OrderTask(OrderMapper orderMapper) {
...@@ -41,8 +51,62 @@ public class OrderTask { ...@@ -41,8 +51,62 @@ public class OrderTask {
@Scheduled(cron = "0 0/5 * * * ? ") @Scheduled(cron = "0 0/5 * * * ? ")
public void updateBeSendOrder() { public void updateBeSendOrder() {
log.info("开始更新已发货超过7天订单"); log.info("开始更新已发货超过7天订单");
orderMapper.updateCompleteOrder(); int i = orderMapper.updateCompleteOrder();
log.info("更新已送货订单"); log.info("更新已送货订单成功:" + i);
}
/**
* 定时器更新智能平台状态
*/
@Scheduled(cron = "0 0/5 * * * ?")
// @Scheduled(fixedRate=28800000)
public void updateStatus() {
// 获取审核中的订单
Wrapper<Order> wrapper = new EntityWrapper<>();
wrapper.eq("order_status", "审核中");
List<Order> orders = orderMapper.selectList(wrapper);
// 循环请求获取数据
for(Order order : orders) {
if (StringUtils.isNotBlank(order.getKdOrderId())) {
String s = intelligenceSendOrder.queryStatus(order.getKdOrderId(), null);
if (StringUtils.isNotBlank(s)) {
Order update = new Order();
update.setId(order.getId());
update.setUpdateTime(new Date());
JSONObject json = JSONObject.parseObject(s);
OrderHistory orderHistory = new OrderHistory();
orderHistory.setOrderId(order.getId());
orderHistory.setCreateDate(new Date());
orderHistory.setStatus("智能平台状态获取");
// 未获取到需要的状态不做更新
if ("归档".equals(json.get("orderStatus")) || "受理成功【待收费】".equals(json.get("orderStatus"))
|| "已收费【待竣工】".equals(json.get("orderStatus")) || "受理成功".equals(json.get("orderStatus"))) {
orderHistory.setStatus("订单已完成");
orderHistoryMapper.insert(orderHistory);
update.setThStatus(json.get("orderStatus").toString());
update.setOrderStatus("已完成");
orderMapper.updateById(update);
// 下发短信
SendSmsAndMail.sendSms2(order.getContactNumber(),
order.getNetNumber(),
order.getNetPassword(), "12");
}else if("作废".equals(json.get("orderStatus")) || "受理异常".equals(json.get("orderStatus"))){
orderHistory.setStatus("订单异常请联系管理员");
orderHistoryMapper.insert(orderHistory);
update.setThStatus(json.get("orderStatus").toString());
update.setOrderStatus("异常单");
orderMapper.updateById(update);
}
}
}
}
} }
@Scheduled(cron = "0 0 0 * * ? ") @Scheduled(cron = "0 0 0 * * ? ")
......
...@@ -10,6 +10,7 @@ import com.winsun.constant.Constant; ...@@ -10,6 +10,7 @@ import com.winsun.constant.Constant;
import com.winsun.mapper.OrderMapper; import com.winsun.mapper.OrderMapper;
import com.winsun.mapper.OrderViewMapper; import com.winsun.mapper.OrderViewMapper;
import com.winsun.mapper.UniversityInfoMapper; import com.winsun.mapper.UniversityInfoMapper;
import com.winsun.outSideSystem.IntelligenceSendOrder;
import com.winsun.utils.BeanUtil; import com.winsun.utils.BeanUtil;
import com.winsun.utils.MD5Utils; import com.winsun.utils.MD5Utils;
import com.winsun.utils.MyBatisPlusUpdateUtils; import com.winsun.utils.MyBatisPlusUpdateUtils;
...@@ -50,6 +51,42 @@ public class RhZhiNenTask { ...@@ -50,6 +51,42 @@ public class RhZhiNenTask {
private OrderViewMapper orderViewMapper; private OrderViewMapper orderViewMapper;
@Autowired @Autowired
private OrderMapper orderMapper; private OrderMapper orderMapper;
@Autowired
private IntelligenceSendOrder intelligenceSendOrder;
/**
* 下发智能平台订单
*
*/
@Scheduled(cron = "0 0/5 0 * * ? ")
// @Scheduled(fixedRate=2800000)
public void sendZhiNengOrder() {
log.info("智能平台定时器下单启动");
try{
// 更新融合时间小于当前时间的未下单订单 更新为待受理
int updateNum = orderMapper.updateNosendAndRhTimeLtNowOrder();
log.info("更新待受理订单数:" + updateNum);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
// 查询未下单并且融合时间为今天的订单
Wrapper<Order> wrapper = new EntityWrapper<>();
wrapper.eq("order_status", "未下单");
wrapper.ge("rh_time", sdf.format(calendar.getTime()));
calendar.add(Calendar.DATE, 1);
wrapper.lt("rh_time", sdf.format(calendar.getTime()));
List<Order> orders = orderMapper.selectList(wrapper);
// 发送下单请求
for(int i = 0; i < orders.size(); ++i) {
intelligenceSendOrder.integrateSendOrder(orders.get(i), false);
}
}catch(Exception e) {
e.printStackTrace();
log.error("智能平台定时器下单异常");
log.error(e.getMessage());
}
}
// @Scheduled(cron = "0 0 0 * * ? ") // @Scheduled(cron = "0 0 0 * * ? ")
......
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