modify ofei error message

master
wangning 7 years ago
parent 8ba499ce78
commit 1a81591c93

@ -14,4 +14,6 @@ public interface CustomerImpression {
JSONObject findOne(int client_id,String customer_id);
void generate(int client_id);
void modifyNameRemark(int client_id, String customer_id,String name_remark);
}

@ -1,5 +1,6 @@
package au.com.royalpay.payment.manage.apps.core.impls;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -22,6 +23,7 @@ import au.com.royalpay.payment.manage.apps.core.CustomerImpression;
import au.com.royalpay.payment.manage.mappers.client.ClientCustomersMapper;
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.utils.PageListUtils;
/**
@ -72,9 +74,9 @@ public class CustomerImpressionImpl implements CustomerImpression {
public void generate(int client_id) {
JSONObject params = new JSONObject();
params.put("client_id", client_id);
PageList<JSONObject> lastRecord = clientCustomersMapper.listCustomerInfo(params, new PageBounds(1, 1, Order.formString("create_time.desc")));
PageList<JSONObject> lastRecord = clientCustomersMapper.listCustomerInfo(params, new PageBounds(1, 1, Order.formString("update_time.desc")));
if (!CollectionUtils.isEmpty(lastRecord)) {
params.put("confirm_time", lastRecord.get(0).getDate("creata_time"));
params.put("confirm_time", lastRecord.get(0).getDate("update_time"));
}
List<JSONObject> orders = orderMapper.listAnalysisClientCustomer(params);
Date now = new Date();
@ -97,11 +99,17 @@ public class CustomerImpressionImpl implements CustomerImpression {
}
client_customer.put("payment_times", order.getIntValue("payment_times"));
client_customer.put("total_amount", order.getBigDecimal("total_amount"));
client_customer.put("create_time", now);
client_customer.put("update_time", now);
clientCustomersMapper.insert(client_customer);
} else {
clientCustomerInfo.put("payment_times", clientCustomerInfo.getIntValue("payment_times") + order.getIntValue("payment_times"));
BigDecimal total_amount = clientCustomerInfo.getBigDecimal("total_amount");
if(total_amount!=null){
clientCustomerInfo.put("total_amount", clientCustomerInfo.getBigDecimal("total_amount").add(order.getBigDecimal("total_amount")));
}else {
clientCustomerInfo.put("total_amount",order.getBigDecimal("total_amount"));
}
if (order.getString("alipay_headimg") == null) {
clientCustomerInfo.put("headimg", order.getString("wechat_headimg"));
clientCustomerInfo.put("nick_name", order.getString("wechat_nickname"));
@ -110,9 +118,20 @@ public class CustomerImpressionImpl implements CustomerImpression {
clientCustomerInfo.put("nick_name", order.getString("alipay_nickname"));
}
clientCustomerInfo.put("channel", order.getString("channel"));
clientCustomerInfo.put("update_time",now);
clientCustomersMapper.update(clientCustomerInfo);
}
}
}
@Override
public void modifyNameRemark(int client_id, String customer_id, String name_remark) {
JSONObject clientCustomerInfo = clientCustomersMapper.getClientCustomer(client_id,customer_id);
if(clientCustomerInfo==null){
throw new NotFoundException("customer not found");
}
clientCustomerInfo.put("name_remak",name_remark);
clientCustomersMapper.update(clientCustomerInfo);
}
}

@ -7,6 +7,7 @@ import au.com.royalpay.payment.manage.apps.core.CustomerImpression;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@ -31,4 +32,10 @@ public class CustomerImpressionController {
public JSONObject find(@PathVariable int client_id,@PathVariable String customer_id) {
return customerImpression.findOne(client_id,customer_id);
}
@RequestMapping(value = "/{client_id}/{customer_id}", method = RequestMethod.PUT)
@ResponseBody
public void modifyNameRemark(@PathVariable int client_id, @PathVariable String customer_id, @RequestBody JSONObject customerInfo) {
customerImpression.modifyNameRemark(client_id,customer_id,customerInfo.getString("name_remark"));
}
}

@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
@ -21,4 +23,7 @@ public interface TopUpOrderMapper {
@AutoSql(type = SqlType.SELECT)
JSONObject findById(@Param("id") String id);
List<String> findOrderIdByStatus(@Param("status") String status);
}

@ -33,6 +33,7 @@ import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult;
import javafx.application.Platform;
/**
* Created by wangning on 2017/12/7.
@ -73,14 +74,15 @@ public class OfeiClientImpl implements OfeiClient {
params.add(new BasicNameValuePair("sporder_id", orderId));
params.add(new BasicNameValuePair("sporder_time", DateFormatUtils.format(now, "yyyyMMddHHmmss")));
params.add(new BasicNameValuePair("game_userid", phoneNumber));
params.add(new BasicNameValuePair("ret_url", "https://mpay.royalpay.com.au/ofei/notice/"+orderId));
saveOrder(orderId, now, "1", price, phoneNumber);
HttpRequestGenerator req = initRequest(topUPUrl, signAndEncryptForm(params), RequestMethod.GET);
Element respXml = executeRequestXML(req, "ofei phone top up fail");
handleResponse(orderId, respXml);
handleResponse(orderId, respXml,phoneNumber);
}
private void handleResponse(String orderId, Element respXml) {
private void handleResponse(String orderId, Element respXml,String phoneNumber) {
JSONObject detail = new JSONObject();
if ("1".equals(respXml.elementText("retcode"))) {
detail.put("cardname", respXml.elementText("cardname"));
@ -99,6 +101,8 @@ public class OfeiClientImpl implements OfeiClient {
}else {
detail.put("err_msg",respXml.elementText("err_msg"));
updateOrder(orderId,"99",detail);
logger.debug("phone->"+phoneNumber+" top up error orderId->"+orderId);
throw new ServerErrorException("System error");
}
}
@ -142,7 +146,7 @@ public class OfeiClientImpl implements OfeiClient {
saveOrder(orderId, new Date(), "2", perValue, phoneNumber);
HttpRequestGenerator req = initRequest(flowTopUPUrl, signAndEncryptForm(params), RequestMethod.GET);
Element respXml = executeRequestXML(req, "ofei flowTopUp");
handleResponse(orderId, respXml);
handleResponse(orderId, respXml,phoneNumber);
}
@Override

@ -0,0 +1,31 @@
package au.com.royalpay.payment.manage.task;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import au.com.royalpay.payment.manage.mappers.ofei.TopUpOrderMapper;
import au.com.royalpay.payment.manage.ofei.core.OfeiServer;
/**
* Created by wangning on 2018/1/2.
*/
@Component
@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true")
public class OfeiOrderCheckTask {
@Resource
private OfeiServer ofeiServer;
@Resource
private TopUpOrderMapper topUpOrderMapper;
@Scheduled(cron = "0 0/20 * * * ?")
public void checkGreenChannel(){
List<String> orderIds = topUpOrderMapper.findOrderIdByStatus("10");
for (String orderId : orderIds) {
ofeiServer.checkOrder(orderId);
}
}
}

