Merge branch 'develop'

# Conflicts:
#	pom.xml
master
todking 5 years ago
commit b110fd0125

@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>1.1.28</version>
<version>1.1.29</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

@ -77,6 +77,9 @@ public interface TransactionAnalysisMapper {
JSONObject getClientTransaction(JSONObject params);
List<JSONObject> getWeekClientTransaction(JSONObject params);
@CountRef(".countAreaMerchantAmountAnalysis")
PageList<JSONObject> getAreaMerchantAmountAnalysis(JSONObject params, PageBounds pagination);

@ -24,6 +24,8 @@ import javax.servlet.http.HttpServletResponse;
public interface RetailAppService {
JSONObject getTransactionCommonData(JSONObject device, AppQueryBean appQueryBean);
List<JSONObject> getTransactionCommonWeekData(JSONObject device, AppQueryBean appQueryBean);
JSONObject getClientSettlementLog(JSONObject device, AppQueryBean appQueryBean);
JSONObject getTransactionLogsByClearingDetailId(JSONObject device, int clearing_detail_id, String timezone);

@ -211,7 +211,7 @@ public class RetailAppServiceImp implements RetailAppService {
private final int BIND_PHONE_TEMPLID = 126978;
private Map<String, AppMsgSender> senderMap = new HashMap<>();
private final String fileName[] = { "client_bank_file", "client_id_file", "client_company_file" };
private final String fileName[] = {"client_bank_file", "client_id_file", "client_company_file"};
@Resource
public void setAppMsgSenders(AppMsgSender[] senders) {
@ -262,6 +262,27 @@ public class RetailAppServiceImp implements RetailAppService {
return res;
}
@Override
public List<JSONObject> getTransactionCommonWeekData(JSONObject device, AppQueryBean appQueryBean) {
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
int client_id = device.getIntValue("client_id");
JSONObject client = clientManager.getClientInfo(client_id);
String timezone = client.getString("timezone");
if (timezone != null && !timezone.isEmpty()) {
appQueryBean.setTimezone(timezone);
}
JSONObject params = appQueryBean.toParams();
setAllClientIds(params, client_id);
params.put("client_id", client_id);
List<JSONObject> res = transactionAnalysisMapper.getWeekClientTransaction(params);
res.forEach(r -> {
r.put("date",r.getDate("date").toString());
});
res.remove(res.size() - 1);
return res;
}
@Override
public JSONObject getTradeCommonDate(JSONObject device, AppQueryBean appQueryBean) {
String clientType = device.getString("client_type");
@ -302,7 +323,7 @@ public class RetailAppServiceImp implements RetailAppService {
@Override
public JSONObject getQrcode(JSONObject device, QRCodeConfig config, int client_id) {
JSONObject client = merchantInfoProvider.getClientInfo(client_id);
String url = PlatformEnvironment.getEnv().concatUrl("/api/payment/v1.0/partners/" + client.getString("client_moniker"));
String url = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/payment/partners/" + client.getString("client_moniker"));
if (config.isCNY()) {
url += "_CNY";
}
@ -484,7 +505,7 @@ public class RetailAppServiceImp implements RetailAppService {
@Override
public JSONObject ctripCouponInfo(JSONObject device, String coupon_id) {
return couponVerificationService.ctripCouponInfo(coupon_id,device.getIntValue("client_id"), true);
return couponVerificationService.ctripCouponInfo(coupon_id, device.getIntValue("client_id"), true);
}
@ -498,7 +519,7 @@ public class RetailAppServiceImp implements RetailAppService {
PageList<JSONObject> cusCouponLogs = couponAccuessLogMapper.getCouponAccuessLog(
client.getIntValue("client_id"), keyword, new PageBounds(appQueryBean.getPage(), appQueryBean.getLimit(), Order.formString("creation_date.desc")));
HashMap<String, JSONObject> couponMap = new HashMap<>();
for(JSONObject cusCouponLog : cusCouponLogs) {
for (JSONObject cusCouponLog : cusCouponLogs) {
cusCouponLog.put("client_moniker", client_moniker);
if (couponMap.containsKey(cusCouponLog.getString("coupon_id"))) {
cusCouponLog.put("coupon", couponMap.get(cusCouponLog.getString("coupon_id")));
@ -521,7 +542,7 @@ public class RetailAppServiceImp implements RetailAppService {
Date date = new Date();
couponAccuessLog.put("client_id", client_id);
couponAccuessLog.put("order_id", "NON_PLATFORM_ORDER");
couponAccuessLog.put("coupon_id", "CTRIP_"+coupon_id);
couponAccuessLog.put("coupon_id", "CTRIP_" + coupon_id);
couponAccuessLog.put("customer_openid", "NON_PLATFORM_ORDER");
couponAccuessLog.put("coupon_deal_amount", 0);
couponAccuessLog.put("currency", "AUD");
@ -1288,10 +1309,10 @@ public class RetailAppServiceImp implements RetailAppService {
String father = "<div style=\"padding:0 10px\"></div>";
String html = doc.body().children().wrap(father).html();
// logger.debug("wrapped html---->"+html);
if (res.getIntValue("type")==2) {
List<JSONObject> buttons = JSONObject.parseArray(res.getString("buttons"),JSONObject.class);
if (res.getIntValue("type") == 2) {
List<JSONObject> buttons = JSONObject.parseArray(res.getString("buttons"), JSONObject.class);
res.put("buttons", buttons);
}else {
} else {
res.put("content", doc.html());
}
return res;
@ -1323,14 +1344,14 @@ public class RetailAppServiceImp implements RetailAppService {
if (latestConfirmNotice != null) {
latestConfirmNotice.put("id", latestConfirmNotice.getString("notice_id"));
latestConfirmNotice.remove("notice_id");
List<JSONObject> buttons = JSONObject.parseArray(latestConfirmNotice.getString("buttons"),JSONObject.class);
List<JSONObject> buttons = JSONObject.parseArray(latestConfirmNotice.getString("buttons"), JSONObject.class);
latestConfirmNotice.put("buttons", buttons);
String content = latestConfirmNotice.getString("content");
if (content.indexOf("%excharge_rate%")>0) {
if (content.indexOf("%excharge_rate%") > 0) {
JSONObject rate = merchantInfoProvider.clientCurrentRate(client_id, new Date(), "CB_BankPay");
if (rate != null) {
content = content.replace("%excharge_rate%", (rate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN).toPlainString() + "%"));
}else {
} else {
content = content.replace("%excharge_rate%", "(暂未配置)");
}
}
@ -1343,10 +1364,10 @@ public class RetailAppServiceImp implements RetailAppService {
String EndDate = DateFormatUtils.format(rate.getDate("expiry_date"), "yyyy-MM-dd");
String[] rateName = {"清算时间", "签约费率", "结束时间"};
String[] rateKey = {cleanDays, rateValue, EndDate};
for(int i =0;i<rateName.length;i++){
for (int i = 0; i < rateName.length; i++) {
JSONObject b = new JSONObject();
b.put("name",rateName[i]);
b.put("value",rateKey[i]);
b.put("name", rateName[i]);
b.put("value", rateKey[i]);
b.put("type", "string");
rateInfo.add(b);
}
@ -1903,7 +1924,7 @@ public class RetailAppServiceImp implements RetailAppService {
getActs.put("ad_cover", getActs.getString("page_desc"));
getActs.put("ad_mode", getActs.getString("page_keywords"));
getActs.put("ad_link", getActs.getString("summery"));
getActs.put("publish_date", DateFormatUtils.format(getActs.getDate("publish_time"),"yyyy/MM/dd HH:mm:ss"));
getActs.put("publish_date", DateFormatUtils.format(getActs.getDate("publish_time"), "yyyy/MM/dd HH:mm:ss"));
String reference = getActs.getString("reference");
JSONObject referenceObj = JSONObject.parseObject(reference);
if (reference != null) {
@ -1916,7 +1937,7 @@ public class RetailAppServiceImp implements RetailAppService {
if (referenceObj.getString("duration_time") != null) {
getActs.put("duration_time", referenceObj.getString("duration_time"));
}
}else {
} else {
getActs.put("message", "mess : (ad_type && expire_date && duration_time) not set");
}
getActs.remove("reference");
@ -1973,7 +1994,7 @@ public class RetailAppServiceImp implements RetailAppService {
riskUploadService.submitMaterial(material);
JSONObject event = riskBusinessService.getRiskEventDetail(material.getString("risk_id"));
//材料审核通过后可以重新提交
if(event.getIntValue("result_type")==3){
if (event.getIntValue("result_type") == 3) {
return;
}
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
@ -1991,14 +2012,14 @@ public class RetailAppServiceImp implements RetailAppService {
public void bindAccountEmail(JSONObject device, JSONObject email) {
String codeKey = device.getString("account_id");
String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountEmailKey(codeKey)).get();
if(StringUtils.isNotEmpty(codeKeyValueRedis)){
if (StringUtils.isNotEmpty(codeKeyValueRedis)) {
throw new BadRequestException("Captcha has been sent.Please check your email or try again in 5 minutes.");
}
String codeKeyValue = RandomStringUtils.random(6, false, true);
Context ctx = new Context();
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
ctx.setVariable("account",account);
ctx.setVariable("captcha",codeKeyValue);
ctx.setVariable("account", account);
ctx.setVariable("captcha", codeKeyValue);
final String content = thymeleaf.process("mail/account_bind_email.html", ctx);
royalThreadPoolExecutor.execute(() -> {
try {
@ -2008,23 +2029,23 @@ public class RetailAppServiceImp implements RetailAppService {
throw new EmailException("Email Sending Failed", e);
}
});
stringRedisTemplate.boundValueOps(getUpdateAccountEmailKey(codeKey)).set(codeKeyValue+"&"+email.getString("contact_email"), 5, TimeUnit.MINUTES);
stringRedisTemplate.boundValueOps(getUpdateAccountEmailKey(codeKey)).set(codeKeyValue + "&" + email.getString("contact_email"), 5, TimeUnit.MINUTES);
}
@Override
public void updateAccountEmail(JSONObject device, JSONObject params) {
String key = stringRedisTemplate.boundValueOps(getUpdateAccountEmailKey(device.getString("account_id"))).get();
if(key == null){
if (key == null) {
throw new BadRequestException("Captcha has expired");
}
String captcha = key.split("&")[0];
String email = key.split("&")[1];
if(!StringUtils.equals(captcha,params.getString("captcha"))){
if (!StringUtils.equals(captcha, params.getString("captcha"))) {
throw new BadRequestException("Verification code is wrong");
}
JSONObject account = new JSONObject();
account.put("account_id",device.getString("account_id"));
account.put("contact_email",email);
account.put("account_id", device.getString("account_id"));
account.put("contact_email", email);
clientAccountMapper.update(account);
deleteAccountEmailKey(device.getString("account_id"));
}
@ -2033,7 +2054,7 @@ public class RetailAppServiceImp implements RetailAppService {
public void bindAccountPhone(JSONObject device, JSONObject phone) {
String codeKey = device.getString("account_id");
String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).get();
if(StringUtils.isNotEmpty(codeKeyValueRedis)){
if (StringUtils.isNotEmpty(codeKeyValueRedis)) {
throw new BadRequestException("Captcha has been sent.Please check your phone or try again in 5 minutes.");
}
String codeKeyValue = RandomStringUtils.random(6, false, true);
@ -2050,25 +2071,25 @@ public class RetailAppServiceImp implements RetailAppService {
e.printStackTrace();
throw new ServerErrorException("Phone number is wrong.Please try again.");
}
stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).set(codeKeyValue+"&"+nationCode+"&"+phoneNumber, Long.parseLong(expireMin), TimeUnit.MINUTES);
stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(codeKey)).set(codeKeyValue + "&" + nationCode + "&" + phoneNumber, Long.parseLong(expireMin), TimeUnit.MINUTES);
}
@Override
public void updateAccountPhone(JSONObject device, JSONObject params) {
String key = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(device.getString("account_id"))).get();
if(key == null){
if (key == null) {
throw new BadRequestException("Captcha has expired");
}
String captcha = key.split("&")[0];
String nation_code = key.split("&")[1];
String contact_phone = key.split("&")[2];
if(!StringUtils.equals(captcha,params.getString("captcha"))){
if (!StringUtils.equals(captcha, params.getString("captcha"))) {
throw new BadRequestException("Verification code is wrong");
}
JSONObject account = new JSONObject();
account.put("account_id",device.getString("account_id"));
account.put("contact_phone",contact_phone);
account.put("nation_code","+" + nation_code);
account.put("account_id", device.getString("account_id"));
account.put("contact_phone", contact_phone);
account.put("nation_code", "+" + nation_code);
clientAccountMapper.update(account);
deleteAccountPhoneKey(device.getString("account_id"));
}
@ -2112,7 +2133,7 @@ public class RetailAppServiceImp implements RetailAppService {
}
@Override
public JSONObject toggleCBBankChannel(JSONObject device,String noticeId) {
public JSONObject toggleCBBankChannel(JSONObject device, String noticeId) {
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
@ -2135,7 +2156,7 @@ public class RetailAppServiceImp implements RetailAppService {
}
@Override
public JSONObject toggleCBBankCustomerSurcharge(JSONObject device,boolean customerSurcharge) {
public JSONObject toggleCBBankCustomerSurcharge(JSONObject device, boolean customerSurcharge) {
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
@ -2150,7 +2171,7 @@ public class RetailAppServiceImp implements RetailAppService {
result.put("status", "Fail");
if (customerSurcharge) {
result.put("message", "开启客户支付手续费失败,失败原因:" + e.getMessage());
}else {
} else {
result.put("message", "关闭客户支付手续费失败,失败原因:" + e.getMessage());
}
@ -2160,7 +2181,7 @@ public class RetailAppServiceImp implements RetailAppService {
result.put("status", "Success");
if (customerSurcharge) {
result.put("message", "开启客户支付手续费成功!");
}else {
} else {
result.put("message", "关闭客户支付手续费成功!");
}
result.put("customerSurcharge", String.valueOf(customerSurcharge));
@ -2219,20 +2240,20 @@ public class RetailAppServiceImp implements RetailAppService {
}
}
private void deleteAccountEmailKey(String codeKey){
private void deleteAccountEmailKey(String codeKey) {
stringRedisTemplate.delete(getUpdateAccountEmailKey(codeKey));
}
private void deleteAccountPhoneKey(String codeKey){
private void deleteAccountPhoneKey(String codeKey) {
stringRedisTemplate.delete(getUpdateAccountPhoneKey(codeKey));
}
private String getUpdateAccountEmailKey(String codeKey){
return BIND_ACCOUNT_EMAIL_PREFIX+codeKey;
private String getUpdateAccountEmailKey(String codeKey) {
return BIND_ACCOUNT_EMAIL_PREFIX + codeKey;
}
private String getUpdateAccountPhoneKey(String codeKey){
return BIND_ACCOUNT_PHONE_PREFIX+codeKey;
private String getUpdateAccountPhoneKey(String codeKey) {
return BIND_ACCOUNT_PHONE_PREFIX + codeKey;
}
}

@ -103,6 +103,12 @@ public class RetailAppController {
return retailAppService.getTransactionCommonData(device, appQueryBean);
}
// 查询7天的交易金额
@RequestMapping(value = "/common/week", method = RequestMethod.GET)
public List<JSONObject> getTransactionCommonWeekData(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, AppQueryBean appQueryBean) {
return retailAppService.getTransactionCommonWeekData(device, appQueryBean);
}
/**
*
*

@ -881,6 +881,35 @@
</if>
</select>
<select id="getWeekClientTransaction" resultType="com.alibaba.fastjson.JSONObject">
SELECT
calendar.datelist AS date,
IFNULL( trade_amount, 0 ) AS trade_amount
FROM
calendar
LEFT JOIN (
SELECT
IFNULL( sum( IF ( l.transaction_type = 'Credit', l.clearing_amount, 0 ) ), 0 ) trade_amount,
DATE_FORMAT( l.transaction_time, '%Y-%m-%d' ) AS queryDate
FROM
pmt_transactions l
WHERE
l.channel != 'Settlement'
AND l.system_generate = 0
<if test="client_ids==null and client_id != null">
AND l.client_id=#{client_id}
</if>
<if test="begin!=null">AND l.transaction_time &gt;= #{begin}</if>
<if test="end!=null">AND l.transaction_time &lt; #{end}</if>
GROUP BY
DATE_FORMAT( l.transaction_time, '%Y-%m-%d' )
) AS ticketCount ON calendar.datelist = ticketCount.queryDate
WHERE
calendar.datelist &lt;= #{end} AND calendar.datelist &gt;= #{begin}
ORDER BY
calendar.datelist
</select>
<select id="getAreaMerchantAmountAnalysis" resultType="com.alibaba.fastjson.JSONObject">
SELECT c.client_moniker,c.short_name,c.bd_user_name,sum(if(t.transaction_type='Credit',t.clearing_amount,0))

Loading…
Cancel
Save