Merge branch 'develop'

master
kira 6 years ago
commit 380952c3b3

@ -160,4 +160,7 @@ public interface RetailAppService {
JSONObject ctripCouponInfo(JSONObject device,String coupon_id);
JSONObject getCouponCusCouponLog(String client_moniker, AppQueryBean appQueryBean);
void saveCouponAccuessLog(int client_id, String coupon_id);
}

@ -172,6 +172,10 @@ public class RetailAppServiceImp implements RetailAppService {
private ClearingLogMapper clearingLogMapper;
@Resource
private CustomerServiceService customerServiceService;
@Resource
private CouponAccuessLogMapper couponAccuessLogMapper;
@Resource
private CouponValidateService couponValidateService;
private Map<String, AppMsgSender> senderMap = new HashMap<>();
private final String fileName[] = { "client_bank_file", "client_id_file", "client_company_file" };
@ -447,10 +451,52 @@ public class RetailAppServiceImp implements RetailAppService {
@Override
public JSONObject ctripCouponInfo(JSONObject device, String coupon_id) {
return couponVerificationService.ctripCouponInfo(coupon_id,device.getIntValue("client_id"));
return couponVerificationService.ctripCouponInfo(coupon_id,device.getIntValue("client_id"), true);
}
@Override
public JSONObject getCouponCusCouponLog(String client_moniker, AppQueryBean appQueryBean) {
JSONObject client = clientMapper.findClientByMoniker(client_moniker);
if (client == null) {
throw new BadRequestException("Partner not exists");
}
PageList<JSONObject> cusCouponLogs = couponAccuessLogMapper.getCouponAccuessLog(
client.getIntValue("client_id"), new PageBounds(appQueryBean.getPage(), appQueryBean.getLimit(), Order.formString("creation_date.desc")));
HashMap<String, JSONObject> couponMap = new HashMap<>();
for(JSONObject cusCouponLog : cusCouponLogs) {
cusCouponLog.put("client_moniker", client_moniker);
if (couponMap.containsKey(cusCouponLog.getString("coupon_id"))) {
cusCouponLog.put("coupon", couponMap.get(cusCouponLog.getString("coupon_id")));
continue;
}
JSONObject coupon = couponValidateService.ctripCouponInfo(cusCouponLog.getString("coupon_id"), cusCouponLog.getIntValue("client_id"), false);
couponMap.put(cusCouponLog.getString("coupon_id"), coupon);
cusCouponLog.put("coupon", coupon);
}
return PageListUtils.buildPageListResult(cusCouponLogs);
}
@Override
public void saveCouponAccuessLog(int client_id, String coupon_id) {
JSONObject client = clientMapper.findClient(client_id);
if (client == null) {
throw new BadRequestException("Partner not exists");
}
JSONObject couponAccuessLog = new JSONObject();
Date date = new Date();
couponAccuessLog.put("client_id", client_id);
couponAccuessLog.put("order_id", "非平台订单");
couponAccuessLog.put("coupon_id", coupon_id);
couponAccuessLog.put("customer_openid", "非平台订单");
couponAccuessLog.put("coupon_deal_amount", 0);
couponAccuessLog.put("currency", "AUD");
couponAccuessLog.put("creation_date", date);
couponAccuessLog.put("last_update_date", date);
couponAccuessLog.put("is_valid", 1);
couponAccuessLogMapper.save(couponAccuessLog);
}
@Override
public void updateClient(JSONObject device, AppClientBean appClientBean) {
String clientType = device.getString("client_type");
@ -729,33 +775,6 @@ public class RetailAppServiceImp implements RetailAppService {
TimeZoneUtils.switchTimeZone(orders, query.getTimezone(), "create_time", "transaction_time", "confirm_time");
ArrayList<String> date_contains = new ArrayList<>();
for (JSONObject order : orders) {
String customer_id = order.getString("customer_id");
if (StringUtils.isEmpty(customer_id)) {
continue;
}
switch (order.getString("channel")) {
case "Alipay":
JSONObject alipayUser = managerCustomerRelationAlipayMapper.findCustomerByUserId(customer_id);
if (alipayUser != null) {
order.put("nickname", alipayUser.getString("nickname"));
order.put("headimg", alipayUser.getString("headimg"));
}
break;
case "Wechat":
JSONObject weUser = new JSONObject();
if (customer_id.startsWith("olH")) {
weUser = customerMapper.findCustomerGlobalpayByOpenId(customer_id);
} else {
weUser = customerMapper.findCustomerByOpenId(customer_id);
}
if (weUser != null && !weUser.isEmpty()) {
order.put("nickname", weUser.getString("nickname"));
order.put("headimg", weUser.getString("headimg"));
}
break;
default:
break;
}
Calendar calendar = (Calendar) order.get("transaction_time");
String trade_date = DateFormatUtils.format(calendar, "yyyy-MM-dd", calendar.getTimeZone());
String trade_time = DateFormatUtils.format(calendar, "HH:mm:ss", calendar.getTimeZone());
@ -785,6 +804,33 @@ public class RetailAppServiceImp implements RetailAppService {
order.put("date_total", analysis);
date_contains.add(trade_date);
}
String customer_id = order.getString("customer_id");
if (StringUtils.isEmpty(customer_id)) {
continue;
}
switch (order.getString("channel")) {
case "Alipay":
JSONObject alipayUser = managerCustomerRelationAlipayMapper.findCustomerByUserId(customer_id);
if (alipayUser != null) {
order.put("nickname", alipayUser.getString("nickname"));
order.put("headimg", alipayUser.getString("headimg"));
}
break;
case "Wechat":
JSONObject weUser = new JSONObject();
if (customer_id.startsWith("olH")) {
weUser = customerMapper.findCustomerGlobalpayByOpenId(customer_id);
} else {
weUser = customerMapper.findCustomerByOpenId(customer_id);
}
if (weUser != null && !weUser.isEmpty()) {
order.put("nickname", weUser.getString("nickname"));
order.put("headimg", weUser.getString("headimg"));
}
break;
default:
break;
}
}
return PageListUtils.buildPageListResult(orders);
}

@ -564,4 +564,14 @@ public class RetailAppController {
return retailAppService.ctripCouponInfo(device,couponId);
}
@RequestMapping(value = "/cus/coupon_accuess_log/{client_moniker}", method = RequestMethod.GET)
public JSONObject getCouponLogByClientMoniker(@PathVariable String client_moniker, AppQueryBean appQueryBean) {
return retailAppService.getCouponCusCouponLog(client_moniker, appQueryBean);
}
@RequestMapping(value = "/cus/coupon_accuess_log/{coupon_id}", method = RequestMethod.POST)
public void saveCouponAccuessLog(@PathVariable String coupon_id, @RequestParam int client_id) {
retailAppService.saveCouponAccuessLog(client_id, coupon_id);
}
}

@ -1,12 +1,14 @@
package au.com.royalpay.payment.manage.apps.events.listeners;
import au.com.royalpay.payment.core.events.AfterPaymentFinishEvent;
import au.com.royalpay.payment.manage.customers.core.CustomerPaymentInfoService;
import au.com.royalpay.payment.manage.mappers.system.SysCustomerPaymentInfoMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationListener;
import org.springframework.data.redis.core.BoundListOperations;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -17,12 +19,38 @@ import javax.annotation.Resource;
@Service
public class AfterPaymentFinishListener implements ApplicationListener<AfterPaymentFinishEvent> {
@Resource
private StringRedisTemplate stringRedisTemplate;
private SysCustomerPaymentInfoMapper sysCustomerPaymentInfoMapper;
@Resource
private CustomerPaymentInfoService customerPaymentInfoService;
@Resource
private ClientManager clientManager;
@Override
public void onApplicationEvent(AfterPaymentFinishEvent event) {
JSONObject order = event.getFinishedEvent().getOrder();
BoundListOperations<String, String> ops = stringRedisTemplate.boundListOps("customer_impression");
ops.rightPush(order.toJSONString());
if(!"hf".equals(order.getString("channel"))){
return;
}
if(StringUtils.isEmpty(order.getString("ext_params"))){
return;
}
JSONObject extParam = JSONObject.parseObject(order.getString("ext_params"));
JSONObject orderInfo = sysCustomerPaymentInfoMapper.selectPaymentInfo(order.getString("customer_id"));
if (orderInfo != null) {
orderInfo.put("idcard_name", extParam.getString("payer_name"));
orderInfo.put("idcard_no", extParam.getString("payer_identity_card"));
orderInfo.put("bankcard", extParam.getString("card_number"));
orderInfo.put("bank", extParam.getString("bankId"));
sysCustomerPaymentInfoMapper.update(orderInfo);
}else {
JSONObject lastOrderInfo = new JSONObject();
lastOrderInfo.put("wechat_openid", order.getString("customer_id"));
lastOrderInfo.put("idcard_name", extParam.getString("payer_name"));
lastOrderInfo.put("idcard_no", extParam.getString("payer_identity_card"));
lastOrderInfo.put("bankcard", extParam.getString("card_number"));
lastOrderInfo.put("bank", extParam.getString("bankId"));
customerPaymentInfoService.save(lastOrderInfo);
}
clientManager.sendHfEmailNotice(order);
}
}

@ -18,7 +18,7 @@ public interface CouponValidateService {
JSONObject ctripCheck(int client_id);
JSONObject ctripCouponInfo(String coupon_log_id,int client_id);
JSONObject ctripCouponInfo(String coupon_log_id,int client_id,boolean is_expiry);
JSONObject ctripCouponLogNotice(String coupon_log_id,String order_id,String open_id,String status);
}

@ -0,0 +1,12 @@
package au.com.royalpay.payment.manage.customers.core;
import com.alibaba.fastjson.JSONObject;
public interface CustomerPaymentInfoService {
void save(JSONObject paymentInfo);
void update(JSONObject paymentInfo);
JSONObject selectPaymentInfoByOpenId(String open_id);
}

@ -177,7 +177,7 @@ public class CouponValidateServiceImpl implements CouponValidateService {
}
@Override
public JSONObject ctripCouponInfo(String coupon_id, int client_id) {
public JSONObject ctripCouponInfo(String coupon_id, int client_id, boolean is_expiry) {
JSONObject client = clientManager.getClientInfo(client_id);
if(client==null){
throw new NotFoundException("Merchant Not Found");
@ -185,6 +185,9 @@ public class CouponValidateServiceImpl implements CouponValidateService {
String uri = signUrl(UriComponentsBuilder.fromHttpUrl(CUSTOMER_HOST + "/coupon/"+coupon_id+"/couponLogInfo"));
HttpRequestGenerator gen = new HttpRequestGenerator(uri, RequestMethod.GET);
gen.addQueryString("client_moniker",client.getString("client_moniker"));
if (!is_expiry) {
gen.addQueryString("is_expiry", "0");
}
try {
HttpRequestResult reqResult = gen.execute();
if (reqResult.isSuccess()) {

@ -0,0 +1,39 @@
package au.com.royalpay.payment.manage.customers.core.impls;
import au.com.royalpay.payment.manage.customers.core.CustomerPaymentInfoService;
import au.com.royalpay.payment.manage.mappers.system.SysCustomerPaymentInfoMapper;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.utils.id.IdUtil;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class CustomerPaymentInfoImpl implements CustomerPaymentInfoService {
@Resource
private SysCustomerPaymentInfoMapper sysCustomerPaymentInfoMapper;
@Override
public void save(JSONObject paymentInfo) {
if (sysCustomerPaymentInfoMapper.selectPaymentInfo(paymentInfo.getString("wechat_openid")) != null) {
throw new BadRequestException("openid already exists");
}
paymentInfo.put("id", IdUtil.getId());
sysCustomerPaymentInfoMapper.save(paymentInfo);
}
@Override
public void update(JSONObject paymentInfo) {
if (paymentInfo.getString("id") == null) {
throw new BadRequestException("ID is empty");
}
sysCustomerPaymentInfoMapper.update(paymentInfo);
}
@Override
public JSONObject selectPaymentInfoByOpenId(String open_id) {
return sysCustomerPaymentInfoMapper.selectPaymentInfo(open_id);
}
}

@ -0,0 +1,30 @@
package au.com.royalpay.payment.manage.customers.web;
import au.com.royalpay.payment.manage.customers.core.CustomerPaymentInfoService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RestController
@RequestMapping(value = "/customer/payment")
public class CustomerPaymentInfoController {
@Resource
private CustomerPaymentInfoService customerPaymentInfoService;
@RequestMapping(value = "/update", method = RequestMethod.POST)
public void savePaymentInfo(@RequestBody JSONObject paymentInfo) {
customerPaymentInfoService.save(paymentInfo);
}
@RequestMapping(value = "/update", method = RequestMethod.PUT)
public void updatePaymentInfo(@RequestBody JSONObject paymentInfo) {
customerPaymentInfoService.update(paymentInfo);
}
@RequestMapping(value = "/{openid}/check", method = RequestMethod.GET)
public JSONObject selectPaymentInfo(@PathVariable String openid) {
return customerPaymentInfoService.selectPaymentInfoByOpenId(openid);
}
}

@ -0,0 +1,9 @@
package au.com.royalpay.payment.manage.dev.core;
import com.alibaba.fastjson.JSONObject;
public interface HfUpdateService {
String updateStatus();
}

@ -0,0 +1,44 @@
package au.com.royalpay.payment.manage.dev.core.impl;
import au.com.royalpay.payment.manage.dev.core.HfUpdateService;
import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Service;
import java.util.List;
import javax.annotation.Resource;
@Service
public class HfUpdateImpl implements HfUpdateService {
@Resource
private ClientMapper clientMapper;
@Resource
private MpWechatApiProvider mpWechatApiProvider;
@Resource
private ClientConfigMapper clientConfigMapper;
@Override
public String updateStatus() {
List<JSONObject> clientIds = clientMapper.findByhfPayUrlNotNull();
clientIds.forEach(dbResult -> {
String longUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/hf_gateway/partners/" + dbResult.getString("client_moniker") + "/jump/pc");
MpWechatApi api = mpWechatApiProvider.getNewPaymentApi();
String url = api.registerShortUrl(longUrl);
dbResult.put("hf_pay_url", url);
JSONObject config = new JSONObject();
config.put("client_id",dbResult.getString("client_id"));
config.put("hf_pay_url", url);
clientConfigMapper.update(config);
clientMapper.update(dbResult);
});
return "ok";
}
}

@ -13,10 +13,7 @@ import au.com.royalpay.payment.manage.appclient.core.RetailAppService;
import au.com.royalpay.payment.manage.dev.bean.AliExcel;
import au.com.royalpay.payment.manage.dev.bean.Message;
import au.com.royalpay.payment.manage.dev.bean.SendWechatMessage;
import au.com.royalpay.payment.manage.dev.core.AliforexcelService;
import au.com.royalpay.payment.manage.dev.core.HfClearAmountService;
import au.com.royalpay.payment.manage.dev.core.NewpartnerService;
import au.com.royalpay.payment.manage.dev.core.WechatMessageService;
import au.com.royalpay.payment.manage.dev.core.*;
import au.com.royalpay.payment.manage.mappers.customers.CustomerEncourageMoneyUseLogMapper;
import au.com.royalpay.payment.manage.mappers.log.NotifyErrorLogMapper;
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
@ -110,6 +107,8 @@ public class TestController implements ApplicationEventPublisherAware {
private AliforexcelService aliforexcelService;
@Resource
private HfClearAmountService hfClearAmountService;
@Resource
private HfUpdateService hfUpdateService;
@ManagerMapping(value = "/{clientMoniker}/export/agreepdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR})
public void exportAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse) throws Exception {
@ -394,7 +393,12 @@ public class TestController implements ApplicationEventPublisherAware {
}
@ManagerMapping(value = "/hfClearAmount", method = RequestMethod.GET, role = ManagerRole.DEVELOPER)
public JSONObject hfClearAmount(@RequestParam String datefrom, @RequestParam String dateto) {
public JSONObject hfUpdate(@RequestParam String datefrom, @RequestParam String dateto) {
return hfClearAmountService.hfjsonobject(dateto,datefrom);
}
@ManagerMapping(value = "/hfUpdate", method = RequestMethod.GET, role = ManagerRole.DEVELOPER)
public String hfClearAmount() {
return hfUpdateService.updateStatus();
}
}

@ -31,6 +31,8 @@ public interface CleanService {
JSONObject getClearDetails(Date dt, String managerId);
JSONObject getClearDetailsLimit20(Date dt, String managerId);
JSONObject getCleanLogTransactions(int detailId, JSONObject manager);
Map<String,JSONObject> getDayAndChannelOfAnalysisMap(int detailId, String channel,JSONObject manager);

@ -248,6 +248,69 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
return total;
}
@Override
public JSONObject getClearDetailsLimit20(Date settleDate, String managerId) {
List<JSONObject> logs = clearingLogMapper.findByDate(settleDate);
if (logs.isEmpty()) {
throw new NotFoundException();
}
JSONObject total = new JSONObject();
total.put("settle_date", settleDate);
total.put("total_credit", 0);
total.put("total_debit", 0);
total.put("gross_amount", 0);
total.put("wechat_charge", 0);
total.put("royalpay_charge", 0);
total.put("net_amount", 0);
total.put("total_charge", 0);
total.put("tax_amount", 0);
total.put("charge_cashback", 0);
List<JSONObject> details = new ArrayList<>();
List<JSONObject> totalList = new ArrayList<>();
int clearingId = 0;
for (JSONObject log : logs) {
addBigDecimal(total, log, "total_credit");
addBigDecimal(total, log, "total_debit");
addBigDecimal(total, log, "gross_amount");
addBigDecimal(total, log, "wechat_charge");
addBigDecimal(total, log, "royalpay_charge");
addBigDecimal(total, log, "net_amount");
addBigDecimal(total, log, "total_charge");
addBigDecimal(total, log, "charge_cashback");
addBigDecimal(total, log, "tax_amount");
clearingId = log.getIntValue("clearing_id");
List<JSONObject> logDetails = clearingDetailMapper.listReportsOfSettlementLimit20(clearingId);
details.addAll(logDetails);
List<String> banks = logDetails.stream().map(detail -> detail.getString("settle_bank")).distinct().collect(Collectors.toList());
List<JSONObject> bankStatistics = banks.stream().map(bank -> {
JSONObject data = new JSONObject();
data.put("bank", bank);
data.put("total_settle", logDetails.stream()
.filter(detail -> bank.equals(detail.getString("settle_bank")))
.map(detail -> detail.getBigDecimal("clearing_amount"))
.reduce(BigDecimal::add)
);
data.put("clients", logDetails.stream()
.filter(detail -> bank.equals(detail.getString("settle_bank")))
.count());
return data;
}).collect(Collectors.toList());
//bankStatistics.put()
log.put("bank_statistics", bankStatistics);
log.put("editable", DateUtils.isSameDay(log.getDate("settle_date"), new Date()) && log.getBooleanValue("editable"));
log.put("channel_analysis", clearingDetailAnalysisMapper.analysisChannelReport(clearingId));
}
totalList = clearingDetailMapper.listRepostTotal(clearingId);
total.put("totalList", totalList);
total.put("logs", logs);
total.put("details", details);
List<JSONObject> channels = clearingDetailAnalysisMapper.analysisChannelReportDaily(settleDate);
total.put("channel_analysis", channels);
return total;
}
private void addBigDecimal(JSONObject total, JSONObject log, String key) {
total.put(key, total.getBigDecimal(key).add(log.getBigDecimal(key)));
}

@ -42,6 +42,16 @@ public class SettlementDevController {
}
@RequestMapping("/reports/{date}")
public JSONObject settleReportLimit20(@PathVariable String date,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
try {
Date dt = dateFormat.parse(date);
return cleanService.getClearDetailsLimit20(dt, manager.getString("manager_id"));
} catch (ParseException e) {
throw new BadRequestException("error.payment.valid.invalid_date_format");
}
}
@RequestMapping("/reports/{date}/all")
public JSONObject settleReport(@PathVariable String date, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
try {
Date dt = dateFormat.parse(date);

@ -29,6 +29,8 @@ public interface ClearingDetailMapper {
List<JSONObject> listReportsOfSettlement(@Param("clearing_id") int clearingId);
List<JSONObject> listReportsOfSettlementLimit20(@Param("clearing_id") int clearingId);
JSONObject listReportsOfSettleCleanDay(@Param("clearing_id") int clearingId, @Param("client_ids") List<String> client_ids);
PageList<JSONObject> listReportsOfSettlementLogs(JSONObject params, PageBounds pagination);
@ -48,4 +50,7 @@ public interface ClearingDetailMapper {
@AutoSql(type = SqlType.DELETE)
void deleteSettleLogs(@Param("clearing_id") int clearingId);
List<JSONObject> listRepostTotal(@Param("clearing_id") int clearingId);
}

@ -2,6 +2,8 @@ package au.com.royalpay.payment.manage.mappers.log;
import java.util.List;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param;
import com.alibaba.fastjson.JSONObject;
@ -26,4 +28,7 @@ public interface CouponAccuessLogMapper {
@AutoSql(type = SqlType.SELECT)
List<JSONObject> findCouponByOrderId(@Param("order_id") String order_id);
@AutoSql(type = SqlType.SELECT)
PageList<JSONObject> getCouponAccuessLog(@Param("client_id")int client_id, PageBounds pageBounds);
}

@ -76,4 +76,6 @@ public interface ClientAccountMapper {
List<JSONObject> listNullUnionIdAccounts();
List<JSONObject> query(JSONObject params);
List<JSONObject> partnerAndSubPartnerAccounts(@Param("client_id") int clientId);
}

@ -4,6 +4,7 @@ import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
@ -94,4 +95,6 @@ public interface ClientMapper {
@AutoSql(type = SqlType.SELECT)
JSONObject findByWechatInstitutionMerchantId(@Param("wechat_institution_merchant_id") String wechat_institution_merchant_id);
List<JSONObject> findByhfPayUrlNotNull();
}

@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@ -63,4 +64,7 @@ public interface ManagerMapper {
List<JSONObject> listOpenIdByRole(@Param("mask") int mask);
List<JSONObject> listServants(@Param("mask") int mask);
@Select("select email from sys_managers where is_valid=1 AND role & 256 > 0 AND email IS NOT NULL")
List<String> listDevManager();
}

@ -0,0 +1,23 @@
package au.com.royalpay.payment.manage.mappers.system;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param;
@AutoMapper(tablename = "sys_customer_payment_info", pkName = "id")
public interface SysCustomerPaymentInfoMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject paymentInfo);
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject paymentInfo);
@AutoSql(type = SqlType.SELECT)
JSONObject selectPaymentInfo(@Param(value = "wechat_openid") String open_id);
@AutoSql(type = SqlType.SELECT)
JSONObject selectById(@Param(value = "id") String id);
}

@ -326,4 +326,8 @@ public interface ClientManager {
@Transactional
void switchHfLink(JSONObject manager, String clientMoniker,boolean allow);
void sendHfEmailNotice(JSONObject order);
void updateAllPartnerPassword(String clientMoniker, List<String> emails);
}

@ -154,13 +154,8 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.*;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
@ -416,6 +411,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (audit_logs != null && !audit_logs.isEmpty()) {
client.put("audit_logs", audit_logs);
}
//HF支付链接二维码
if (client.getString("hf_pay_url") != null) {
String hfQrcodeUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/hf_gateway/partners/" + client.getString("client_moniker") + "/jump/app");
client.put("hfQrcodeUrl", QRCodeUtils.qrcodeImageCode(hfQrcodeUrl, 200, false));
}
return client;
}
@ -886,7 +887,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (StringUtils.isEmpty(client.getString("sub_merchant_id"))) {
throw new BadRequestException("Sub Merchant ID Can't be null ");
}
String username = clientMoniker + client.getString("sub_merchant_id");
String username = clientMoniker;
boolean duplicated = true;
String pwd = RandomStringUtils.random(8, true, true);
while (duplicated) {
@ -899,7 +900,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
newAccount(clientMoniker, account, manager, 1);
duplicated = false;
} catch (Exception e) {
username += "1";
username += "0";
}
}
sendInitEmail(client, username, pwd);
@ -959,9 +960,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
ctx.setVariable("client_moniker", client.getString("client_moniker"));
ctx.setVariable("contact_person", client.getString("contact_person"));
ctx.setVariable("credential_code", client.getString("credential_code"));
final String content = thymeleaf.process("mail/new_client_notice", ctx);
// final String content = VelocityEngineUtils.mergeTemplateIntoString(null, "mail/new_client_notice.vm",
// "utf-8", model);
ctx.setVariable("password", "*****");
final String contentBd = thymeleaf.process("mail/new_client_notice", ctx);
final String mailTo = client.getString("contact_email");
if (StringUtils.isEmpty(mailTo)) {
throw new EmailException("Client Contact Email is invalid");
@ -977,8 +981,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
public void run() {
try {
String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", mailTo,
emails.isEmpty() ? "" : StringUtils.join(emails, ","), content);
String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", mailTo, "", content);
mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", emails.isEmpty() ? "" : StringUtils.join(emails, ","),
"", contentBd);
JSONObject clientUpdate = new JSONObject();
clientUpdate.put("client_id", client.getIntValue("client_id"));
clientUpdate.put("approve_email_send", 3);
@ -1175,6 +1180,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new NotFoundException("Client Not Exists");
}
if (channel.equals("hf") && !allow && client.getBoolean("enable_hf_email_notice")) {
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_hf_email_notice", allow));
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel.toLowerCase(), allow));
logger.info(manager.getString("display_name") + "(" + manager.getString("manager_id") + ") switched client " + clientMoniker + " channel "
+ channel + " to " + allow);
@ -3751,12 +3759,66 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_link", allow));
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_hf", allow));
}
@Override
public void sendHfEmailNotice(JSONObject order) {
JSONObject client = clientMapper.findClient(order.getIntValue("client_id"));
JSONObject clientConfig = clientConfigMapper.find(order.getIntValue("client_id"));
if (client == null || clientConfig == null) {
return;
}
if (client.getString("contact_email") == null ||
!clientConfig.getBoolean("enable_hf_email_notice")) {
return;
}
Context ctx = new Context();
ctx.setVariable("img_url", PlatformEnvironment.getEnv().concatUrl("/static/images/royalpay_logo.png"));
ctx.setVariable("name", client.getString("contact_person"));
ctx.setVariable("order_id", order.getString("order_id"));
ctx.setVariable("amount", order.getString("total_amount"));
ctx.setVariable("time", order.getString("create_time"));
final String content = thymeleaf.process( "mail/hf_email_notice", ctx);
final String mailTo = client.getString("contact_email");
if (StringUtils.isEmpty(mailTo)) {
throw new EmailException("Client Contact Email is invalid");
}
new Thread(() -> {
try {
mailService.sendEmail("你刚刚有一笔到账信息", mailTo, "", content);
} catch (Exception ignored) {
logger.error("邮件发送失败", ignored);
}
}).start();
}
@Override
public void updateAllPartnerPassword(String clientMoniker, List<String> emails) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
List<JSONObject> partners = clientAccountMapper.partnerAndSubPartnerAccounts(client.getIntValue("client_id"));
partners.stream().forEach(partner -> {
String pwd = RandomStringUtils.random(8, true, true);
String salt = PasswordUtils.newSalt();
String pwdHash = PasswordUtils.hashPwd(pwd, salt);
partner.put("salt", salt);
partner.put("password_hash", pwdHash);
partner.put("password_aes", PasswordUtils.encryptAESPwd(pwd));
deviceManager.deviceOffline(partner.getString("account_id"));
clientAccountMapper.update(partner);
signInAccountService.clearAccountCache(partner.getString("account_id"));
partner.put("password", pwd);
});
sendTestMerchantPassword(partners, emails);
}
@Override
public String getShortLink(String clientMoniker) {
String longUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/hf_gateway/partners/" + clientMoniker + "/jump");
String longUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/hf_gateway/partners/" + clientMoniker + "/jump/pc");
MpWechatApi api = mpWechatApiProvider.getNewPaymentApi();
return api.registerShortUrl(longUrl);
}
@ -3782,4 +3844,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
private void sendTestMerchantPassword(List<JSONObject> accounts, List<String> emails) {
Context ctx = new Context();
ctx.setVariable("accounts", accounts);
final String content = thymeleaf.process( "mail/test_merchant_password", ctx);
new Thread(() -> {
try {
mailService.sendEmail("测试商户账户已更新", emails.isEmpty() ? "" : StringUtils.join(emails, ","), "", content);
} catch (Exception ignored) {
logger.error("邮件发送失败", ignored);
}
}).start();
}
}

@ -284,12 +284,12 @@ public class PartnerManageController {
return tradeLogService.listOrderRefunds(orderId, null);
}
@ManagerMapping(value = "/{clientMoniker}/accounts", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR, ManagerRole.SERVANT, ManagerRole.DIRECTOR})
@ManagerMapping(value = "/{clientMoniker}/accounts", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR, ManagerRole.SERVANT, ManagerRole.DIRECTOR,ManagerRole.DEVELOPER})
public List<JSONObject> partnerAccounts(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return clientManager.listAccounts(manager, clientMoniker);
}
@ManagerMapping(value = "/{clientMoniker}/accounts", method = RequestMethod.POST, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER, ManagerRole.SERVANT})
@ManagerMapping(value = "/{clientMoniker}/accounts", method = RequestMethod.POST, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.DEVELOPER})
public JSONObject addPartnerAccount(@RequestBody @Valid NewAccountBean account, Errors errors, @PathVariable String clientMoniker,
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
HttpUtils.handleValidErrors(errors);
@ -546,4 +546,9 @@ public class PartnerManageController {
clientManager.switchHfLink(manager, clientMoniker, pass.getBooleanValue("allow"));
}
@ManagerMapping(value = "/{clientMoniker}/hf/email_notice", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER})
public void switchHfEmailNotice(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchPermission(manager, clientMoniker, "enable_hf_email_notice", pass.getBooleanValue("allow"));
}
}