@ -6,25 +6,33 @@ import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi;
import au.com.royalpay.payment.channels.wechat.runtime.beans.SettlementLog;
import au.com.royalpay.payment.core.PaymentApi;
import au.com.royalpay.payment.core.TransactionService;
import au.com.royalpay.payment.core.exceptions.*;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.core.exceptions.OrderNotMatchException;
import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
import au.com.royalpay.payment.manage.mappers.client.ClientCustomersMapper;
import au.com.royalpay.payment.manage.mappers.payment.*;
import au.com.royalpay.payment.manage.mappers.payment.AustracDataMapper;
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import au.com.royalpay.payment.manage.mappers.payment.RefundAuditionMapper;
import au.com.royalpay.payment.manage.mappers.payment.RefundMapper;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.CustomerMapper;
import au.com.royalpay.payment.manage.mappers.system.CustomerRelationAlipayMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.manage.tradelog.beans.PreRefundQueryBean;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
@ -32,13 +40,24 @@ import net.sf.jasperreports.engine.JasperRunManager;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.engine.export.JRXlsExporter;
import net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter;
import net.sf.jasperreports.export.*;
import net.sf.jasperreports.export.ExporterInput;
import net.sf.jasperreports.export.OutputStreamExporterOutput;
import net.sf.jasperreports.export.SimpleExporterInput;
import net.sf.jasperreports.export.SimpleOutputStreamExporterOutput;
import net.sf.jasperreports.export.SimpleXlsxReportConfiguration;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -46,8 +65,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@ -63,6 +80,9 @@ import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.checkOrgPermission;
@ -380,7 +400,7 @@ public class TradeLogServiceImpl implements TradeLogService {
obj.put("customer_id", orderLog.getString("customer_id"));
obj.put("name_remak", name_remark);
obj.put("channel",order.getString("channel"));
obj.put("create_time",new Date());
obj.put("update_time",new Date());
JSONObject client_coustom = clientCustomersMapper.getClientCustomer(orderLog.getInteger("client_id"), orderLog.getString("customer_id"));
if (null == client_coustom) {
clientCustomersMapper.insert(obj);

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.ofei.TopUpOrderMapper">
<select id="findOrderIdByStatus">
SELECT
id
FROM top_up_order
where status = #{status}
</select>
</mapper>

@ -540,8 +540,10 @@
cra.headimg alipay_headimg,
cra.nickname alipay_nickname,
cr.nickname wechat_nickname,
cr.headimg wechat_headimg
from pmt_orders o
cr.headimg wechat_headimg,
max( o.confirm_time) confirm_time
from pmt_orders_copy o
left join sys_customer_relation cr on cr.wepay_openid = o.customer_id
left join sys_customer_relation_alipay cra on cra.alipay_uid = o.customer_id
where o.customer_id is not null

@ -35,11 +35,26 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu
return $http.get('/app/cms/categories/' + $stateParams.catId + '/articles/' + $stateParams.articleId);
}]
}
}).state('cms.phone_top_up', {
url: '/phone_top_up',
controller: 'CmsPhonetopupCtrl',
templateUrl: '/static/cms/templates/phone_top_up.html'
})
}]);
app.controller('cmsRootCtrl', ['$scope', function ($scope) {
}]);
app.controller('CmsPhonetopupCtrl', ['$scope', '$http', '$filter', function ($scope, $http, $filter) {
$scope.topUp = function () {
var params = angular.copy($scope.params);
$http.get('/phone_top_up/recharge',{params: params}).then(function (resp) {
alert('ok');
}, function (resp) {
alert(resp.data.message);
})
}
}]);
app.controller('cmsArticleListCtrl', ['$scope', '$http', '$stateParams', function ($scope, $http, $stateParams) {
$scope.pagination = {};
$scope.listArticles = function (page) {

@ -26,6 +26,9 @@
<div class="btn-group">
<a class="btn btn-default" ui-sref=".category({catId:'app_ad'})">App广告页</a>
</div>
<div class="btn-group">
<a class="btn btn-default" ui-sref=".phone_top_up">话费充值</a>
</div>
</div>
</div>
</section>

@ -0,0 +1,36 @@
<section class="content-header">
<h1>Phone Top Up</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-cog"></i> Basic Config
</li>
<li><a ui-sref="^">Dev Tools</a></li>
<li class="active">phone top up</li>
</ol>
</section>
<div class="content">
<div class="row">
<div class="col-sm-12">
<div class="box-solid">
<div class="box box-warning">
<div class="box-header">
<form role="form" style="margin:0px auto;width: 50%">
<div class="form-group">
<label>Phone Number</label>
<input ng-model="params.phoneNumber" name="code" class="form-control" type="text"/>
</div>
<div class="form-group">
<label>Amount</label>
<input ng-model="params.amount" class="form-control" type="text" />
</div>
<div class="form-group">
<button class="btn btn-primary btn-block" ng-click="topUp()">commit</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
Loading…
Cancel
Save