optimise code

master
yixian 5 years ago
parent 78aa62f892
commit 639b861495

@ -17,8 +17,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DateFormat; import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
@ -57,7 +56,7 @@ public class ActChairtyServiceImp implements ActChairtyService {
client.put("client_moniker", client.getString("client_moniker")); client.put("client_moniker", client.getString("client_moniker"));
client.put("active_time", DateFormatUtils.format(client.getDate("active_time"), "yyyy/MM/dd")); client.put("active_time", DateFormatUtils.format(client.getDate("active_time"), "yyyy/MM/dd"));
BigDecimal bg = new BigDecimal(client.getIntValue("count_ordernum") * 0.01); BigDecimal bg = new BigDecimal(client.getIntValue("count_ordernum") * 0.01);
double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); double f1 = bg.setScale(2, RoundingMode.HALF_UP).doubleValue();
client.put("chairty_num", f1); client.put("chairty_num", f1);
} }
return PageListUtils.buildPageListResult(clients); return PageListUtils.buildPageListResult(clients);
@ -98,12 +97,12 @@ public class ActChairtyServiceImp implements ActChairtyService {
} }
BigDecimal chairty = new BigDecimal(0.01); BigDecimal chairty = new BigDecimal(0.01);
BigDecimal chairty_amount = count_ordernum.multiply(chairty); BigDecimal chairty_amount = count_ordernum.multiply(chairty);
BigDecimal f1 = sum_ordernum.setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal f1 = sum_ordernum.setScale(2, RoundingMode.HALF_UP);
BigDecimal f2 = chairty_amount.setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal f2 = chairty_amount.setScale(2, RoundingMode.HALF_UP);
weekDay.put("weekstart", weekStart.get(i)); weekDay.put("weekstart", weekStart.get(i));
weekDay.put("count_ordernum", count_ordernum); weekDay.put("count_ordernum", count_ordernum);
weekDay.put("sum_ordernum", f1); weekDay.put("sum_ordernum", f1);
weekDay.put("chairty_amount",f2 ); weekDay.put("chairty_amount", f2);
result.add(weekDay); result.add(weekDay);
} catch (Exception e) { } catch (Exception e) {
logger.info("Act_Chairty Error:",e); logger.info("Act_Chairty Error:",e);
@ -123,15 +122,15 @@ public class ActChairtyServiceImp implements ActChairtyService {
@Override @Override
public JSONObject gettotal() { public JSONObject gettotal() {
List<JSONObject> gettotalnum = actChairtyMapper.chairtyClientNum(); List<JSONObject> gettotalnum = actChairtyMapper.chairtyClientNum();
BigDecimal amount= new BigDecimal(0) ; BigDecimal amount = new BigDecimal(0);
double chairty=0.00; double chairty = 0.00;
for (JSONObject gettotals : gettotalnum) { for (JSONObject gettotals : gettotalnum) {
amount = amount.add(gettotals.getBigDecimal("sum_ordernum")); amount = amount.add(gettotals.getBigDecimal("sum_ordernum"));
chairty += gettotals.getIntValue("count_ordernum") * 0.01; chairty += gettotals.getIntValue("count_ordernum") * 0.01;
} }
BigDecimal bg = new BigDecimal(chairty); BigDecimal bg = new BigDecimal(chairty);
double f1 = amount.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); double f1 = amount.setScale(2, RoundingMode.HALF_UP).doubleValue();
double f2 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); double f2 = bg.setScale(2, RoundingMode.HALF_UP).doubleValue();
JSONObject gettotal = new JSONObject(); JSONObject gettotal = new JSONObject();
gettotal.put("amount", f1); gettotal.put("amount", f1);
gettotal.put("chairty", f2); gettotal.put("chairty", f2);

@ -20,26 +20,24 @@ import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClien
import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.TimeZone; import java.util.TimeZone;
import javax.annotation.Resource;
/** /**
* Created by yixian on 2017-03-21. * Created by yixian on 2017-03-21.
*/ */
@ -86,20 +84,20 @@ public class OneDollarDayActivitySupportImpl implements OneDollarDayActivity, Pa
String currency = paymentInfo.getCurrency(); String currency = paymentInfo.getCurrency();
dietOrderInfo.put("order_currency", currency); dietOrderInfo.put("order_currency", currency);
BigDecimal totalFee = paymentInfo.getTotalFee(); BigDecimal totalFee = paymentInfo.getTotalFee();
BigDecimal payAmount = totalFee.divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_DOWN); BigDecimal payAmount = totalFee.divide(CommonConsts.HUNDRED, 2, RoundingMode.DOWN);
BigDecimal payLocalCurrency = paymentInfo.getDisplayAmount().divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_DOWN); BigDecimal payLocalCurrency = paymentInfo.getDisplayAmount().divide(CommonConsts.HUNDRED, 2, RoundingMode.DOWN);
if (!"AUD".equals(currency)) { if (!"AUD".equals(currency)) {
BigDecimal exchange = mpPaymentApi.queryExchangeRateDecimal(clientId); BigDecimal exchange = mpPaymentApi.queryExchangeRateDecimal(clientId);
payLocalCurrency = payLocalCurrency.divide(exchange, 2, BigDecimal.ROUND_DOWN); payLocalCurrency = payLocalCurrency.divide(exchange, 2, RoundingMode.DOWN);
} }
if (payLocalCurrency.compareTo(MIN_PAY) <= 0) { if (payLocalCurrency.compareTo(MIN_PAY) <= 0) {
return; return;
} }
BigDecimal discount; BigDecimal discount;
dietOrderInfo.put("order_amount", totalFee.divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_DOWN)); dietOrderInfo.put("order_amount", totalFee.divide(CommonConsts.HUNDRED, 2, RoundingMode.DOWN));
if (!"AUD".equals(currency)) { if (!"AUD".equals(currency)) {
BigDecimal exchange = mpPaymentApi.queryExchangeRateDecimal(clientId); BigDecimal exchange = mpPaymentApi.queryExchangeRateDecimal(clientId);
discount = DISCOUNT_AMOUNT.multiply(exchange).setScale(2, BigDecimal.ROUND_DOWN); discount = DISCOUNT_AMOUNT.multiply(exchange).setScale(2, RoundingMode.DOWN);
} else { } else {
discount = DISCOUNT_AMOUNT; discount = DISCOUNT_AMOUNT;
} }
@ -109,7 +107,7 @@ public class OneDollarDayActivitySupportImpl implements OneDollarDayActivity, Pa
BigDecimal discountOrigin = paymentInfo.getDiscount(); BigDecimal discountOrigin = paymentInfo.getDiscount();
paymentInfo.setDiscount(discountOrigin.add(discount)); paymentInfo.setDiscount(discountOrigin.add(discount));
JSONObject updateOrder = new JSONObject(); JSONObject updateOrder = new JSONObject();
BigDecimal customerPay = payAmount.subtract(discount).setScale(2, BigDecimal.ROUND_DOWN); BigDecimal customerPay = payAmount.subtract(discount).setScale(2, RoundingMode.DOWN);
updateOrder.put("customer_payment_amount", customerPay); updateOrder.put("customer_payment_amount", customerPay);
updateOrder.put("coupon_payment_amount", discount); updateOrder.put("coupon_payment_amount", discount);
updateOrder.put("order_id", orderId); updateOrder.put("order_id", orderId);