@ -11,6 +11,7 @@ public class ProductBean {
private String name;
private String price;
private String industry;
private String hf_industry;
private String counts;
private String degree;
private String client_moniker;
@ -32,6 +33,9 @@ public class ProductBean {
if (StringUtils.isNotBlank(industry)) {
param.put("industry", industry);
}
if (StringUtils.isNotBlank(hf_industry)) {
param.put("hf_industry", hf_industry);
}
if (StringUtils.isNotBlank(counts)) {
param.put("counts", counts);
}
@ -79,6 +83,14 @@ public class ProductBean {
this.industry = industry;
}
public String getHf_industry() {
return hf_industry;
}
public void setHf_industry(String hf_industry) {
this.hf_industry = hf_industry;
}
public String getCounts() {
return counts;
}

@ -159,6 +159,7 @@ public class ClientProductImpl implements ClientProduct {
object.put("industry", sqlValue[2]);
object.put("counts", sqlValue[3]);
object.put("degree", sqlValue[4]);
object.put("hf_industry", sqlValue[5]);
object.put("client_id", client.getString("client_id"));
object.put("create_id",manager.getString("manager_id"));
object.put("create_time",new Date());

@ -1,37 +1,54 @@
package au.com.royalpay.payment.manage.signin.web;
import com.google.code.kaptcha.Producer;
import au.com.royalpay.payment.manage.customers.core.CustomerPaymentInfoService;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.permission.manager.PartnerMapping;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
import au.com.royalpay.payment.manage.signin.beans.FindPwdBean;
import au.com.royalpay.payment.manage.signin.beans.LoginInfo;
import au.com.royalpay.payment.manage.signin.beans.TodoNotice;
import au.com.royalpay.payment.manage.signin.core.*;
import au.com.royalpay.payment.manage.signin.core.ClientLoginLogRepository;
import au.com.royalpay.payment.manage.signin.core.ManagerLoginLogRepository;
import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider;
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
import au.com.royalpay.payment.manage.signin.core.SignInStatusManager;
import au.com.royalpay.payment.tools.CommonConsts;
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.WxOauthType;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.http.HttpUtils;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.permission.wechat.WechatMapping;
import com.alibaba.fastjson.JSONObject;
import com.google.code.kaptcha.Producer;
import org.springframework.ui.Model;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* Created by yixian on 2016-06-29.
@ -54,6 +71,8 @@ public class SignInController {
@Resource
private MpWechatApiProvider mpWechatApiProvider;
@Resource
private CustomerPaymentInfoService customerPaymentInfoService;
@RequestMapping(value = "/partner_signin", method = RequestMethod.POST)
@ -340,8 +359,13 @@ public class SignInController {
}
@RequestMapping(value = "/customer_wechat_qrcode/{codeId}/check", method = RequestMethod.GET)
public void getCustomerID(@PathVariable String codeId, HttpServletResponse response) {
public JSONObject getCustomerID(@PathVariable String codeId, HttpServletResponse response,@RequestParam(value = "pay_info",defaultValue = "false") boolean pay_info) {
JSONObject result = new JSONObject();
String statusKey = signInStatusManager.getWechatCustomerId(codeId);
if(pay_info){
result = customerPaymentInfoService.selectPaymentInfoByOpenId(statusKey);
}
HttpUtils.setCookie(response, "CustomerID", statusKey,false);
return result;
}
}

@ -0,0 +1,43 @@
package au.com.royalpay.payment.manage.task;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
@Component
@ConditionalOnProperty(value = "app.run-tasks", havingValue = "false")
public class UpdatePartnerPasswordTask {
private Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private ClientManager clientManager;
@Resource
private SynchronizedScheduler synchronizedScheduler;
@Resource
private ManagerMapper managerMapper;
private final static String EMAIL = "lily.tao@royalpay.com.au,bella.sun@royalpay.com.au," +
"astro.dai@royalpay.com.au,taylor.dang@royalpay.com.au";
@Scheduled(cron = "0 0 9 28 * ?")
public void resetPartnerPassword() {
synchronizedScheduler.executeProcess("manage_task:resetPartnerPassword", 120_000, () -> {
final List<String> emails = managerMapper.listDevManager();
List<String> emailList = Arrays.asList(EMAIL.split(","));
emailList.stream().forEach(email -> {
if (!emails.contains(email)) {
emails.add(email);
}
});
clientManager.updateAllPartnerPassword("PINE", emails);
});
}
}

@ -25,7 +25,37 @@
INNER JOIN sys_clients c ON c.client_id = d.client_id AND c.is_valid=1
WHERE d.clearing_id = #{clearing_id}
</select>
<select id="listReportsOfSettlementLimit20" resultType="com.alibaba.fastjson.JSONObject">
(SELECT
d.*,DATE_FORMAT(d.report_date,'%y-%m-%d')clear_date,DATE_FORMAT(d.settle_date_from,'%m-%d')settle_from,DATE_FORMAT(d.settle_date_to,'%m-%d')settle_to,
c.client_id as cid,
c.client_moniker,
c.parent_client_id
FROM log_clearing_detail d
INNER JOIN sys_clients c ON c.client_id = d.client_id AND c.is_valid=1
WHERE d.clearing_id = #{clearing_id} and clear_days='1' limit 20
) UNION All
( SELECT
d.*,DATE_FORMAT(d.report_date,'%y-%m-%d')clear_date,DATE_FORMAT(d.settle_date_from,'%m-%d')settle_from,DATE_FORMAT(d.settle_date_to,'%m-%d')settle_to,
c.client_id as cid,
c.client_moniker,
c.parent_client_id
FROM log_clearing_detail d
INNER JOIN sys_clients c ON c.client_id = d.client_id AND c.is_valid=1
WHERE d.clearing_id = #{clearing_id} and clear_days='2' limit 20
)
UNION All
( SELECT
d.*,DATE_FORMAT(d.report_date,'%y-%m-%d')clear_date,DATE_FORMAT(d.settle_date_from,'%m-%d')settle_from,DATE_FORMAT(d.settle_date_to,'%m-%d')settle_to,
c.client_id as cid,
c.client_moniker,
c.parent_client_id
FROM log_clearing_detail d
INNER JOIN sys_clients c ON c.client_id = d.client_id AND c.is_valid=1
WHERE d.clearing_id = #{clearing_id} and clear_days='3' limit 20
)
</select>
<select id="listReportsOfSettleCleanDay" resultType="com.alibaba.fastjson.JSONObject">
SELECT SUM(d.clearing_amount) total_amount
FROM log_clearing_detail d
@ -77,4 +107,11 @@
<if test="end!=null">and report_date &lt;= #{end}</if>
</where>
</select>
<select id="listRepostTotal" resultType="com.alibaba.fastjson.JSONObject">
select count(*) as clients,SUM(clearing_amount) as total_settle,settle_bank as bank,clear_days from log_clearing_detail where clearing_id=#{clearing_id}
GROUP BY
clear_days
</select>
</mapper>

@ -17,4 +17,10 @@
</if>
</where>
</select>
<select id="partnerAndSubPartnerAccounts" resultType="com.alibaba.fastjson.JSONObject">
SELECT sc.client_moniker, sa.*
FROM sys_clients sc
INNER JOIN sys_accounts sa ON sc.client_id = sa.client_id AND sa.is_valid = 1
WHERE sc.client_id = #{client_id} OR sc.parent_client_id = #{client_id} AND sc.is_valid = 1
</select>
</mapper>

@ -6,23 +6,24 @@
WHERE is_valid=1 and (approve_result = 1 or approve_result = 2)
</select>
<select id="listGreenChannel" resultType="com.alibaba.fastjson.JSONObject">
select m.manager_id manager_id,m.display_name display_name, m.wx_openid wx_openid , c.client_moniker client_moniker
select m.manager_id manager_id,m.display_name display_name, m.wx_openid wx_openid , c.client_moniker
client_moniker
from sys_clients c
left join sys_client_bd cb on cb.client_id = c.client_id
left join sys_managers m on m.manager_id = cb.bd_id
where approve_result = 2 and (source = 1 or source = 2)
<if test="approve_time != null and interval_begin_day != null">
and TIMESTAMPDIFF(DAY,c.approve_time,#{approve_time})&gt;#{interval_begin_day}
</if>
<if test="approve_time != null and interval_begin_day != null">
and TIMESTAMPDIFF(DAY,c.approve_time,#{approve_time})&gt;#{interval_begin_day}
</if>
<if test="approve_time != null and interval_end_day != null">
and TIMESTAMPDIFF(DAY,c.approve_time,#{approve_time})&lt;#{interval_end_day}
</if>
<if test="open_status != null">
and c.open_status = #{open_status}
</if>
<if test="managerId!=null">
and m.manager_id = #{managerId}
</if>
<if test="open_status != null">
and c.open_status = #{open_status}
</if>
<if test="managerId!=null">
and m.manager_id = #{managerId}
</if>
order by display_name
</select>
<select id="listPartners" resultType="com.alibaba.fastjson.JSONObject">
@ -101,7 +102,8 @@
and c.suburb like #{suburb_pattern}
</if>
<if test="approving">
and ((c.approve_result=4 and c.open_status is null) or (c.approve_result=3 and c.open_status is null) or c.open_status=1 or c.open_status=2 or c.open_status=4)
and ((c.approve_result=4 and c.open_status is null) or (c.approve_result=3 and c.open_status is null) or
c.open_status=1 or c.open_status=2 or c.open_status=4)
</if>
<if test="state!=null">
and c.state=#{state}
@ -137,7 +139,8 @@
<if test="search_text!=null">
<bind name="name_pattern" value="'%'+search_text+'%'"/>
<if test="text_type=='all'">
and (c.client_moniker=#{search_text} or c.short_name like #{name_pattern} or c.company_name like #{name_pattern} or c.business_name like #{name_pattern} or c.remark like
and (c.client_moniker=#{search_text} or c.short_name like #{name_pattern} or c.company_name like
#{name_pattern} or c.business_name like #{name_pattern} or c.remark like
#{name_pattern} or c.contact_email=#{search_text})
</if>
<if test="text_type=='client_moniker'">
@ -161,7 +164,8 @@
</if>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
<if test="referrer_id!=null">and c.referrer_id=#{referrer_id}</if>
<if test="is_valid">and c.is_valid=1</if>
</where>
@ -222,7 +226,8 @@
</if>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
and c.is_valid=1
</where>
GROUP BY c.contact_email
@ -267,21 +272,25 @@
<select id="listUnAuthPartners" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT
client_id,
client_moniker,
approve_time
FROM sys_clients
WHERE is_valid = 1 AND approve_result = 2 AND source = 4 AND datediff(now(), approve_time) <= #{auth_days}
]]>
</select>
<select id="analysisClients" resultType="com.alibaba.fastjson.JSONObject">
SELECT
sum(if(((c.approve_result=4 and c.open_status is null) or (c.approve_result=3 and c.open_status is null) or c.open_status=1 or c.open_status=2 or c.open_status=4),1,0)) wp,
sum(if(((c.approve_result=4 and c.open_status is null) or (c.approve_result=3 and c.open_status is null) or
c.open_status=1 or c.open_status=2 or c.open_status=4),1,0)) wp,
sum(if(c.approve_result is null and c.source= 4,1,0)) a_unagree,
sum(if(((c.approve_result=4 and c.open_status is null) or (c.approve_result=3 and c.open_status is null) or c.open_status=1 or c.open_status=2 or c.open_status=4) and c.source = 4,1,0)) a_wp,
sum(if(((c.approve_result=4 and c.open_status is null) or (c.approve_result=3 and c.open_status is null) or
c.open_status=1 or c.open_status=2 or c.open_status=4) and c.source = 4,1,0)) a_wp,
sum(if(c.approve_result=2 and c.source = 4,1,0)) wa,
sum(if(c.approve_result=1,1,0)) pass,
sum(if(c.approve_result=1 and c.source=2,1,0)) z_pass,
@ -340,7 +349,7 @@
)
</if>
<if test="source!=null">
and source = #{source}
and source = #{source}
</if>
<if test="approve_result!=null">
and approve_result = #{approve_result}
@ -349,4 +358,8 @@
and contact_email = #{contact_email}
</if>
</select>
<select id="findByhfPayUrlNotNull" resultType="com.alibaba.fastjson.JSONObject">
select client_id,client_moniker FROM sys_clients WHERE hf_pay_url != ''
</select>
</mapper>

@ -12,6 +12,9 @@
<if test="industry!=null">
and co.industry=#{industry}
</if>
<if test="hf_industry!=null">
and co.hf_industry=#{hf_industry}
</if>
<if test="client_id!=null">
and co.client_id = #{client_id}
</if>

@ -0,0 +1,31 @@
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
</head>
<body>
<div style="width: 91%;border: 1px #F2F2F2 solid;margin: 0 auto; ">
<div style="height: 3%;background-color: #F2F2F2;"></div>
<div style="text-align: center;margin-top: 2.5%;">
<img th:src="${img_url}"/>
</div>
<div style="width: 80.3%;margin: 0 auto;">
<p>您好,<span th:text="${name}"></span></p>
<p>您有一笔收款信息如下:</p>
<div style="border: 1px #EAEAEA solid;margin-bottom: 5.5%;font-size: 12px;">
<p style="margin-left: 3%;">RoyalPay到账提醒</p>
<ul>
<li style="margin-bottom: 6px;">订单编号:<span style="color: #EE6723;" th:text="${order_id}"></span></li>
<li style="margin-bottom: 6px;">收款金额:<span style="color: #EE6723;" th:text="${amount}"></span></li>
<li style="margin-bottom: 6px;">到账时间:<span style="color: #EE6723;" th:text="${time}"></span></li>
</ul>
</div>
<span>此致</span><br />
<span>RoyalPay</span>
</div>
<div style="height: 3%;background-color: #F2F2F2;margin-top: 6.5%;"></div>
</div>
</body>
</html>

@ -0,0 +1,49 @@
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
<style type="text/css">
table.gridtable {
font-family: verdana,arial,sans-serif;
font-size:11px;
color:#333333;
border-width: 1px;
border-color: #666666;
border-collapse: collapse;
}
table.gridtable th {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #dedede;
}
table.gridtable td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #ffffff;
}
</style>
<table class="gridtable">
<thead>
<tr>
<th>序号</th>
<th>商户</th>
<th>角色</th>
<th>用户名</th>
<th>密码</th>
</tr>
</thead>
<tbody>
<tr th:each="account : ${accounts}">
<td th:text="${accountStat.index} + 1"></td>
<td th:text="${account.client_moniker}"></td>
<td th:if="${account.role} == 1">admin</td>
<td th:if="${account.role} == 2">Manager</td>
<td th:if="${account.role} == 3">Cashier</td>
<td th:text="${account.username}"></td>
<td th:text="${account.password}"></td>
</tr>
</tbody>
</table>
</html>

@ -994,7 +994,7 @@ margin-bottom: 10%;"/>
<!--<i class="fa fa-file-image-o"></i> -->Marketing Materials
</a>
</li>
<li ng-if="[1]|withRole">
<li ng-if="(currentUser.client.client_id!=9 && currentUser.client.parent_client_id!=9)&&([1]|withRole)">
<a ui-sref="accounts">
<!--<i class="fa fa-users"></i> -->Accounts
</a>

@ -243,6 +243,8 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
}]);
app.controller('settlementDetailCtrl', ['$scope', '$stateParams', '$http', '$uibModal', '$filter', '$state', 'detail', 'commonDialog',
function ($scope, $stateParams, $http, $uibModal, $filter, $state, detail, commonDialog) {
$scope.allButton = false;
$scope.limitButton = true;
$scope.detail = detail.data;
$scope.hasSentMail = false;
$scope.sendNotice = false;
@ -250,6 +252,9 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
$scope.analysisFilter = {};
$scope.currentAnalysis = $scope.detail;
$scope.pageCtrl = {visible:{}};
var t1Amount =0;
var t2Amount =0;
var t3Amount =0;
function getAnalysisTemplate() {
return [
@ -266,7 +271,44 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
};
angular.forEach($scope.detail.logs, function (batch) {
$scope.batchAnalysis[batch.clearing_id + ''] = getAnalysisTemplate();
});
$scope.allClearing = function() {
$http.get('/sys/settlement/reports/' + $stateParams.date + '/all').then(function (resp) {
angular.forEach($scope.settleAnalysis, function (list) {
list.settles.splice(0, list.settles.length);
list.clients = 0;
list.settleAmount = 0;
});
angular.forEach(resp.data.details, function (settleItem) {
var settleDays = settleItem.clear_days;
attachAnalysis($scope.settleAnalysis[Math.min(settleDays - 1, 2)]);
attachAnalysis($scope.batchAnalysis[settleItem.clearing_id + ''][Math.min(settleDays - 1, 2)]);
function attachAnalysis(analysisItem) {
analysisItem.settles.push(settleItem);
analysisItem.clients++;
analysisItem.settleAmount = Decimal.add(analysisItem.settleAmount, settleItem.clearing_amount).toFixed(2, Decimal.ROUND_FLOOR);
}
});
$scope.allButton = true;
$scope.limitButton = false;
});
};
$scope.packup = function() {
angular.forEach($scope.settleAnalysis, function (list) {
list.settles.splice(20, list.settles.length);
list.clients = 20;
});
$scope.settleAnalysis[0].settleAmount = t1Amount;
$scope.settleAnalysis[1].settleAmount = t2Amount;
$scope.settleAnalysis[2].settleAmount = t3Amount;
$scope.allButton = false;
$scope.limitButton = true;
};
angular.forEach($scope.detail.details, function (settleItem) {
var settleDays = settleItem.clear_days;
@ -279,6 +321,10 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
analysisItem.settleAmount = Decimal.add(analysisItem.settleAmount, settleItem.clearing_amount).toFixed(2, Decimal.ROUND_FLOOR);
}
});
t1Amount = $scope.settleAnalysis[0].settleAmount;
t2Amount = $scope.settleAnalysis[1].settleAmount;
t3Amount = $scope.settleAnalysis[2].settleAmount;
var nowStr = $filter('date')(new Date(), "yyyy-MM-dd");
$scope.datePattern = $stateParams.date;
if ($scope.datePattern == nowStr) {

@ -169,6 +169,14 @@
</ul>
</div>
</div>
<div class="box ">
<div class="box-header" ><span >Total Amount:</span></div>
<div style="padding-left: 2%" ng-repeat="clearingTotal in detail.totalList" >
<span ng-bind="'T+' + clearingTotal.clear_days"></span>
<span ng-bind="'Clients:' + clearingTotal.clients"></span> &nbsp Amounts:
<span ng-bind="+clearingTotal.total_settle |currency:''"></span>
</div>
</div>
<div class="box box-success settle-result-box"
ng-repeat="group in batchAnalysis[analysisFilter.clearing_id==null?'All':analysisFilter.clearing_id+'']">
@ -217,6 +225,14 @@
</tr>
</tbody>
</table>
<a style="cursor: pointer" class="list-group-item col-sm-12 col-xs-12 text-center" >
<span class="small-box-footer cursor" ng-click="allClearing()" ng-hide="allButton">
全部 <i class="fa fa-arrow-circle-down"></i>
</span>
<span class="small-box-footer cursor pull-right" ng-click="packup()" ng-hide="limitButton">
收起 <i class="fa fa-arrow-circle-up"></i>
</span>
</a>
</div>
</div>
</section>

@ -8,7 +8,8 @@ define(['../app'], function (app) {
{"label": "SA", "value": "SA"},
{"label": "TAS", "value": "TAS"},
{"label": "VIC","value": "VIC"},
{"label": "WA", "value": "WA"}
{"label": "WA", "value": "WA"},
{"label": "其他(Other)", "value": "其他(Other)"}
];
app.factory('stateMap', function () {
return {

@ -59,7 +59,11 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
url: '/hfClearAmount',
templateUrl: '/static/config/devtools/templates/hfClearAmount.html',
controller: 'hfClearAmountCtrl'
})
}).state('devtools.hfupdate', {
url: '/hfupdate',
templateUrl: '/static/config/devtools/templates/hfupdate.html',
controller: 'hfupdateCtrl'
})
}]);
app.controller('devManualRefundCtrl', ['$scope', '$http', 'commonDialog', function ($scope, $http, commonDialog) {
$scope.sendRefund = function () {
@ -363,6 +367,23 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}]);
app.controller('hfupdateCtrl', ['$scope', '$http','$filter', function ($scope, $http,$filter) {
$scope.selecttotal = true;
$scope.select = function () {
$scope.totalhide = true;
$scope.selecttotal = false;
$http.get('/dev/hfUpdate').then(function (resp) {
alert(resp.data);
$scope.totalhide = false;
$scope.selecttotal = true;
}, function (resp) {
alert(resp.data.message);
})
}
}]);
return app;
});

@ -0,0 +1,15 @@
<section class="content-header">
<h1>更新HF短链接</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-cog"></i> Basic Config
</li>
<li><a ui-sref="^">Dev Tools</a></li>
<li class="active">hfupdate</li>
</ol>
</section>
<section class="content">
<div class="box">
<button class="btn btn-primary" ng-click="select()">Update</button> <label ng-hide="selecttotal" style="padding-left: 30px">请稍后</label>
</div>
</section>

@ -79,6 +79,10 @@
<i class="fa fa-credit-card-alt"></i>
HF清算金额统计
</a>
<a class="btn btn-app" role="button" ui-sref=".hfupdate">
<i class="fa fa-credit-card-alt"></i>
更新HF短连接
</a>
</div>
</div>
</section>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

@ -113,6 +113,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
url: '/payment',
templateUrl: '/static/payment/partner/templates/partner_payment_info.html',
controller: 'partnerPaymentInfoCtrl'
}).state('partners.detail.payment_info_invalid', {
url: '/payment_invalid',
templateUrl: '/static/payment/partner/templates/partner_payment_info_invalid.html',
controller: 'partnerPaymentInfoCtrl'
}).state('partners.detail.subpartners', {
url: '/sub_partners',
templateUrl: '/static/payment/partner/templates/sub_partners.html',
@ -1369,7 +1373,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
})
})
};
$scope.init = {jsapi: false, gateway: false, offline: false, refund: false,common_sub_merchant_id:false, channel: {},gateway_alipay_online:false,hf_Link:false};
$scope.init = {jsapi: false, gateway: false, offline: false, refund: false,common_sub_merchant_id:false, channel: {},gateway_alipay_online:false,hf_Link:false,enable_hf_email_notice:false};
$scope.switchCommonSubMerchantId = function () {
if (!$scope.paymentInfo) {
return;
@ -1474,6 +1478,25 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
})
};
$scope.toggleHfEmailNotice = function () {
if (!$scope.paymentInfo) {
return;
}
if (!$scope.init.enable_hf_email_notice) {
$scope.init.enable_hf_email_notice = true;
return;
}
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/hf/email_notice', {allow: $scope.paymentInfo.enable_hf_email_notice}).then(function () {
$scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({
title: 'Failed to change enable_hf_email_notice permission status',
content: resp.data.message,
type: 'error'
});
})
};
$scope.toggleJsApi = function () {
if (!$scope.paymentInfo) {
return;
@ -3284,4 +3307,4 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
};
});
return app;
});
});

@ -103,7 +103,7 @@
<label class="control-label col-sm-2">HF Pay Link</label>
<div class="col-sm-10">
<p class="form-control-static">{{partner.hf_pay_url}}
<span id="intro">
<!-- <span id="intro">
<a href=""><i id="carousel_id" class="glyphicon glyphicon-info-sign" ng-mouseover="toFirst();toShow()"></i></a>
<div class="pos" ng-show="show">
<i class="tocancle glyphicon glyphicon-remove" ng-click="toHide()"></i>
@ -116,9 +116,16 @@
</uib-slide>
</uib-carousel>
</div>
</span>
</span>-->
</p>
</div>
<div class="form-group" >
<label class="col-sm-2 control-label">HF Pay QR Code</label>
<img ng-src="{{partner.hfQrcodeUrl}}" class="img-responsive">
<div>
&nbsp;&nbsp;<span style="padding-left: 18.5%;font-size:9px;">仅支持微信客户端扫描</span>
</div>
</div>
</div>
</div>
</div>

@ -1,7 +1,7 @@
<div class="row margin-bottom">
<div class="col-sm-12">
<div class="btn-group">
<button class="btn btn-success" type="button" ng-click="addAccount()" ng-if="'111'|withRole">
<button class="btn btn-success" type="button" ng-click="addAccount()" ng-if="'100000011'|withRole">
<i class="fa fa-plus"></i> Add Account
</button>
</div>
@ -9,7 +9,7 @@
</div>
<div class="row">
<div class="col-sm-12">
<p ng-if="!accounts.length">There is no accounts for this partner, <a role="button" ng-click="addAccount()" ng-if="'111'|withRole">Create One</a></p>
<p ng-if="!accounts.length">There is no accounts for this partner, <a role="button" ng-click="addAccount()" ng-if="'100000011'|withRole">Create One</a></p>
<div class="col-sm-12 table-responsive">
<table class="table table-striped table-bordered table-hover" ng-if="accounts.length">
<thead>