@ -4,7 +4,9 @@ import au.com.royalpay.payment.manage.activities.diet.core.OneDollarDayActivity;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
@ -31,13 +33,13 @@ public class OneDollarDayAnalysisController {
*/ */
@GetMapping("/transaction_analysis") @GetMapping("/transaction_analysis")
public List<JSONObject> transaction_analysis(@RequestParam Map<String,String> map) { public List<JSONObject> transaction_analysis(@RequestParam Map<String,String> map) {
JSONObject params = JSONObject.parseObject(JSON.toJSONString(map)); JSONObject params = JSON.parseObject(JSON.toJSONString(map));
return oneDollarDayActivity.getTransactionAnalysis(params); return oneDollarDayActivity.getTransactionAnalysis(params);
} }
@GetMapping("/subsidy") @GetMapping("/subsidy")
public List<JSONObject> transaction_subsidy(@RequestParam Map<String,String> map) { public List<JSONObject> transaction_subsidy(@RequestParam Map<String,String> map) {
JSONObject params = JSONObject.parseObject(JSON.toJSONString(map)); JSONObject params = JSON.parseObject(JSON.toJSONString(map));
return oneDollarDayActivity.getSubsidyInDays(params); return oneDollarDayActivity.getSubsidyInDays(params);
} }

@ -5,7 +5,6 @@ import au.com.royalpay.payment.manage.activities.monsettledelay.core.ActMonDelay
import au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleMapper; import au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleMapper;
import au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleRedPackMapper; import au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleRedPackMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
@ -15,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -43,7 +41,7 @@ public class ActMonDelaySettleManagerServiceImpl implements ActMonDelaySettleMan
public void disableClient(String clientMoniker) { public void disableClient(String clientMoniker) {
JSONObject client = clientMapper.findClientByMoniker(clientMoniker); JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
List<JSONObject> clientLogs = actMonDelaySettleMapper.clientLog(client.getInteger("client_id")); List<JSONObject> clientLogs = actMonDelaySettleMapper.clientLog(client.getInteger("client_id"));
if (clientLogs.isEmpty() || clientLogs.size()==0){ if (clientLogs.isEmpty() || clientLogs.isEmpty()){
throw new BadRequestException("您未参加活动,不可取消"); throw new BadRequestException("您未参加活动,不可取消");
} }
JSONObject clientLog = clientLogs.get(0); JSONObject clientLog = clientLogs.get(0);

@ -40,13 +40,13 @@ public class AmountAnalysisServiceImp implements AmountAnalysisService {
// for (Map.Entry<String,Object> entry :amountData.entrySet()){ // for (Map.Entry<String,Object> entry :amountData.entrySet()){
// //
// } // }
if (ar.size() == 0) { if (ar.isEmpty()) {
return res; return res;
} }
PageList<JSONObject> logs = transactionAnalysisMapper.listAmountRangeOrders(params, PageList<JSONObject> logs = transactionAnalysisMapper.listAmountRangeOrders(params,
new PageBounds(Order.formString("transaction_time.desc"))); new PageBounds(Order.formString("transaction_time.desc")));
for (JSONObject log : logs) { for (JSONObject log : logs) {
if (ar.size() > 0) { if (!ar.isEmpty()) {
for (int i = 0; i < ar.size(); i++) { for (int i = 0; i < ar.size(); i++) {
JSONObject amountObj = ar.getJSONObject(i); JSONObject amountObj = ar.getJSONObject(i);
// params.put("amount_from",amountObj.getString("from").length()>0?amountObj.getBigDecimal("from"):null); // params.put("amount_from",amountObj.getString("from").length()>0?amountObj.getBigDecimal("from"):null);
@ -72,7 +72,7 @@ public class AmountAnalysisServiceImp implements AmountAnalysisService {
} }
} }
} }
if (ar.size() > 0) { if (!ar.isEmpty()) {
for (int i = 0; i < ar.size(); i++) { for (int i = 0; i < ar.size(); i++) {
JSONObject amountObj = ar.getJSONObject(i); JSONObject amountObj = ar.getJSONObject(i);
res.add(amountObj); res.add(amountObj);

@ -22,6 +22,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
@ -412,7 +413,7 @@ public class BDAnalysisServiceImpl implements BDAnalysisService {
} else if (lastTotal.compareTo(new BigDecimal(0)) == 0 && total.compareTo(new BigDecimal(0)) == 0) { } else if (lastTotal.compareTo(new BigDecimal(0)) == 0 && total.compareTo(new BigDecimal(0)) == 0) {
rate = 0; rate = 0;
} else { } else {
rate = total.subtract(lastTotal).multiply(new BigDecimal(100)).divide(lastTotal, 2, BigDecimal.ROUND_DOWN).doubleValue(); rate = total.subtract(lastTotal).multiply(new BigDecimal(100)).divide(lastTotal, 2, RoundingMode.DOWN).doubleValue();
} }
} }
HSSFRichTextString text23 = i == 0 ? new HSSFRichTextString("-") : new HSSFRichTextString(String.valueOf(rate)); HSSFRichTextString text23 = i == 0 ? new HSSFRichTextString("-") : new HSSFRichTextString(String.valueOf(rate));
@ -451,7 +452,7 @@ public class BDAnalysisServiceImpl implements BDAnalysisService {
} else if (lastTotal.compareTo(new BigDecimal(0)) == 0 && total.compareTo(new BigDecimal(0)) == 0) { } else if (lastTotal.compareTo(new BigDecimal(0)) == 0 && total.compareTo(new BigDecimal(0)) == 0) {
rate = 0; rate = 0;
} else { } else {
rate = total.subtract(lastTotal).multiply(new BigDecimal(100)).divide(lastTotal, 2, BigDecimal.ROUND_DOWN).doubleValue(); rate = total.subtract(lastTotal).multiply(new BigDecimal(100)).divide(lastTotal, 2, RoundingMode.DOWN).doubleValue();
} }
} }
HSSFRichTextString texti3 = new HSSFRichTextString(String.valueOf(rate)); HSSFRichTextString texti3 = new HSSFRichTextString(String.valueOf(rate));
@ -489,7 +490,7 @@ public class BDAnalysisServiceImpl implements BDAnalysisService {
// else if (lastTotal.compareTo(new BigDecimal(0))==0 && total.compareTo(new BigDecimal(0)) ==0){ // else if (lastTotal.compareTo(new BigDecimal(0))==0 && total.compareTo(new BigDecimal(0)) ==0){
// rate=0; // rate=0;
// }else { // }else {
// rate = total.subtract(lastTotal).multiply(new BigDecimal(100)).divide(lastTotal,2,BigDecimal.ROUND_DOWN).doubleValue(); // rate = total.subtract(lastTotal).multiply(new BigDecimal(100)).divide(lastTotal,2,RoundingMode.DOWN).doubleValue();
// } // }
// } // }
// HSSFRichTextString texti3 = new HSSFRichTextString(String.valueOf(rate)); // HSSFRichTextString texti3 = new HSSFRichTextString(String.valueOf(rate));

@ -106,7 +106,7 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService {
public JSONObject getCustomersRanking(JSONObject params, int page, int limit) { public JSONObject getCustomersRanking(JSONObject params, int page, int limit) {
PageList<JSONObject> logs = orderAnalysisMapper.listCustomersData(params, new PageBounds(page, limit, Order.formString( params.getString("orderValue") ))); PageList<JSONObject> logs = orderAnalysisMapper.listCustomersData(params, new PageBounds(page, limit, Order.formString( params.getString("orderValue") )));
if (logs.size() > 0) { if (!logs.isEmpty()) {
for (JSONObject log : logs) { for (JSONObject log : logs) {
generatorUserProfile(log, params); generatorUserProfile(log, params);
} }
@ -351,7 +351,7 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService {
JSONObject user = new JSONObject(); JSONObject user = new JSONObject();
user.put("id", 0); user.put("id", 0);
user.put("category", 0); user.put("category", 0);
if (userInfo.size() > 0) { if (!userInfo.isEmpty()) {
user.put("name", userInfo.getString("nickname")); user.put("name", userInfo.getString("nickname"));
} else { } else {
user.put("name", params.getString("customer_id")); user.put("name", params.getString("customer_id"));
@ -417,9 +417,9 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService {
} }
private String getTopInfo(List<JSONObject> list, String key) { private String getTopInfo(List<JSONObject> list, String key) {
if (list != null && list.size() > 0) { if (list != null && !list.isEmpty()) {
List<String> clients = list.stream().map(e -> e.getString(key)).collect(Collectors.toList()); List<String> clients = list.stream().map(e -> e.getString(key)).collect(Collectors.toList());
return String.join(",", clients); return String.join(",", clients);
} }
return "None"; return "None";
} }

@ -19,6 +19,7 @@ import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.utils.JsonHelper;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
@ -29,6 +30,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.text.ParseException; import java.text.ParseException;
@ -136,7 +138,7 @@ public class DailyReportImp implements DailyReport {
kpi.put("compare_value", Math.abs(compare.doubleValue())); kpi.put("compare_value", Math.abs(compare.doubleValue()));
} }
} }
kpi.put("kpi_percent", p.getBigDecimal("month_amount").divide(kpi_amount, 4, BigDecimal.ROUND_HALF_DOWN).multiply(BigDecimal.valueOf(100)).toString().substring(0, 5) + "%"); kpi.put("kpi_percent", p.getBigDecimal("month_amount").divide(kpi_amount, 4, RoundingMode.HALF_DOWN).multiply(BigDecimal.valueOf(100)).toString().substring(0, 5) + "%");
for (JSONObject clientAmount : clientsAmount) { for (JSONObject clientAmount : clientsAmount) {
if (clientAmount.getString("bd_group").equals(kpi.getString("bd_group"))) { if (clientAmount.getString("bd_group").equals(kpi.getString("bd_group"))) {
//查询该领队下所有BD //查询该领队下所有BD
@ -162,11 +164,11 @@ public class DailyReportImp implements DailyReport {
kpiList.add(kpi); kpiList.add(kpi);
} }
report.put("kpiList", kpiList); report.put("kpiList", kpiList);
report.put("kpi_percent_total", total_month_amount.divide(total_kpi_amount, 4, BigDecimal.ROUND_HALF_DOWN).multiply(BigDecimal.valueOf(100)).toString().substring(0, 5) + "%"); report.put("kpi_percent_total", total_month_amount.divide(total_kpi_amount, 4, RoundingMode.HALF_DOWN).multiply(BigDecimal.valueOf(100)).toString().substring(0, 5) + "%");
report.put("total_month_amount", total_month_amount); report.put("total_month_amount", total_month_amount);
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(dt); calendar.setTime(dt);
report.put("time_percent", BigDecimal.valueOf(calendar.get(Calendar.DAY_OF_MONTH)).divide(BigDecimal.valueOf(calendar.getActualMaximum(Calendar.DAY_OF_MONTH)), 4, BigDecimal.ROUND_HALF_DOWN).multiply(BigDecimal.valueOf(100)).toString().substring(0, 5) + "%"); report.put("time_percent", BigDecimal.valueOf(calendar.get(Calendar.DAY_OF_MONTH)).divide(BigDecimal.valueOf(calendar.getActualMaximum(Calendar.DAY_OF_MONTH)), 4, RoundingMode.HALF_DOWN).multiply(BigDecimal.valueOf(100)).toString().substring(0, 5) + "%");
return report; return report;
} }
@ -246,38 +248,38 @@ public class DailyReportImp implements DailyReport {
JSONObject percentage_yesterday_tax_amount = this.percentage(yesterday_tax_amount, last_tax_amount); JSONObject percentage_yesterday_tax_amount = this.percentage(yesterday_tax_amount, last_tax_amount);
report.put("channels", settles); report.put("channels", settles);
report.put("total_settle_amount", new JSONObject() {{ report.put("total_settle_amount", JsonHelper.newJson(json -> {
put("amount", yesterday_settle_amount); json.put("amount", yesterday_settle_amount);
put("compare", percentage_yesterday_settle_amount); json.put("compare", percentage_yesterday_settle_amount);
}}); }));
report.put("total_credit_amount", new JSONObject() {{ report.put("total_credit_amount", JsonHelper.newJson(json -> {
put("amount", yesterday_credit_amount); json.put("amount", yesterday_credit_amount);
put("compare", percentage_yesterday_total_credit); json.put("compare", percentage_yesterday_total_credit);
}}); }));
report.put("total_debit_amount", new JSONObject() {{ report.put("total_debit_amount", JsonHelper.newJson(json -> {
put("amount", yesterday_debit_amount); json.put("amount", yesterday_debit_amount);
put("compare", percentage_yesterday_debit_amount); json.put("compare", percentage_yesterday_debit_amount);
}}); }));
report.put("total_net_trading", new JSONObject() {{ report.put("total_net_trading", JsonHelper.newJson(json -> {
put("amount", yesterday_net_trading); json.put("amount", yesterday_net_trading);
put("compare", percentage_yesterday_net_trading); json.put("compare", percentage_yesterday_net_trading);
}}); }));
report.put("total_total_surcharge", new JSONObject() {{ report.put("total_total_surcharge", JsonHelper.newJson(json -> {
put("amount", yesterday_total_surcharge); json.put("amount", yesterday_total_surcharge);
put("compare", percentage_yesterday_total_surcharge); json.put("compare", percentage_yesterday_total_surcharge);
}}); }));
report.put("total_royal_surcharge", new JSONObject() {{ report.put("total_royal_surcharge", JsonHelper.newJson(json -> {
put("amount", yesterday_royal_surcharge); json.put("amount", yesterday_royal_surcharge);
put("compare", percentage_yesterday_royal_surcharge); json.put("compare", percentage_yesterday_royal_surcharge);
}}); }));
report.put("total_channel_surcharge", new JSONObject() {{ report.put("total_channel_surcharge", JsonHelper.newJson(json -> {
put("amount", yesterday_channel_surcharge); json.put("amount", yesterday_channel_surcharge);
put("compare", percentage_yesterday_channel_surcharge); json.put("compare", percentage_yesterday_channel_surcharge);
}}); }));
report.put("total_tax_amount", new JSONObject() {{ report.put("total_tax_amount", JsonHelper.newJson(json -> {
put("amount", yesterday_tax_amount); json.put("amount", yesterday_tax_amount);
put("compare", percentage_yesterday_tax_amount); json.put("compare", percentage_yesterday_tax_amount);
}}); }));
return report; return report;
} }
@ -337,16 +339,16 @@ public class DailyReportImp implements DailyReport {
String finalTotal_royal_surcharge = df1.format(total_royal_surcharge); String finalTotal_royal_surcharge = df1.format(total_royal_surcharge);
String finalTotal_channel_surcharge = df1.format(total_channel_surcharge); String finalTotal_channel_surcharge = df1.format(total_channel_surcharge);
String finalTotal_tax_amount = df1.format(total_tax_amount); String finalTotal_tax_amount = df1.format(total_tax_amount);
return new JSONObject() {{ return JsonHelper.newJson(json -> {
put("total_settle_amount", finalTotal_settle_amount); json.put("total_settle_amount", finalTotal_settle_amount);
put("total_credit_amount", finalTotal_credit_amount); json.put("total_credit_amount", finalTotal_credit_amount);
put("total_debit_amount", finalTotal_debit_amount); json.put("total_debit_amount", finalTotal_debit_amount);
put("total_net_trading", finalTotal_net_trading); json.put("total_net_trading", finalTotal_net_trading);
put("total_total_surcharge", finalTotal_total_surcharge); json.put("total_total_surcharge", finalTotal_total_surcharge);
put("total_royal_surcharge", finalTotal_royal_surcharge); json.put("total_royal_surcharge", finalTotal_royal_surcharge);
put("total_channel_surcharge", finalTotal_channel_surcharge); json.put("total_channel_surcharge", finalTotal_channel_surcharge);
put("total_tax_amount", finalTotal_tax_amount); json.put("total_tax_amount", finalTotal_tax_amount);
}}; });
} }
private JSONObject percentage(BigDecimal num1, BigDecimal num2) { private JSONObject percentage(BigDecimal num1, BigDecimal num2) {
@ -364,10 +366,10 @@ public class DailyReportImp implements DailyReport {
String result = format.format(ratio < 1 ? 1 - ratio : ratio - 1); String result = format.format(ratio < 1 ? 1 - ratio : ratio - 1);
boolean finalPositive = positive; boolean finalPositive = positive;
return new JSONObject() {{ return JsonHelper.newJson(json -> {
put("compare", result); json.put("compare", result);
put("positive", finalPositive); json.put("positive", finalPositive);
}}; });
} }
@ -410,7 +412,7 @@ public class DailyReportImp implements DailyReport {
} }
} }
} }
logger.info("DailyReportUsers" + clean_users.toString()); logger.info("DailyReportUsers {}", clean_users.toString());
} }
private TemplateMessage initMsg(String range, String url, String time, String openId, String templateId) { private TemplateMessage initMsg(String range, String url, String time, String openId, String templateId) {

@ -13,6 +13,7 @@ import au.com.royalpay.payment.manage.mappers.system.ExchangeRateMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.defines.TradeType; import au.com.royalpay.payment.tools.defines.TradeType;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
@ -66,8 +67,8 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
@Override @Override
public JSONObject getCommonAnalysis1(JSONObject params) { public JSONObject getCommonAnalysis1(JSONObject params) {
String jsonStr = stringRedisTemplate.boundValueOps("org_commonAnalysis1"+ params.getString("org_id")+ params.getString("begin")).get(); String jsonStr = stringRedisTemplate.boundValueOps("org_commonAnalysis1" + params.getString("org_id") + params.getString("begin")).get();
JSONObject commonAnalysis1 = JSONObject.parseObject(jsonStr); JSONObject commonAnalysis1 = JSON.parseObject(jsonStr);
if(commonAnalysis1 != null){ if(commonAnalysis1 != null){
return commonAnalysis1; return commonAnalysis1;
} }
@ -88,8 +89,8 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
@Override @Override
public JSONObject getCommonAnalysis3(JSONObject params) { public JSONObject getCommonAnalysis3(JSONObject params) {
String jsonStr = stringRedisTemplate.boundValueOps("org_commonAnalysis3"+ params.getString("org_id")+ params.getString("begin")).get(); String jsonStr = stringRedisTemplate.boundValueOps("org_commonAnalysis3" + params.getString("org_id") + params.getString("begin")).get();
JSONObject commonAnalysis3 = JSONObject.parseObject(jsonStr); JSONObject commonAnalysis3 = JSON.parseObject(jsonStr);
if(commonAnalysis3 != null){ if(commonAnalysis3 != null){
return commonAnalysis3; return commonAnalysis3;
} }
@ -105,8 +106,8 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
@Override @Override
public JSONObject getCommonAnalysis2(JSONObject params) { public JSONObject getCommonAnalysis2(JSONObject params) {
String jsonStr = stringRedisTemplate.boundValueOps("org_commonAnalysis2"+ params.getString("org_id")+ params.getString("begin")).get(); String jsonStr = stringRedisTemplate.boundValueOps("org_commonAnalysis2" + params.getString("org_id") + params.getString("begin")).get();
JSONObject commonAnalysis2 = JSONObject.parseObject(jsonStr); JSONObject commonAnalysis2 = JSON.parseObject(jsonStr);
if(commonAnalysis2 != null){ if(commonAnalysis2 != null){
return commonAnalysis2; return commonAnalysis2;
} }
@ -135,8 +136,8 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
@Override @Override
public JSONObject getCommonAnalysis4(JSONObject params) { public JSONObject getCommonAnalysis4(JSONObject params) {
String jsonStr = stringRedisTemplate.boundValueOps("org_commonAnalysis4"+ params.getString("org_id")+ params.getString("begin")).get(); String jsonStr = stringRedisTemplate.boundValueOps("org_commonAnalysis4" + params.getString("org_id") + params.getString("begin")).get();
JSONObject commonAnalysis4 = JSONObject.parseObject(jsonStr); JSONObject commonAnalysis4 = JSON.parseObject(jsonStr);
if(commonAnalysis4 != null){ if(commonAnalysis4 != null){
return commonAnalysis4; return commonAnalysis4;
} }
@ -265,7 +266,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
JSONObject retailInStore = new JSONObject(); JSONObject retailInStore = new JSONObject();
retailInStore.put("name", "Retail In-Store"); retailInStore.put("name", "Retail In-Store");
retailInStore.put("data", retailInStore_orders); retailInStore.put("data", retailInStore_orders);
if (!retailInStore_orders.isEmpty() && retailInStore_orders.size() > 0) { if (!retailInStore_orders.isEmpty()) {
analysis.add(retailInStore); analysis.add(retailInStore);
} }
params.put("trade_type", "WeChat HTML5"); params.put("trade_type", "WeChat HTML5");
@ -468,7 +469,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
@Override @Override
public JSONObject getNewRecord() { public JSONObject getNewRecord() {
String jsonStr = stringRedisTemplate.boundValueOps("newRecord").get(); String jsonStr = stringRedisTemplate.boundValueOps("newRecord").get();
JSONObject newRecord = JSONObject.parseObject(jsonStr); JSONObject newRecord = JSON.parseObject(jsonStr);
if(newRecord != null){ if(newRecord != null){
return newRecord; return newRecord;
} }
@ -568,8 +569,8 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
} }
@Override @Override
public JSONObject getPlatformAmount(JSONObject params) { public JSONObject getPlatformAmount(JSONObject params) {
String jsonStr = stringRedisTemplate.boundValueOps("org_ChannelAnalysis" + params.getString("org_id")+params.getString("begin")).get(); String jsonStr = stringRedisTemplate.boundValueOps("org_ChannelAnalysis" + params.getString("org_id") + params.getString("begin")).get();
JSONObject channelAnalysis = JSONObject.parseObject(jsonStr); JSONObject channelAnalysis = JSON.parseObject(jsonStr);
if(channelAnalysis != null){ if(channelAnalysis != null){
return channelAnalysis; return channelAnalysis;
}else { }else {

@ -15,27 +15,19 @@ import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils; import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.jsoup.helper.DataUtil;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
import javax.annotation.Resource;
/** /**
* Created by Tayl0r on 2017/7/3. * Created by Tayl0r on 2017/7/3.
@ -258,7 +250,7 @@ public class EstimateAnalysisServiceImpl implements EstimateAnalysisService {
String end_date = maxDays.getString("date_str"); String end_date = maxDays.getString("date_str");
JSONObject cleanDays = estimateAnalysisMapper.findLastCleanDays(endStr, 1); JSONObject cleanDays = estimateAnalysisMapper.findLastCleanDays(endStr, 1);
List<JSONObject> tencentSettle = platformSettlementMapper.findBySettleDate(new Date(maxDays.getDate("date_str").getTime() - 86400000L), "Wechat"); List<JSONObject> tencentSettle = platformSettlementMapper.findBySettleDate(new Date(maxDays.getDate("date_str").getTime() - 86400000L), "Wechat");
if (tencentSettle != null && tencentSettle.size() > 0) { if (tencentSettle != null && !tencentSettle.isEmpty()) {
for (JSONObject logs : tencentSettle) { for (JSONObject logs : tencentSettle) {
dayInfo.put("settlementFee_" + logs.getString("merchants"), logs.getBigDecimal("settlement_fee")); dayInfo.put("settlementFee_" + logs.getString("merchants"), logs.getBigDecimal("settlement_fee"));
if (!dayInfo.containsKey("platformGetSettleFee")) { if (!dayInfo.containsKey("platformGetSettleFee")) {
@ -316,7 +308,7 @@ public class EstimateAnalysisServiceImpl implements EstimateAnalysisService {
logger.info("系统开始生成[ " + report_date + " ]清算总额"); logger.info("系统开始生成[ " + report_date + " ]清算总额");
JSONObject isClearDay = estimateAnalysisMapper.checkIsClearDay(report_date); JSONObject isClearDay = estimateAnalysisMapper.checkIsClearDay(report_date);
if (isClearDay != null && isClearDay.size() > 0) { if (isClearDay != null && !isClearDay.isEmpty()) {
JSONObject estimate = getCleanDayAmount(report_date); JSONObject estimate = getCleanDayAmount(report_date);
estimate.put("log_date", report_date); estimate.put("log_date", report_date);
estimate.put("last_update_date", new Date()); estimate.put("last_update_date", new Date());

@ -22,7 +22,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.RoundingMode;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -63,13 +63,13 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi
JSONObject ali_pay = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data, "Alipay"); JSONObject ali_pay = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data, "Alipay");
JSONObject rate_value = new JSONObject(); JSONObject rate_value = new JSONObject();
if (res != null) { if (res != null) {
rate_value.put("wechat_rate_value", res.getBigDecimal("rate_value").setScale(1, BigDecimal.ROUND_DOWN)); rate_value.put("wechat_rate_value", res.getBigDecimal("rate_value").setScale(1, RoundingMode.DOWN));
if (res.getInteger("clean_days") != null) { if (res.getInteger("clean_days") != null) {
client.put("clean_days", res.getIntValue("clean_days")); client.put("clean_days", res.getIntValue("clean_days"));
} }
} }
if (ali_pay != null) { if (ali_pay != null) {
rate_value.put("ali_rate_value", ali_pay.getBigDecimal("rate_value").setScale(1, BigDecimal.ROUND_DOWN)); rate_value.put("ali_rate_value", ali_pay.getBigDecimal("rate_value").setScale(1, RoundingMode.DOWN));
} }
client.put("rate_value", rate_value); client.put("rate_value", rate_value);
return client; return client;

@ -189,7 +189,7 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService {
params.put("channel", channel); params.put("channel", channel);
params.put("last_update_date", new Date()); params.put("last_update_date", new Date());
JSONObject sysClearData = getSystemClearingAmount(dateStr, aliSettleLog, channel); JSONObject sysClearData = getSystemClearingAmount(dateStr, aliSettleLog, channel);
if (sysClearData != null && sysClearData.size() > 0) { if (sysClearData != null && !sysClearData.isEmpty()) {
params.put("sys_pay_fee", sysClearData.getBigDecimal("sys_pay_fee")); params.put("sys_pay_fee", sysClearData.getBigDecimal("sys_pay_fee"));
params.put("sys_refund_fee", sysClearData.getBigDecimal("sys_refund_fee")); params.put("sys_refund_fee", sysClearData.getBigDecimal("sys_refund_fee"));
params.put("sys_net_fee", sysClearData.getBigDecimal("sys_net_fee")); params.put("sys_net_fee", sysClearData.getBigDecimal("sys_net_fee"));
@ -222,7 +222,7 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService {
params.put("channel", "Wechat"); params.put("channel", "Wechat");
params.put("last_update_date", new Date()); params.put("last_update_date", new Date());
JSONObject sysClearData = getSystemClearingAmount(null, settle, "Wechat"); JSONObject sysClearData = getSystemClearingAmount(null, settle, "Wechat");
if (sysClearData != null && sysClearData.size() > 0) { if (sysClearData != null && !sysClearData.isEmpty()) {
params.put("sys_pay_fee", sysClearData.getBigDecimal("sys_pay_fee")); params.put("sys_pay_fee", sysClearData.getBigDecimal("sys_pay_fee"));
params.put("sys_refund_fee", sysClearData.getBigDecimal("sys_refund_fee")); params.put("sys_refund_fee", sysClearData.getBigDecimal("sys_refund_fee"));
params.put("sys_net_fee", sysClearData.getBigDecimal("sys_net_fee")); params.put("sys_net_fee", sysClearData.getBigDecimal("sys_net_fee"));

@ -22,11 +22,11 @@ import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
@ -124,8 +124,8 @@ public class WeekReporterImpl implements WeekReporter {
if (sendMsg) { if (sendMsg) {
List<JSONObject> users = managerMapper.listRoyalPayUsers(); List<JSONObject> users = managerMapper.listRoyalPayUsers();
publishMessages(users, reportId, dateRange); publishMessages(users, reportId, dateRange);
if (partnersReport!=null && partnersReport.size()>0){ if (partnersReport != null && !partnersReport.isEmpty()) {
publishPartnersMessages(reportId,dateRange); publishPartnersMessages(reportId, dateRange);
} }
} }
} catch (ParseException e) { } catch (ParseException e) {
@ -386,7 +386,7 @@ public class WeekReporterImpl implements WeekReporter {
for (JSONObject tranaction : transactions) { for (JSONObject tranaction : transactions) {
JSONObject report = new JSONObject(); JSONObject report = new JSONObject();
report.put("date", tranaction.getString("date_str")); report.put("date", tranaction.getString("date_str"));
BigDecimal fee = tranaction.getBigDecimal("aud_fee").setScale(2, BigDecimal.ROUND_DOWN); BigDecimal fee = tranaction.getBigDecimal("aud_fee").setScale(2, RoundingMode.DOWN);
report.put("fee", fee); report.put("fee", fee);
report.put("order_count", tranaction.getIntValue("order_count")); report.put("order_count", tranaction.getIntValue("order_count"));
dailyReport.add(report); dailyReport.add(report);

@ -1,20 +1,15 @@
package au.com.royalpay.payment.manage.appclient.beans; package au.com.royalpay.payment.manage.appclient.beans;
import au.com.royalpay.payment.core.beans.OrderStatus; import au.com.royalpay.payment.core.beans.OrderStatus;
import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
import au.com.royalpay.payment.core.beans.PayChannel; import au.com.royalpay.payment.core.beans.PayChannel;
import au.com.royalpay.payment.tools.defines.TradeType; import au.com.royalpay.payment.tools.defines.TradeType;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.castor.util.StringUtil;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.DateTimeZone; import org.joda.time.DateTimeZone;
import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormat;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -61,7 +56,7 @@ public class AppQueryBean {
tradeTypes.add(type.getGateway()); tradeTypes.add(type.getGateway());
} }
} }
if (tradeTypes.size() > 0) { if (!tradeTypes.isEmpty()) {
params.put("trade_type", tradeTypes); params.put("trade_type", tradeTypes);
} }
} }
@ -74,7 +69,7 @@ public class AppQueryBean {
tradeTypes.add(type.getGateway()); tradeTypes.add(type.getGateway());
} }
} }
if (tradeTypes.size() > 0) { if (!tradeTypes.isEmpty()) {
params.put("trade_type", tradeTypes); params.put("trade_type", tradeTypes);
} }
} }

@ -290,11 +290,11 @@ public class RetailAppServiceImp implements RetailAppService {
res.put("alipay_rate", paymentApi.channelApi("Alipay").queryExchangeRateDecimal(clientId)); res.put("alipay_rate", paymentApi.channelApi("Alipay").queryExchangeRateDecimal(clientId));
} }
params.put("channel", "system"); params.put("channel", "system");
res.put("sys_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)).setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); res.put("sys_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)).setScale(2, RoundingMode.DOWN).toPlainString());
params.put("channel", "rpaypmt_card"); params.put("channel", "rpaypmt_card");
res.put("rpaypmt_card_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)).setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); res.put("rpaypmt_card_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)).setScale(2, RoundingMode.DOWN).toPlainString());
params.put("channel", "rpaypmt_dd"); params.put("channel", "rpaypmt_dd");
res.put("rpaypmt_dd_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)).setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); res.put("rpaypmt_dd_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)).setScale(2, RoundingMode.DOWN).toPlainString());
return res; return res;
} }
@ -2291,7 +2291,7 @@ public class RetailAppServiceImp implements RetailAppService {
throw new BadRequestException("Verification code is wrong"); throw new BadRequestException("Verification code is wrong");
} }
List<JSONObject> account = clientAccountMapper.findByPhone(contactPhone, "+" + nationCode); List<JSONObject> account = clientAccountMapper.findByPhone(contactPhone, "+" + nationCode);
if (account != null && account.size() > 0) { if (account != null && !account.isEmpty()) {
throw new BadRequestException("Mobile phone number has been bound to other users, please unbind it before binding"); throw new BadRequestException("Mobile phone number has been bound to other users, please unbind it before binding");
} }
@ -2678,7 +2678,7 @@ public class RetailAppServiceImp implements RetailAppService {
return params; return params;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
if (clientFileUrl.size() > 0) { if (!clientFileUrl.isEmpty()) {
result.put("kyc_utility_bill_file", clientFileUrl); result.put("kyc_utility_bill_file", clientFileUrl);
} }
} }
@ -3129,14 +3129,14 @@ public class RetailAppServiceImp implements RetailAppService {
int clientId = account.getIntValue("client_id"); int clientId = account.getIntValue("client_id");
JSONObject displayInfo = actPartnerReadMapper.displayInfo(actId, clientId, accountId); JSONObject displayInfo = actPartnerReadMapper.displayInfo(actId, clientId, accountId);
if (displayInfo == null) { if (displayInfo == null) {
displayInfo = new JSONObject() {{ displayInfo = JsonHelper.newJson(json -> {
put("display_client_id", UUID.randomUUID().toString()); json.put("display_client_id", UUID.randomUUID().toString());
put("act_id", actId); json.put("act_id", actId);
put("client_id", clientId); json.put("client_id", clientId);
put("account_id", accountId); json.put("account_id", accountId);
put("last_read_time", new Date()); json.put("last_read_time", new Date());
put("display_count", 1); json.put("display_count", 1);
}}; });
actPartnerReadMapper.save(displayInfo); actPartnerReadMapper.save(displayInfo);
return false; return false;
} }

@ -18,10 +18,11 @@ import au.com.royalpay.payment.tools.encryptalgorithm.SignUtils;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.mappers.CommonIncrementalChannelMapper; import au.com.royalpay.payment.tools.mappers.CommonIncrementalChannelMapper;
import org.apache.commons.codec.binary.Base64; import au.com.royalpay.payment.tools.utils.JsonHelper;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.parser.Feature; import com.alibaba.fastjson.parser.Feature;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -37,8 +38,8 @@ import java.util.concurrent.TimeUnit;
@Service @Service
public class RetailRSvcServiceImpl implements RetailRSvcService { public class RetailRSvcServiceImpl implements RetailRSvcService {
private Logger logger = LoggerFactory.getLogger(getClass()); private final Logger logger = LoggerFactory.getLogger(getClass());
private Map<String, AppMsgSender> senderMap = new HashMap<>(); private final Map<String, AppMsgSender> senderMap = new HashMap<>();
@Resource @Resource
private ClientManager clientManager; private ClientManager clientManager;
@Resource @Resource
@ -54,7 +55,7 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
@Resource @Resource
private AppMessageLogMapper appMessageLogMapper; private AppMessageLogMapper appMessageLogMapper;
private ThreadPoolExecutor sendingAppleMsgPool = new ThreadPoolExecutor(10, 30, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); private final ThreadPoolExecutor sendingAppleMsgPool = new ThreadPoolExecutor(10, 30, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
@Resource @Resource
public void setAppMsgSenders(AppMsgSender[] senders) { public void setAppMsgSenders(AppMsgSender[] senders) {
@ -79,23 +80,22 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
RSvcMchBean svcMchBean = clientManager.findSvcMchByAccountId(device.getString("account_id")); RSvcMchBean svcMchBean = clientManager.findSvcMchByAccountId(device.getString("account_id"));
String aesKeyStr = Base64.encodeBase64String(AESCrypt.randomKey().getEncoded()); String aesKeyStr = Base64.encodeBase64String(AESCrypt.randomKey().getEncoded());
Key key = AESCrypt.fromKeyString(Base64.decodeBase64(aesKeyStr)); Key key = AESCrypt.fromKeyString(Base64.decodeBase64(aesKeyStr));
JSONObject result = (JSONObject) JSONObject.toJSON(svcMchBean); JSONObject result = (JSONObject) JSON.toJSON(svcMchBean);
result.put("sign_type", "RSA2"); result.put("sign_type", "RSA2");
result.put("enc_data", new JSONObject() { result.put("enc_data", JsonHelper.newJson(json -> {
{ json.put("credentialCode", encData(svcMchBean.getCredentialCode(), key, svcInfo.getString("channel_pub_key")));
put("credentialCode", encData(svcMchBean.getCredentialCode(), key, svcInfo.getString("channel_pub_key"))); json.put("payHost", encData(svcMchBean.getPayHost(), key, svcInfo.getString("channel_pub_key")));
put("payHost", encData(svcMchBean.getPayHost(), key, svcInfo.getString("channel_pub_key"))); json.put("partnerCode", encData(svcMchBean.getPartnerCode(), key, svcInfo.getString("channel_pub_key")));
put("partnerCode", encData(svcMchBean.getPartnerCode(), key, svcInfo.getString("channel_pub_key"))); json.put("merchantNumber", encData(svcMchBean.getMerchantNumber(), key, svcInfo.getString("channel_pub_key")));
put("merchantNumber", encData(svcMchBean.getMerchantNumber(), key, svcInfo.getString("channel_pub_key"))); }
} ));
});
result.remove("credentialCode"); result.remove("credentialCode");
result.remove("payHost"); result.remove("payHost");
result.remove("partnerCode"); result.remove("partnerCode");
result.remove("merchantNumber"); result.remove("merchantNumber");
result.put("nonce_str", aesKeyStr); result.put("nonce_str", aesKeyStr);
result.put("timestamp", System.currentTimeMillis()); result.put("timestamp", System.currentTimeMillis());
result = JSONObject.parseObject(JSON.toJSONString(result), Feature.OrderedField); result = JSON.parseObject(JSON.toJSONString(result), Feature.OrderedField);
result.put("sign", SignUtils.buildSign(result.toJSONString(), svcInfo.getString("platform_pri_key"))); result.put("sign", SignUtils.buildSign(result.toJSONString(), svcInfo.getString("platform_pri_key")));
logger.info("svc [{}] info:{}", sourceCode, result.toJSONString()); logger.info("svc [{}] info:{}", sourceCode, result.toJSONString());
return result; return result;
@ -110,10 +110,10 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
|| StringUtils.isEmpty(svcInfo.getString("platform_pub_key")) || StringUtils.isEmpty("platform_pri_key")) { || StringUtils.isEmpty(svcInfo.getString("platform_pub_key")) || StringUtils.isEmpty("platform_pri_key")) {
throw new BadRequestException("this channel config is wrong"); throw new BadRequestException("this channel config is wrong");
} }
logger.debug("{} new services apply :{}", params.getString("signClient"),params.toJSONString()); logger.debug("{} new services apply :{}", params.getString("signClient"), params.toJSONString());
String signa = params.getString("sign"); String signa = params.getString("sign");
params.remove("sign"); params.remove("sign");
params = JSONObject.parseObject(JSON.toJSONString(params), Feature.OrderedField); params = JSON.parseObject(JSON.toJSONString(params), Feature.OrderedField);
boolean checkSign = SignUtils.validSign(params.toJSONString(), signa, svcInfo.getString("channel_pub_key")); boolean checkSign = SignUtils.validSign(params.toJSONString(), signa, svcInfo.getString("channel_pub_key"));
if (!checkSign) { if (!checkSign) {
throw new BadRequestException("sign is wrong"); throw new BadRequestException("sign is wrong");
@ -126,14 +126,14 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
String signPrice = "0"; String signPrice = "0";
String signRate = "0"; String signRate = "0";
if (params.get("signPrice") != null) { if (params.get("signPrice") != null) {
logger.debug("{} new services apply amount origin:{}", params.getString("signClient"),params.getString("signPrice")); logger.debug("{} new services apply amount origin:{}", params.getString("signClient"), params.getString("signPrice"));
signPrice = decData(params.getString("signPrice"), key, svcInfo.getString("platform_pri_key")); signPrice = decData(params.getString("signPrice"), key, svcInfo.getString("platform_pri_key"));
logger.debug("{} new services apply amount now:{}", params.getString("signClient"),signPrice); logger.debug("{} new services apply amount now:{}", params.getString("signClient"), signPrice);
} }
if (params.get("signRate") != null) { if (params.get("signRate") != null) {
logger.debug("{} new services apply rate origin:{}", params.getString("signClient"),params.getString("signRate")); logger.debug("{} new services apply rate origin:{}", params.getString("signClient"), params.getString("signRate"));
signRate = decData(params.getString("signRate"), key, svcInfo.getString("platform_pri_key")); signRate = decData(params.getString("signRate"), key, svcInfo.getString("platform_pri_key"));
logger.debug("{} new services apply rate origin:{}", params.getString("signClient"),signRate); logger.debug("{} new services apply rate origin:{}", params.getString("signClient"), signRate);
} }
JSONObject serviceApply = new JSONObject(); JSONObject serviceApply = new JSONObject();
serviceApply.put("apply_id", UUID.randomUUID().toString()); serviceApply.put("apply_id", UUID.randomUUID().toString());
@ -149,7 +149,7 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
clientServicesApplyMapper.save(serviceApply); clientServicesApplyMapper.save(serviceApply);
result.put("result_status", "PROCESSING"); result.put("result_status", "PROCESSING");
} catch (Exception e) { } catch (Exception e) {
logger.error("enter R services fail:{} - {}",sourceCode,e.getMessage()); logger.error("enter R services fail:{} - {}", sourceCode, e.getMessage());
result.put("result_status", "SYSTEMERROR"); result.put("result_status", "SYSTEMERROR");
result.put("result_msg", e.getMessage()); result.put("result_msg", e.getMessage());
} }
@ -168,13 +168,13 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
Key key = AESCrypt.fromKeyString(Base64.decodeBase64(params.getString("nonce_str"))); Key key = AESCrypt.fromKeyString(Base64.decodeBase64(params.getString("nonce_str")));
String signa = params.getString("sign"); String signa = params.getString("sign");
params.remove("sign"); params.remove("sign");
params = JSONObject.parseObject(JSON.toJSONString(params), Feature.OrderedField); params = JSON.parseObject(JSON.toJSONString(params), Feature.OrderedField);
boolean checkSign = SignUtils.validSign(params.toJSONString(), signa, svcInfo.getString("channel_pub_key")); boolean checkSign = SignUtils.validSign(params.toJSONString(), signa, svcInfo.getString("channel_pub_key"));
if (!checkSign) { if (!checkSign) {
throw new BadRequestException("sign is wrong"); throw new BadRequestException("sign is wrong");
} }
String clientMoniker = decData(params.getString("partnerCode"), key, svcInfo.getString("platform_pri_key")); String clientMoniker = decData(params.getString("partnerCode"), key, svcInfo.getString("platform_pri_key"));
logger.debug("{} new shop set up :{}", clientMoniker,params.toJSONString()); logger.debug("{} new shop set up :{}", clientMoniker, params.toJSONString());
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
@ -184,7 +184,7 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
clientConfigMapper.update(clientConfig); clientConfigMapper.update(clientConfig);
result.put("result_status", "SUCCESS"); result.put("result_status", "SUCCESS");
} catch (Exception e) { } catch (Exception e) {
logger.error("set up geek shop fail:{} - {}",sourceCode,e.getMessage()); logger.error("set up geek shop fail:{} - {}", sourceCode, e.getMessage());
result.put("result_status", "SYSTEMERROR"); result.put("result_status", "SYSTEMERROR");
result.put("result_msg", e.getMessage()); result.put("result_msg", e.getMessage());
} }
@ -203,13 +203,13 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
Key key = AESCrypt.fromKeyString(Base64.decodeBase64(params.getString("nonce_str"))); Key key = AESCrypt.fromKeyString(Base64.decodeBase64(params.getString("nonce_str")));
String signa = params.getString("sign"); String signa = params.getString("sign");
params.remove("sign"); params.remove("sign");
params = JSONObject.parseObject(JSON.toJSONString(params), Feature.OrderedField); params = JSON.parseObject(JSON.toJSONString(params), Feature.OrderedField);
boolean checkSign = SignUtils.validSign(params.toJSONString(), signa, svcInfo.getString("channel_pub_key")); boolean checkSign = SignUtils.validSign(params.toJSONString(), signa, svcInfo.getString("channel_pub_key"));
if (!checkSign) { if (!checkSign) {
throw new BadRequestException("sign is wrong"); throw new BadRequestException("sign is wrong");
} }
String clientMoniker = decData(params.getString("partnerCode"), key, svcInfo.getString("platform_pri_key")); String clientMoniker = decData(params.getString("partnerCode"), key, svcInfo.getString("platform_pri_key"));
logger.debug("geek {} app notify info :{}", clientMoniker,params.toJSONString()); logger.debug("geek {} app notify info :{}", clientMoniker, params.toJSONString());
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
@ -220,7 +220,7 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
sendRServiceNotifyMessage(client, title, body, url); sendRServiceNotifyMessage(client, title, body, url);
result.put("result_status", "SUCCESS"); result.put("result_status", "SUCCESS");
} catch (Exception e) { } catch (Exception e) {
logger.error("geek notify app fail:{} - {}",sourceCode,e.getMessage()); logger.error("geek notify app fail:{} - {}", sourceCode, e.getMessage());
result.put("result_status", "SYSTEMERROR"); result.put("result_status", "SYSTEMERROR");
result.put("result_msg", e.getMessage()); result.put("result_msg", e.getMessage());
} }
@ -241,15 +241,13 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
result.put("partnerCode", encData(clientMoniker, key, svcInfo.getString("channel_pub_key"))); result.put("partnerCode", encData(clientMoniker, key, svcInfo.getString("channel_pub_key")));
result.put("nonce_str", aesKeyStr); result.put("nonce_str", aesKeyStr);
result.put("timestamp", System.currentTimeMillis()); result.put("timestamp", System.currentTimeMillis());
result = JSONObject.parseObject(JSON.toJSONString(result), Feature.OrderedField); result = JSON.parseObject(JSON.toJSONString(result), Feature.OrderedField);
result.put("sign", SignUtils.buildSign(result.toJSONString(), svcInfo.getString("platform_pri_key"))); result.put("sign", SignUtils.buildSign(result.toJSONString(), svcInfo.getString("platform_pri_key")));
String encryptedStrInfo = JSON.toJSONString(result); String encryptedStrInfo = JSON.toJSONString(result);
String jwtResult = JWTUtil.sign(encryptedStrInfo, JWTUtil.SECRET); String jwtResult = JWTUtil.sign(encryptedStrInfo, JWTUtil.SECRET);
logger.info("clientMoniker:{} - json:{} - token:{}", clientMoniker, encryptedStrInfo, jwtResult); logger.info("clientMoniker:{} - json:{} - token:{}", clientMoniker, encryptedStrInfo, jwtResult);
return new JSONObject() {{ return JsonHelper.newJson(json -> json.put("token", jwtResult));
put("token", jwtResult);
}};
} }
private void sendRServiceNotifyMessage(JSONObject client, String title, String body, String url) { private void sendRServiceNotifyMessage(JSONObject client, String title, String body, String url) {
@ -285,7 +283,7 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
log.put("status", 2); log.put("status", 2);
appMessageLogMapper.update(log); appMessageLogMapper.update(log);
} catch (Exception e) { } catch (Exception e) {
logger.error("出错了:" + e.getMessage()); logger.error("出错了:{}", e.getMessage());
appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage()); appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage());
} }
}; };

@ -6,16 +6,14 @@ import au.com.royalpay.payment.manage.signin.core.SignInStatusManager;
import au.com.royalpay.payment.manage.signin.events.ClientLoginEvent; import au.com.royalpay.payment.manage.signin.events.ClientLoginEvent;
import au.com.royalpay.payment.tools.env.RequestEnvironment; import au.com.royalpay.payment.tools.env.RequestEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.utils.JsonHelper;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware; import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import au.com.royalpay.payment.manage.permission.utils.GeekLoginDESUtil;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
@ -58,14 +56,14 @@ public class RetailClientController implements ApplicationEventPublisherAware {
JSONObject response = new JSONObject(); JSONObject response = new JSONObject();
response.put("status", "SUCCESS"); response.put("status", "SUCCESS");
JSONObject industryInfo = clientManager.findByLookupCode(clientAllInfo.getString("industry")); JSONObject industryInfo = clientManager.findByLookupCode(clientAllInfo.getString("industry"));
response.put("clientInfo", new JSONObject() {{ response.put("clientInfo", JsonHelper.newJson(json -> {
put("partner_code", clientAllInfo.getString("client_moniker")); json.put("partner_code", clientAllInfo.getString("client_moniker"));
put("company_name", clientAllInfo.getString("company_name")); json.put("company_name", clientAllInfo.getString("company_name"));
put("logo", clientAllInfo.getString("client_moniker")); json.put("logo", clientAllInfo.getString("client_moniker"));
put("gateway_credential", clientAllInfo.getString("credential_code")); json.put("gateway_credential", clientAllInfo.getString("credential_code"));
put("industry_code", clientAllInfo.getString("industry")); json.put("industry_code", clientAllInfo.getString("industry"));
put("industry_value", industryInfo.getString("lookup_value")); json.put("industry_value", industryInfo.getString("lookup_value"));
}}); }));
return response; return response;
} }

@ -276,7 +276,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
nation_code = "+" + nation_code; nation_code = "+" + nation_code;
} }
List<JSONObject> account = clientAccountMapper.findByPhone(contact_phone, nation_code); List<JSONObject> account = clientAccountMapper.findByPhone(contact_phone, nation_code);
if (account != null && account.size()>0) { if (account != null && !account.isEmpty()) {
throw new ForbiddenException("用户名已被注册"); throw new ForbiddenException("用户名已被注册");
} }
} }
@ -330,7 +330,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
apply.put("clean", "T+" + clean_days.trim()); apply.put("clean", "T+" + clean_days.trim());
apply.put("clean_days", clean_days); apply.put("clean_days", clean_days);
JSONObject sysConfig = sysConfigManager.getSysConfig(); JSONObject sysConfig = sysConfigManager.getSysConfig();
JSONObject test = JSONObject.parseObject(sysConfig.getString("sys_apply_rates")); JSONObject test = JSON.parseObject(sysConfig.getString("sys_apply_rates"));
JSONObject rate = test.getJSONObject("t"+clean_days.trim()); JSONObject rate = test.getJSONObject("t"+clean_days.trim());
@ -498,8 +498,8 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
apply.put("clean", "T+" + clean_days.trim()); apply.put("clean", "T+" + clean_days.trim());
apply.put("clean_days", clean_days); apply.put("clean_days", clean_days);
JSONObject sysConfig = sysConfigManager.getSysConfig(); JSONObject sysConfig = sysConfigManager.getSysConfig();
JSONObject test = JSONObject.parseObject(sysConfig.getString("sys_apply_rates")); JSONObject test = JSON.parseObject(sysConfig.getString("sys_apply_rates"));
JSONObject rate = test.getJSONObject("t"+clean_days.trim()); JSONObject rate = test.getJSONObject("t" + clean_days.trim());
apply.put("wechat_rate",rate.getString("Wechat")); apply.put("wechat_rate",rate.getString("Wechat"));
apply.put("alipay_rate",rate.getString("Alipay")); apply.put("alipay_rate",rate.getString("Alipay"));
apply.put("alipay_online_rate",rate.getString("AlipayOnline")); apply.put("alipay_online_rate",rate.getString("AlipayOnline"));
@ -590,7 +590,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
JSONObject apply = sysClientPreMapperMapper.findByUserName(username); JSONObject apply = sysClientPreMapperMapper.findByUserName(username);
List<JSONObject> account = clientAccountMapper.findByPhone(apply.getString("contact_phone"), "+61"); List<JSONObject> account = clientAccountMapper.findByPhone(apply.getString("contact_phone"), "+61");
if (account != null && account.size() > 0) { if (account != null && !account.isEmpty()) {
throw new ForbiddenException("The user name has been registered"); throw new ForbiddenException("The user name has been registered");
} }
String clientMoniker = generateClientMoniker(); String clientMoniker = generateClientMoniker();
@ -739,7 +739,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
sysRate.put("active_time", DateFormatUtils.format(DateUtils.addDays(new Date(),-1), "yyyy-MM-dd")); sysRate.put("active_time", DateFormatUtils.format(DateUtils.addDays(new Date(),-1), "yyyy-MM-dd"));
sysRate.put("expiry_time", DateFormatUtils.format(DateUtils.addYears(new Date(), 1), "yyyy-MM-dd")); sysRate.put("expiry_time", DateFormatUtils.format(DateUtils.addYears(new Date(), 1), "yyyy-MM-dd"));
JSONObject rateConfig = JSONObject.parseObject(sysConfig.getString("sys_apply_rates")); JSONObject rateConfig = JSON.parseObject(sysConfig.getString("sys_apply_rates"));
JSONObject chooseRate = new JSONObject(); JSONObject chooseRate = new JSONObject();
if (apply.getIntValue("clean_days") == 1) { if (apply.getIntValue("clean_days") == 1) {
chooseRate = rateConfig.getJSONObject("t1"); chooseRate = rateConfig.getJSONObject("t1");

@ -6,6 +6,7 @@ import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient; import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient;
import au.com.royalpay.payment.tools.env.RequestEnvironment; import au.com.royalpay.payment.tools.env.RequestEnvironment;
import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.env.SysConfigManager;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -111,7 +112,7 @@ public class SimpleClientApplyController {
@GetMapping("/config/sys_rates") @GetMapping("/config/sys_rates")
public JSONObject getSysRate() { public JSONObject getSysRate() {
JSONObject sysConfig = sysConfigManager.getSysConfig(); JSONObject sysConfig = sysConfigManager.getSysConfig();
return JSONObject.parseObject(sysConfig.getString("sys_apply_rates")); return JSON.parseObject(sysConfig.getString("sys_apply_rates"));
} }
@GetMapping("/config/sys_rates_register") @GetMapping("/config/sys_rates_register")

@ -10,13 +10,12 @@ import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.lock.Locker; import au.com.royalpay.payment.tools.lock.Locker;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.maxmind.geoip.LookupService; import com.maxmind.geoip.LookupService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
import org.joda.time.DateTime; import org.joda.time.DateTime;
@ -28,12 +27,11 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.annotation.Resource;
/** /**
* Created by wangning on 2017/12/28. * Created by wangning on 2017/12/28.
*/ */
@ -137,7 +135,7 @@ public class CustomerImpressionServiceImpl implements CustomerImpressionService
while (!StringUtils.isEmpty(redisValue)) { while (!StringUtils.isEmpty(redisValue)) {
try { try {
JSONObject order = JSONObject.parseObject(redisValue); JSONObject order = JSON.parseObject(redisValue);
redisValue = ops.leftPop(); redisValue = ops.leftPop();
if (StringUtils.isEmpty(order.getString("channel"))) { if (StringUtils.isEmpty(order.getString("channel"))) {
continue; continue;

@ -1,6 +1,7 @@
package au.com.royalpay.payment.manage.apps.core.impls; package au.com.royalpay.payment.manage.apps.core.impls;
import au.com.royalpay.payment.manage.apps.core.SSOSupport; import au.com.royalpay.payment.manage.apps.core.SSOSupport;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -48,7 +49,7 @@ public class SSOSupportImpl implements SSOSupport {
String jsonstr = stringRedisTemplate.boundValueOps(cacheKey).get(); String jsonstr = stringRedisTemplate.boundValueOps(cacheKey).get();
stringRedisTemplate.delete(cacheKey); stringRedisTemplate.delete(cacheKey);
if (jsonstr != null) { if (jsonstr != null) {
JSONObject referer = JSONObject.parseObject(jsonstr); JSONObject referer = JSON.parseObject(jsonstr);
return new RefererInfo(referer.getString("referer"), referer.getString("appid")); return new RefererInfo(referer.getString("referer"), referer.getString("appid"));
} }
return null; return null;
@ -74,7 +75,7 @@ public class SSOSupportImpl implements SSOSupport {
String jsonstr = stringRedisTemplate.boundValueOps(cacheKey).get(); String jsonstr = stringRedisTemplate.boundValueOps(cacheKey).get();
stringRedisTemplate.delete(cacheKey); stringRedisTemplate.delete(cacheKey);
if (jsonstr != null) { if (jsonstr != null) {
return JSONObject.parseObject(jsonstr); return JSON.parseObject(jsonstr);
} }
return null; return null;
} }

@ -3,17 +3,14 @@ package au.com.royalpay.payment.manage.apps.events.listeners.ctrip;
import au.com.royalpay.payment.core.events.AfterPaymentFinishEvent; import au.com.royalpay.payment.core.events.AfterPaymentFinishEvent;
import au.com.royalpay.payment.manage.customers.core.CouponValidateService; import au.com.royalpay.payment.manage.customers.core.CouponValidateService;
import au.com.royalpay.payment.manage.mappers.log.CouponAccuessLogMapper; import au.com.royalpay.payment.manage.mappers.log.CouponAccuessLogMapper;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener; import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
/** /**
* Created by wangning on 17/01/2018. * Created by wangning on 17/01/2018.
@ -31,10 +28,10 @@ public class CtripAfterPaymentFinishListener implements ApplicationListener<Afte
JSONObject order = event.getFinishedEvent().getOrder(); JSONObject order = event.getFinishedEvent().getOrder();
String orderId = order.getString("order_id"); String orderId = order.getString("order_id");
List<JSONObject> accuessCouponLogs = couponAccuessLogMapper.findCouponByOrderId(orderId); List<JSONObject> accuessCouponLogs = couponAccuessLogMapper.findCouponByOrderId(orderId);
if (accuessCouponLogs != null&&accuessCouponLogs.size()>0) { if (accuessCouponLogs != null && !accuessCouponLogs.isEmpty()) {
JSONObject accuessCouponLog = accuessCouponLogs.get(0); JSONObject accuessCouponLog = accuessCouponLogs.get(0);
String couponId = accuessCouponLog.getString("coupon_id"); String couponId = accuessCouponLog.getString("coupon_id");
couponValidateService.ctripCouponLogNotice(couponId,orderId,order.getString("customer_id"),order.getString("status")); couponValidateService.ctripCouponLogNotice(couponId, orderId, order.getString("customer_id"), order.getString("status"));
logger.info("订单 [" + orderId + "]推送支付成功Ctrip卡券=======>[" + couponId + "]"); logger.info("订单 [" + orderId + "]推送支付成功Ctrip卡券=======>[" + couponId + "]");
} }
} }

@ -4,17 +4,14 @@ import au.com.royalpay.payment.core.events.RefundFinishedEvent;
import au.com.royalpay.payment.manage.customers.core.CouponValidateService; import au.com.royalpay.payment.manage.customers.core.CouponValidateService;
import au.com.royalpay.payment.manage.mappers.log.CouponAccuessLogMapper; import au.com.royalpay.payment.manage.mappers.log.CouponAccuessLogMapper;
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener; import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
/** /**
* @author kira * @author kira
@ -35,10 +32,10 @@ public class CtripRefundFinishedEventListener implements ApplicationListener<Ref
JSONObject order = orderMapper.find(refund.getString("order_id")); JSONObject order = orderMapper.find(refund.getString("order_id"));
String orderId = order.getString("order_id"); String orderId = order.getString("order_id");
List<JSONObject> accuessCouponLogs = couponAccuessLogMapper.findCouponByOrderId(orderId); List<JSONObject> accuessCouponLogs = couponAccuessLogMapper.findCouponByOrderId(orderId);
if (accuessCouponLogs != null&&accuessCouponLogs.size()>0) { if (accuessCouponLogs != null && !accuessCouponLogs.isEmpty()) {
JSONObject accuessCouponLog = accuessCouponLogs.get(0); JSONObject accuessCouponLog = accuessCouponLogs.get(0);
String couponId = accuessCouponLog.getString("coupon_id"); String couponId = accuessCouponLog.getString("coupon_id");
couponValidateService.ctripCouponLogNotice(couponId,orderId,order.getString("customer_id"),order.getString("status")); couponValidateService.ctripCouponLogNotice(couponId, orderId, order.getString("customer_id"), order.getString("status"));
logger.info("订单 [" + orderId + "]推送退款成功Ctrip卡券=======>[" + couponId + "]"); logger.info("订单 [" + orderId + "]推送退款成功Ctrip卡券=======>[" + couponId + "]");
} }
} }

@ -39,6 +39,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@ -155,7 +156,7 @@ public class BDPrizeServiceImpl implements BDPrizeService {
JSONObject rateJson = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, groupAmount.toString(), bd_type); JSONObject rateJson = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, groupAmount.toString(), bd_type);
BigDecimal groupPrize = new BigDecimal(0); BigDecimal groupPrize = new BigDecimal(0);
if (rateJson != null) { if (rateJson != null) {
groupPrize = groupAmount.multiply(new BigDecimal(rateJson.getString("commission_rate")).divide(percent)).setScale(2, BigDecimal.ROUND_DOWN); groupPrize = groupAmount.multiply(new BigDecimal(rateJson.getString("commission_rate")).divide(percent)).setScale(2, RoundingMode.DOWN);
} }
BigDecimal send_prize = groupPrize; BigDecimal send_prize = groupPrize;
JSONObject prizeLog = new JSONObject(); JSONObject prizeLog = new JSONObject();
@ -236,12 +237,12 @@ public class BDPrizeServiceImpl implements BDPrizeService {
// } else { // } else {
// BigDecimal _commission_rate = new BigDecimal(cplRate.getString("commission_rate")); // BigDecimal _commission_rate = new BigDecimal(cplRate.getString("commission_rate"));
// BigDecimal _total_amount = new BigDecimal(cityPrizeLog.getString("total_amount")); // BigDecimal _total_amount = new BigDecimal(cityPrizeLog.getString("total_amount"));
// BigDecimal total_prize = _total_amount.multiply(_commission_rate.divide(percent)).setScale(2, BigDecimal.ROUND_DOWN); // BigDecimal total_prize = _total_amount.multiply(_commission_rate.divide(percent)).setScale(2, RoundingMode.DOWN);
// cityPrizeLog.put("total_prize", total_prize); // cityPrizeLog.put("total_prize", total_prize);
// } // }
// report.put("cityPrizeLogs", cityPrizeLog); // report.put("cityPrizeLogs", cityPrizeLog);
List<JSONObject> leaderPrizeLog = financialLeaderPrizeLogMapper.listLeaderPrizeLog(report.getString("record_id")); List<JSONObject> leaderPrizeLog = financialLeaderPrizeLogMapper.listLeaderPrizeLog(report.getString("record_id"));
if (leaderPrizeLog.size() > 0) { if (!leaderPrizeLog.isEmpty()) {
for (JSONObject prizeLog : leaderPrizeLog) { for (JSONObject prizeLog : leaderPrizeLog) {
if (prizeLog.getIntValue("bd_type") == 3) { if (prizeLog.getIntValue("bd_type") == 3) {
report.put("sydneyPrizeLog", prizeLog); report.put("sydneyPrizeLog", prizeLog);
@ -270,7 +271,7 @@ public class BDPrizeServiceImpl implements BDPrizeService {
sydneyPrizeLog.put("total_prize", 0.00); sydneyPrizeLog.put("total_prize", 0.00);
} else { } else {
BigDecimal sydney_commission_rate = new BigDecimal(sydneyGMRate.getString("commission_rate")); BigDecimal sydney_commission_rate = new BigDecimal(sydneyGMRate.getString("commission_rate"));
BigDecimal total_prize = sydneyAmount.multiply(sydney_commission_rate.divide(percent)).setScale(2, BigDecimal.ROUND_DOWN); BigDecimal total_prize = sydneyAmount.multiply(sydney_commission_rate.divide(percent)).setScale(2, RoundingMode.DOWN);
sydneyPrizeLog.put("total_prize", total_prize); sydneyPrizeLog.put("total_prize", total_prize);
} }
report.put("sydneyPrizeLog", sydneyPrizeLog); report.put("sydneyPrizeLog", sydneyPrizeLog);
@ -292,7 +293,7 @@ public class BDPrizeServiceImpl implements BDPrizeService {
} else { } else {
BigDecimal _commission_rate = new BigDecimal(rate.getString("commission_rate")); BigDecimal _commission_rate = new BigDecimal(rate.getString("commission_rate"));
BigDecimal _total_amount = new BigDecimal(directPrizeLogs.getString("total_amount")); BigDecimal _total_amount = new BigDecimal(directPrizeLogs.getString("total_amount"));
BigDecimal total_prize = _total_amount.multiply(_commission_rate.divide(percent)).setScale(2, BigDecimal.ROUND_DOWN); BigDecimal total_prize = _total_amount.multiply(_commission_rate.divide(percent)).setScale(2, RoundingMode.DOWN);
directPrizeLogs.put("total_prize", total_prize); directPrizeLogs.put("total_prize", total_prize);
} }
report.put("directPrizeLogs", directPrizeLogs); report.put("directPrizeLogs", directPrizeLogs);
@ -306,7 +307,7 @@ public class BDPrizeServiceImpl implements BDPrizeService {
ngDepartmentPrizeLog.put("total_prize", 0.00); ngDepartmentPrizeLog.put("total_prize", 0.00);
} else { } else {
BigDecimal ng_commission_rate = new BigDecimal(ngRate.getString("commission_rate")); BigDecimal ng_commission_rate = new BigDecimal(ngRate.getString("commission_rate"));
BigDecimal ng_total_prize = totalprize.multiply(ng_commission_rate.divide(percent)).setScale(2, BigDecimal.ROUND_DOWN); BigDecimal ng_total_prize = totalprize.multiply(ng_commission_rate.divide(percent)).setScale(2, RoundingMode.DOWN);
ngDepartmentPrizeLog.put("total_prize", ng_total_prize); ngDepartmentPrizeLog.put("total_prize", ng_total_prize);
} }
report.put("ngDepartmentPrizeLog", ngDepartmentPrizeLog); report.put("ngDepartmentPrizeLog", ngDepartmentPrizeLog);

@ -1,23 +1,17 @@
package au.com.royalpay.payment.manage.bdprize.support.impls; package au.com.royalpay.payment.manage.bdprize.support.impls;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import com.alibaba.fastjson.JSONObject;
import au.com.royalpay.payment.manage.bdprize.support.BDPrizeCalculator; import au.com.royalpay.payment.manage.bdprize.support.BDPrizeCalculator;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper; import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException; import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
/** /**
* Created by yixian on 2017-02-08. * Created by yixian on 2017-02-08.
*/ */
@ -107,24 +101,24 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator {
int prizeLevel = getKpiPrizeLevel(totalAmount,log.getBigDecimal("kpi_amount")); int prizeLevel = getKpiPrizeLevel(totalAmount,log.getBigDecimal("kpi_amount"));
logger.debug("-------->bd kpi level:"+bd.getString("bd_name")+"---level:"+prizeLevel+",kpi:"+log.getBigDecimal("kpi_amount")+",trans:"+totalAmount+",client_id:"+clientId); logger.debug("-------->bd kpi level:"+bd.getString("bd_name")+"---level:"+prizeLevel+",kpi:"+log.getBigDecimal("kpi_amount")+",trans:"+totalAmount+",client_id:"+clientId);
BigDecimal bdRate = getNewRate(bdLevel, prizeLevel, detailItem.getIntValue("client_source"), detailItem.getBigDecimal("rate_value")); BigDecimal bdRate = getNewRate(bdLevel, prizeLevel, detailItem.getIntValue("client_source"), detailItem.getBigDecimal("rate_value"));
BigDecimal prizeValue = totalTransaction.multiply(coefficient).multiply(bdRate).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_DOWN); BigDecimal prizeValue = totalTransaction.multiply(coefficient).multiply(bdRate).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN);
BigDecimal donation = BigDecimal.ZERO; BigDecimal donation = BigDecimal.ZERO;
if (clientsWithBDAwayDeterminor.clientWithBDAway(clientId, month)) { if (clientsWithBDAwayDeterminor.clientWithBDAway(clientId, month)) {
prizeValue = prizeValue.multiply(BigDecimal.valueOf(0.5)).setScale(2, BigDecimal.ROUND_DOWN); prizeValue = prizeValue.multiply(BigDecimal.valueOf(0.5)).setScale(2, RoundingMode.DOWN);
donation = new BigDecimal(prizeValue.toPlainString()).setScale(2, BigDecimal.ROUND_DOWN); donation = new BigDecimal(prizeValue.toPlainString()).setScale(2, RoundingMode.DOWN);
detailItem.put("client_status", 2); detailItem.put("client_status", 2);
} }
detailItem.put("prize_value", prizeValue); detailItem.put("prize_value", prizeValue);
detailItem.put("donation", donation); detailItem.put("donation", donation);
detailItem.put("bd_rate", bdRate); detailItem.put("bd_rate", bdRate);
details.add(detailItem); details.add(detailItem);
log.put("total_amount", log.getBigDecimal("total_amount").add(totalTransaction.multiply(coefficient)).setScale(2, BigDecimal.ROUND_DOWN)); log.put("total_amount", log.getBigDecimal("total_amount").add(totalTransaction.multiply(coefficient)).setScale(2, RoundingMode.DOWN));
log.put("total_prize", log.getBigDecimal("total_prize").add(prizeValue)); log.put("total_prize", log.getBigDecimal("total_prize").add(prizeValue));
log.put("total_donation", log.getBigDecimal("total_donation").add(donation)); log.put("total_donation", log.getBigDecimal("total_donation").add(donation));
} }
log.put("details", details); log.put("details", details);
BigDecimal totalPrize = log.getBigDecimal("total_prize"); BigDecimal totalPrize = log.getBigDecimal("total_prize");
BigDecimal sendPrize = totalPrize.multiply(BigDecimal.valueOf(0.8)).setScale(2, BigDecimal.ROUND_DOWN); BigDecimal sendPrize = totalPrize.multiply(BigDecimal.valueOf(0.8)).setScale(2, RoundingMode.DOWN);
log.put("send_prize", sendPrize); log.put("send_prize", sendPrize);
log.put("hold_prize", totalPrize.subtract(sendPrize)); log.put("hold_prize", totalPrize.subtract(sendPrize));
report.add(log); report.add(log);
@ -237,7 +231,7 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator {
if (clientSource == 1) { if (clientSource == 1) {
return prizeRate; return prizeRate;
} else { } else {
return prizeRate.divide(BigDecimal.valueOf(2),3,BigDecimal.ROUND_HALF_DOWN); return prizeRate.divide(BigDecimal.valueOf(2), 3, RoundingMode.HALF_DOWN);
} }
} }
@ -245,7 +239,7 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator {
if (kpiAmount.compareTo(BigDecimal.ZERO)==0){//未设置kpi金额的按照最小完成度来计算 if (kpiAmount.compareTo(BigDecimal.ZERO)==0){//未设置kpi金额的按照最小完成度来计算
return 1; return 1;
} }
BigDecimal rate = transactionAmount.divide(kpiAmount,2,BigDecimal.ROUND_HALF_DOWN); BigDecimal rate = transactionAmount.divide(kpiAmount, 2, RoundingMode.HALF_DOWN);
if (rate.compareTo(BigDecimal.valueOf(0.5))<0){ if (rate.compareTo(BigDecimal.valueOf(0.5))<0){
return 1; return 1;
} }

@ -1,17 +1,5 @@
package au.com.royalpay.payment.manage.bill.core.impl; package au.com.royalpay.payment.manage.bill.core.impl;
import java.math.BigDecimal;
import java.util.Date;
import javax.annotation.Resource;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import au.com.royalpay.payment.manage.bill.bean.NewBillBean; import au.com.royalpay.payment.manage.bill.bean.NewBillBean;
import au.com.royalpay.payment.manage.bill.bean.QueryBillBean; import au.com.royalpay.payment.manage.bill.bean.QueryBillBean;
import au.com.royalpay.payment.manage.bill.core.BillService; import au.com.royalpay.payment.manage.bill.core.BillService;
@ -22,6 +10,15 @@ import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException; import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.RoundingMode;
import java.util.Date;
/** /**
* Created by wangning on 11/02/2018. * Created by wangning on 11/02/2018.
@ -42,7 +39,7 @@ public class BillServiceImpl implements BillService {
Date now = new Date(); Date now = new Date();
JSONObject record = new JSONObject(); JSONObject record = new JSONObject();
record.put("client_id", client_id); record.put("client_id", client_id);
record.put("price", newBillBean.getAmount().divide(CommonConsts.HUNDRED,2, BigDecimal.ROUND_DOWN)); record.put("price", newBillBean.getAmount().divide(CommonConsts.HUNDRED, 2, RoundingMode.DOWN));
record.put("currency", newBillBean.getCurrency()); record.put("currency", newBillBean.getCurrency());
record.put("remark", newBillBean.getRemark()); record.put("remark", newBillBean.getRemark());
record.put("create_time", now); record.put("create_time", now);

@ -23,7 +23,7 @@ import org.springframework.ui.Model;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.RoundingMode;
import java.util.Date; import java.util.Date;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -141,7 +141,7 @@ public class CashierServiceImp implements CashierService {
@Override @Override
public void prepareModalMap(JSONObject client, JSONObject cashier, String channel, Model modelMap) { public void prepareModalMap(JSONObject client, JSONObject cashier, String channel, Model modelMap) {
PaymentChannelApi api = paymentApi.channelApi(channel); PaymentChannelApi api = paymentApi.channelApi(channel);
String exchangeRate = api.queryExchangeRateDecimal(client.getIntValue("client_id")).setScale(5, BigDecimal.ROUND_DOWN).toPlainString(); String exchangeRate = api.queryExchangeRateDecimal(client.getIntValue("client_id")).setScale(5, RoundingMode.DOWN).toPlainString();
modelMap.addAttribute("exchange_rate", exchangeRate); modelMap.addAttribute("exchange_rate", exchangeRate);
modelMap.addAttribute("channel", channel); modelMap.addAttribute("channel", channel);

@ -345,7 +345,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
int month = monthCal.get(Calendar.MONTH) + 1; int month = monthCal.get(Calendar.MONTH) + 1;
List<JSONObject> list = financialPartnerCommissionMapper.list(year, month); List<JSONObject> list = financialPartnerCommissionMapper.list(year, month);
if (list != null && list.size() > 0) { if (list != null && !list.isEmpty()) {
throw new ServerErrorException("请不要重复生成合伙人记录"); throw new ServerErrorException("请不要重复生成合伙人记录");
} }
@ -630,13 +630,13 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
BigDecimal thirdPartyPaymentCharge = BigDecimal.ZERO; BigDecimal thirdPartyPaymentCharge = BigDecimal.ZERO;
switch (channel) { switch (channel) {
case "Alipay": case "Alipay":
thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("alipayChargeRate").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).setScale(2, RoundingMode.HALF_UP); thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("alipayChargeRate").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)).setScale(2, RoundingMode.HALF_UP);
break; break;
case "Wechat": case "Wechat":
thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("wechatChargeRate").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).setScale(2, RoundingMode.HALF_UP); thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("wechatChargeRate").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)).setScale(2, RoundingMode.HALF_UP);
break; break;
case "AlipayOnline": case "AlipayOnline":
thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("alipayonlineChargeRate").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).setScale(2, RoundingMode.HALF_UP); thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("alipayonlineChargeRate").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)).setScale(2, RoundingMode.HALF_UP);
break; break;
default: default:
break; break;
@ -1145,7 +1145,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
} }
BigDecimal finalRate = rate; BigDecimal finalRate = rate;
result.parallelStream().forEach(p -> { result.parallelStream().forEach(p -> {
p.put("net_charge", p.getBigDecimal("gross_amount").multiply(finalRate).setScale(2, BigDecimal.ROUND_HALF_DOWN)); p.put("net_charge", p.getBigDecimal("gross_amount").multiply(finalRate).setScale(2, RoundingMode.HALF_DOWN));
p.put("org_rate", finalRate.multiply(CommonConsts.HUNDRED)); p.put("org_rate", finalRate.multiply(CommonConsts.HUNDRED));
}); });
return result; return result;

@ -60,7 +60,7 @@ public class ClientComplianceApplyImpl implements ClientComplianceApply
} }
List<JSONObject> clientFiles = clientFilesMapper.findAllClientFile(client.getIntValue("client_id")); List<JSONObject> clientFiles = clientFilesMapper.findAllClientFile(client.getIntValue("client_id"));
JSONObject fileJson = new JSONObject(); JSONObject fileJson = new JSONObject();
if (clientFiles != null && clientFiles.size() > 0) { if (clientFiles != null && !clientFiles.isEmpty()) {
for (String fileKey : fileKeys) { for (String fileKey : fileKeys) {
List<JSONObject> clientFileUrl = clientFiles.stream() List<JSONObject> clientFileUrl = clientFiles.stream()
.filter(json -> (fileKey.equals(json.getString("file_name")))) .filter(json -> (fileKey.equals(json.getString("file_name"))))
@ -73,7 +73,7 @@ public class ClientComplianceApplyImpl implements ClientComplianceApply
return params; return params;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
if (clientFileUrl != null && clientFileUrl.size() > 0) { if (clientFileUrl != null && !clientFileUrl.isEmpty()) {
fileJson.put(fileKey, clientFileUrl); fileJson.put(fileKey, clientFileUrl);
} }
} }

@ -7,9 +7,9 @@ import au.com.royalpay.payment.manage.mappers.system.CustomerMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.apache.http.NameValuePair; import org.apache.http.NameValuePair;
@ -21,15 +21,11 @@ import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.util.UriComponentsBuilder; import org.springframework.web.util.UriComponentsBuilder;
import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.annotation.Resource;
import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult;
/** /**
* Created by yuan on 2017/10/10. * Created by yuan on 2017/10/10.
@ -251,7 +247,7 @@ public class CouponValidateServiceImpl implements CouponValidateService {
} }
// 获取万圣节活动当天支付成功的订单 // 获取万圣节活动当天支付成功的订单
JSONObject result = null; JSONObject result = null;
if (orderList != null && orderList.size() > 0) { if (orderList != null && !orderList.isEmpty()) {
result = new JSONObject(); result = new JSONObject();
result.put("orderList", orderList); result.put("orderList", orderList);
for (JSONObject order : orderList) { for (JSONObject order : orderList) {

@ -21,12 +21,10 @@ import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
@ -37,13 +35,13 @@ import org.springframework.cache.annotation.Cacheable;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.annotation.Resource;
/** /**
* Created by yixian on 2017-04-24. * Created by yixian on 2017-04-24.
*/ */
@ -178,7 +176,7 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
} }
int rand = RandomUtils.nextInt(0, int rand = RandomUtils.nextInt(0,
config.getBigDecimal("max_amount").subtract(config.getBigDecimal("min_amount")).multiply(CommonConsts.HUNDRED).intValue()); config.getBigDecimal("max_amount").subtract(config.getBigDecimal("min_amount")).multiply(CommonConsts.HUNDRED).intValue());
BigDecimal amount = config.getBigDecimal("min_amount").add(BigDecimal.valueOf(rand).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_DOWN)); BigDecimal amount = config.getBigDecimal("min_amount").add(BigDecimal.valueOf(rand).divide(CommonConsts.HUNDRED, 2, RoundingMode.DOWN));
customerMembershipMapper.addEncourage(memberId, amount); customerMembershipMapper.addEncourage(memberId, amount);
JSONObject customer = customerMembershipMapper.findByMemberId(memberId); JSONObject customer = customerMembershipMapper.findByMemberId(memberId);
JSONObject accessLog = new JSONObject(); JSONObject accessLog = new JSONObject();
@ -219,8 +217,8 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
int critRate = config.getIntValue("crit_rate"); int critRate = config.getIntValue("crit_rate");
if (RandomUtils.nextInt(0, 100) < critRate) { if (RandomUtils.nextInt(0, 100) < critRate) {
int factorInt = RandomUtils.nextInt(0, config.getBigDecimal("max_crit").multiply(CommonConsts.HUNDRED).intValue() - 100); int factorInt = RandomUtils.nextInt(0, config.getBigDecimal("max_crit").multiply(CommonConsts.HUNDRED).intValue() - 100);
BigDecimal factor = BigDecimal.valueOf(factorInt + 100).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_DOWN); BigDecimal factor = BigDecimal.valueOf(factorInt + 100).divide(CommonConsts.HUNDRED, 2, RoundingMode.DOWN);
BigDecimal actural = log.getBigDecimal("access_amount").multiply(factor).setScale(2, BigDecimal.ROUND_DOWN); BigDecimal actural = log.getBigDecimal("access_amount").multiply(factor).setScale(2, RoundingMode.DOWN);
BigDecimal sub = actural.subtract(log.getBigDecimal("actural_amount")); BigDecimal sub = actural.subtract(log.getBigDecimal("actural_amount"));
customerMembershipMapper.addEncourage(log.getString("member_id"), sub); customerMembershipMapper.addEncourage(log.getString("member_id"), sub);
JSONObject customer = customerMembershipMapper.findByMemberId(log.getString("member_id")); JSONObject customer = customerMembershipMapper.findByMemberId(log.getString("member_id"));
@ -252,7 +250,7 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
if(use!=null){ if(use!=null){
balance = use.getBigDecimal("use_amount"); balance = use.getBigDecimal("use_amount");
} }
member.put("used_amount",balance.setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); member.put("used_amount", balance.setScale(2, RoundingMode.DOWN).toPlainString());
if (member != null) { if (member != null) {
status.put("member_info", member); status.put("member_info", member);
List<JSONObject> balanceLogs = customerMembershipMapper.listEncourageBalanceHistory(fromDate, toDate, member.getString("member_id")); List<JSONObject> balanceLogs = customerMembershipMapper.listEncourageBalanceHistory(fromDate, toDate, member.getString("member_id"));

@ -496,7 +496,7 @@ public class AliforexcelServiceImpl implements AliforexcelService {
clientConfig.put("client_id", partner.getIntValue("client_id")); clientConfig.put("client_id", partner.getIntValue("client_id"));
clientConfig.put("client_moniker", partner.getString("client_moniker")); clientConfig.put("client_moniker", partner.getString("client_moniker"));
List<Integer> gateways = orderMapper.listGatewayByClientId(partner.getIntValue("client_id")); List<Integer> gateways = orderMapper.listGatewayByClientId(partner.getIntValue("client_id"));
if (gateways.size() == 0) { if (gateways.isEmpty()) {
unOrdersPartner(partner, clientConfig); unOrdersPartner(partner, clientConfig);
continue; continue;
} }

@ -7,11 +7,11 @@ import au.com.royalpay.payment.manage.dev.listeners.WarningSenderHelper;
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper; import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi; import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider; import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage; import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
@ -23,6 +23,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*; import java.util.*;
@Component @Component
@ -87,7 +88,7 @@ public class PaymentAmountCheatMonitor implements CheatMonitor {
logger.debug("order count:" + cleaned.size() + " is less than min orders, skip"); logger.debug("order count:" + cleaned.size() + " is less than min orders, skip");
return; return;
} }
BigDecimal percentage = BigDecimal.valueOf(orderCount).multiply(CommonConsts.HUNDRED).divide(BigDecimal.valueOf(cleaned.size()), 2, BigDecimal.ROUND_DOWN); BigDecimal percentage = BigDecimal.valueOf(orderCount).multiply(CommonConsts.HUNDRED).divide(BigDecimal.valueOf(cleaned.size()), 2, RoundingMode.DOWN);
if (percentage.compareTo(sysConfig.getBigDecimal("cheat_monitor.warning_rate")) > 0) { if (percentage.compareTo(sysConfig.getBigDecimal("cheat_monitor.warning_rate")) > 0) {
JSONObject client = clientMapper.findClient(order.getIntValue("client_id")); JSONObject client = clientMapper.findClient(order.getIntValue("client_id"));
String clientMoniker = client.getString("client_moniker"); String clientMoniker = client.getString("client_moniker");

@ -53,8 +53,8 @@ import org.joda.time.DateTime;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.ui.Model;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.ui.Model;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.validation.Errors; import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -67,7 +67,7 @@ import javax.validation.Valid;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.RoundingMode;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -157,7 +157,7 @@ public class TestController {
if (rate == null) { if (rate == null) {
throw new BadRequestException("The Partner's Rate is not config!"); throw new BadRequestException("The Partner's Rate is not config!");
} }
client.put("rate_value", rate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("rate_value", rate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
client.put("clean", "T+" + rate.getString("clean_days")); client.put("clean", "T+" + rate.getString("clean_days"));
client.put("clean_days", rate.getString("clean_days")); client.put("clean_days", rate.getString("clean_days"));
JSONObject account = getBankAccountByClientId(client.getIntValue("client_id")); JSONObject account = getBankAccountByClientId(client.getIntValue("client_id"));
@ -209,18 +209,18 @@ public class TestController {
if (weChatRate == null) { if (weChatRate == null) {
throw new BadRequestException("The Partner's Rate is not config!"); throw new BadRequestException("The Partner's Rate is not config!");
} }
client.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
client.put("clean", "T+" + weChatRate.getString("clean_days")); client.put("clean", "T+" + weChatRate.getString("clean_days"));
client.put("clean_days", weChatRate.getString("clean_days")); client.put("clean_days", weChatRate.getString("clean_days"));
try { try {
JSONObject alipayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Alipay"); JSONObject alipayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Alipay");
if (alipayRate != null) { if (alipayRate != null) {
client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
} }
JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline"); JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline");
if (alipayOnlineRate != null) { if (alipayOnlineRate != null) {
client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
} }
} catch (Exception ignored) { } catch (Exception ignored) {
//do nothing //do nothing

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
/** /**
* Create by yixian at 2017-09-05 19:09 * Create by yixian at 2017-09-05 19:09
@ -35,9 +36,9 @@ public class XPlanFundConfig {
public static XPlanFundConfig fromSysConfig(JSONObject sysConfig) { public static XPlanFundConfig fromSysConfig(JSONObject sysConfig) {
XPlanFundConfig conf = new XPlanFundConfig(); XPlanFundConfig conf = new XPlanFundConfig();
conf.setInterestRate(sysConfig.getBigDecimal("fund.x-plan.interest-rate").setScale(4,BigDecimal.ROUND_DOWN)); conf.setInterestRate(sysConfig.getBigDecimal("fund.x-plan.interest-rate").setScale(4, RoundingMode.DOWN));
conf.setAutoJoin(sysConfig.getBooleanValue("fund.x-plan.auto-join-enabled")); conf.setAutoJoin(sysConfig.getBooleanValue("fund.x-plan.auto-join-enabled"));
conf.setMaxAmount(sysConfig.getBigDecimal("fund.x-plan.max-money").setScale(2,BigDecimal.ROUND_DOWN)); conf.setMaxAmount(sysConfig.getBigDecimal("fund.x-plan.max-money").setScale(2, RoundingMode.DOWN));
conf.setTradeRule(sysConfig.getString("fund.x-plan.trade-rule")); conf.setTradeRule(sysConfig.getString("fund.x-plan.trade-rule"));
conf.setWithdrawRule(sysConfig.getString("fund.x-plan.withdraw-rule")); conf.setWithdrawRule(sysConfig.getString("fund.x-plan.withdraw-rule"));
conf.setInterestRule(sysConfig.getString("fund.x-plan.interest-rule")); conf.setInterestRule(sysConfig.getString("fund.x-plan.interest-rule"));

@ -6,7 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.RoundingMode;
import java.util.List; import java.util.List;
/** /**
@ -25,7 +25,7 @@ public class FundsConfigServiceImpl implements FundsConfigService {
switch (conf.getIntValue("type_desc")) { switch (conf.getIntValue("type_desc")) {
case 1: case 1:
case 2: case 2:
conf.put("rate", conf.getBigDecimal("rate").setScale(2, BigDecimal.ROUND_DOWN).toPlainString() + "%"); conf.put("rate", conf.getBigDecimal("rate").setScale(2, RoundingMode.DOWN).toPlainString() + "%");
break; break;
} }
} }

@ -15,22 +15,19 @@ import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.annotation.Resource;
/** /**
* Create by yixian at 2017-09-14 17:33 * Create by yixian at 2017-09-14 17:33
*/ */
@ -114,7 +111,7 @@ public class XPlanFundConfigServiceImpl implements XPlanFundConfigService {
} }
public static BigDecimal calculateInterest(BigDecimal interestRate, BigDecimal amount) { public static BigDecimal calculateInterest(BigDecimal interestRate, BigDecimal amount) {
return amount.multiply(interestRate.divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).divide(BigDecimal.valueOf(365), 2, RoundingMode.HALF_UP); return amount.multiply(interestRate.divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)).divide(BigDecimal.valueOf(365), 2, RoundingMode.HALF_UP);
} }
private JSONObject getClient(String clientMoniker) { private JSONObject getClient(String clientMoniker) {

@ -6,6 +6,7 @@ import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
import au.com.royalpay.payment.core.exceptions.SignInvalidException; import au.com.royalpay.payment.core.exceptions.SignInvalidException;
import au.com.royalpay.payment.manage.mappers.system.OrgSignInfoMapper; import au.com.royalpay.payment.manage.mappers.system.OrgSignInfoMapper;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException; import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.serializer.SerializerFeature;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
@ -83,7 +84,7 @@ public class Gtw2SignAspect {
for (Object arg : requestArgs) { for (Object arg : requestArgs) {
try { try {
if (arg instanceof JSONObject) { if (arg instanceof JSONObject) {
requestBody = JSONObject.parseObject(arg.toString()); requestBody = JSON.parseObject(arg.toString());
} }
} catch (Exception e) { } catch (Exception e) {
throw new ParamInvalidException("Request Body", "error.payment.valid.invalid_param"); throw new ParamInvalidException("Request Body", "error.payment.valid.invalid_param");
@ -102,7 +103,7 @@ public class Gtw2SignAspect {
throw new SignInvalidException(); throw new SignInvalidException();
} }
Object result = pjp.proceed(); Object result = pjp.proceed();
JSONObject data = JSONObject.parseObject(result.toString()); JSONObject data = JSON.parseObject(result.toString());
return buildResponseData(pathVariables.get("shortId"), requestUrl, data); return buildResponseData(pathVariables.get("shortId"), requestUrl, data);
} }

@ -123,7 +123,7 @@ public class GatewayMerchantApplyImpl implements GatewayMerchantApply {
ClientAuthFilesInfo clientAuthFilesInfo = registerBean.insertClientComplianceInfo(); ClientAuthFilesInfo clientAuthFilesInfo = registerBean.insertClientComplianceInfo();
clientManager.uploadAuthFiles(manager, client.getString("client_moniker"), clientAuthFilesInfo); clientManager.uploadAuthFiles(manager, client.getString("client_moniker"), clientAuthFilesInfo);
JSONObject rateConfig = registerBean.insertClientRateInfo(JSONObject.parseObject(sysConfigManager.getSysConfig().getString("sys_rates"))); JSONObject rateConfig = registerBean.insertClientRateInfo(JSON.parseObject(sysConfigManager.getSysConfig().getString("sys_rates")));
clientManager.newConfigRate(manager, client.getString("client_moniker"), rateConfig); clientManager.newConfigRate(manager, client.getString("client_moniker"), rateConfig);
clientManager.commitToCompliance(client.getString("client_moniker"), manager); clientManager.commitToCompliance(client.getString("client_moniker"), manager);
result.put("partner_code", client.getString("client_moniker")); result.put("partner_code", client.getString("client_moniker"));

@ -129,7 +129,7 @@ public class KycServiceImpl implements KycService {
ctx.setVariable("contact_email", client.getString("contact_email")); ctx.setVariable("contact_email", client.getString("contact_email"));
ctx.setVariable("submit_time", DateFormatUtils.format(complianceInfo.getDate("submit_time"),"yyyy-MM-dd HH:mm:ss")); ctx.setVariable("submit_time", DateFormatUtils.format(complianceInfo.getDate("submit_time"),"yyyy-MM-dd HH:mm:ss"));
final String content = thymeleaf.process("mail/kyc_email_notice", ctx); final String content = thymeleaf.process("mail/kyc_email_notice", ctx);
if (emails.size() > 0) { if (!emails.isEmpty()) {
royalThreadPoolExecutor.execute(() -> { royalThreadPoolExecutor.execute(() -> {
try { try {
mailService.sendEmail("[RoyalPay]商户需要您协助补充KYC材料,请尽快查看", StringUtils.join(emails, ","), "", content); mailService.sendEmail("[RoyalPay]商户需要您协助补充KYC材料,请尽快查看", StringUtils.join(emails, ","), "", content);
@ -138,7 +138,7 @@ public class KycServiceImpl implements KycService {
} }
}); });
} }
if (openIds.size() > 0) { if (!openIds.isEmpty()) {
for (String openId : openIds) { for (String openId : openIds) {
try { try {
MpWechatApi mpWechatApi = mpWechatApiProvider.getApiFromOpenId(openId); MpWechatApi mpWechatApi = mpWechatApiProvider.getApiFromOpenId(openId);
@ -223,7 +223,7 @@ public class KycServiceImpl implements KycService {
} }
int sourceEnum = 2; int sourceEnum = 2;
List<JSONObject> clientAllAuthFiles = clientFilesMapper.findAllClientFile(client.getIntValue("client_id")); List<JSONObject> clientAllAuthFiles = clientFilesMapper.findAllClientFile(client.getIntValue("client_id"));
if (clientAllAuthFiles == null || clientAllAuthFiles.size() == 0) { if (clientAllAuthFiles == null || clientAllAuthFiles.isEmpty()) {
throw new BadRequestException("Please check the information is uploaded completely"); throw new BadRequestException("Please check the information is uploaded completely");
} }
if (StringUtils.isNotBlank(account.getString("beneficiary_id_title"))) { if (StringUtils.isNotBlank(account.getString("beneficiary_id_title"))) {

@ -1104,7 +1104,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
} else { } else {
row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue("-"); row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue("-");
} }
row.createCell(7, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("exchange_rate").setScale(5, BigDecimal.ROUND_DOWN).toPlainString()); row.createCell(7, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("exchange_rate").setScale(5, RoundingMode.DOWN).toPlainString());
cell = row.createCell(8, Cell.CELL_TYPE_STRING); cell = row.createCell(8, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getString("transaction_type")); cell.setCellValue(settle.getString("transaction_type"));
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null); cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null);
@ -1112,20 +1112,20 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
cell = row.createCell(10, Cell.CELL_TYPE_STRING); cell = row.createCell(10, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getBigDecimal("display_amount") == null ? "" cell.setCellValue(settle.getBigDecimal("display_amount") == null ? ""
: "Credit".equals(settle.getString("transaction_type")) ? : "Credit".equals(settle.getString("transaction_type")) ?
settle.getBigDecimal("display_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString() : settle.getBigDecimal("display_amount").setScale(2, RoundingMode.DOWN).toPlainString() :
"-" + settle.getBigDecimal("display_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); "-" + settle.getBigDecimal("display_amount").setScale(2, RoundingMode.DOWN).toPlainString());
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null); cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null);
cell = row.createCell(11, Cell.CELL_TYPE_STRING); cell = row.createCell(11, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getBigDecimal("transaction_amount") == null ? "" cell.setCellValue(settle.getBigDecimal("transaction_amount") == null ? ""
: "Credit".equals(settle.getString("transaction_type")) ? : "Credit".equals(settle.getString("transaction_type")) ?
settle.getBigDecimal("transaction_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString() : settle.getBigDecimal("transaction_amount").setScale(2, RoundingMode.DOWN).toPlainString() :
"-" + settle.getBigDecimal("transaction_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); "-" + settle.getBigDecimal("transaction_amount").setScale(2, RoundingMode.DOWN).toPlainString());
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null); cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null);
cell = row.createCell(12, Cell.CELL_TYPE_STRING); cell = row.createCell(12, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getBigDecimal("clearing_amount") == null ? "" cell.setCellValue(settle.getBigDecimal("clearing_amount") == null ? ""
: "Credit".equals(settle.getString("transaction_type")) ? : "Credit".equals(settle.getString("transaction_type")) ?
settle.getBigDecimal("clearing_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString() : settle.getBigDecimal("clearing_amount").setScale(2, RoundingMode.DOWN).toPlainString() :
"-" + settle.getBigDecimal("clearing_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); "-" + settle.getBigDecimal("clearing_amount").setScale(2, RoundingMode.DOWN).toPlainString());
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null); cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null);
row.createCell(13, Cell.CELL_TYPE_STRING).setCellValue(channels.getString(settle.getString("channel")) == null ? "" row.createCell(13, Cell.CELL_TYPE_STRING).setCellValue(channels.getString(settle.getString("channel")) == null ? ""
: channels.getJSONObject(settle.getString("channel")).getBigDecimal("rate").toPlainString() + "%"); : channels.getJSONObject(settle.getString("channel")).getBigDecimal("rate").toPlainString() + "%");
@ -1137,8 +1137,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
cell = row.createCell(16, Cell.CELL_TYPE_STRING); cell = row.createCell(16, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getBigDecimal("settle_amount") == null ? "" cell.setCellValue(settle.getBigDecimal("settle_amount") == null ? ""
: "Credit".equals(settle.getString("transaction_type")) ? : "Credit".equals(settle.getString("transaction_type")) ?
settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString() : settle.getBigDecimal("settle_amount").setScale(2, RoundingMode.DOWN).toPlainString() :
"-" + settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); "-" + settle.getBigDecimal("settle_amount").setScale(2, RoundingMode.DOWN).toPlainString());
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null); cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null);
row.createCell(17, Cell.CELL_TYPE_STRING).setCellValue(settle.containsKey("order_detail") ? settle.getString("order_detail") : settle.getString("remark")); row.createCell(17, Cell.CELL_TYPE_STRING).setCellValue(settle.containsKey("order_detail") ? settle.getString("order_detail") : settle.getString("remark"));
String clientDevId = StringUtils.defaultString(settle.getString("dev_id"), "-"); String clientDevId = StringUtils.defaultString(settle.getString("dev_id"), "-");
@ -1226,7 +1226,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
} else { } else {
row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue("-"); row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue("-");
} }
row.createCell(7, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("exchange_rate").setScale(5, BigDecimal.ROUND_DOWN).toPlainString()); row.createCell(7, Cell.CELL_TYPE_STRING).setCellValue(settle.getBigDecimal("exchange_rate").setScale(5, RoundingMode.DOWN).toPlainString());
cell = row.createCell(8, Cell.CELL_TYPE_STRING); cell = row.createCell(8, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getString("transaction_type")); cell.setCellValue(settle.getString("transaction_type"));
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null); cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null);
@ -1234,20 +1234,20 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
cell = row.createCell(10, Cell.CELL_TYPE_STRING); cell = row.createCell(10, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getBigDecimal("display_amount") == null ? "" cell.setCellValue(settle.getBigDecimal("display_amount") == null ? ""
: "Credit".equals(settle.getString("transaction_type")) ? : "Credit".equals(settle.getString("transaction_type")) ?
settle.getBigDecimal("display_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString() : settle.getBigDecimal("display_amount").setScale(2, RoundingMode.DOWN).toPlainString() :
"-" + settle.getBigDecimal("display_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); "-" + settle.getBigDecimal("display_amount").setScale(2, RoundingMode.DOWN).toPlainString());
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null); cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null);
cell = row.createCell(11, Cell.CELL_TYPE_STRING); cell = row.createCell(11, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getBigDecimal("transaction_amount") == null ? "" cell.setCellValue(settle.getBigDecimal("transaction_amount") == null ? ""
: "Credit".equals(settle.getString("transaction_type")) ? : "Credit".equals(settle.getString("transaction_type")) ?
settle.getBigDecimal("transaction_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString() : settle.getBigDecimal("transaction_amount").setScale(2, RoundingMode.DOWN).toPlainString() :
"-" + settle.getBigDecimal("transaction_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); "-" + settle.getBigDecimal("transaction_amount").setScale(2, RoundingMode.DOWN).toPlainString());
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null); cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null);
cell = row.createCell(12, Cell.CELL_TYPE_STRING); cell = row.createCell(12, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getBigDecimal("clearing_amount") == null ? "" cell.setCellValue(settle.getBigDecimal("clearing_amount") == null ? ""
: "Credit".equals(settle.getString("transaction_type")) ? : "Credit".equals(settle.getString("transaction_type")) ?
settle.getBigDecimal("clearing_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString() : settle.getBigDecimal("clearing_amount").setScale(2, RoundingMode.DOWN).toPlainString() :
"-" + settle.getBigDecimal("clearing_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); "-" + settle.getBigDecimal("clearing_amount").setScale(2, RoundingMode.DOWN).toPlainString());
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null); cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null);
row.createCell(13, Cell.CELL_TYPE_STRING).setCellValue(channels.getString(settle.getString("channel")) == null ? "" row.createCell(13, Cell.CELL_TYPE_STRING).setCellValue(channels.getString(settle.getString("channel")) == null ? ""
: channels.getJSONObject(settle.getString("channel")).getBigDecimal("rate").toPlainString() + "%"); : channels.getJSONObject(settle.getString("channel")).getBigDecimal("rate").toPlainString() + "%");
@ -1259,8 +1259,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
cell = row.createCell(16, Cell.CELL_TYPE_STRING); cell = row.createCell(16, Cell.CELL_TYPE_STRING);
cell.setCellValue(settle.getBigDecimal("settle_amount") == null ? "" cell.setCellValue(settle.getBigDecimal("settle_amount") == null ? ""
: "Credit".equals(settle.getString("transaction_type")) ? : "Credit".equals(settle.getString("transaction_type")) ?
settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString() : settle.getBigDecimal("settle_amount").setScale(2, RoundingMode.DOWN).toPlainString() :
"-" + settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); "-" + settle.getBigDecimal("settle_amount").setScale(2, RoundingMode.DOWN).toPlainString());
cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null); cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null);
row.createCell(17, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("order_detail")); row.createCell(17, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("order_detail"));
String clientDevId = StringUtils.defaultString(settle.getString("dev_id"), "-"); String clientDevId = StringUtils.defaultString(settle.getString("dev_id"), "-");

@ -90,8 +90,8 @@ public class MerchantIdManageServiceImpl implements MerchantIdManageService {
} }
Map<String, List<JSONObject>> merchantIdMap = clients.stream().filter(t->t.containsKey("merchant_id")).filter(t->t.containsKey("sub_merchant_id")).collect(Collectors.groupingBy(t->t.getString("merchant_id"))); Map<String, List<JSONObject>> merchantIdMap = clients.stream().filter(t->t.containsKey("merchant_id")).filter(t->t.containsKey("sub_merchant_id")).collect(Collectors.groupingBy(t->t.getString("merchant_id")));
JSONObject returnJason = new JSONObject(); JSONObject returnJason = new JSONObject();
returnJason.put("merchant_id_map",merchantIdMap); returnJason.put("merchant_id_map", merchantIdMap);
returnJason.put("refresh_time",clients.size()>0?clients.get(0).getDate("create_time"):""); returnJason.put("refresh_time", !clients.isEmpty() ? clients.get(0).getDate("create_time") : "");
return returnJason; return returnJason;
} }
@ -99,7 +99,7 @@ public class MerchantIdManageServiceImpl implements MerchantIdManageService {
public void generateClientsSunMerchantId() { public void generateClientsSunMerchantId() {
//重构未交易商户号逻辑 //重构未交易商户号逻辑
List<JSONObject> clients = clientAnalysisMapper.tradeSubMerchantIdBy60Days(DateUtils.addDays(new Date(), -60)); List<JSONObject> clients = clientAnalysisMapper.tradeSubMerchantIdBy60Days(DateUtils.addDays(new Date(), -60));
if (clients.size() > 0) { if (!clients.isEmpty()) {
clientSubMerchantIdMapper.deleteAll(); clientSubMerchantIdMapper.deleteAll();
} }
for (JSONObject client: clients) { for (JSONObject client: clients) {

@ -364,13 +364,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override @Override
public JSONObject getSysRateConfig() { public JSONObject getSysRateConfig() {
String rateConfig = sysConfigManager.getSysConfig().getString("sys_rates"); String rateConfig = sysConfigManager.getSysConfig().getString("sys_rates");
return JSONObject.parseObject(rateConfig); return JSON.parseObject(rateConfig);
} }
@Override @Override
public JSONObject getSysCardRateConfig() { public JSONObject getSysCardRateConfig() {
String rateConfig = sysConfigManager.getSysConfig().getString("sys_card_rates"); String rateConfig = sysConfigManager.getSysConfig().getString("sys_card_rates");
return JSONObject.parseObject(rateConfig); return JSON.parseObject(rateConfig);
} }
@Override @Override
@ -447,7 +447,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (ManagerRole.OPERATOR.hasRole(role)) { if (ManagerRole.OPERATOR.hasRole(role)) {
List<JSONObject> log = logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"), List<JSONObject> log = logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"),
new PageBounds(Order.formString("create_time.desc"))); new PageBounds(Order.formString("create_time.desc")));
client.put("sub_merchant_id_log", log.size() > 0); client.put("sub_merchant_id_log", !log.isEmpty());
} }
if (ManagerRole.BD_USER.hasRole(role)) { if (ManagerRole.BD_USER.hasRole(role)) {
int checkBDPermission = clientBDMapper.checkBDPermission(client.getIntValue("client_id"), manager.getString("manager_id")); int checkBDPermission = clientBDMapper.checkBDPermission(client.getIntValue("client_id"), manager.getString("manager_id"));
@ -728,7 +728,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
param.put("type", 0); param.put("type", 0);
List<Integer> orgIds = new ArrayList<>(); List<Integer> orgIds = new ArrayList<>();
List<JSONObject> childOrgs = orgMapper.listOrgsWithChid(param); List<JSONObject> childOrgs = orgMapper.listOrgsWithChid(param);
if (childOrgs.size() > 0) { if (!childOrgs.isEmpty()) {
for (JSONObject object : childOrgs) { for (JSONObject object : childOrgs) {
orgIds.add(object.getIntValue("org_id")); orgIds.add(object.getIntValue("org_id"));
} }
@ -1206,7 +1206,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
createKycAuthStatus(manager, client); createKycAuthStatus(manager, client);
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "skip_clearing", false)); clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "skip_clearing", false));
List<JSONObject> accounts = clientAccountMapper.listAdminAccounts(clientId); List<JSONObject> accounts = clientAccountMapper.listAdminAccounts(clientId);
if (accounts != null && accounts.size() > 0) { if (accounts != null && !accounts.isEmpty()) {
sendInitEmail(client, accounts.get(0).getString("username"), "*******", true); sendInitEmail(client, accounts.get(0).getString("username"), "*******", true);
} else { } else {
initAdminUserAndSendEmail(manager, clientMoniker, client, true); initAdminUserAndSendEmail(manager, clientMoniker, client, true);
@ -1306,7 +1306,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
// sendInitEmail(manager, client, account.getString("username"), "*****"); // sendInitEmail(manager, client, account.getString("username"), "*****");
sendInitEmail(client, account.getString("username"), "*****", cardApproving); sendInitEmail(client, account.getString("username"), "*****", cardApproving);
} else { } else {
if (accounts.size() == 0) { if (accounts.isEmpty()) {
initAdminUserAndSendEmail(manager, clientMoniker, client, cardApproving); initAdminUserAndSendEmail(manager, clientMoniker, client, cardApproving);
} else { } else {
JSONObject account = accounts.get(0); JSONObject account = accounts.get(0);
@ -1540,7 +1540,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
int clientId = client.getIntValue("client_id"); int clientId = client.getIntValue("client_id");
List<JSONObject> clientBankAccounts = clientBankAccountMapper.clientBankAccounts(clientId); List<JSONObject> clientBankAccounts = clientBankAccountMapper.clientBankAccounts(clientId);
if (clientBankAccounts.size() > 0) { if (!clientBankAccounts.isEmpty()) {
isRiskyMerchant(client, clientBankAccounts.get(0)); isRiskyMerchant(client, clientBankAccounts.get(0));
} else { } else {
isRiskyMerchant(client, null); isRiskyMerchant(client, null);
@ -1599,7 +1599,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private void checkPhoneAndWechatExist(NewAccountBean account) { private void checkPhoneAndWechatExist(NewAccountBean account) {
List<JSONObject> accounts = clientAccountMapper.findByPhone(account.getContactPhone(), account.getNation_code().startsWith("+") ? account.getNation_code() : "+" + account.getNation_code()); List<JSONObject> accounts = clientAccountMapper.findByPhone(account.getContactPhone(), account.getNation_code().startsWith("+") ? account.getNation_code() : "+" + account.getNation_code());
if (accounts != null && accounts.size() > 0) { if (accounts != null && !accounts.isEmpty()) {
throw new BadRequestException("Mobile phone number has been bound to other accounts"); throw new BadRequestException("Mobile phone number has been bound to other accounts");
} }
} }
@ -1867,7 +1867,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
rate.put("clean_days", clientConfig.getIntValue("clean_days")); rate.put("clean_days", clientConfig.getIntValue("clean_days"));
} }
if (StringUtils.equalsIgnoreCase("rpaypmt_card", rate.getString("rate_name"))) { if (StringUtils.equalsIgnoreCase("rpaypmt_card", rate.getString("rate_name"))) {
JSONObject extRates = JSONObject.parseObject(rate.getString("ext_rates")); JSONObject extRates = JSON.parseObject(rate.getString("ext_rates"));
convertExtRateValueDataVersion(rate, extRates, "domestic_rate_value"); convertExtRateValueDataVersion(rate, extRates, "domestic_rate_value");
convertExtRateValueDataVersion(rate, extRates, "overseas_rate_value"); convertExtRateValueDataVersion(rate, extRates, "overseas_rate_value");
rate.put("ext_rates", extRates); rate.put("ext_rates", extRates);
@ -1973,11 +1973,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientRateMapper.updateConfig(rateLog); clientRateMapper.updateConfig(rateLog);
} }
if (StringUtils.equalsIgnoreCase("rpaypmt_card", config.getString("type"))) { if (StringUtils.equalsIgnoreCase("rpaypmt_card", config.getString("type"))) {
JSONObject extRateParams = new JSONObject() {{ JSONObject extRateParams = JsonHelper.newJson(json -> {
put("domestic_rate_value", subRateObject(config.getBigDecimal("rate_value"), config.getIntValue("clean_days"))); json.put("domestic_rate_value", subRateObject(config.getBigDecimal("rate_value"), config.getIntValue("clean_days")));
JSONObject extRates = config.getJSONObject("ext_rates"); JSONObject extRates = config.getJSONObject("ext_rates");
put("overseas_rate_value", subRateObject(extRates.getBigDecimal("international_rate_value"), config.getIntValue("clean_days") + 1)); json.put("overseas_rate_value", subRateObject(extRates.getBigDecimal("international_rate_value"), config.getIntValue("clean_days") + 1));
}}; });
newConfig.put("ext_rates", extRateParams.toJSONString()); newConfig.put("ext_rates", extRateParams.toJSONString());
} }
if ("cb_bankpay".equalsIgnoreCase(channel)) { if ("cb_bankpay".equalsIgnoreCase(channel)) {
@ -1987,7 +1987,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} else { } else {
clientRateMapper.saveRate(newConfig); clientRateMapper.saveRate(newConfig);
} }
logger.info(clientId + "的" + channel + "费率设置成功"); logger.info("{}的{}费率设置成功", clientId, channel);
} }
} }
@ -2041,7 +2041,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new ForbiddenException("费率参数小于旗下商户最低" + rateName + "费率,请重新输入"); throw new ForbiddenException("费率参数小于旗下商户最低" + rateName + "费率,请重新输入");
} }
;
} }
} }
} }
@ -2053,7 +2052,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new ForbiddenException("费率参数小于旗下商户最低" + channel + "费率,请重新输入"); throw new ForbiddenException("费率参数小于旗下商户最低" + channel + "费率,请重新输入");
} }
;
} }
} }
} }
@ -2073,11 +2071,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (mchConfig.getBooleanValue("level3_mch_config")) { if (mchConfig.getBooleanValue("level3_mch_config")) {
for (JSONObject partner : listChildClients) { for (JSONObject partner : listChildClients) {
List<JSONObject> clients = clientMapper.listChildClients(partner.getIntValue("client_id")); List<JSONObject> clients = clientMapper.listChildClients(partner.getIntValue("client_id"));
if (clients.size() > 0) { if (!clients.isEmpty()) {
partner.put("level3Clients", clients); partner.put("level3Clients", clients);
clients.forEach(e -> { clients.forEach(e -> e.put("parent_client_moniker", partner.getString("client_moniker")));
e.put("parent_client_moniker", partner.getString("client_moniker"));
});
} }
} }
} }
@ -2094,9 +2090,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
PageBounds pageBounds; PageBounds pageBounds;
pageBounds = new PageBounds(page, 20, Order.formString("create_time.desc")); pageBounds = new PageBounds(page, 20, Order.formString("create_time.desc"));
JSONObject params = new JSONObject() {{ JSONObject params = JsonHelper.newJson(json -> json.put("parent_client_id", client.getIntValue("client_id")));
put("parent_client_id", client.getIntValue("client_id"));
}};
if (StringUtils.isNotBlank(searchText)) { if (StringUtils.isNotBlank(searchText)) {
params.put("search_text", searchText); params.put("search_text", searchText);
} }
@ -2105,11 +2099,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (mchConfig.getBooleanValue("level3_mch_config")) { if (mchConfig.getBooleanValue("level3_mch_config")) {
for (JSONObject partner : childClients) { for (JSONObject partner : childClients) {
List<JSONObject> clients = clientMapper.listChildClients(partner.getIntValue("client_id")); List<JSONObject> clients = clientMapper.listChildClients(partner.getIntValue("client_id"));
if (clients.size() > 0) { if (!clients.isEmpty()) {
partner.put("level3Clients", clients); partner.put("level3Clients", clients);
clients.forEach(e -> { clients.forEach(e -> e.put("parent_client_moniker", partner.getString("client_moniker")));
e.put("parent_client_moniker", partner.getString("client_moniker"));
});
} }
} }
} }
@ -2123,48 +2115,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return clientMapper.listChildClients(clientId); return clientMapper.listChildClients(clientId);
} }
// @Override
// @Transactional
// public void newSubClient(String clientMoniker, SubClientRegistry registry, JSONObject manager) {
// JSONObject client = getClientInfoByMoniker(clientMoniker);
// if (client == null) {
// throw new InvalidShortIdException();
// }
// checkOrgPermission(manager, client);
// JSONObject subClient = registry.insertObject();
// client.put("parent_client_id", client.getIntValue("client_id"));
// //解决子商户不能编辑
// client.remove("client_id");
// client.remove("approve_result");
// client.remove("approver");
// client.remove("approve_time");
// client.remove("approve_email_id");
// client.remove("approve_email_send");
// client.putAll(subClient);
// client.put("create_time", new Date());
// client.put("credential_code", RandomStringUtils.random(32, true, true));
// client.put("creator", manager.getString("manager_id"));
// if (ManagerRole.OPERATOR.hasRole(manager.getIntValue("role"))) {
// client.put("approve_result", 1);
// client.put("approver", manager.getString("manager_id"));
// client.put("approve_time", new Date());
// }
// if (clientMapper.findClientByMoniker(registry.getClientMoniker()) != null) {
// throw new BadRequestException("error.partner.valid.dumplicate_client_moniker");
// }
// clientMapper.save(client);
//
// List<JSONObject> client_bds = listClientCurrentBDUsers(manager, clientMoniker);
// if (!client_bds.isEmpty() && client_bds.size() > 0) {
// for (JSONObject client_bd : client_bds) {
// client_bd.put("client_id", client.getIntValue("client_id"));
// client_bd.remove("client_bd_id");
// clientBDMapper.saveBD(client_bd);
// }
// }
//
//
// }
@Override @Override
public void toggleAccountReceiveNoticeByOpenId(String openid, boolean enable) { public void toggleAccountReceiveNoticeByOpenId(String openid, boolean enable) {
@ -2284,26 +2234,26 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (weChatRate == null) { if (weChatRate == null) {
throw new BadRequestException("The Partner's Rate is not config!"); throw new BadRequestException("The Partner's Rate is not config!");
} }
client.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
client.put("clean", "T+" + weChatRate.getString("clean_days")); client.put("clean", "T+" + weChatRate.getString("clean_days"));
client.put("clean_days", weChatRate.getString("clean_days")); client.put("clean_days", weChatRate.getString("clean_days"));
String rateConfig = sysConfigManager.getSysConfig().getString("sys_rates"); String rateConfig = sysConfigManager.getSysConfig().getString("sys_rates");
JSONObject sysConfigRate = JSONObject.parseObject(rateConfig); JSONObject sysConfigRate = JSON.parseObject(rateConfig);
try { try {
JSONObject alipayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Alipay"); JSONObject alipayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Alipay");
if (alipayRate != null) { if (alipayRate != null) {
client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
} }
JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline"); JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline");
if (alipayOnlineRate != null) { if (alipayOnlineRate != null) {
client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
} }
JSONObject cbBankPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "CB_BankPay"); JSONObject cbBankPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "CB_BankPay");
if (cbBankPayRate != null) { if (cbBankPayRate != null) {
client.put("cbbank_rate", cbBankPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("cbbank_rate", cbBankPayRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
} }
} catch (Exception ignored) { } catch (Exception ignored) {
throw new BadRequestException("Merchant Rate Not Configure,Please Contact Customer Service"); throw new BadRequestException("Merchant Rate Not Configure,Please Contact Customer Service");
@ -2373,14 +2323,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Transactional @Transactional
public void updateBD(String manager_id, JSONObject data, JSONObject client) throws Exception { public void updateBD(String manager_id, JSONObject data, JSONObject client) throws Exception {
String type = data.getString("type").isEmpty() ? "add" : data.getString("type"); String type = data.getString("type").isEmpty() ? "add" : data.getString("type");
List<JSONObject> users = (List<JSONObject>) data.get("users"); List<JSONObject> users = data.getJSONArray("users").toJavaList(JSONObject.class);
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
params.put("client_id", client.getIntValue("client_id")); params.put("client_id", client.getIntValue("client_id"));
params.put("end_date", null); params.put("end_date", null);
params.put("is_valid", "1"); params.put("is_valid", "1");
String start_date = DateFormatUtils.format(data.getDate("start_date"), "yyyy-MM-dd"); String start_date = DateFormatUtils.format(data.getDate("start_date"), "yyyy-MM-dd");
List<JSONObject> listClientBDUsers = clientBDMapper.listClientDB(params, new PageBounds(Order.formString("create_time.desc"))); List<JSONObject> listClientBDUsers = clientBDMapper.listClientDB(params, new PageBounds(Order.formString("create_time.desc")));
if (!listClientBDUsers.isEmpty() && listClientBDUsers.size() > 0) { if (!listClientBDUsers.isEmpty()) {
JSONObject clientBDUser = listClientBDUsers.get(0); JSONObject clientBDUser = listClientBDUsers.get(0);
clientBDUser.put("end_date", start_date); clientBDUser.put("end_date", start_date);
if (type.equals("add") && (clientBDUser.getDate("end_date").getTime() < clientBDUser.getDate("start_date").getTime())) { if (type.equals("add") && (clientBDUser.getDate("end_date").getTime() < clientBDUser.getDate("start_date").getTime())) {
@ -2417,7 +2367,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
BDUserModify bdUserModify = new BDUserModify(managerMapper.findById(manager_id), client.getString("client_moniker"), BDUserModify bdUserModify = new BDUserModify(managerMapper.findById(manager_id), client.getString("client_moniker"),
bd_id.substring(0, bd_id.length() - 1), bd_name.substring(0, bd_name.length() - 1)); bd_id.substring(0, bd_id.length() - 1), bd_name.substring(0, bd_name.length() - 1));
if (users.size() > 0) { if (!users.isEmpty()) {
String bd_manager_id = users.get(0).getString("manager_id"); String bd_manager_id = users.get(0).getString("manager_id");
JSONObject manager = managerMapper.findById(bd_manager_id); JSONObject manager = managerMapper.findById(bd_manager_id);
bdUserModify.setOrg_id(manager.getIntValue("org_id")); bdUserModify.setOrg_id(manager.getIntValue("org_id"));
@ -2455,9 +2405,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override @Override
public String getQrCodeBoard(JSONObject client, QRCodeConfig config, JSONObject account, String plantform) { public String getQrCodeBoard(JSONObject client, QRCodeConfig config, JSONObject account, String plantform) {
// JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
return merchantInfoProvider.getQrCodeBoard(client, config); return merchantInfoProvider.getQrCodeBoard(client, config);
// return merchantInfoProvider.getQrCodeBoard(client, config,account,plantform);
} }
@Override @Override
@ -2680,9 +2628,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
queryModifyClientIds(client.getIntValue("client_id"), params); queryModifyClientIds(client.getIntValue("client_id"), params);
} }
List<JSONObject> deviceIds = clientDeviceMapper.listClientDeviceIds(params); List<JSONObject> deviceIds = clientDeviceMapper.listClientDeviceIds(params);
return new JSONObject() {{ return JsonHelper.newJson(json -> json.put("data", deviceIds));
put("data", deviceIds);
}};
} }
@Override @Override
@ -2889,7 +2835,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (rate == null) { if (rate == null) {
throw new BadRequestException("The Partner's Rate is not config!"); throw new BadRequestException("The Partner's Rate is not config!");
} }
client.put("rate_value", rate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("rate_value", rate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
client.put("clean", "T+" + rate.getString("clean_days")); client.put("clean", "T+" + rate.getString("clean_days"));
client.put("clean_days", rate.getString("clean_days")); client.put("clean_days", rate.getString("clean_days"));
JSONObject account = getBankAccountByClientId(client.getIntValue("client_id")); JSONObject account = getBankAccountByClientId(client.getIntValue("client_id"));
@ -2908,17 +2854,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
PdfUtils pdu = new PdfUtils(); PdfUtils pdu = new PdfUtils();
pdu.setTemplatePdfPath(agreetemplatePdfPath); pdu.setTemplatePdfPath(agreetemplatePdfPath);
pdu.setPdfTemplate(client); pdu.setPdfTemplate(client);
InputStream stream = null; File file = new File(clientMoniker + "_agreement.pdf");
try { try (ByteArrayOutputStream bos = pdu.templetPdfBos(file);
File file = new File(clientMoniker + "_agreement.pdf"); InputStream stream = new ByteArrayInputStream(bos.toByteArray())) {
ByteArrayOutputStream bos = pdu.templetPdfBos(file);
stream = new ByteArrayInputStream(bos.toByteArray());
JSONObject fileRes = attachmentClient.uploadFile(stream, clientMoniker + "_agreement.pdf", false); JSONObject fileRes = attachmentClient.uploadFile(stream, clientMoniker + "_agreement.pdf", false);
importAgreeFile(clientMoniker, manager, fileRes.getString("url"), false); importAgreeFile(clientMoniker, manager, fileRes.getString("url"), false);
} catch (Exception e) { } catch (Exception e) {
logger.error("合同制作出现问题:", e); logger.error("合同制作出现问题:", e);
} finally {
stream.close();
} }
} }
@ -2947,18 +2889,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (weChatRate == null) { if (weChatRate == null) {
throw new BadRequestException("The Partner's Rate is not config!"); throw new BadRequestException("The Partner's Rate is not config!");
} }
client.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
client.put("clean", "T+" + weChatRate.getString("clean_days")); client.put("clean", "T+" + weChatRate.getString("clean_days"));
client.put("clean_days", weChatRate.getString("clean_days")); client.put("clean_days", weChatRate.getString("clean_days"));
try { try {
JSONObject alipayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Alipay"); JSONObject alipayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Alipay");
if (alipayRate != null) { if (alipayRate != null) {
client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
} }
JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline"); JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline");
if (alipayOnlineRate != null) { if (alipayOnlineRate != null) {
client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
} }
} catch (Exception ignored) { } catch (Exception ignored) {
// do nothing // do nothing
@ -3055,13 +2997,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientRate.forEach((p) -> { clientRate.forEach((p) -> {
String rate_name = p.getString("rate_name"); String rate_name = p.getString("rate_name");
if ("Wechat".equals(rate_name)) { if ("Wechat".equals(rate_name)) {
client.put("wechat_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("wechat_rate", p.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
client.put("clean", "T+" + p.getString("clean_days")); client.put("clean", "T+" + p.getString("clean_days"));
client.put("clean_days", p.getString("clean_days")); client.put("clean_days", p.getString("clean_days"));
} else if ("Alipay".equals(rate_name)) { } else if ("Alipay".equals(rate_name)) {
client.put("alipay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("alipay_rate", p.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
} else if ("AlipayOnline".equals(rate_name)) { } else if ("AlipayOnline".equals(rate_name)) {
client.put("alipay_online_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("alipay_online_rate", p.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
} }
}); });
@ -3126,19 +3068,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (weChatRate == null) { if (weChatRate == null) {
throw new BadRequestException("The Partner's Rate is not config!"); throw new BadRequestException("The Partner's Rate is not config!");
} }
client.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
client.put("clean", "T+" + weChatRate.getString("clean_days")); client.put("clean", "T+" + weChatRate.getString("clean_days"));
client.put("clean_days", weChatRate.getString("clean_days")); client.put("clean_days", weChatRate.getString("clean_days"));
try { try {
JSONObject alipayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Alipay"); JSONObject alipayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Alipay");
if (alipayRate != null) { if (alipayRate != null) {
client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
} }
JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline"); JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline");
if (alipayOnlineRate != null) { if (alipayOnlineRate != null) {
client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
} }
} catch (Exception ignored) { } catch (Exception ignored) {
// do nothing // do nothing
@ -3258,7 +3200,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
List<JSONObject> files = clientFilesMapper.findClientFile(client.getIntValue("client_id")); List<JSONObject> files = clientFilesMapper.findClientFile(client.getIntValue("client_id"));
if (files != null && files.size() > 0) { if (files != null && !files.isEmpty()) {
List<String> filePaths = new ArrayList<>(); List<String> filePaths = new ArrayList<>();
for (JSONObject file : files) { for (JSONObject file : files) {
filePaths.add(file.getString("file_value")); filePaths.add(file.getString("file_value"));
@ -3298,7 +3240,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
List<JSONObject> files = clientMWAuthFilesInfo.findClientFile(client.getIntValue("client_id"), new PageBounds(1, 999999, Order.formString("last_update_date.asc"))); List<JSONObject> files = clientMWAuthFilesInfo.findClientFile(client.getIntValue("client_id"), new PageBounds(1, 999999, Order.formString("last_update_date.asc")));
if (files != null && files.size() > 0) { if (files != null && !files.isEmpty()) {
List<String> filePaths = new ArrayList<>(); List<String> filePaths = new ArrayList<>();
for (JSONObject file : files) { for (JSONObject file : files) {
filePaths.add(file.getString("file_value")); filePaths.add(file.getString("file_value"));
@ -3549,7 +3491,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
fileJson.put(file.getString("file_name"), file.getString("file_value")); fileJson.put(file.getString("file_name"), file.getString("file_value"));
} }
String[] fileKeys = {"kyc_utility_bill_file"}; String[] fileKeys = {"kyc_utility_bill_file"};
if (clientFiles.size() > 0) { if (!clientFiles.isEmpty()) {
for (String fileKey : fileKeys) { for (String fileKey : fileKeys) {
List<JSONObject> clientFileUrl = clientFiles.stream() List<JSONObject> clientFileUrl = clientFiles.stream()
.filter(json -> (fileKey.equals(json.getString("file_name")))) .filter(json -> (fileKey.equals(json.getString("file_name"))))
@ -3561,7 +3503,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return params; return params;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
if (clientFileUrl != null && clientFileUrl.size() > 0) { if (clientFileUrl != null && !clientFileUrl.isEmpty()) {
fileJson.put(fileKey, clientFileUrl); fileJson.put(fileKey, clientFileUrl);
} }
} }
@ -3609,7 +3551,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
List<JSONObject> clientFiles = clientFilesMapper.findClientFile(client.getIntValue("client_id")); List<JSONObject> clientFiles = clientFilesMapper.findClientFile(client.getIntValue("client_id"));
JSONObject fileJson = new JSONObject(); JSONObject fileJson = new JSONObject();
if (clientFiles != null && clientFiles.size() > 0) { if (clientFiles != null && !clientFiles.isEmpty()) {
for (String fileKey : fileKeys) { for (String fileKey : fileKeys) {
List<JSONObject> clientFileUrl = clientFiles.stream() List<JSONObject> clientFileUrl = clientFiles.stream()
.filter(json -> (fileKey.equals(json.getString("file_name")))) .filter(json -> (fileKey.equals(json.getString("file_name"))))
@ -3621,7 +3563,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return params; return params;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
if (clientFileUrl != null && clientFileUrl.size() > 0) { if (clientFileUrl != null && !clientFileUrl.isEmpty()) {
fileJson.put(fileKey, clientFileUrl); fileJson.put(fileKey, clientFileUrl);
} }
} }
@ -3643,7 +3585,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
String[] fileKeys = UPayAuthFileEnum.ALL.getFileNameArrays(); String[] fileKeys = UPayAuthFileEnum.ALL.getFileNameArrays();
List<JSONObject> clientFiles = clientMWAuthFilesInfo.findClientFile(client.getIntValue("client_id"), new PageBounds(1, 999999, Order.formString("last_update_date.asc"))); List<JSONObject> clientFiles = clientMWAuthFilesInfo.findClientFile(client.getIntValue("client_id"), new PageBounds(1, 999999, Order.formString("last_update_date.asc")));
JSONObject fileJson = new JSONObject(); JSONObject fileJson = new JSONObject();
if (clientFiles != null && clientFiles.size() > 0) { if (clientFiles != null && !clientFiles.isEmpty()) {
for (String fileKey : fileKeys) { for (String fileKey : fileKeys) {
List<JSONObject> clientFileUrl = clientFiles.stream() List<JSONObject> clientFileUrl = clientFiles.stream()
.filter(json -> (fileKey.equals(json.getString("file_name")))) .filter(json -> (fileKey.equals(json.getString("file_name"))))
@ -3655,7 +3597,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return params; return params;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
if (clientFileUrl != null && clientFileUrl.size() > 0) { if (clientFileUrl != null && !clientFileUrl.isEmpty()) {
fileJson.put(fileKey, clientFileUrl); fileJson.put(fileKey, clientFileUrl);
} }
} }
@ -3674,7 +3616,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
JSONObject fileJson = new JSONObject(); JSONObject fileJson = new JSONObject();
JSONObject companyFile = clientComplianceCompanyMapper.findKycFileByClientId(client.getIntValue("client_id")); JSONObject companyFile = clientComplianceCompanyMapper.findKycFileByClientId(client.getIntValue("client_id"));
fileJson.put("companyFile", companyFile); fileJson.put("companyFile", companyFile);
if (clientFiles != null && clientFiles.size() > 0) { if (clientFiles != null && !clientFiles.isEmpty()) {
for (String fileKey : fileKeys) { for (String fileKey : fileKeys) {
List<JSONObject> clientFileUrl = clientFiles.stream() List<JSONObject> clientFileUrl = clientFiles.stream()
.filter(json -> (fileKey.equals(json.getString("file_name")))) .filter(json -> (fileKey.equals(json.getString("file_name"))))
@ -3686,7 +3628,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return params; return params;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
if (clientFileUrl != null && clientFileUrl.size() > 0) { if (clientFileUrl != null && !clientFileUrl.isEmpty()) {
fileJson.put(fileKey, clientFileUrl); fileJson.put(fileKey, clientFileUrl);
} }
} }
@ -3704,7 +3646,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
List<JSONObject> clientFiles = clientFilesMapper.findAllClientFile(client.getIntValue("client_id")); List<JSONObject> clientFiles = clientFilesMapper.findAllClientFile(client.getIntValue("client_id"));
JSONObject fileJson = new JSONObject(); JSONObject fileJson = new JSONObject();
if (clientFiles != null && clientFiles.size() > 0) { if (clientFiles != null && !clientFiles.isEmpty()) {
for (String fileKey : fileKeys) { for (String fileKey : fileKeys) {
List<JSONObject> clientFileUrl = clientFiles.stream() List<JSONObject> clientFileUrl = clientFiles.stream()
.filter(json -> (fileKey.equals(json.getString("file_name")))) .filter(json -> (fileKey.equals(json.getString("file_name"))))
@ -3717,7 +3659,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return params; return params;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
if (clientFileUrl != null && clientFileUrl.size() > 0) { if (clientFileUrl != null && !clientFileUrl.isEmpty()) {
fileJson.put(fileKey, clientFileUrl); fileJson.put(fileKey, clientFileUrl);
} }
} }
@ -3929,7 +3871,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
List<JSONObject> clientAllAuthFiles = clientFilesMapper.findAllClientFile(client.getIntValue("client_id")); List<JSONObject> clientAllAuthFiles = clientFilesMapper.findAllClientFile(client.getIntValue("client_id"));
if (clientAllAuthFiles == null || clientAllAuthFiles.size() == 0) { if (clientAllAuthFiles == null || clientAllAuthFiles.isEmpty()) {
throw new BadRequestException("Please check the information is uploaded completely"); throw new BadRequestException("Please check the information is uploaded completely");
} }
String[] fileKeys = {"client_bank_file", "client_company_file", "client_id_file", "client_agree_file"}; String[] fileKeys = {"client_bank_file", "client_company_file", "client_id_file", "client_agree_file"};
@ -4009,26 +3951,26 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (weChatRate == null) { if (weChatRate == null) {
throw new BadRequestException("The Partner's Rate is not config!"); throw new BadRequestException("The Partner's Rate is not config!");
} }
client.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
client.put("clean", "T+" + weChatRate.getString("clean_days")); client.put("clean", "T+" + weChatRate.getString("clean_days"));
client.put("clean_days", weChatRate.getString("clean_days")); client.put("clean_days", weChatRate.getString("clean_days"));
String rateConfig = sysConfigManager.getSysConfig().getString("sys_rates"); String rateConfig = sysConfigManager.getSysConfig().getString("sys_rates");
JSONObject sysConfigRate = JSONObject.parseObject(rateConfig); JSONObject sysConfigRate = JSON.parseObject(rateConfig);
try { try {
JSONObject alipayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Alipay"); JSONObject alipayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Alipay");
if (alipayRate != null) { if (alipayRate != null) {
client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
} }
JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline"); JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline");
if (alipayOnlineRate != null) { if (alipayOnlineRate != null) {
client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
} }
JSONObject cbBankPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "CB_BankPay"); JSONObject cbBankPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "CB_BankPay");
if (cbBankPayRate != null) { if (cbBankPayRate != null) {
client.put("cbbank_rate", cbBankPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); client.put("cbbank_rate", cbBankPayRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
} }
} catch (Exception ignored) { } catch (Exception ignored) {
throw new BadRequestException("Merchant Rate Not Configure,Please Contact Customer Service"); throw new BadRequestException("Merchant Rate Not Configure,Please Contact Customer Service");
@ -4091,14 +4033,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
new PageBounds(query.getPage(), query.getLimit(), Order.formString("clearing_time.desc"))); new PageBounds(query.getPage(), query.getLimit(), Order.formString("clearing_time.desc")));
JSONObject result = PageListUtils.buildPageListResult(logs); JSONObject result = PageListUtils.buildPageListResult(logs);
if (query.getPage() == 1) { if (query.getPage() == 1) {
if (!logs.isEmpty() && logs.size() > 0) { if (!logs.isEmpty()) {
JSONObject clearingDetail = clearingDetailMapper.findByDetailId(logs.get(0).getIntValue("clear_detail_id")); JSONObject clearingDetail = clearingDetailMapper.findByDetailId(logs.get(0).getIntValue("clear_detail_id"));
if (clearingDetail != null) { if (clearingDetail != null) {
JSONObject clearingLog = clearingLogMapper.findById(clearingDetail.getIntValue("clearing_id")); JSONObject clearingLog = clearingLogMapper.findById(clearingDetail.getIntValue("clearing_id"));
if (clearingLog.getBooleanValue("editable")) { if (clearingLog.getBooleanValue("editable")) {
result.put("padding", true); result.put("padding", true);
logs.get(0).put("padding", true); logs.get(0).put("padding", true);
logger.info("##editable" + clearingLog.getBooleanValue("editable")); logger.info("##editable{}", clearingLog.getBooleanValue("editable"));
} }
} }
} }
@ -4146,7 +4088,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for (int i = 0; i < childs.size(); i++) { for (int i = 0; i < childs.size(); i++) {
params.put("client_id", childs.get(i).getInteger("client_id")); params.put("client_id", childs.get(i).getInteger("client_id"));
PageList<JSONObject> childLogs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), 10000, Order.formString("clearing_time.desc"))); PageList<JSONObject> childLogs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), 10000, Order.formString("clearing_time.desc")));
if (childLogs.size() > 0) { if (!childLogs.isEmpty()) {
addSheet(i + 1, workbook, childs.get(i), childLogs); addSheet(i + 1, workbook, childs.get(i), childLogs);
} }
} }
@ -4244,9 +4186,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
HSSFRichTextString text0 = new HSSFRichTextString(client.getString("short_name")); HSSFRichTextString text0 = new HSSFRichTextString(client.getString("short_name"));
HSSFRichTextString text1 = new HSSFRichTextString(client.getString("client_moniker")); HSSFRichTextString text1 = new HSSFRichTextString(client.getString("client_moniker"));
HSSFRichTextString text2 = new HSSFRichTextString(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dataItem.getDate("report_date"))); HSSFRichTextString text2 = new HSSFRichTextString(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dataItem.getDate("report_date")));
HSSFRichTextString text3 = new HSSFRichTextString(dataItem.getBigDecimal("total").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString()); HSSFRichTextString text3 = new HSSFRichTextString(dataItem.getBigDecimal("total").setScale(2, RoundingMode.HALF_DOWN).toString());
HSSFRichTextString text4 = new HSSFRichTextString(dataItem.getBigDecimal("income").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString()); HSSFRichTextString text4 = new HSSFRichTextString(dataItem.getBigDecimal("income").setScale(2, RoundingMode.HALF_DOWN).toString());
HSSFRichTextString text5 = new HSSFRichTextString(dataItem.getBigDecimal("fee").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString()); HSSFRichTextString text5 = new HSSFRichTextString(dataItem.getBigDecimal("fee").setScale(2, RoundingMode.HALF_DOWN).toString());
cell0.setCellValue(text0); cell0.setCellValue(text0);
cell1.setCellValue(text1); cell1.setCellValue(text1);
cell2.setCellValue(text2); cell2.setCellValue(text2);
@ -4391,11 +4333,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
public void updateAggregateFilesForWaitCompliance(JSONObject manager, int clientId, String fileType, String fileValue, List<JSONObject> fileResult) { public void updateAggregateFilesForWaitCompliance(JSONObject manager, int clientId, String fileType, String fileValue, List<JSONObject> fileResult) {
if (fileValue != null) { if (fileValue != null) {
List<JSONObject> passAggregateFiles = clientFilesMapper.findClientPassAggreeFile(clientId); List<JSONObject> passAggregateFiles = clientFilesMapper.findClientPassAggreeFile(clientId);
if (passAggregateFiles != null && passAggregateFiles.size() > 0) { if (passAggregateFiles != null && !passAggregateFiles.isEmpty()) {
throw new BadRequestException("合同已提交或审核通过,请勿重复签订合同"); throw new BadRequestException("合同已提交或审核通过,请勿重复签订合同");
} }
List<JSONObject> aggregateFiles = clientFilesMapper.findClientAggreeFileCommit(clientId); List<JSONObject> aggregateFiles = clientFilesMapper.findClientAggreeFileCommit(clientId);
if (aggregateFiles != null && aggregateFiles.size() > 0) { if (aggregateFiles != null && !aggregateFiles.isEmpty()) {
clientFilesMapper.deleteAggreeByClientId(clientId); clientFilesMapper.deleteAggreeByClientId(clientId);
} }
String signatureAccountId = StringUtils.isNotBlank("account_id") ? manager.getString("account_id") : manager.getString("manager_id"); String signatureAccountId = StringUtils.isNotBlank("account_id") ? manager.getString("account_id") : manager.getString("manager_id");
@ -4582,12 +4524,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(clientId); JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(clientId);
JSONObject cardFlow = new JSONObject() {{ JSONObject cardFlow = JsonHelper.newJson(json -> {
put("client_id", clientId); json.put("client_id", clientId);
put("upay_approve_result", 4); json.put("upay_approve_result", 4);
put("upay_open_status", 1); json.put("upay_open_status", 1);
put("upay_approve_time", new Date()); json.put("upay_approve_time", new Date());
}}; });
sysClientUpayProfileMapper.update(cardFlow); sysClientUpayProfileMapper.update(cardFlow);
saveClientAuditProcess(client.getIntValue("client_id"), null, 1, "提交Card Payment Compliance制作合同", manager, 2); saveClientAuditProcess(client.getIntValue("client_id"), null, 1, "提交Card Payment Compliance制作合同", manager, 2);
} }
@ -5017,12 +4959,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
public void updateAppClient(JSONObject account, int clientId, AppClientBean appClientBean) { public void updateAppClient(JSONObject account, int clientId, AppClientBean appClientBean) {
JSONObject client = getClientInfo(clientId); JSONObject client = getClientInfo(clientId);
JSONObject updateObj = appClientBean.updateObject(); JSONObject updateObj = appClientBean.updateObject();
if (updateObj.size() > 0) { if (!updateObj.isEmpty()) {
updateObj.put("client_id", clientId); updateObj.put("client_id", clientId);
clientMapper.update(updateObj); clientMapper.update(updateObj);
} }
JSONObject clientLegal = appClientBean.legalObject(); JSONObject clientLegal = appClientBean.legalObject();
if (clientLegal.size() > 0) { if (!clientLegal.isEmpty()) {
clientLegal.put("client_id", clientId); clientLegal.put("client_id", clientId);
JSONObject oldClienetLegal = sysClientLegalPersonMapper.findRepresentativeInfo(clientId); JSONObject oldClienetLegal = sysClientLegalPersonMapper.findRepresentativeInfo(clientId);
if (oldClienetLegal == null) { if (oldClienetLegal == null) {
@ -5221,7 +5163,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private void sendMessagetoCompliance(JSONObject client, String bd_user_name) { private void sendMessagetoCompliance(JSONObject client, String bd_user_name) {
List<JSONObject> complianceList = managerMapper.getOnlyCompliance(); List<JSONObject> complianceList = managerMapper.getOnlyCompliance();
if (complianceList != null && complianceList.size() > 0) { if (complianceList != null && !complianceList.isEmpty()) {
for (JSONObject compliance : complianceList) { for (JSONObject compliance : complianceList) {
String wxopenid = compliance.getString("wx_openid"); String wxopenid = compliance.getString("wx_openid");
String loginUrl = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat"); String loginUrl = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat");
@ -5313,7 +5255,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private void sendAgreeFileMsgtoCompliance(JSONObject client, String bd_user_name) { private void sendAgreeFileMsgtoCompliance(JSONObject client, String bd_user_name) {
List<JSONObject> complianceList = managerMapper.getOnlyCompliance(); List<JSONObject> complianceList = managerMapper.getOnlyCompliance();
if (complianceList != null && complianceList.size() > 0) { if (complianceList != null && !complianceList.isEmpty()) {
for (JSONObject compliance : complianceList) { for (JSONObject compliance : complianceList) {
String wxopenid = compliance.getString("wx_openid"); String wxopenid = compliance.getString("wx_openid");
String loginUrl = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat"); String loginUrl = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat");
@ -5346,7 +5288,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private void sendGreenChannelMessagetoCompliance(JSONObject client, String bd_user_name) { private void sendGreenChannelMessagetoCompliance(JSONObject client, String bd_user_name) {
List<JSONObject> complianceList = managerMapper.getOnlyCompliance(); List<JSONObject> complianceList = managerMapper.getOnlyCompliance();
if (complianceList != null && complianceList.size() > 0) { if (complianceList != null && !complianceList.isEmpty()) {
for (JSONObject compliance : complianceList) { for (JSONObject compliance : complianceList) {
String wxopenid = compliance.getString("wx_openid"); String wxopenid = compliance.getString("wx_openid");
String loginUrl = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat"); String loginUrl = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/manager_signin_wechat");
@ -5424,7 +5366,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client.getIntValue("open_status") == 1) { if (client.getIntValue("open_status") == 1) {
List<JSONObject> complianceList = managerMapper.getOnlyCompliance(); List<JSONObject> complianceList = managerMapper.getOnlyCompliance();
if (complianceList != null && complianceList.size() > 0) { if (complianceList != null && !complianceList.isEmpty()) {
for (JSONObject compliance : complianceList) { for (JSONObject compliance : complianceList) {
String wxopenid = compliance.getString("wx_openid"); String wxopenid = compliance.getString("wx_openid");
try { try {
@ -5465,7 +5407,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
bd_user_name = "自助开通商户"; bd_user_name = "自助开通商户";
} }
List<JSONObject> complianceList = managerMapper.getOnlyCompliance(); List<JSONObject> complianceList = managerMapper.getOnlyCompliance();
if (complianceList != null && complianceList.size() > 0) { if (complianceList != null && !complianceList.isEmpty()) {
for (JSONObject compliance : complianceList) { for (JSONObject compliance : complianceList) {
String wxopenid = compliance.getString("wx_openid"); String wxopenid = compliance.getString("wx_openid");
try { try {
@ -5503,7 +5445,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client.getIntValue("open_status") == 10) { if (client.getIntValue("open_status") == 10) {
List<JSONObject> complianceList = managerMapper.getOnlyCompliance(); List<JSONObject> complianceList = managerMapper.getOnlyCompliance();
if (complianceList != null && complianceList.size() > 0) { if (complianceList != null && !complianceList.isEmpty()) {
for (JSONObject compliance : complianceList) { for (JSONObject compliance : complianceList) {
String wxopenid = compliance.getString("wx_openid"); String wxopenid = compliance.getString("wx_openid");
try { try {
@ -5532,7 +5474,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
if (cardFlowInfo.getIntValue("upay_open_status") == 1) { if (cardFlowInfo.getIntValue("upay_open_status") == 1) {
List<JSONObject> complianceList = managerMapper.getOnlyCompliance(); List<JSONObject> complianceList = managerMapper.getOnlyCompliance();
if (complianceList != null && complianceList.size() > 0) { if (complianceList != null && !complianceList.isEmpty()) {
for (JSONObject compliance : complianceList) { for (JSONObject compliance : complianceList) {
String wxopenid = compliance.getString("wx_openid"); String wxopenid = compliance.getString("wx_openid");
try { try {
@ -5573,7 +5515,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
bd_user_name = "自助开通商户"; bd_user_name = "自助开通商户";
} }
List<JSONObject> complianceList = managerMapper.getOnlyCompliance(); List<JSONObject> complianceList = managerMapper.getOnlyCompliance();
if (complianceList != null && complianceList.size() > 0) { if (complianceList != null && !complianceList.isEmpty()) {
for (JSONObject compliance : complianceList) { for (JSONObject compliance : complianceList) {
String wxopenid = compliance.getString("wx_openid"); String wxopenid = compliance.getString("wx_openid");
try { try {
@ -5905,7 +5847,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
List<JSONObject> listByshortName = sysRpayMerchantApplyMapper.listByShortName(merchantInfo.getString("company_shortname")); List<JSONObject> listByshortName = sysRpayMerchantApplyMapper.listByShortName(merchantInfo.getString("company_shortname"));
if (listByshortName.size() > 0) { if (!listByshortName.isEmpty()) {
throw new BadRequestException("请修改【" + clientMoniker + "】的Company shortName信息Short Name 已被使用)"); throw new BadRequestException("请修改【" + clientMoniker + "】的Company shortName信息Short Name 已被使用)");
} }
if (client.getString("rpay_enterprise_id") != null) { if (client.getString("rpay_enterprise_id") != null) {
@ -6555,7 +6497,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
} }
String path = paymentConfig.getString("path"); String path = paymentConfig.getString("path");
path = path.replaceAll("app", "pc"); path = path.replace("app", "pc");
response.sendRedirect(String.format(PlatformEnvironment.getEnv().concatUrl(path), clientMoniker)); response.sendRedirect(String.format(PlatformEnvironment.getEnv().concatUrl(path), clientMoniker));
} }
@ -6600,7 +6542,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
logger.error("合同制作出现问题:", e); logger.error("合同制作出现问题:", e);
throw new BadRequestException("合同制作出现问题:" + e.getMessage()); throw new BadRequestException("合同制作出现问题:" + e.getMessage());
} finally { } finally {
stream.close(); if (stream != null) {
try {
stream.close();
} catch (IOException e) {
}
}
} }
return result; return result;
} }
@ -6684,10 +6631,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
} }
incrementalChannels.remove("system"); incrementalChannels.remove("system");
return new JSONObject() {{ return JsonHelper.newJson(json -> {
put("all_service", service); json.put("all_service", service);
put("incremental_channel", incrementalChannels); json.put("incremental_channel", incrementalChannels);
}}; });
} }
@Override @Override
@ -6812,10 +6759,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
public JSONObject findByLookupCode(String code) { public JSONObject findByLookupCode(String code) {
JSONObject industryInfo = industryLookupMapper.findByLookupCode(code); JSONObject industryInfo = industryLookupMapper.findByLookupCode(code);
if (industryInfo == null) { if (industryInfo == null) {
return new JSONObject() {{ return JsonHelper.newJson(json -> {
put("lookup_code", "code"); json.put("lookup_code", "code");
put("lookup_value", "未知行业"); json.put("lookup_value", "未知行业");
}}; });
} }
return industryInfo; return industryInfo;
} }
@ -6900,10 +6847,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientIds.add(p.getString("client_id")); clientIds.add(p.getString("client_id"));
if (mchConfig.getBooleanValue("level3_mch_config")) { if (mchConfig.getBooleanValue("level3_mch_config")) {
List<JSONObject> clients = clientMapper.listChildClients(p.getIntValue("client_id")); List<JSONObject> clients = clientMapper.listChildClients(p.getIntValue("client_id"));
if (clients.size() > 0) { if (!clients.isEmpty()) {
clients.forEach(e -> { clients.forEach(e -> clientIds.add(e.getString("client_id")));
clientIds.add(e.getString("client_id"));
});
} }
} }
}); });
@ -6961,7 +6906,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
JSONObject extParmas = JSONObject.parseObject(client.getString("ext_params")); JSONObject extParmas = JSON.parseObject(client.getString("ext_params"));
if ("true".equals(params.getString("value")) || "false".equals(params.getString("value"))) { if ("true".equals(params.getString("value")) || "false".equals(params.getString("value"))) {
extParmas.put(params.getString("key"), params.getBoolean("value")); extParmas.put(params.getString("key"), params.getBoolean("value"));
} else { } else {
@ -7126,7 +7071,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
info.put("partner_bussiness_name", client.getString("business_name"));//商户商用名称 info.put("partner_bussiness_name", client.getString("business_name"));//商户商用名称
info.put("legal_bussiness", legalInfo.getString("representative_person") + " AS " + (client.containsKey("business_name") ? client.getString("business_name") : legalInfo.getString("representative_person")) + " ABN " + client.getString("abn"));//拼接规则:法人名 AS 商用名称 ABD 编码 info.put("legal_bussiness", legalInfo.getString("representative_person") + " AS " + (client.containsKey("business_name") ? client.getString("business_name") : legalInfo.getString("representative_person")) + " ABN " + client.getString("abn"));//拼接规则:法人名 AS 商用名称 ABD 编码
info.put("domestic_fee", cardRate.getString("domestic_rate_value"));//国内服务费 info.put("domestic_fee", cardRate.getString("domestic_rate_value"));//国内服务费
info.put("international_fee", upayProfileInfo.getBoolean("enable_international_card") ? cardRate.getString("overseas_rate_value") : "-");//国际服务费 info.put("international_fee", upayProfileInfo.getBooleanValue("enable_international_card") ? cardRate.getString("overseas_rate_value") : "-");//国际服务费
info.put("promotional_effective_date", formatter.print(currentRate.getDate("active_time").getTime())); info.put("promotional_effective_date", formatter.print(currentRate.getDate("active_time").getTime()));
info.put("promotional_period", formatter.print(currentRate.getDate("expiry_time").getTime())); info.put("promotional_period", formatter.print(currentRate.getDate("expiry_time").getTime()));
return info; return info;

@ -91,15 +91,15 @@ public class NoticeInfo {
} }
if (button2 != null) { if (button2 != null) {
JSONObject buttonJson = JSON.parseObject(button2); JSONObject buttonJson = JSON.parseObject(button2);
if (StringUtils.isNotBlank(buttonJson.getString("name")) && StringUtils.isNotBlank(buttonJson.getString("type"))) { if (StringUtils.isNotBlank(buttonJson.getString("name")) && StringUtils.isNotBlank(buttonJson.getString("type"))) {
buttons.add(buttonJson); buttons.add(buttonJson);
} }
} }
if (buttons.size() > 0 ) { if (!buttons.isEmpty()) {
res.put("buttons",buttons); res.put("buttons", buttons);
} }
if (aggregate_file != null) { if (aggregate_file != null) {
res.put("aggregate_file",aggregate_file); res.put("aggregate_file", aggregate_file);
} }
if (url != null) { if (url != null) {
res.put("url",url); res.put("url",url);

@ -125,7 +125,7 @@ public class MailServiceImp implements MailService {
noticeBean.setNotice_id(notice_id); noticeBean.setNotice_id(notice_id);
noticeBean.setMailClients(mailToWithoutUnsub); noticeBean.setMailClients(mailToWithoutUnsub);
noticeBean.setContent(doc.outerHtml()); noticeBean.setContent(doc.outerHtml());
if (files.size() > 0) { if (!files.isEmpty()) {
noticeBean.setFiles(files.toString()); noticeBean.setFiles(files.toString());
} }
JSONObject sysConfig = sysConfigManager.getSysConfig(); JSONObject sysConfig = sysConfigManager.getSysConfig();

@ -13,12 +13,10 @@ import au.com.royalpay.payment.manage.notice.core.NoticeManage;
import au.com.royalpay.payment.manage.system.core.MailGunService; import au.com.royalpay.payment.manage.system.core.MailGunService;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -27,14 +25,13 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.annotation.Resource;
/** /**
* Created by yishuqian on 28/09/2016. * Created by yishuqian on 28/09/2016.
*/ */
@ -73,7 +70,7 @@ public class NoticeManageImpl implements NoticeManage {
if (notice.getIntValue("type") == 2) { if (notice.getIntValue("type") == 2) {
if (notice.get("buttons") != null) { if (notice.get("buttons") != null) {
List<JSONObject> buttons = JSONObject.parseArray(notice.getString("buttons"), JSONObject.class); List<JSONObject> buttons = JSONObject.parseArray(notice.getString("buttons"), JSONObject.class);
if (buttons != null && buttons.size() > 0) { if (buttons != null && !buttons.isEmpty()) {
for (int i = 0; i < buttons.size(); i++) { for (int i = 0; i < buttons.size(); i++) {
notice.put("button" + i, buttons.get(i)); notice.put("button" + i, buttons.get(i));
} }
@ -156,7 +153,7 @@ public class NoticeManageImpl implements NoticeManage {
if (notice.getIntValue("type") == 2) { if (notice.getIntValue("type") == 2) {
if (notice.get("buttons") != null) { if (notice.get("buttons") != null) {
List<JSONObject> buttons = JSONObject.parseArray(notice.getString("buttons"), JSONObject.class); List<JSONObject> buttons = JSONObject.parseArray(notice.getString("buttons"), JSONObject.class);
if (buttons != null && buttons.size() > 0) { if (buttons != null && !buttons.isEmpty()) {
for (int i = 0; i < buttons.size(); i++) { for (int i = 0; i < buttons.size(); i++) {
notice.put("button" + i, buttons.get(i)); notice.put("button" + i, buttons.get(i));
} }

@ -3,20 +3,17 @@ package au.com.royalpay.payment.manage.notice.core.impls;
import au.com.royalpay.payment.manage.mappers.notice.NoticePartnerMapper; import au.com.royalpay.payment.manage.mappers.notice.NoticePartnerMapper;
import au.com.royalpay.payment.manage.notice.core.NoticePartner; import au.com.royalpay.payment.manage.notice.core.NoticePartner;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.annotation.Resource;
/** /**
* Created by yishuqian on 29/09/2016. * Created by yishuqian on 29/09/2016.
*/ */
@ -54,13 +51,13 @@ public class NoticePartnerImpl implements NoticePartner {
params.put("client_id",partner.getIntValue("client_id")); params.put("client_id",partner.getIntValue("client_id"));
params.put("notice_id",noticeId); params.put("notice_id",noticeId);
List<JSONObject> partnerNotices = noticePartnerMapper.listNoticePartner(params); List<JSONObject> partnerNotices = noticePartnerMapper.listNoticePartner(params);
if (!partnerNotices.isEmpty() && partnerNotices.size()>0){ if (!partnerNotices.isEmpty()) {
JSONObject noticePartner = partnerNotices.get(0); JSONObject noticePartner = partnerNotices.get(0);
noticePartner.put("status",'1'); noticePartner.put("status", '1');
noticePartner.put("read_id",partner.getString("account_id")); noticePartner.put("read_id", partner.getString("account_id"));
noticePartner.put("read_time",new Date()); noticePartner.put("read_time", new Date());
noticePartnerMapper.update(noticePartner); noticePartnerMapper.update(noticePartner);
}else { } else {
throw new Exception("there is no notice for the noticeId"); throw new Exception("there is no notice for the noticeId");
} }
} }

@ -1,7 +1,7 @@
package au.com.royalpay.payment.manage.openim.core; package au.com.royalpay.payment.manage.openim.core;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException; import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.taobao.api.ApiException; import com.taobao.api.ApiException;
import com.taobao.api.DefaultTaobaoClient; import com.taobao.api.DefaultTaobaoClient;
@ -15,7 +15,6 @@ import com.taobao.api.response.OpenimCustmsgPushResponse;
import com.taobao.api.response.OpenimUsersAddResponse; import com.taobao.api.response.OpenimUsersAddResponse;
import com.taobao.api.response.OpenimUsersGetResponse; import com.taobao.api.response.OpenimUsersGetResponse;
import com.taobao.api.response.OpenimUsersUpdateResponse; import com.taobao.api.response.OpenimUsersUpdateResponse;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -47,7 +46,7 @@ public class OpenimClient {
} catch (ApiException e) { } catch (ApiException e) {
logger.info("openim get user fail", e); logger.info("openim get user fail", e);
} }
JSONObject openInfo = JSONObject.parseObject(rsp.getBody()); JSONObject openInfo = JSON.parseObject(rsp.getBody());
if (openInfo.getJSONObject("openim_users_get_response").getJSONObject("userinfos").size() < 1) { if (openInfo.getJSONObject("openim_users_get_response").getJSONObject("userinfos").size() < 1) {
return null; return null;
} }
@ -64,9 +63,9 @@ public class OpenimClient {
} catch (ApiException e) { } catch (ApiException e) {
logger.info("openim add user fail", e); logger.info("openim add user fail", e);
} }
JSONObject result = JSONObject.parseObject(rsp.getBody()); JSONObject result = JSON.parseObject(rsp.getBody());
JSONObject failMsg = result.getJSONObject("openim_users_add_response").getJSONObject("fail_msg"); JSONObject failMsg = result.getJSONObject("openim_users_add_response").getJSONObject("fail_msg");
if (failMsg.size() > 0) { if (!failMsg.isEmpty()) {
if ("data exist".equals(failMsg.getJSONArray("string").get(0))) { if ("data exist".equals(failMsg.getJSONArray("string").get(0))) {
return; return;
} }
@ -85,7 +84,7 @@ public class OpenimClient {
} catch (ApiException e) { } catch (ApiException e) {
logger.info("openim update user fail", e); logger.info("openim update user fail", e);
} }
JSONObject result = JSONObject.parseObject(rsp.getBody()); JSONObject result = JSON.parseObject(rsp.getBody());
if (result.getJSONObject("openim_users_update_response").getJSONObject("fail_msg").size() > 0) { if (result.getJSONObject("openim_users_update_response").getJSONObject("fail_msg").size() > 0) {
logger.info("openim update user fail reason:" logger.info("openim update user fail reason:"
+ result.getJSONObject("openim_users_update_response").getJSONObject("fail_msg").getJSONArray("string").toJSONString()); + result.getJSONObject("openim_users_update_response").getJSONObject("fail_msg").getJSONArray("string").toJSONString());
@ -103,7 +102,7 @@ public class OpenimClient {
} catch (ApiException e) { } catch (ApiException e) {
logger.info("openim push msg fail", e); logger.info("openim push msg fail", e);
} }
JSONObject result = JSONObject.parseObject(rsp.getBody()); JSONObject result = JSON.parseObject(rsp.getBody());
if (result.getJSONObject("openim_custmsg_push_response").getJSONObject("fail_msg").size() > 0) { if (result.getJSONObject("openim_custmsg_push_response").getJSONObject("fail_msg").size() > 0) {
logger.info("openim push message fail reason:" logger.info("openim push message fail reason:"
+ result.getJSONObject("openim_custmsg_push_response").getJSONObject("fail_msg").getJSONArray("string").toJSONString()); + result.getJSONObject("openim_custmsg_push_response").getJSONObject("fail_msg").getJSONArray("string").toJSONString());

@ -13,9 +13,8 @@ import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException; import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -26,13 +25,8 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*;
/** /**
* @author kira * @author kira
@ -173,7 +167,7 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
for (int i = 0; i < ops.size(); i++) { for (int i = 0; i < ops.size(); i++) {
String jStr = ops.index(i); String jStr = ops.index(i);
if (jStr.contains(uid)) { if (jStr.contains(uid)) {
JSONObject record = JSONObject.parseObject(jStr); JSONObject record = JSON.parseObject(jStr);
record.put("unreadMsg", record.getIntValue("unreadMsg") + 1); record.put("unreadMsg", record.getIntValue("unreadMsg") + 1);
ops.set(i, record.toJSONString()); ops.set(i, record.toJSONString());
return; return;
@ -197,7 +191,7 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
int unreadMsg = 0; int unreadMsg = 0;
for (int i = 0; i < ops.size(); i++) { for (int i = 0; i < ops.size(); i++) {
clients++; clients++;
unreadMsg += JSONObject.parseObject(ops.index(i)).getIntValue("unreadMsg"); unreadMsg += JSON.parseObject(ops.index(i)).getIntValue("unreadMsg");
} }
TemplateMessage msg = initUnreadMsg(unreadMsg, clients, p.getString("wx_openid"), paymentApi.getTemplateId("commission")); TemplateMessage msg = initUnreadMsg(unreadMsg, clients, p.getString("wx_openid"), paymentApi.getTemplateId("commission"));
paymentApi.sendTemplateMessage(msg); paymentApi.sendTemplateMessage(msg);

@ -353,24 +353,24 @@ public class OrgManagerImpl implements OrgManager {
if(StringUtils.isEmpty(orgObject.getString(rateName))){ if(StringUtils.isEmpty(orgObject.getString(rateName))){
rate1.add(rateName); rate1.add(rateName);
} }
if(StringUtils.isEmpty(json.getString(rateName))){ if (StringUtils.isEmpty(json.getString(rateName))) {
rate2.add(rateName); rate2.add(rateName);
} }
if(StringUtils.isNotEmpty(orgObject.getString(rateName))&&StringUtils.isNotEmpty(json.getString(rateName))){ if (StringUtils.isNotEmpty(orgObject.getString(rateName)) && StringUtils.isNotEmpty(json.getString(rateName))) {
if(orgObject.getDouble(rateName).compareTo(json.getDouble(rateName)) > 0){ if (orgObject.getDouble(rateName).compareTo(json.getDouble(rateName)) > 0) {
rateNames += rateName +","; rateNames += rateName + ",";
} }
} }
} }
} }
if(rate1.size()>0){ if (!rate1.isEmpty()) {
throw new ForbiddenException("费率异常,请联系管理员"); throw new ForbiddenException("费率异常,请联系管理员");
} }
if(rate2.size()>0){ if (!rate2.isEmpty()) {
throw new ForbiddenException("费率输入不完整,请重新输入"); throw new ForbiddenException("费率输入不完整,请重新输入");
} }
if(!rateNames.equals("")){ if (!rateNames.equals("")) {
throw new ForbiddenException("二级组织"+rateNames+"费率参数应大于一级组织费率,请重新输入"); throw new ForbiddenException("二级组织" + rateNames + "费率参数应大于一级组织费率,请重新输入");
} }
} }
} }

@ -27,6 +27,7 @@ import org.springframework.web.util.UriComponentsBuilder;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -82,7 +83,7 @@ public class CtripCouponOnlyLogProcessor implements PaymentProcessor {
BigDecimal payFee = paymentInfo.getTotalFee(); BigDecimal payFee = paymentInfo.getTotalFee();
BigDecimal exchange = paymentApi.channelApi(paymentInfo.getChannel()).queryExchangeRateDecimal(paymentInfo.getClientId()); BigDecimal exchange = paymentApi.channelApi(paymentInfo.getChannel()).queryExchangeRateDecimal(paymentInfo.getClientId());
if (StringUtils.equals(paymentInfo.getCurrency(), "CNY")) { if (StringUtils.equals(paymentInfo.getCurrency(), "CNY")) {
payFee = CurrencyAmountUtils.scale(payFee.divide(exchange,2, BigDecimal.ROUND_HALF_UP), PlatformEnvironment.getEnv().getForeignCurrency()); payFee = CurrencyAmountUtils.scale(payFee.divide(exchange, 2, RoundingMode.HALF_UP), PlatformEnvironment.getEnv().getForeignCurrency());
} }
BigDecimal couponCondition = couponInfo.getBigDecimal("condition") == null ? BigDecimal.ZERO BigDecimal couponCondition = couponInfo.getBigDecimal("condition") == null ? BigDecimal.ZERO
: couponInfo.getBigDecimal("condition"); : couponInfo.getBigDecimal("condition");
@ -105,7 +106,7 @@ public class CtripCouponOnlyLogProcessor implements PaymentProcessor {
} }
//携程折扣 //携程折扣
if (StringUtils.equals(couponInfo.getString("type"), "32")) { if (StringUtils.equals(couponInfo.getString("type"), "32")) {
BigDecimal couponDiscount = couponInfo.getBigDecimal("discount").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_HALF_UP); BigDecimal couponDiscount = couponInfo.getBigDecimal("discount").divide(CommonConsts.HUNDRED, 4, RoundingMode.HALF_UP);
BigDecimal couponDealAmount = CurrencyAmountUtils.scale(couponDiscount.multiply(paymentInfo.getTotalFee()), PlatformEnvironment.getEnv().getForeignCurrency()); BigDecimal couponDealAmount = CurrencyAmountUtils.scale(couponDiscount.multiply(paymentInfo.getTotalFee()), PlatformEnvironment.getEnv().getForeignCurrency());
couponAccuessLog.put("coupon_deal_amount", couponDealAmount); couponAccuessLog.put("coupon_deal_amount", couponDealAmount);
} }
@ -119,7 +120,7 @@ public class CtripCouponOnlyLogProcessor implements PaymentProcessor {
JSONObject order = finishedEvent.getOrder(); JSONObject order = finishedEvent.getOrder();
String orderId = order.getString("order_id"); String orderId = order.getString("order_id");
List<JSONObject> accuessCouponLogs = payCouponAccuessLogMapper.findAccuessLogByOrderId(orderId, new PageBounds(Order.formString("last_update_date.desc"))); List<JSONObject> accuessCouponLogs = payCouponAccuessLogMapper.findAccuessLogByOrderId(orderId, new PageBounds(Order.formString("last_update_date.desc")));
if (accuessCouponLogs != null&&accuessCouponLogs.size()>0) { if (accuessCouponLogs != null && !accuessCouponLogs.isEmpty()) {
if (!isOnlyLogMerchant(order.getIntValue("client_id"))) { if (!isOnlyLogMerchant(order.getIntValue("client_id"))) {
return; return;
} }
@ -128,7 +129,7 @@ public class CtripCouponOnlyLogProcessor implements PaymentProcessor {
logger.info("订单 [" + orderId + "]成功使用Ctrip卡券=======>[" + couponLogId + "]"); logger.info("订单 [" + orderId + "]成功使用Ctrip卡券=======>[" + couponLogId + "]");
accuessCouponLog.put("is_valid", 1); accuessCouponLog.put("is_valid", 1);
accuessCouponLog.put("last_update_date", new Date()); accuessCouponLog.put("last_update_date", new Date());
accuessCouponLog.put("customer_openid",order.getString("customer_id")); accuessCouponLog.put("customer_openid", order.getString("customer_id"));
payCouponAccuessLogMapper.update(accuessCouponLog); payCouponAccuessLogMapper.update(accuessCouponLog);
} }
@ -145,14 +146,14 @@ public class CtripCouponOnlyLogProcessor implements PaymentProcessor {
JSONObject refundOrder = event.getRefundOrder(); JSONObject refundOrder = event.getRefundOrder();
String orderId = refundOrder.getString("order_id"); String orderId = refundOrder.getString("order_id");
List<JSONObject> accuessCouponLogs = payCouponAccuessLogMapper.findUsedCouponByOrderIdList(orderId); List<JSONObject> accuessCouponLogs = payCouponAccuessLogMapper.findUsedCouponByOrderIdList(orderId);
if (accuessCouponLogs != null&& accuessCouponLogs.size()>0) { if (accuessCouponLogs != null && !accuessCouponLogs.isEmpty()) {
if (!isOnlyLogMerchant(refundOrder.getIntValue("client_id"))) { if (!isOnlyLogMerchant(refundOrder.getIntValue("client_id"))) {
return; return;
} }
JSONObject accuessCouponLog = accuessCouponLogs.get(0); JSONObject accuessCouponLog = accuessCouponLogs.get(0);
accuessCouponLog.put("is_valid", 0); accuessCouponLog.put("is_valid", 0);
accuessCouponLog.put("last_update_date", new Date()); accuessCouponLog.put("last_update_date", new Date());
accuessCouponLog.put("refund_id",refundOrder.getString("refund_id")); accuessCouponLog.put("refund_id", refundOrder.getString("refund_id"));
payCouponAccuessLogMapper.update(accuessCouponLog); payCouponAccuessLogMapper.update(accuessCouponLog);
} }
} }

@ -30,6 +30,7 @@ import org.springframework.web.util.UriComponentsBuilder;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -91,7 +92,7 @@ public class CtripCouponProvideProcessor implements PaymentProcessor {
BigDecimal payFee = paymentInfo.getTotalFee(); BigDecimal payFee = paymentInfo.getTotalFee();
BigDecimal exchange = paymentApi.channelApi(paymentInfo.getChannel()).queryExchangeRateDecimal(paymentInfo.getClientId()); BigDecimal exchange = paymentApi.channelApi(paymentInfo.getChannel()).queryExchangeRateDecimal(paymentInfo.getClientId());
if (StringUtils.equals(paymentInfo.getCurrency(), "CNY")) { if (StringUtils.equals(paymentInfo.getCurrency(), "CNY")) {
payFee = CurrencyAmountUtils.scale(payFee.divide(exchange,2, BigDecimal.ROUND_HALF_UP), PlatformEnvironment.getEnv().getForeignCurrency()); payFee = CurrencyAmountUtils.scale(payFee.divide(exchange, 2, RoundingMode.HALF_UP), PlatformEnvironment.getEnv().getForeignCurrency());
} }
BigDecimal couponCondition = couponInfo.getBigDecimal("condition") == null ? BigDecimal.ZERO BigDecimal couponCondition = couponInfo.getBigDecimal("condition") == null ? BigDecimal.ZERO
: couponInfo.getBigDecimal("condition"); : couponInfo.getBigDecimal("condition");
@ -116,7 +117,7 @@ public class CtripCouponProvideProcessor implements PaymentProcessor {
} }
//携程折扣 //携程折扣
if (StringUtils.equals(couponInfo.getString("type"), "32")) { if (StringUtils.equals(couponInfo.getString("type"), "32")) {
BigDecimal couponDiscount = couponInfo.getBigDecimal("discount").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_HALF_UP); BigDecimal couponDiscount = couponInfo.getBigDecimal("discount").divide(CommonConsts.HUNDRED, 4, RoundingMode.HALF_UP);
BigDecimal couponDealAmount = CurrencyAmountUtils.scale(couponDiscount.multiply(paymentInfo.getTotalFee()), PlatformEnvironment.getEnv().getForeignCurrency()); BigDecimal couponDealAmount = CurrencyAmountUtils.scale(couponDiscount.multiply(paymentInfo.getTotalFee()), PlatformEnvironment.getEnv().getForeignCurrency());
paymentInfo.setDiscount(currentDiscount.add(couponDealAmount)); paymentInfo.setDiscount(currentDiscount.add(couponDealAmount));
couponAccuessLog.put("coupon_deal_amount", couponDealAmount); couponAccuessLog.put("coupon_deal_amount", couponDealAmount);
@ -146,7 +147,7 @@ public class CtripCouponProvideProcessor implements PaymentProcessor {
}*/ }*/
String orderId = order.getString("order_id"); String orderId = order.getString("order_id");
List<JSONObject> accuessCouponLogs = payCouponAccuessLogMapper.findAccuessLogByOrderId(orderId, new PageBounds(Order.formString("last_update_date.desc"))); List<JSONObject> accuessCouponLogs = payCouponAccuessLogMapper.findAccuessLogByOrderId(orderId, new PageBounds(Order.formString("last_update_date.desc")));
if (accuessCouponLogs != null&&accuessCouponLogs.size()>0) { if (accuessCouponLogs != null && !accuessCouponLogs.isEmpty()) {
if (isOnlyLogMerchant(order.getIntValue("client_id"))) { if (isOnlyLogMerchant(order.getIntValue("client_id"))) {
return; return;
} }
@ -203,7 +204,7 @@ public class CtripCouponProvideProcessor implements PaymentProcessor {
logger.info("积分商城携程优惠券开始退款"); logger.info("积分商城携程优惠券开始退款");
String orderId = refundOrder.getString("order_id"); String orderId = refundOrder.getString("order_id");
List<JSONObject> accuessCouponLogs = payCouponAccuessLogMapper.findUsedCouponByOrderIdList(orderId); List<JSONObject> accuessCouponLogs = payCouponAccuessLogMapper.findUsedCouponByOrderIdList(orderId);
if (accuessCouponLogs != null&& accuessCouponLogs.size()>0) { if (accuessCouponLogs != null && !accuessCouponLogs.isEmpty()) {
if (isOnlyLogMerchant(refundOrder.getIntValue("client_id"))) { if (isOnlyLogMerchant(refundOrder.getIntValue("client_id"))) {
return; return;
} }

@ -17,11 +17,9 @@ import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.RandomUtils;
@ -34,6 +32,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.Collections; import java.util.Collections;
@ -43,8 +42,6 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
/** /**
* Created by wangning on 2017/8/10. * Created by wangning on 2017/8/10.
*/ */
@ -239,7 +236,7 @@ public class ActRedPackServiceImpl implements ActRedPackService {
for (int i = 0; i < redpackCounts; i++) { for (int i = 0; i < redpackCounts; i++) {
BigDecimal amount = amountFrom.equals(amountTo) ? amountFrom BigDecimal amount = amountFrom.equals(amountTo) ? amountFrom
: amountFrom.add(BigDecimal.valueOf(RandomUtils.nextInt(0, amountTo.subtract(amountFrom).multiply(CommonConsts.HUNDRED).intValue())) : amountFrom.add(BigDecimal.valueOf(RandomUtils.nextInt(0, amountTo.subtract(amountFrom).multiply(CommonConsts.HUNDRED).intValue()))
.divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_DOWN)); .divide(CommonConsts.HUNDRED, 2, RoundingMode.DOWN));
JSONObject prize = new JSONObject(); JSONObject prize = new JSONObject();
String prefix = DateFormatUtils.format(new Date(), "yyyyMMddHHmmssSSS"); String prefix = DateFormatUtils.format(new Date(), "yyyyMMddHHmmssSSS");
String redpackOrderId = prefix + RandomStringUtils.random(28 - prefix.length(), true, true); String redpackOrderId = prefix + RandomStringUtils.random(28 - prefix.length(), true, true);

@ -7,15 +7,15 @@ import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.CustomerMapper; import au.com.royalpay.payment.manage.mappers.system.CustomerMapper;
import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery; import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.redpack.beans.ActTypeEnum; import au.com.royalpay.payment.manage.redpack.beans.ActTypeEnum;
import au.com.royalpay.payment.manage.redpack.beans.RedpackQuery; import au.com.royalpay.payment.manage.redpack.beans.RedpackQuery;
import au.com.royalpay.payment.manage.redpack.core.PartnerLMService; import au.com.royalpay.payment.manage.redpack.core.PartnerLMService;
import au.com.royalpay.payment.manage.redpack.core.RedpackService; import au.com.royalpay.payment.manage.redpack.core.RedpackService;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi; import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
import au.com.royalpay.payment.tools.connections.mpsupport.beans.WechatRedpack; import au.com.royalpay.payment.tools.connections.mpsupport.beans.WechatRedpack;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
@ -40,7 +40,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import static java.math.BigDecimal.ROUND_DOWN; import static java.math.RoundingMode.DOWN;
/** /**
* Created by yishuqian on 08/12/2016. * Created by yishuqian on 08/12/2016.
@ -141,7 +141,7 @@ public class PartnerLMServiceImp implements PartnerLMService {
params.put("status", 1); params.put("status", 1);
params.put("act_type", ActTypeEnum.partner.toString()); params.put("act_type", ActTypeEnum.partner.toString());
List<JSONObject> openList = actPartnerLMMapper.actList(params); List<JSONObject> openList = actPartnerLMMapper.actList(params);
if (!openList.isEmpty() && openList.size() > 0) { if (!openList.isEmpty()) {
throw new Exception("存在已经开启的红包返现活动,请先关闭旧的活动再开启新的活动"); throw new Exception("存在已经开启的红包返现活动,请先关闭旧的活动再开启新的活动");
} }
} }
@ -171,7 +171,7 @@ public class PartnerLMServiceImp implements PartnerLMService {
JSONObject res = actPartnerLMMapper.findOne(act_id); JSONObject res = actPartnerLMMapper.findOne(act_id);
if (res.getString("act_type").equals(ActTypeEnum.redpack.toString())) { if (res.getString("act_type").equals(ActTypeEnum.redpack.toString())) {
List<JSONObject> prize_type_list = actPrizeTypeMapper.listPrizeTypes(act_id, new PageBounds(Order.formString("rate.desc ,weight.asc"))); List<JSONObject> prize_type_list = actPrizeTypeMapper.listPrizeTypes(act_id, new PageBounds(Order.formString("rate.desc ,weight.asc")));
if (!prize_type_list.isEmpty() && prize_type_list.size() > 0) { if (!prize_type_list.isEmpty()) {
for (JSONObject prize_type : prize_type_list) { for (JSONObject prize_type : prize_type_list) {
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
params.put("red_pack_type_id", prize_type.getString("type_id")); params.put("red_pack_type_id", prize_type.getString("type_id"));
@ -182,7 +182,7 @@ public class PartnerLMServiceImp implements PartnerLMService {
} }
} }
List<JSONObject> blackList = actBlackListMapper.listByActId(act_id); List<JSONObject> blackList = actBlackListMapper.listByActId(act_id);
if (blackList != null && blackList.size() > 0) { if (blackList != null && !blackList.isEmpty()) {
String partnerCodes = ""; String partnerCodes = "";
for (JSONObject b : blackList) { for (JSONObject b : blackList) {
partnerCodes += b.getString("partner_code") + ","; partnerCodes += b.getString("partner_code") + ",";
@ -204,7 +204,7 @@ public class PartnerLMServiceImp implements PartnerLMService {
params.put("act_type", ActTypeEnum.partner.toString()); params.put("act_type", ActTypeEnum.partner.toString());
params.put("status", 1); params.put("status", 1);
List<JSONObject> actList = actPartnerLMMapper.actList(params); List<JSONObject> actList = actPartnerLMMapper.actList(params);
if (!actList.isEmpty() && actList.size() > 0) { if (!actList.isEmpty()) {
JSONObject act = actList.get(0); JSONObject act = actList.get(0);
String act_id = act.getString("act_id"); String act_id = act.getString("act_id");
BigDecimal rule_order_total = act.getBigDecimal("rule_order_total"); BigDecimal rule_order_total = act.getBigDecimal("rule_order_total");
@ -217,7 +217,7 @@ public class PartnerLMServiceImp implements PartnerLMService {
return; return;
} }
//int random = new Random().nextInt(100); //int random = new Random().nextInt(100);
int random = (int) (Math.random() * 100); int random = new Random().nextInt(100);
if (random > probability) { if (random > probability) {
return; return;
} }
@ -229,8 +229,8 @@ public class PartnerLMServiceImp implements PartnerLMService {
return; return;
} }
Double max = new BigDecimal(orderAmount).multiply(new BigDecimal(rule_order_rate)).compareTo(rule_max_lucky_money) > 0 ? Double max = new BigDecimal(orderAmount).multiply(new BigDecimal(rule_order_rate)).compareTo(rule_max_lucky_money) > 0 ?
rule_max_lucky_money.setScale(2, ROUND_DOWN).doubleValue() : rule_max_lucky_money.setScale(2, DOWN).doubleValue() :
new BigDecimal(orderAmount).multiply(new BigDecimal(rule_order_rate)).setScale(2, ROUND_DOWN).doubleValue(); new BigDecimal(orderAmount).multiply(new BigDecimal(rule_order_rate)).setScale(2, DOWN).doubleValue();
Double luckyMoney = max > 1 ? Math.random() * (max - 1) + 1 : 1; Double luckyMoney = max > 1 ? Math.random() * (max - 1) + 1 : 1;
BigDecimal nowTotal = actPartnerLMLogMapper.getTotalLuckyMoney(act_id); BigDecimal nowTotal = actPartnerLMLogMapper.getTotalLuckyMoney(act_id);
@ -244,7 +244,7 @@ public class PartnerLMServiceImp implements PartnerLMService {
relationParams.put("client_id", client_id); relationParams.put("client_id", client_id);
relationParams.put("channel", "Wechat"); relationParams.put("channel", "Wechat");
List<JSONObject> relationList = actPartnerWechatRelationMapper.relationList(relationParams); List<JSONObject> relationList = actPartnerWechatRelationMapper.relationList(relationParams);
if (!relationList.isEmpty() && relationList.size() > 0) { if (!relationList.isEmpty()) {
int accountSize = relationList.size(); int accountSize = relationList.size();
int randomAccount = new Random().nextInt(accountSize); int randomAccount = new Random().nextInt(accountSize);
String open_id = relationList.get(randomAccount).getString("customer_id"); String open_id = relationList.get(randomAccount).getString("customer_id");
@ -274,7 +274,7 @@ public class PartnerLMServiceImp implements PartnerLMService {
} }
String rpOpenId = customerRelation.getString(redpackApi.getOpenIdKey()); String rpOpenId = customerRelation.getString(redpackApi.getOpenIdKey());
wechatRedpack.setSendName(sendName).setOpenId(rpOpenId).setActName(actName) wechatRedpack.setSendName(sendName).setOpenId(rpOpenId).setActName(actName)
.setRemark("商家激励计划").setAmount(new BigDecimal(luckyMoney).setScale(2, ROUND_DOWN)).setWishing(wishing).setNotifyUrl(notifyUrl); .setRemark("商家激励计划").setAmount(new BigDecimal(luckyMoney).setScale(2, DOWN)).setWishing(wishing).setNotifyUrl(notifyUrl);
String redPacketId = redpackApi.sendRedpack(wechatRedpack).getString("out_biz_no"); String redPacketId = redpackApi.sendRedpack(wechatRedpack).getString("out_biz_no");
send.put("red_packet_id", redPacketId); send.put("red_packet_id", redPacketId);
actPartnerLMLogMapper.saveLog(send); actPartnerLMLogMapper.saveLog(send);
@ -327,10 +327,10 @@ public class PartnerLMServiceImp implements PartnerLMService {
params.remove("customer_id"); params.remove("customer_id");
params.put("client_id", client.getIntValue("client_id")); params.put("client_id", client.getIntValue("client_id"));
List<JSONObject> partnerBinds = actPartnerWechatRelationMapper.relationList(params); List<JSONObject> partnerBinds = actPartnerWechatRelationMapper.relationList(params);
if (!relList.isEmpty() && relList.size() > 0) { if (!relList.isEmpty()) {
throw new Exception("You have bind your wechat account !"); throw new Exception("You have bind your wechat account !");
} }
if (!partnerBinds.isEmpty() && partnerBinds.size() > 0) { if (!partnerBinds.isEmpty()) {
throw new Exception("The merchant has been bind by other wechat!"); throw new Exception("The merchant has been bind by other wechat!");
} }
// JSONObject updateObj = new JSONObject(); // JSONObject updateObj = new JSONObject();
@ -371,10 +371,10 @@ public class PartnerLMServiceImp implements PartnerLMService {
params.remove("customer_id"); params.remove("customer_id");
params.put("client_id", client.getIntValue("client_id")); params.put("client_id", client.getIntValue("client_id"));
List<JSONObject> partnerBinds = actPartnerWechatRelationMapper.relationList(params); List<JSONObject> partnerBinds = actPartnerWechatRelationMapper.relationList(params);
if (!relList.isEmpty() && relList.size() > 0) { if (!relList.isEmpty()) {
throw new Exception("You have bind your alipay account !"); throw new Exception("You have bind your alipay account !");
} }
if (!partnerBinds.isEmpty() && partnerBinds.size() > 0) { if (!partnerBinds.isEmpty()) {
throw new Exception("The merchant has been bind by other alipay!"); throw new Exception("The merchant has been bind by other alipay!");
} }
JSONObject relation = new JSONObject(); JSONObject relation = new JSONObject();
@ -444,7 +444,7 @@ public class PartnerLMServiceImp implements PartnerLMService {
params.put("customer_id", customerId); params.put("customer_id", customerId);
params.put("channel", channel); params.put("channel", channel);
List<JSONObject> wechatBinds = actPartnerWechatRelationMapper.relationList(params); List<JSONObject> wechatBinds = actPartnerWechatRelationMapper.relationList(params);
if (!partnerBinds.isEmpty() && partnerBinds.size() > 0) { if (!partnerBinds.isEmpty()) {
JSONObject partnerBind = partnerBinds.get(0); JSONObject partnerBind = partnerBinds.get(0);
if (partnerBinds.get(0).getString("customer_id").equals(customerId)) { if (partnerBinds.get(0).getString("customer_id").equals(customerId)) {
res.put("status", 3); res.put("status", 3);
@ -454,7 +454,7 @@ public class PartnerLMServiceImp implements PartnerLMService {
} }
} else { } else {
res.put("status", 0); res.put("status", 0);
if (!wechatBinds.isEmpty() && wechatBinds.size() > 0) { if (!wechatBinds.isEmpty()) {
res.put("status", 2); res.put("status", 2);
} }
} }

@ -31,6 +31,7 @@ import org.springframework.util.Assert;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -153,7 +154,7 @@ public class RedpackServiceImpl implements RedpackService {
int min = CurrencyAmountUtils.toCent(config.getBigDecimal("min_amount"), "CNY"); int min = CurrencyAmountUtils.toCent(config.getBigDecimal("min_amount"), "CNY");
int max = CurrencyAmountUtils.toCent(config.getBigDecimal("max_amount"), "CNY"); int max = CurrencyAmountUtils.toCent(config.getBigDecimal("max_amount"), "CNY");
int amount = min == max ? min : RandomUtils.nextInt(0,max - min) + min; int amount = min == max ? min : RandomUtils.nextInt(0, max - min) + min;
WechatRedpack wechatRedpack = new WechatRedpack(); WechatRedpack wechatRedpack = new WechatRedpack();
JSONObject customerRelation = customerMapper.findCustomerByOpenId(openId); JSONObject customerRelation = customerMapper.findCustomerByOpenId(openId);
MpWechatApi redpackApi = mpWechatApiProvider.getApi("Redpack"); MpWechatApi redpackApi = mpWechatApiProvider.getApi("Redpack");
@ -186,8 +187,8 @@ public class RedpackServiceImpl implements RedpackService {
if (redpack_counts > 0) { if (redpack_counts > 0) {
for (int i = 0; i < redpack_counts; i++) { for (int i = 0; i < redpack_counts; i++) {
BigDecimal amount = amountFrom.equals(amountTo) ? amountFrom BigDecimal amount = amountFrom.equals(amountTo) ? amountFrom
: amountFrom.add(BigDecimal.valueOf(RandomUtils.nextInt(0,amountTo.subtract(amountFrom).multiply(hundred).intValue())).divide(hundred, : amountFrom.add(BigDecimal.valueOf(RandomUtils.nextInt(0, amountTo.subtract(amountFrom).multiply(hundred).intValue())).divide(hundred,
2, BigDecimal.ROUND_DOWN)); 2, RoundingMode.DOWN));
JSONObject prize = new JSONObject(); JSONObject prize = new JSONObject();
String prefix = DateFormatUtils.format(new Date(), "yyyyMMddHHmmssSSS"); String prefix = DateFormatUtils.format(new Date(), "yyyyMMddHHmmssSSS");
String red_packet_order_id = prefix + RandomStringUtils.random(28 - prefix.length(), true, true); String red_packet_order_id = prefix + RandomStringUtils.random(28 - prefix.length(), true, true);
@ -216,7 +217,7 @@ public class RedpackServiceImpl implements RedpackService {
params.put("act_type", ActTypeEnum.redpack.toString()); params.put("act_type", ActTypeEnum.redpack.toString());
params.put("status", 1); params.put("status", 1);
List<JSONObject> actList = actPartnerLMMapper.actList(params); List<JSONObject> actList = actPartnerLMMapper.actList(params);
if (!actList.isEmpty() && actList.size() > 0) { if (!actList.isEmpty()) {
JSONObject act = actList.get(0); JSONObject act = actList.get(0);
String act_id = act.getString("act_id"); String act_id = act.getString("act_id");
@ -224,14 +225,14 @@ public class RedpackServiceImpl implements RedpackService {
blackListParams.put("act_id", act_id); blackListParams.put("act_id", act_id);
blackListParams.put("client_id", client_id); blackListParams.put("client_id", client_id);
List<JSONObject> blackList = actBlackListMapper.list(blackListParams); List<JSONObject> blackList = actBlackListMapper.list(blackListParams);
if (blackList != null && blackList.size() > 0) { if (blackList != null && !blackList.isEmpty()) {
logger.error("client_id:" + client_id + ",在活动" + act_id + "的黑名单下"); logger.error("client_id:" + client_id + ",在活动" + act_id + "的黑名单下");
return; return;
} }
BigDecimal rule_order_total = act.getBigDecimal("rule_order_total"); BigDecimal rule_order_total = act.getBigDecimal("rule_order_total");
int probability = act.getIntValue("probability"); int probability = act.getIntValue("probability");
if (orderAmount.compareTo(rule_order_total) < 0) { if (orderAmount.compareTo(rule_order_total) < 0) {
logger.error("订单不满足金额" + rule_order_total + ",跳过"); logger.error("订单不满足金额{},跳过", rule_order_total);
return; return;
} }
// int random = new Random().nextInt(100); // int random = new Random().nextInt(100);
@ -246,8 +247,8 @@ public class RedpackServiceImpl implements RedpackService {
relationParams.put("client_id", client_id); relationParams.put("client_id", client_id);
relationParams.put("channel", "Wechat"); relationParams.put("channel", "Wechat");
List<JSONObject> relationList = actPartnerWechatRelationMapper.relationList(relationParams); List<JSONObject> relationList = actPartnerWechatRelationMapper.relationList(relationParams);
if (relationList.isEmpty() || relationList.size() == 0) { if (relationList.isEmpty()) {
logger.error("client_id:" + client_id + ";没有绑定的wechat跳过"); logger.error("client_id:{};没有绑定的wechat跳过", client_id);
return; return;
} }
@ -256,7 +257,7 @@ public class RedpackServiceImpl implements RedpackService {
// add 每天只能得到100个红包的限制 // add 每天只能得到100个红包的限制
int getTotalCounts = getRedPacketsByOpenid(open_id, new Date()); int getTotalCounts = getRedPacketsByOpenid(open_id, new Date());
if (getTotalCounts >= 100) { if (getTotalCounts >= 100) {
logger.error("open_id:" + open_id + "当日红包发送数量已到达100跳过"); logger.error("open_id:{}当日红包发送数量已到达100跳过", open_id);
return; return;
} }
List<JSONObject> prizeTypes = actPrizeTypeMapper.listAvailableTypes(BigDecimal.ONE, act_id); List<JSONObject> prizeTypes = actPrizeTypeMapper.listAvailableTypes(BigDecimal.ONE, act_id);
@ -264,7 +265,7 @@ public class RedpackServiceImpl implements RedpackService {
for (JSONObject prizeType : prizeTypes) { for (JSONObject prizeType : prizeTypes) {
totalWeight += prizeType.getIntValue("weight"); totalWeight += prizeType.getIntValue("weight");
} }
int ran = RandomUtils.nextInt(0,totalWeight); int ran = RandomUtils.nextInt(0, totalWeight);
for (JSONObject prizeType : prizeTypes) { for (JSONObject prizeType : prizeTypes) {
ran -= prizeType.getIntValue("weight"); ran -= prizeType.getIntValue("weight");
@ -325,16 +326,16 @@ public class RedpackServiceImpl implements RedpackService {
@Override @Override
public void sendAlipayLuckyMoney(String orderId, BigDecimal orderAmount, int client_id) throws RedPackException { public void sendAlipayLuckyMoney(String orderId, BigDecimal orderAmount, int client_id) throws RedPackException {
logger.info("======================sendAlipayLuckyMoney===================="); logger.info("======================sendAlipayLuckyMoney====================");
logger.info("======================orderId:" + orderId + ";orderAmount:" + orderAmount + ";client_id:" + client_id + "===================="); logger.info("======================orderId:{};orderAmount:{};client_id:{}====================", orderId, orderAmount, client_id);
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
params.put("act_type", ActTypeEnum.redpack.toString()); params.put("act_type", ActTypeEnum.redpack.toString());
params.put("status", 1); params.put("status", 1);
List<JSONObject> actList = actPartnerLMMapper.actList(params); List<JSONObject> actList = actPartnerLMMapper.actList(params);
if (!actList.isEmpty() && actList.size() > 0) { if (!actList.isEmpty()) {
JSONObject act = actList.get(0); JSONObject act = actList.get(0);
if (orderAmount.compareTo(act.getBigDecimal("rule_order_total")) < 0) { if (orderAmount.compareTo(act.getBigDecimal("rule_order_total")) < 0) {
logger.info("支付金额不足" + act.getDouble("rule_order_total") + "跳过"); logger.info("支付金额不足{}跳过", act.getDouble("rule_order_total"));
return; return;
} }
@ -344,8 +345,8 @@ public class RedpackServiceImpl implements RedpackService {
blackListParams.put("act_id", act_id); blackListParams.put("act_id", act_id);
blackListParams.put("client_id", client_id); blackListParams.put("client_id", client_id);
List<JSONObject> blackList = actBlackListMapper.list(blackListParams); List<JSONObject> blackList = actBlackListMapper.list(blackListParams);
if (blackList != null && blackList.size() > 0) { if (blackList != null && !blackList.isEmpty()) {
logger.error("client_id:" + client_id + ",在活动" + act_id + "的黑名单下"); logger.error("client_id:{},在活动{}的黑名单下", client_id, act_id);
return; return;
} }
JSONObject actPartnerParams = new JSONObject(); JSONObject actPartnerParams = new JSONObject();
@ -373,8 +374,8 @@ public class RedpackServiceImpl implements RedpackService {
relationParams.put("client_id", client_id); relationParams.put("client_id", client_id);
relationParams.put("channel", "Alipay"); relationParams.put("channel", "Alipay");
List<JSONObject> relationList = actPartnerWechatRelationMapper.relationList(relationParams); List<JSONObject> relationList = actPartnerWechatRelationMapper.relationList(relationParams);
if (relationList.isEmpty() || relationList.size() == 0) { if (relationList.isEmpty()) {
logger.error("client_id:" + client_id + ";没有绑定的Alipay跳过"); logger.error("client_id:{};没有绑定的Alipay跳过", client_id);
return; return;
} }
@ -384,7 +385,7 @@ public class RedpackServiceImpl implements RedpackService {
for (JSONObject prizeType : prizeTypes) { for (JSONObject prizeType : prizeTypes) {
totalWeight += prizeType.getIntValue("weight"); totalWeight += prizeType.getIntValue("weight");
} }
int ran = RandomUtils.nextInt(0,totalWeight); int ran = RandomUtils.nextInt(0, totalWeight);
for (JSONObject prizeType : prizeTypes) { for (JSONObject prizeType : prizeTypes) {
ran -= prizeType.getIntValue("weight"); ran -= prizeType.getIntValue("weight");

@ -730,7 +730,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
Context ctx = getMailContext(event); Context ctx = getMailContext(event);
ctx.setVariable("refuse", true); ctx.setVariable("refuse", true);
List<JSONObject> findAllMaterials = riskMaterialMapper.findAllMaterials(riskId); List<JSONObject> findAllMaterials = riskMaterialMapper.findAllMaterials(riskId);
if (findAllMaterials == null || findAllMaterials.size() == 0) { if (findAllMaterials == null || findAllMaterials.isEmpty()) {
ctx.setVariable("refuse_description", ""); ctx.setVariable("refuse_description", "");
} else { } else {
ctx.setVariable("refuse_description", findAllMaterials.get(0).getString("refuse_description")); ctx.setVariable("refuse_description", findAllMaterials.get(0).getString("refuse_description"));
@ -942,7 +942,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
@Override @Override
public JSONObject getRiskMaterial(JSONObject param) { public JSONObject getRiskMaterial(JSONObject param) {
List<JSONObject> riskMaterialList = riskMaterialMapper.findAllMaterials(param.getString("risk_id")); List<JSONObject> riskMaterialList = riskMaterialMapper.findAllMaterials(param.getString("risk_id"));
if (riskMaterialList != null && riskMaterialList.size() > 0) { if (riskMaterialList != null && !riskMaterialList.isEmpty()) {
JSONObject fileNew = riskMaterialList.get(0); JSONObject fileNew = riskMaterialList.get(0);
List<JSONObject> files = riskFileMapper.findAllFiles(fileNew.getString("material_id")); List<JSONObject> files = riskFileMapper.findAllFiles(fileNew.getString("material_id"));
for (JSONObject file : files) { for (JSONObject file : files) {
@ -973,7 +973,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
@Transactional @Transactional
public void completeEventRealOrderIds() { public void completeEventRealOrderIds() {
List<JSONObject> riskEventList = getRiskEvents(null); List<JSONObject> riskEventList = getRiskEvents(null);
if (riskEventList != null && riskEventList.size() > 0) { if (riskEventList != null && !riskEventList.isEmpty()) {
for (JSONObject riskEvent : riskEventList) { for (JSONObject riskEvent : riskEventList) {
String clientMoniker = riskEvent.getString("client_moniker"); String clientMoniker = riskEvent.getString("client_moniker");
JSONObject client = clientMapper.findClientByMonikerAll(clientMoniker); JSONObject client = clientMapper.findClientByMonikerAll(clientMoniker);
@ -989,7 +989,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
client.getIntValue("client_id"), client.getIntValue("client_id"),
systemTransactionIdArr[i], systemTransactionIdArr[i],
new PageBounds(Order.formString("transaction_time.desc"))); new PageBounds(Order.formString("transaction_time.desc")));
if (transactionList != null && transactionList.size() > 0) if (transactionList != null && !transactionList.isEmpty())
realOrderIds.add(transactionList.get(0).getString("order_id")); realOrderIds.add(transactionList.get(0).getString("order_id"));
} }
riskEvent.put("real_order_ids", StringUtils.join(realOrderIds, ",")); riskEvent.put("real_order_ids", StringUtils.join(realOrderIds, ","));
@ -1192,7 +1192,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
result.put("notice_flag", false); result.put("notice_flag", false);
if (riskEventList != null && riskEventList.size() > 0) { if (riskEventList != null && !riskEventList.isEmpty()) {
result.put("notice_flag", true); result.put("notice_flag", true);
} }
return result; return result;
@ -1232,7 +1232,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
String alipayMaterials = riskEvent.getString("alipay_materials"); String alipayMaterials = riskEvent.getString("alipay_materials");
if (StringUtils.isNotBlank(alipayMaterials)) { if (StringUtils.isNotBlank(alipayMaterials)) {
List<JSONObject> alipayMaterialRemarkList = JSONObject.parseArray(alipayMaterials, JSONObject.class); List<JSONObject> alipayMaterialRemarkList = JSONObject.parseArray(alipayMaterials, JSONObject.class);
if (alipayMaterialRemarkList != null && alipayMaterialRemarkList.size() > 0) { if (alipayMaterialRemarkList != null && !alipayMaterialRemarkList.isEmpty()) {
for (int i = 0; i < alipayMaterialRemarkList.size(); i++) { for (int i = 0; i < alipayMaterialRemarkList.size(); i++) {
materialsRemark.add(alipayMaterialRemarkList.get(i).getString("question" + (i + 1))); materialsRemark.add(alipayMaterialRemarkList.get(i).getString("question" + (i + 1)));
} }

@ -181,7 +181,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
client.put("client_less_file", false); client.put("client_less_file", false);
if ((client.getIntValue("approve_result") == 2 || client.getIntValue("open_status") == 10 || client.getIntValue("approve_result") == 1 || client.getIntValue("open_status") == 5)) { if ((client.getIntValue("approve_result") == 2 || client.getIntValue("open_status") == 10 || client.getIntValue("approve_result") == 1 || client.getIntValue("open_status") == 5)) {
List<JSONObject> clientFiles = clientFilesMapper.findAllClientFile(client.getIntValue("client_id")); List<JSONObject> clientFiles = clientFilesMapper.findAllClientFile(client.getIntValue("client_id"));
if (clientFiles != null && clientFiles.size() > 0) { if (clientFiles != null && !clientFiles.isEmpty()) {
clientFiles = clientFiles.stream().filter(fileJson -> ((fileJson.getIntValue("status") == 1 || fileJson.getIntValue("status") == 2))).collect(Collectors.toList()); clientFiles = clientFiles.stream().filter(fileJson -> ((fileJson.getIntValue("status") == 1 || fileJson.getIntValue("status") == 2))).collect(Collectors.toList());
String[] fileKeys = {"client_bank_file", "client_company_file", "client_id_file", "client_agree_file"}; String[] fileKeys = {"client_bank_file", "client_company_file", "client_id_file", "client_agree_file"};
for (String fileKey : fileKeys) { for (String fileKey : fileKeys) {
@ -426,7 +426,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
throw new Exception("Email Address of this partner is null,Please contact customer service"); throw new Exception("Email Address of this partner is null,Please contact customer service");
} }
List<JSONObject> accounts = clientAccountMapper.listAdminAccounts(client.getIntValue("client_id")); List<JSONObject> accounts = clientAccountMapper.listAdminAccounts(client.getIntValue("client_id"));
if (accounts != null && accounts.size() > 0) { if (accounts != null && !accounts.isEmpty()) {
String codeKey = signInStatusManager.addChangepasswordVerifyCode(client_moniker); String codeKey = signInStatusManager.addChangepasswordVerifyCode(client_moniker);
String url = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/partner_changepassword_page/" + codeKey); String url = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/partner_changepassword_page/" + codeKey);
@ -466,7 +466,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
// throw new Exception("Email Address of this partner is null,Please contact customer service"); // throw new Exception("Email Address of this partner is null,Please contact customer service");
// } // }
// List<JSONObject> accounts = clientAccountMapper.listAdminAccounts(client.getIntValue("client_id")); // List<JSONObject> accounts = clientAccountMapper.listAdminAccounts(client.getIntValue("client_id"));
// if (accounts != null && accounts.size() > 0) { // if (accounts != null && !accounts.isEmpty()) {
// //
// String codeKey = signInStatusManager.addChangepasswordVerifyCode(client_moniker); // String codeKey = signInStatusManager.addChangepasswordVerifyCode(client_moniker);
// String url = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/partner_changepassword_page/" + codeKey); // String url = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/partner_changepassword_page/" + codeKey);
@ -694,7 +694,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
boolean clientFilesIsLess = false; boolean clientFilesIsLess = false;
for (int i = 0; i < FILE_KEYS.length; i++) { for (int i = 0; i < FILE_KEYS.length; i++) {
String fileKey = FILE_KEYS[i]; String fileKey = FILE_KEYS[i];
if (clientFiles != null && clientFiles.size() > 0) { if (clientFiles != null && !clientFiles.isEmpty()) {
List<JSONObject> clientFileUrl = clientFiles.stream() List<JSONObject> clientFileUrl = clientFiles.stream()
.filter(fileJson -> (fileKey.equals(fileJson.getString("file_name")) && (fileJson.getIntValue("status") == 1 || fileJson.getIntValue("status") == 2))) .filter(fileJson -> (fileKey.equals(fileJson.getString("file_name")) && (fileJson.getIntValue("status") == 1 || fileJson.getIntValue("status") == 2)))
.sorted((log1, log2) -> log2.getDate("last_update_date").compareTo(log1.getDate("last_update_date"))) .sorted((log1, log2) -> log2.getDate("last_update_date").compareTo(log1.getDate("last_update_date")))
@ -705,7 +705,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
return params; return params;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
if (clientFileUrl != null && clientFileUrl.size() > 0) { if (clientFileUrl != null && !clientFileUrl.isEmpty()) {
JSONObject fileJson = new JSONObject(); JSONObject fileJson = new JSONObject();
fileJson.put("key", PUT_KEYS[i]); fileJson.put("key", PUT_KEYS[i]);
fileJson.put("name", FILE_NAMES[i]); fileJson.put("name", FILE_NAMES[i]);
@ -726,7 +726,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
JSONObject fileJson = new JSONObject(); JSONObject fileJson = new JSONObject();
fileJson.put("key", PUT_KEYS[i]); fileJson.put("key", PUT_KEYS[i]);
fileJson.put("name", FILE_NAMES[i]); fileJson.put("name", FILE_NAMES[i]);
if (clientBackToFileUrl != null && clientBackToFileUrl.size() > 0) { if (clientBackToFileUrl != null && !clientBackToFileUrl.isEmpty()) {
if ("client_agree_file".equals(fileKey)) { if ("client_agree_file".equals(fileKey)) {
List<JSONObject> agreeFile = new ArrayList<>(); List<JSONObject> agreeFile = new ArrayList<>();
agreeFile.add(clientBackToFileUrl.get(0)); agreeFile.add(clientBackToFileUrl.get(0));
@ -791,7 +791,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
return params; return params;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
if (clientFileUrl.size() > 0) { if (!clientFileUrl.isEmpty()) {
result.put("kyc_utility_bill_file", clientFileUrl); result.put("kyc_utility_bill_file", clientFileUrl);
} }
} }
@ -826,7 +826,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
return params; return params;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
if (clientFileUrl.size() > 0) { if (!clientFileUrl.isEmpty()) {
result.put("kyc_utility_bill_file", clientFileUrl); result.put("kyc_utility_bill_file", clientFileUrl);
} }
} }

@ -10,6 +10,7 @@ import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.utils.JsonHelper;
import au.com.royalpay.payment.tools.utils.QRCodeUtils; import au.com.royalpay.payment.tools.utils.QRCodeUtils;
import au.com.royalpay.payment.tools.utils.apple.AppleAuthUtils; import au.com.royalpay.payment.tools.utils.apple.AppleAuthUtils;
import au.com.royalpay.payment.tools.utils.apple.UserClaim; import au.com.royalpay.payment.tools.utils.apple.UserClaim;
@ -298,10 +299,10 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
} }
JSONObject account = signInAccountService.clientAppleSignIn(userClaim.getSub()); JSONObject account = signInAccountService.clientAppleSignIn(userClaim.getSub());
if (account == null || account.isEmpty()) { if (account == null || account.isEmpty()) {
return new JSONObject() {{ return JsonHelper.newJson(json -> {
put("apple_userid", userClaim.getSub()); json.put("apple_userid", userClaim.getSub());
put("bind_status", false); json.put("bind_status", false);
}}; });
} }
String statusKey = newStatusKey(); String statusKey = newStatusKey();
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
@ -348,7 +349,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
getlockRandomCodeId(codeId); getlockRandomCodeId(codeId);
String statusKey = newStatusKey(); String statusKey = newStatusKey();
JSONObject account = new JSONObject(); JSONObject account = new JSONObject();
if (device != null && device.size() > 0) { if (device != null && !device.isEmpty()) {
account = signInAccountService.getClient(device.getString("account_id")); account = signInAccountService.getClient(device.getString("account_id"));
} }
if (account == null || account.size() <= 0) { if (account == null || account.size() <= 0) {
@ -366,7 +367,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
getlockRandomCodeId(codeId); getlockRandomCodeId(codeId);
String statusKey = newStatusKey(); String statusKey = newStatusKey();
JSONObject account = new JSONObject(); JSONObject account = new JSONObject();
if (wxUser != null && wxUser.size() > 0) { if (wxUser != null && !wxUser.isEmpty()) {
account = signInAccountService.clientWechatSignIn(wxUser.getString("openid")); account = signInAccountService.clientWechatSignIn(wxUser.getString("openid"));
} }
if (account == null || account.size() <= 0) { if (account == null || account.size() <= 0) {
@ -464,10 +465,10 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
String nickName = codeValue.split("&")[1]; String nickName = codeValue.split("&")[1];
String unionId = codeValue.split("&")[2]; String unionId = codeValue.split("&")[2];
stringRedisTemplate.delete(rediskey); stringRedisTemplate.delete(rediskey);
return new JSONObject() {{ return JsonHelper.newJson(json -> {
put("nick_name", nickName); json.put("nick_name", nickName);
put("union_id", unionId); json.put("union_id", unionId);
}}; });
} }
private String getClientLoginPhoneBindRedisKey(String phone, String nationCode) { private String getClientLoginPhoneBindRedisKey(String phone, String nationCode) {

@ -1,14 +1,12 @@
package au.com.royalpay.payment.manage.system.core.impl; package au.com.royalpay.payment.manage.system.core.impl;
import au.com.royalpay.payment.manage.mappers.system.MailSendMapper; import au.com.royalpay.payment.manage.mappers.system.MailSendMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.system.core.MailGunService; import au.com.royalpay.payment.manage.system.core.MailGunService;
import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient; import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient;
import au.com.royalpay.payment.tools.mail.MailGunClient; import au.com.royalpay.payment.tools.mail.MailGunClient;
import au.com.royalpay.payment.tools.mail.SendMail; import au.com.royalpay.payment.tools.mail.SendMail;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
@ -20,16 +18,11 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Resource;
@Service @Service
public class MailGunServiceImpl implements MailGunService { public class MailGunServiceImpl implements MailGunService {
@ -54,7 +47,7 @@ public class MailGunServiceImpl implements MailGunService {
String myData = mailgunNotify.get("my-custom-data"); String myData = mailgunNotify.get("my-custom-data");
String recipient = mailgunNotify.get("recipient"); String recipient = mailgunNotify.get("recipient");
if (StringUtils.isNotEmpty(myData) && StringUtils.isNotEmpty(recipient)) { if (StringUtils.isNotEmpty(myData) && StringUtils.isNotEmpty(recipient)) {
JSONObject tmpJSONObject = JSONObject.parseObject(myData); JSONObject tmpJSONObject = JSON.parseObject(myData);
String[] mailAddresses = recipient.split(","); String[] mailAddresses = recipient.split(",");
for (String mailAddress : mailAddresses) { for (String mailAddress : mailAddresses) {
JSONObject record = new JSONObject(); JSONObject record = new JSONObject();
@ -81,7 +74,7 @@ public class MailGunServiceImpl implements MailGunService {
String myData = myDataArr[0]; String myData = myDataArr[0];
String recipient = recipientArr[0]; String recipient = recipientArr[0];
if (StringUtils.isNotEmpty(myData) && StringUtils.isNotEmpty(recipient)) { if (StringUtils.isNotEmpty(myData) && StringUtils.isNotEmpty(recipient)) {
JSONObject tmpJSONObject = JSONObject.parseObject(myData); JSONObject tmpJSONObject = JSON.parseObject(myData);
String[] mailAddresses = recipient.split(","); String[] mailAddresses = recipient.split(",");
for (String mailAddress : mailAddresses) { for (String mailAddress : mailAddresses) {
JSONObject record = new JSONObject(); JSONObject record = new JSONObject();

@ -78,7 +78,7 @@ public class TradeLogQuery {
tradeTypes.add(type.getGateway()); tradeTypes.add(type.getGateway());
} }
} }
if (tradeTypes.size() > 0) { if (!tradeTypes.isEmpty()) {
params.put("trade_type", tradeTypes); params.put("trade_type", tradeTypes);
} }
} }

@ -20,9 +20,9 @@ public class ReportConfigServiceImp implements ReportConfigService {
@Override @Override
public JSONObject getReportConfig(){ public JSONObject getReportConfig(){
List<JSONObject> configs = reportConfigMapper.listReportConfig(); List<JSONObject> configs = reportConfigMapper.listReportConfig();
if (!configs.isEmpty() && configs.size()>0){ if (!configs.isEmpty()) {
return configs.get(0); return configs.get(0);
}else { } else {
return null; return null;
} }
} }

@ -32,6 +32,7 @@ import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.utils.CurrencyAmountUtils; import au.com.royalpay.payment.tools.utils.CurrencyAmountUtils;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils; import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
@ -428,7 +429,7 @@ public class TradeLogServiceImpl implements TradeLogService {
order.put("status_str", statusStr); order.put("status_str", statusStr);
if (StringUtils.equalsIgnoreCase("rpaypmt_card", order.getString("channel")) if (StringUtils.equalsIgnoreCase("rpaypmt_card", order.getString("channel"))
|| StringUtils.equalsIgnoreCase("rpaypmt_dd", order.getString("channel"))) { || StringUtils.equalsIgnoreCase("rpaypmt_dd", order.getString("channel"))) {
JSONObject extParams = JSONObject.parseObject(order.getString("ext_params")); JSONObject extParams = JSON.parseObject(order.getString("ext_params"));
if (extParams != null) { if (extParams != null) {
order.putAll(extParams); order.putAll(extParams);
} }
@ -1358,7 +1359,7 @@ public class TradeLogServiceImpl implements TradeLogService {
for (int i = 0; i < childs.size(); i++) { for (int i = 0; i < childs.size(); i++) {
params.put("client_id", childs.get(i).getInteger("client_id")); params.put("client_id", childs.get(i).getInteger("client_id"));
PageList<JSONObject> childLogs = transactionMapper.listSettlementLog(params, new PageBounds(1, 100000000, Order.formString("clearing_time.desc"))); PageList<JSONObject> childLogs = transactionMapper.listSettlementLog(params, new PageBounds(1, 100000000, Order.formString("clearing_time.desc")));
if (childLogs.size() > 0) { if (!childLogs.isEmpty()) {
addSheet(i + 1, workbook, childs.get(i), childLogs); addSheet(i + 1, workbook, childs.get(i), childLogs);
} }
} }
@ -1455,9 +1456,9 @@ public class TradeLogServiceImpl implements TradeLogService {
HSSFRichTextString text0 = new HSSFRichTextString(client.getString("short_name")); HSSFRichTextString text0 = new HSSFRichTextString(client.getString("short_name"));
HSSFRichTextString text1 = new HSSFRichTextString(client.getString("client_moniker")); HSSFRichTextString text1 = new HSSFRichTextString(client.getString("client_moniker"));
HSSFRichTextString text2 = new HSSFRichTextString(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dataItem.getDate("report_date"))); HSSFRichTextString text2 = new HSSFRichTextString(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dataItem.getDate("report_date")));
HSSFRichTextString text3 = new HSSFRichTextString(dataItem.getBigDecimal("total").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString()); HSSFRichTextString text3 = new HSSFRichTextString(dataItem.getBigDecimal("total").setScale(2, RoundingMode.HALF_DOWN).toString());
HSSFRichTextString text4 = new HSSFRichTextString(dataItem.getBigDecimal("income").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString()); HSSFRichTextString text4 = new HSSFRichTextString(dataItem.getBigDecimal("income").setScale(2, RoundingMode.HALF_DOWN).toString());
HSSFRichTextString text5 = new HSSFRichTextString(dataItem.getBigDecimal("fee").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString()); HSSFRichTextString text5 = new HSSFRichTextString(dataItem.getBigDecimal("fee").setScale(2, RoundingMode.HALF_DOWN).toString());
cell0.setCellValue(text0); cell0.setCellValue(text0);
cell1.setCellValue(text1); cell1.setCellValue(text1);
cell2.setCellValue(text2); cell2.setCellValue(text2);
@ -1638,13 +1639,6 @@ public class TradeLogServiceImpl implements TradeLogService {
List<JSONObject> oneClear = transactionMapper.getMerchantAmount(dateParams); List<JSONObject> oneClear = transactionMapper.getMerchantAmount(dateParams);
Date now = new Date(); Date now = new Date();
for (JSONObject clientClear : oneClear) { for (JSONObject clientClear : oneClear) {
// JSONObject params = new JSONObject();
// params.put("client_id",clientClear.getIntValue("client_id"));
// params.put("clearing_time",clientClear.getDate("clearing_time"));
// List<JSONObject> clientTrans = austracDataMapper.getTransactionTotal(params);
// if (!clientTrans.isEmpty() && clientTrans.size()>0){
// austracDataMapper.delete(clientClear.getIntValue("client_id"),clientClear.getDate("clearing_time"));
// }
austracDataMapper.delete(clientClear.getIntValue("client_id"), clientClear.getDate("clearing_time")); austracDataMapper.delete(clientClear.getIntValue("client_id"), clientClear.getDate("clearing_time"));
BigDecimal lastTransTotal = austracDataMapper.getClientLastTransactionTotal(clientClear.getIntValue("client_id"), BigDecimal lastTransTotal = austracDataMapper.getClientLastTransactionTotal(clientClear.getIntValue("client_id"),
clientClear.getDate("clearing_time")); clientClear.getDate("clearing_time"));
@ -1995,7 +1989,7 @@ public class TradeLogServiceImpl implements TradeLogService {
List<JSONObject> settlementLogDetailList = new ArrayList<>(); List<JSONObject> settlementLogDetailList = new ArrayList<>();
try { try {
parmerters.put("logo", logo.getInputStream()); parmerters.put("logo", logo.getInputStream());
if (clientOrderList.size() > 0) { if (!clientOrderList.isEmpty()) {
List<Integer> clientOrders = new ArrayList<>(clientOrderList.size()); List<Integer> clientOrders = new ArrayList<>(clientOrderList.size());
clientOrderList.parallelStream().forEach(p -> clientOrders.add(p.getInteger("clearing_order"))); clientOrderList.parallelStream().forEach(p -> clientOrders.add(p.getInteger("clearing_order")));
settlementLogDetailList = transactionMapper.getSettlementLogDetailList(clientOrders); settlementLogDetailList = transactionMapper.getSettlementLogDetailList(clientOrders);

@ -194,7 +194,7 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
BigDecimal realAmount = original ? fee : CurrencyAmountUtils.toAmount(fee, order.getString("currency")); BigDecimal realAmount = original ? fee : CurrencyAmountUtils.toAmount(fee, order.getString("currency"));
JSONObject refundConfig = checkRefundAuditFlag(); JSONObject refundConfig = checkRefundAuditFlag();
if (partnerAccount != null && refundConfig != null && refundConfig.size() > 0 && refundConfig.getBoolean("refundAudit")) { if (partnerAccount != null && refundConfig != null && !refundConfig.isEmpty() && refundConfig.getBoolean("refundAudit")) {
if (realAmount.compareTo(refundConfig.getBigDecimal("refundAuditAmount")) > 0) { if (realAmount.compareTo(refundConfig.getBigDecimal("refundAuditAmount")) > 0) {
// 订单需要审核 // 订单需要审核
boolean casherRefund = reviewNewRefundOrder(orderId, realAmount, remark, partnerAccount, manager); boolean casherRefund = reviewNewRefundOrder(orderId, realAmount, remark, partnerAccount, manager);

@ -18,7 +18,7 @@ import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.RoundingMode;
import java.util.List; import java.util.List;
import java.util.TimeZone; import java.util.TimeZone;
@ -59,7 +59,7 @@ public class RefundSendTemplateMessageSender implements ApplicationListener<Refu
private void sendAppMessage(RefundSendEvent event) { private void sendAppMessage(RefundSendEvent event) {
JSONObject refundOrder = event.getRefundOrder(); JSONObject refundOrder = event.getRefundOrder();
JSONObject order = pmtOrderMapper.find(refundOrder.getString("order_id")); JSONObject order = pmtOrderMapper.find(refundOrder.getString("order_id"));
String refundAmount = order.getString("currency") + " " + refundOrder.getBigDecimal("amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString(); String refundAmount = order.getString("currency") + " " + refundOrder.getBigDecimal("amount").setScale(2, RoundingMode.DOWN).toPlainString();
retailAppService.sendRefundAppMessage(refundAmount, order); retailAppService.sendRefundAppMessage(refundAmount, order);
} }
@ -70,7 +70,7 @@ public class RefundSendTemplateMessageSender implements ApplicationListener<Refu
JSONObject client = merchantInfoProvider.getClientInfo(order.getIntValue("client_id")); JSONObject client = merchantInfoProvider.getClientInfo(order.getIntValue("client_id"));
String refundTimeString = DateFormatUtils.format(refundOrder.getDate("create_time"), "yyyy-MM-dd HH:mm:ss", TimeZone.getTimeZone(client.getString("timezone"))); String refundTimeString = DateFormatUtils.format(refundOrder.getDate("create_time"), "yyyy-MM-dd HH:mm:ss", TimeZone.getTimeZone(client.getString("timezone")));
String refundAmount = order.getString("currency") + " " + refundOrder.getBigDecimal("amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString(); String refundAmount = order.getString("currency") + " " + refundOrder.getBigDecimal("amount").setScale(2, RoundingMode.DOWN).toPlainString();
for (JSONObject account : accounts) { for (JSONObject account : accounts) {
String openId = account.getString("wechat_openid"); String openId = account.getString("wechat_openid");
if (openId != null) { if (openId != null) {

@ -17,7 +17,7 @@ import javax.annotation.Resource;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.RoundingMode;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
@ -72,8 +72,8 @@ public class FixAlipayData {
row.getCell(9).setCellValue(client.getString("address") + "," + client.getString("state")); row.getCell(9).setCellValue(client.getString("address") + "," + client.getString("state"));
} }
if (client.getString("latitude") != null) { if (client.getString("latitude") != null) {
row.getCell(29).setCellValue(client.getBigDecimal("latitude").setScale(8, BigDecimal.ROUND_DOWN).toPlainString()); row.getCell(29).setCellValue(client.getBigDecimal("latitude").setScale(8, RoundingMode.DOWN).toPlainString());
row.getCell(30).setCellValue(client.getBigDecimal("longitude").setScale(8, BigDecimal.ROUND_DOWN).toPlainString()); row.getCell(30).setCellValue(client.getBigDecimal("longitude").setScale(8, RoundingMode.DOWN).toPlainString());
} }
logger.info("finished update row:" + (rowNum - 1)); logger.info("finished update row:" + (rowNum - 1));
} }

Loading…
Cancel
Save