@ -224,6 +224,9 @@
<li ui-sref-active="active" ng-if="partner.show_all_permission && partner.is_valid==1">
<a ui-sref=".payment_info">Payment Config</a>
</li>
<li ui-sref-active="active" ng-if="partner.show_all_permission && partner.is_valid==0">
<a ui-sref=".payment_info_invalid">Payment Config</a>
</li>
<li ui-sref-active="active" ng-if="partner.show_all_permission && partner.is_valid==1">
<a ui-sref=".accounts">Partner Accounts</a>
</li>

@ -331,6 +331,19 @@
&nbsp;&nbsp;<span ng-if="paymentInfo.enable_link">{{paymentInfo.hf_pay_url}}</span>
</div>
</div>
<div class="form-group" ng-if="paymentInfo.enable_link">
<label class="col-sm-2 control-label">HF Pay QR Code</label>
<img ng-src="{{paymentInfo.hfQrcodeUrl}}" class="img-responsive">
<div>
&nbsp;&nbsp;<span style="padding-left: 18.5%;font-size:9px;" ng-if="paymentInfo.enable_link">仅支持微信客户端扫描</span>
</div>
</div>
<div class="form-group" ng-if="paymentInfo.enable_hf">
<label class="col-sm-2 control-label">HF Pay Email Notice</label>
<div class="col-sm-10">
<input type="checkbox" ng-model="paymentInfo.enable_hf_email_notice" bs-switch switch-change="toggleHfEmailNotice()">
</div>
</div>
</div>
</div>
</div>

@ -0,0 +1,48 @@
<!--<div class="panel panel-default" ng-if="!partner.parent_client_id || ('00010'|withRole)">-->
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-sm-12">
<div class="form-horizontal" ng-form="configForm">
<div class="form-group">
<label class="col-sm-3 control-label">WeChat Sub Merchant Id</label>
<div class="col-sm-9">
<p ng-if="!ctrl.editSubMerchant" class="form-control-static">
{{paymentInfo.sub_merchant_id||'Not Configure'}}
<a role="button" ng-click="ctrl.editSubMerchant=true" ng-if="'011'|withRole"><i class="fa fa-edit"></i></a>
<i class="fa fa-clock-o text-danger" title="Using temp Sub Merchant ID" ng-if="paymentInfo.temp_sub_merchant"></i>
&nbsp;&nbsp;<span class="small" ng-if="('10'|withRole) &&paymentInfo.sub_merchant_id&&paymentInfo.merchant_id"><b>Merchant ID</b>:{{paymentInfo.merchant_id | choose_merchant_id}}</span>
&nbsp;&nbsp;
<span class="small"
ng-if="('10'|withRole) &&paymentInfo.sub_merchant_id&&paymentInfo.sub_merchant_id_log">
<a class="text-primary" role="button" title="modify logs"
ng-click="showSubMerchantLogs(sub_merchant_id_logs)">
<span class="pull-right-container">
<span class="label label-primary">history</span>
</span>
</a>
</span>
</p>
<div class="input-group" ng-if="ctrl.editSubMerchant">
<input type="text" class="form-control" ng-model="paymentInfo.sub_merchant_id"
title="WeChat Sub Merchant Id">
<div class="input-group-btn">
<button class="btn btn-success" ng-click="saveSubMerchantId()">
<i class="fa fa-check"></i>
</button>
</div>
<div class="input-group-btn">
<button class="btn btn-danger" ng-click="ctrl.editSubMerchant=false">
<i class="fa fa-remove"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

@ -92,6 +92,20 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.loadProducts(1);
})
};
$scope.loadHfindustry = function () {
$http.get('/static/data/hfindustry.json').then(function (resp) {
$scope.hf_industry = resp.data;
})
};
$scope.loadHfindustry();
$scope.onHfIndustrySelect = function (selectedItem) {
$scope.params.hf_industry = selectedItem.mccCode;
$scope.loadProducts(1);
};
$scope.clearHFIndustry = function () {
$scope.params.hf_industry = null;
$scope.loadProducts(1);
}
$scope.loadProducts(1);
}]);
app.controller('managerAddProductDialogCtrl', ['$scope', '$http','$uibModal','product','$state','commonDialog','industryMap', function ($scope, $http,$uibModal,product,$state,commonDialog,industryMap) {
@ -102,7 +116,25 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}else {
$scope.edit_or_add = "Add";
}
$scope.save = function () {
$scope.loadHfindustry = function () {
$http.get('/static/data/hfindustry.json').then(function (resp) {
$scope.hf_industry = resp.data;
})
};
$scope.loadHfindustry();
$scope.onHfIndustrySelect = function (selectedItem) {
$scope.product.hf_label = selectedItem.label;
$scope.product.hf_industry = selectedItem.mccCode;
};
$scope.save = function (goodForm) {
if (goodForm.$invalid) {
angular.forEach(goodForm, function (item, key) {
if (key.indexOf('$') < 0) {
item.$dirty = true;
}
});
return;
}
if ($scope.product.commodity_id) {
$http.put('/sys/product', $scope.product).then(function (resp) {
alert("Success");

@ -71,6 +71,18 @@
</div>
</div>
<div class="form-group" ng-if="!product.partner"
ng-class="{'has-error':goodForm.hf_industry.$invalid && goodForm.hf_industry.$dirty}">
<label class="control-label col-sm-2" for="hf-industry-input">* HF Industry</label>
<div class="col-sm-8">
<input class="form-control" id="hf-industry-input" required
name="hf_industry" readonly
ng-model="product.hf_industry|partner_hf_industry"
multi-level-select-popup="hf_industry"
on-select="onHfIndustrySelect($selected)">
</div>
</div>
<div class="form-group"
ng-class="{'has-error':goodForm.degree.$invalid && goodForm.degree.$dirty}">
<label class="control-label col-sm-2" for="degree-input">* Degree</label>

@ -19,27 +19,37 @@
</ui-select>
</div>
<div class="col-sm-6">
<input class="form-control" id="hf-industry-input" required
style="min-width: 150px;"
name="hf_industry" readonly
ng-model="params.hf_industry|partner_hf_industry"
multi-level-select-popup="hf_industry"
placeholder="Select a Hf Industry To Follow Up"
on-select="onHfIndustrySelect($selected)">
<a role="button" ng-if="params.hf_industry" style="position: absolute;margin-top: 7px;top: 0;right: 30px;" ng-click="clearHFIndustry()"><i class="fa fa-close"></i></a>
</div>
</div>
<div class="form-group col-sm-6">
<div class="col-sm-10">
<input type="text" class="form-control"
ng-model="params.search_text" placeholder="请输入商品名称"
ng-enter="loadProducts(1)">
</div>
<div class="col-sm-2">
<a class="btn btn-primary pull-left" type="button" ng-click="loadProducts(1)"><i
class="fa fa-search"></i></a>
</div>
</div>
<div class="form-group col-sm-1">
<a class="btn btn-primary pull-left" type="button" ng-click="loadProducts(1)"><i
class="fa fa-search"></i></a>
</div>
<div class="form-group col-sm-5">
<div class="pull-right">
<button class="btn btn-success" type="button" ngf-select="importExcel($file)"
ng-if="importShow==1">
<i class="fa fa-upload"></i> 导入Excel
</button>
<div class="col-xs-12">
<button class="btn btn-success" type="button" ngf-select="importExcel($file)"
ng-if="importShow==1">
<i class="fa fa-upload"></i> 导入Excel
</button>
<button role="button" class="btn btn-info" title="Add Product"
ng-click="addProduct();">
<i class="fa fa-plus"></i>
Add Product
</button>
</div>
</div>
</div>
</div>
@ -55,6 +65,7 @@
<th>Product Name</th>
<th>Price</th>
<th>Industry</th>
<th>HF Industry</th>
<th>Counts</th>
<th>Degree</th>
<th>Operate</th>
@ -65,6 +76,7 @@
<td ng-bind="product.name"></td>
<td ng-bind="product.price"></td>
<td ng-bind="product.industry|partner_industry"></td>
<td ng-bind="product.hf_industry|partner_hf_industry"></td>
<td ng-bind="product.counts"></td>
<td ng-bind="product.degree"></td>
<td>

@ -88,7 +88,7 @@ $(document).ready(function () {
},
closeCurrentApp: false
});
location.href = window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=true';
startCheckOrder(window.client_moniker, window.merchant_orderid);
} else {
alert(res.memo);
if (window.tradeNo) {
@ -103,6 +103,25 @@ $(document).ready(function () {
}
}
function startCheckOrder(clientMoniker, merchantOrderId) {
function checkOrderStd() {
$.ajax({
url: '/api/v1.0/payment/clients/' + clientMoniker + '/orders/' + merchantOrderId + '/status',
method: 'GET',
dataType: 'json',
success: function (res) {
if (res.paid) {
location.href = window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=true';
} else {
setTimeout(checkOrderStd, 500);
}
}
})
}
checkOrderStd();
}
function waitForPaymentSuccess(orderId) {
var sock = new SockJS('/register');
var client = Stomp.over(sock);

@ -290,7 +290,7 @@ $(function () {
},
closeCurrentApp: false
});
location.href = '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result';
startCheckOrder(pay.order_id, '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result');
} else if (res.resultCode == '6001') {
//do nothing
} else {
@ -315,6 +315,25 @@ $(function () {
})
});
function startCheckOrder(orderId, url) {
function checkOrderStd() {
$.ajax({
url: '/api/v1.0/payment/orders/' + orderId + '/status',
method: 'GET',
dataType: 'json',
success: function (res) {
if (res.paid) {
location.href = url;
} else {
setTimeout(checkOrderStd, 500);
}
}
})
}
checkOrderStd();
}
function weuiAlert(msg) {
var config = {
template: msg

@ -54,7 +54,7 @@ $(document).ready(function () {
},
closeCurrentApp: false
});
location.href = window.redirect;
startCheckOrder(window.order_id, window.redirect);
} else {
alert(res.memo);
}
@ -76,4 +76,22 @@ $(document).ready(function () {
}
function startCheckOrder(orderId, url) {
function checkOrderStd() {
$.ajax({
url: '/api/v1.0/payment/orders/' + orderId + '/status',
method: 'GET',
dataType: 'json',
success: function (res) {
if (res.paid) {
location.href = url;
} else {
setTimeout(checkOrderStd, 500);
}
}
})
}
checkOrderStd();
}
});

@ -0,0 +1,205 @@
body {
color: #333333;
font-family: PingFang-SC-Regular;
font-size: 14px;
letter-spacing: 0px;
}
ul, li {
padding: 0px;
margin: 0px;
list-style: none;
}
input::-webkit-input-placeholder {
color: #C0C0C0;
}
input::-moz-placeholder { /* Mozilla Firefox 19+ */
color: #C0C0C0;
}
input:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color: #C0C0C0;
}
input:-ms-input-placeholder { /* Internet Explorer 10-11 */
color: #C0C0C0;
}
.my-input {
border-top: 0;
border-right: 0;
border-bottom: 1px solid #EBEBEB;
border-left: 0;
padding: 10px 0;
width: 100%;
outline: none;
}
.tab-item {
position:relative;
display: inline-block;
font-size: 16px;
width:100px;
background:#fff;
padding: 10px 0px;
text-align: center;
border-bottom: 1px solid #EBEBEB;
margin-right: -4px;
box-sizing: border-box;
cursor: pointer;
}
.change-color {
color: #FF6600;
border-bottom: 1px solid #FF6600;
}
.s1{
position:absolute;
bottom:-1px;
left:45px;
width:0px;
height:0px;
border-top:5px solid transparent;
border-left:5px solid transparent;
border-right:5px solid transparent;
border-bottom:5px solid #EBEBEB;
}
.s1-change-color {
border-bottom:5px solid #FF6600;
}
.s2{
position:absolute;
bottom:-3px;
left:45px;
width:0px;
height:0px;
border-top:5px solid transparent;
border-left:5px solid transparent;
border-right:5px solid transparent;
border-bottom:5px solid #fff;
}
.bg-pc {
width: 100%;
height: 100%;
background: url("../img/bg_pc.png") no-repeat center transparent;
position: absolute;
top: 0;
left: 0;
display: box;
box-pack: center;
box-orient: vertical;
display: -webkit-box;
-webkit-box-pack: center;
-webkit-box-orient: vertical;
}
.main {
width: 700px;
padding: 40px 0 0 70px;
background-color: #FFFFFF;
margin: 0 auto;
}
.main-logo {
width: 770px;
height: 47px;
margin: 0 auto;
margin-bottom: 32px;
}
.main-left {
width: 300px;
display: inline-block;
margin-right: 50px;
vertical-align: top;
}
.input-item {
margin-bottom: 12px;
}
.commit-button {
background-color: #FF6600;
color: #FFFFFF;
width: 100%;
text-align: center;
padding: 10px 0;
font-size: 17px;
border: none;
border-radius: 2px;
margin: 20px 0;
box-shadow: 0 2px 11px 0;
cursor: pointer;
outline: none;
}
select {
appearance:none;
-moz-appearance:none;
-webkit-appearance:none;
background: url("../img/down.png") no-repeat scroll right center transparent;
}
.select-placeholder {
position: absolute;
top: 10px;
color: #C0C0C0;
}
.main-middle {
width: 2px;
height: 306px;
border: 1px dashed #EBEBEB;
display: inline-block;
box-sizing: border-box;
vertical-align: top;
margin: 47px 40px 0 0;
}
.main-right {
vertical-align: top;
display: inline-block;
text-align: center;
padding-top: 72px;
}
.main-right-top {
background: #FFFFFF;
border: 1px solid #EBEBEB;
box-shadow: 0px 0px 4px 0px rgba(0,0,0,0.30);
width: 120px;
height: 120px;
border-radius: 120px;
text-align: center;
margin: 0 auto;
line-height: 120px;
}
.main-right-top img {
width: 35px;
height: 40px;
display: inline-block;
vertical-align: middle;
}
.royalpay {
font-size: 16px;
letter-spacing: 0px;
margin-top: 12px;
}
.description {
margin-top: 162px;
letter-spacing: 0px;
}
.my-modal {
position: absolute;
width: 100%;
height: 100%;
background-color: black;
opacity:0.80;
z-index: 111;
}
.qrcode {
left: 0;
right: 0;
text-align: center;
}

@ -0,0 +1,102 @@
$("#bank-li").hide();
var currentIndex = 0;
$(".main .main-left ul li.tab-item").click(function () {
$("#qrode").hide();
$("#payment-form").show();
var selectedIndex = $(this).index();
$(this).addClass("change-color").siblings().removeClass("change-color");
$(this).children(".s1").addClass("s1-change-color");
$(this).siblings().children(".s1").removeClass("s1-change-color");
if (selectedIndex == 2) {
$("#bank-li").show();
} else {
$("#bank-li").hide();
}
});
$("#modal-close").click(function () {
$(".my-modal").hide();
$(".qrcode").hide();
});
var select = $("select#bank-select,#product-category-select");
if (select.val() != "")
select.prev().hide();
select.bind("change", function () {
if ($(this).val() != "") {
$(this).prev().hide();
}
});
var bankList = [
{label:'招商银行',value:'CMB'},
{label:'中国工商银行',value:'ICBC'},
{label:'中国农业银行',value:'ABC'},
{label:'中国建设银行',value:'CCB'},
{label:'中国银行',value:'BOC'},
{label:'浦发银行',value:'SPDB'},
{label:'中国交通银行',value:'BCOM'},
{label:'中国民生银行',value:'CMBC'},
{label:'广东发展银行',value:'GDB'},
{label:'中信银行',value:'CITIC'},
{label:'华夏银行',value:'HXB'},
{label:'上海农村商业银行',value:'SRCB'},
{label:'中国邮政储蓄银行',value:'PSBC'},
{label:'北京银行',value:'BOB'},
{label:'渤海银行',value:'CBHB'},
{label:'北京农商银行',value:'BJRCB'},
{label:'南京银行',value:'NJCB'},
{label:'中国光大银行',value:'CEB'},
{label:'浙商银行',value:'CZB'},
{label:'兴业银行',value:'CIB'},
{label:'杭州银行',value:'HZB'},
{label:'平安银行',value:'PAB'},
{label:'上海银行',value:'SHB'},
];
var productList = [
{label:'护肤品',value:'100003'},
{label:'洗发护发',value:'100004'},
{label:'身体护理',value:'100005'},
{label:'口腔护理',value:'100006'},
{label:'包包',value:'100007'},
{label:'女装',value:'100008'},
{label:'男装',value:'100009'},
{label:'童装',value:'100010'},
{label:'内衣',value:'100011'},
{label:'睡衣',value:'100012'},
{label:'袜品',value:'100013'},
{label:'配饰',value:'100014'},
{label:'香水',value:'100015'},
{label:'彩妆',value:'100016'},
{label:'奶粉',value:'100017'},
{label:'母婴营养保健',value:'100018'},
{label:'婴儿辅食',value:'100019'},
{label:'尿裤纸巾',value:'100020'},
{label:'男鞋',value:'100021'},
{label:'女鞋',value:'100022'},
{label:'运动鞋',value:'100023'},
{label:'户外鞋',value:'100024'},
{label:'运动服',value:'100025'},
{label:'休闲服装',value:'100026'},
{label:'家纺/床品',value:'100027'},
{label:'生活日用',value:'100028'},
{label:'厨房电器',value:'100029'},
{label:'家装软饰',value:'100030'},
{label:'生活电器',value:'100031'},
{label:'手机',value:'100032'},
{label:'手机配件',value:'100033'},
{label:'数码相机',value:'100034'},
{label:'单反相机',value:'100035'},
{label:'摄像机',value:'100036'},
{label:'镜头',value:'100037'},
{label:'耳机/耳麦',value:'100038'},
{label:'音箱/音响',value:'100039'},
{label:'数码配件',value:'100040'},
{label:'智能手环',value:'100041'},
{label:'影音娱乐',value:'100042'},
{label:'笔记本',value:'100043'},
{label:'进口食品',value:'100044'},
{label:'休闲食品',value:'100045'},
{label:'营养品',value:'100046'},
{label:'地方特产',value:'100047'}
];

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

@ -19,9 +19,19 @@ $(document).ready(function () {
var dataCache = {paying: false};
$('#key_P').bind('touchstart', startPay);
if (window.paydata) {
wx.ready(function () {
var paymentInvoker = function() {
invokePay(window.paydata);
})
};
if (typeof WeixinJSBridge == "undefined"){
if( document.addEventListener ){
document.addEventListener('WeixinJSBridgeReady', paymentInvoker, false);
}else if (document.attachEvent){
document.attachEvent('WeixinJSBridgeReady', paymentInvoker);
document.attachEvent('onWeixinJSBridgeReady', paymentInvoker);
}
}else{
paymentInvoker();
}
}
function startPay() {

@ -276,7 +276,7 @@ $(function () {
}, function (res) {
dataCache.paying = false;
if (res.err_msg == 'get_brand_wcpay_request:ok') {
startCheckOrder(pay.order_id);
startCheckOrder(pay.order_id, '/api/payment/v1.0/wechat_jsapi_payment/partners/' + window.client_moniker + '/orders/' + pay.order_id);
} else {
if (res.err_msg != 'get_brand_wcpay_request:cancel' && res.err_msg != 'get_brand_wcpay_request:fail') {
@ -305,7 +305,7 @@ $(function () {
})
});
function startCheckOrder(orderId) {
function startCheckOrder(orderId, url) {
function checkOrderStd() {
$.ajax({
url: '/api/v1.0/payment/orders/' + orderId + '/status',
@ -313,7 +313,7 @@ $(function () {
dataType: 'json',
success: function (res) {
if (res.paid) {
location.href = '/api/payment/v1.0/wechat_jsapi_payment/partners/' + window.client_moniker + '/orders/' + orderId;
location.href = url;
} else {
setTimeout(checkOrderStd, 500);
}

@ -73,7 +73,7 @@ $(document).ready(function () {
}, function (res) {
dataCache.paying = false;
if (res.err_msg == 'get_brand_wcpay_request:ok') {
startCheckOrder(window.order_id)
startCheckOrder(window.order_id,window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=true')
} else {
if (res.err_msg != 'get_brand_wcpay_request:cancel' && res.err_msg != 'get_brand_wcpay_request:fail') {
alert('WeChat Error:' + res.err_msg);
@ -87,7 +87,8 @@ $(document).ready(function () {
})
}
function startCheckOrder(orderId) {
function startCheckOrder(orderId, url) {
function checkOrderStd() {
$.ajax({
url: '/api/v1.0/payment/orders/' + orderId + '/status',
@ -95,7 +96,7 @@ $(document).ready(function () {
dataType: 'json',
success: function (res) {
if (res.paid) {
location.href = window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=true';
location.href = url;
} else {
setTimeout(checkOrderStd, 500);
}

Loading…
Cancel
Save