parent
f906f0d9c8
commit
2691047d15
@ -1,25 +0,0 @@
|
|||||||
package au.com.royalpay.payment.manage.mappers.payment;
|
|
||||||
|
|
||||||
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;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by liuxinxin on 2019-11-12.
|
|
||||||
*/
|
|
||||||
@AutoMapper(tablename = "sys_client_incremental", pkName = "incremental_id")
|
|
||||||
public interface SysClientIncrementalMapper {
|
|
||||||
|
|
||||||
@Select("SELECT incremental_rate_value FROM sys_client_incremental WHERE channel = #{channel} AND client_id = #{client_id} ")
|
|
||||||
String findByChannelAndClientId(@Param("client_id") String clientId,@Param("channel") String channel);
|
|
||||||
|
|
||||||
@AutoSql(type = SqlType.SELECT)
|
|
||||||
List<JSONObject> find(@Param("client_id") String clientId);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package au.com.royalpay.payment.manage.mappers.system;
|
||||||
|
|
||||||
|
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.JSONObject;
|
||||||
|
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||||
|
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by yishuqian on 06/03/2017.
|
||||||
|
*/
|
||||||
|
@AutoMapper(tablename = "sys_client_services_apply", pkName = "apply_id")
|
||||||
|
public interface ClientServicesApplyMapper {
|
||||||
|
@AutoSql(type = SqlType.INSERT)
|
||||||
|
void save(JSONObject partner);
|
||||||
|
|
||||||
|
@AutoSql(type = SqlType.UPDATE)
|
||||||
|
void update(JSONObject partner);
|
||||||
|
|
||||||
|
@AutoSql(type = SqlType.SELECT)
|
||||||
|
@AdvanceSelect(addonWhereClause = "is_valid = 1")
|
||||||
|
JSONObject findApplyByApplyId(@Param("apply_id") String applyId);
|
||||||
|
|
||||||
|
@AutoSql(type = SqlType.SELECT)
|
||||||
|
JSONObject findApplyByClientId(@Param("client_id") int clientId);
|
||||||
|
|
||||||
|
PageList<JSONObject> listServicesApply(JSONObject params, PageBounds pageBounds);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
package au.com.royalpay.payment.manage.rservices.bean;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by yixian on 2016-07-01.
|
||||||
|
*/
|
||||||
|
public class RServicesApplyQuery {
|
||||||
|
private int limit = 10;
|
||||||
|
private int page = 1;
|
||||||
|
private String clientMoniker;
|
||||||
|
private String serviceName;
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
public JSONObject toJson(){
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
if(StringUtils.isNotEmpty(clientMoniker)){
|
||||||
|
json.put("client_moniker",clientMoniker);
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotEmpty(serviceName)){
|
||||||
|
json.put("service_name",serviceName);
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotEmpty(status)){
|
||||||
|
json.put("status",status);
|
||||||
|
}
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLimit() {
|
||||||
|
return limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLimit(int limit) {
|
||||||
|
this.limit = limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPage() {
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPage(int page) {
|
||||||
|
this.page = page;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClientMoniker() {
|
||||||
|
return clientMoniker;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClientMoniker(String clientMoniker) {
|
||||||
|
this.clientMoniker = clientMoniker;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getServiceName() {
|
||||||
|
return serviceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setServiceName(String serviceName) {
|
||||||
|
this.serviceName = serviceName;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package au.com.royalpay.payment.manage.rservices.core;
|
||||||
|
|
||||||
|
import au.com.royalpay.payment.manage.rservices.bean.RServicesApplyQuery;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
public interface RServicesApplyService {
|
||||||
|
|
||||||
|
JSONObject getServicesApply(RServicesApplyQuery applyQuery);
|
||||||
|
|
||||||
|
void passServicesApply(String applyId, JSONObject manager);
|
||||||
|
|
||||||
|
void refuseServicesApply(String applyId, JSONObject manager);
|
||||||
|
}
|
||||||
@ -0,0 +1,207 @@
|
|||||||
|
package au.com.royalpay.payment.manage.rservices.core.impl;
|
||||||
|
|
||||||
|
import au.com.royalpay.payment.core.TransactionService;
|
||||||
|
import au.com.royalpay.payment.manage.appclient.core.RetailAppService;
|
||||||
|
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
|
||||||
|
import au.com.royalpay.payment.manage.mappers.system.ClientIncrementalMapper;
|
||||||
|
import au.com.royalpay.payment.manage.mappers.system.ClientServicesApplyMapper;
|
||||||
|
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
||||||
|
import au.com.royalpay.payment.manage.notice.core.MailService;
|
||||||
|
import au.com.royalpay.payment.manage.rservices.bean.RServicesApplyQuery;
|
||||||
|
import au.com.royalpay.payment.manage.rservices.core.RServicesApplyService;
|
||||||
|
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.TemplateMessage;
|
||||||
|
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
|
||||||
|
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
||||||
|
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
|
||||||
|
import au.com.royalpay.payment.tools.lock.Locker;
|
||||||
|
import au.com.royalpay.payment.tools.mappers.CommonIncrementalChannelMapper;
|
||||||
|
import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor;
|
||||||
|
import au.com.royalpay.payment.tools.utils.PageListUtils;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.github.miemiedev.mybatis.paginator.domain.Order;
|
||||||
|
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||||
|
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
||||||
|
import org.apache.commons.lang3.RandomStringUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.thymeleaf.context.Context;
|
||||||
|
import org.thymeleaf.spring5.SpringTemplateEngine;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class RServicesApplyServiceImpl implements RServicesApplyService {
|
||||||
|
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||||
|
@Resource
|
||||||
|
private MpWechatApiProvider mpWechatApiProvider;
|
||||||
|
@Resource
|
||||||
|
private ClientAccountMapper clientAccountMapper;
|
||||||
|
@Resource
|
||||||
|
private ClientManager clientManager;
|
||||||
|
@Resource
|
||||||
|
private ClientServicesApplyMapper clientServicesApplyMapper;
|
||||||
|
@Resource
|
||||||
|
private TransactionService transactionService;
|
||||||
|
@Resource
|
||||||
|
private RetailAppService retailAppService;
|
||||||
|
@Resource
|
||||||
|
private Locker locker;
|
||||||
|
@Resource
|
||||||
|
private RoyalThreadPoolExecutor royalThreadPoolExecutor;
|
||||||
|
@Resource
|
||||||
|
private SpringTemplateEngine thymeleaf;
|
||||||
|
@Resource
|
||||||
|
private CommonIncrementalChannelMapper commonIncrementalChannelMapper;
|
||||||
|
@Resource
|
||||||
|
private MailService mailService;
|
||||||
|
@Resource
|
||||||
|
private ClientIncrementalMapper clientIncrementalMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject getServicesApply(RServicesApplyQuery applyQuery) {
|
||||||
|
JSONObject params = applyQuery.toJson();
|
||||||
|
PageList<JSONObject> apply = clientServicesApplyMapper.listServicesApply(params, new PageBounds(applyQuery.getPage(), applyQuery.getLimit(), Order.formString("create_time.desc")));
|
||||||
|
return PageListUtils.buildPageListResult(apply);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void passServicesApply(String applyId, JSONObject manager) {
|
||||||
|
JSONObject applyInfo = clientServicesApplyMapper.findApplyByApplyId(applyId);
|
||||||
|
if (applyInfo == null) {
|
||||||
|
throw new BadRequestException("签约服务申请不存在");
|
||||||
|
}
|
||||||
|
String lockKey = applyInfo.getIntValue("client_id") + "_processing_RServices_" + applyInfo.getString("service_code");
|
||||||
|
if (!locker.lock(lockKey, 120_000)) {
|
||||||
|
throw new ServerErrorException("Processing task, wait for a moment");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
applyInfo.put("operator", manager.getString("manager_id"));
|
||||||
|
applyInfo.put("operator_time", new Date());
|
||||||
|
applyInfo.put("status", 1);
|
||||||
|
clientServicesApplyMapper.update(applyInfo);
|
||||||
|
JSONObject clientServices = clientIncrementalMapper.findBySourceCodeAndClientId(applyInfo.getIntValue("client_id"), applyInfo.getString("service_code"));
|
||||||
|
JSONObject increment = commonIncrementalChannelMapper.findIncreamentalChannelBySourceCode(applyInfo.getString("service_code"));
|
||||||
|
if (clientServices == null) {
|
||||||
|
clientServices = new JSONObject();
|
||||||
|
clientServices.put("incremental_id", UUID.randomUUID().toString());
|
||||||
|
clientServices.put("client_id", applyInfo.getIntValue("client_id"));
|
||||||
|
clientServices.put("channel", increment.getIntValue("channel"));
|
||||||
|
clientServices.put("incremental_mode", 2);
|
||||||
|
clientServices.put("incremental_rate_value", 0);
|
||||||
|
clientServices.put("total_incremental_amount", applyInfo.getBigDecimal("amount"));
|
||||||
|
clientServices.put("create_time", applyInfo.getDate("create_time"));
|
||||||
|
clientServices.put("update_time", applyInfo.getDate("operator_time"));
|
||||||
|
clientServices.put("operator", applyInfo.getString("operator"));
|
||||||
|
clientServices.put("is_valid", 1);
|
||||||
|
clientIncrementalMapper.save(clientServices);
|
||||||
|
}else {
|
||||||
|
clientServices.put("incremental_mode", 2);
|
||||||
|
clientServices.put("incremental_rate_value", 0);
|
||||||
|
clientServices.put("total_incremental_amount", applyInfo.getBigDecimal("amount"));
|
||||||
|
clientServices.put("create_time", applyInfo.getDate("create_time"));
|
||||||
|
clientServices.put("update_time", applyInfo.getDate("operator_time"));
|
||||||
|
clientServices.put("operator", applyInfo.getString("operator"));
|
||||||
|
clientServices.put("is_valid", 1);
|
||||||
|
clientIncrementalMapper.update(clientServices);
|
||||||
|
}
|
||||||
|
afterPassProcessingApply(applyInfo);
|
||||||
|
} finally {
|
||||||
|
locker.unlock(lockKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void refuseServicesApply(String applyId, JSONObject manager) {
|
||||||
|
JSONObject applyInfo = clientServicesApplyMapper.findApplyByApplyId(applyId);
|
||||||
|
if (applyInfo == null) {
|
||||||
|
throw new BadRequestException("签约服务申请不存在");
|
||||||
|
}
|
||||||
|
applyInfo.put("operator", manager.getString("manager_id"));
|
||||||
|
applyInfo.put("operator_time", new Date());
|
||||||
|
applyInfo.put("status", 2);
|
||||||
|
clientServicesApplyMapper.update(applyInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void afterPassProcessingApply(JSONObject applyInfo) {
|
||||||
|
JSONObject client = clientManager.getClientInfo(applyInfo.getIntValue("client_id"));
|
||||||
|
String orderId = "R-" + client.getString("client_moniker") + "-" + applyInfo.getString("service_code") + "-" + DateFormatUtils.format(new Date(), "yyyyMMddHHmmssSSS") + "-" + RandomStringUtils.random(3, true, false).toUpperCase();
|
||||||
|
JSONObject transaction = new JSONObject();
|
||||||
|
transaction.put("org_id", client.getIntValue("org_id"));
|
||||||
|
transaction.put("system_transaction_id", orderId);
|
||||||
|
transaction.put("order_id", orderId);
|
||||||
|
transaction.put("client_id", applyInfo.getIntValue("client_id"));
|
||||||
|
transaction.put("transaction_currency", PlatformEnvironment.getEnv().getForeignCurrency());
|
||||||
|
transaction.put("transaction_amount", applyInfo.getBigDecimal("amount"));
|
||||||
|
transaction.put("clearing_currency", PlatformEnvironment.getEnv().getForeignCurrency());
|
||||||
|
transaction.put("clearing_amount", applyInfo.getBigDecimal("amount"));
|
||||||
|
transaction.put("exchange_rate", 1);
|
||||||
|
transaction.put("channel", "System");
|
||||||
|
transaction.put("transaction_type", "Debit");
|
||||||
|
transaction.put("transaction_time", new Date());
|
||||||
|
transaction.put("clearing_status", 0);
|
||||||
|
transaction.put("remark", applyInfo.getString("service_code") + ":" + applyInfo.getString("title"));
|
||||||
|
transaction.put("system_generate", 1);
|
||||||
|
transactionService.saveTransaction(transaction);
|
||||||
|
sendNotify(applyInfo, client);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendNotify(JSONObject applyInfo, JSONObject client) {
|
||||||
|
try {
|
||||||
|
retailAppService.sendRServicesApplyMessage(applyInfo, client);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("R-services-{}付费成功app推送发送失败 - {}",client.getIntValue("client_id"), e);
|
||||||
|
}
|
||||||
|
JSONObject increment = commonIncrementalChannelMapper.findIncreamentalChannelBySourceCode(applyInfo.getString("service_code"));
|
||||||
|
JSONObject account = clientAccountMapper.findByUsernameForDuplicate(applyInfo.getString("apply_username"));
|
||||||
|
if (increment == null || account == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(account.getString("contact_email"))) {
|
||||||
|
Context ctx = new Context();
|
||||||
|
ctx.setVariable("img_url", PlatformEnvironment.getEnv().concatUrl("/static/images/royalpay_logo.png"));
|
||||||
|
ctx.setVariable("name", account.getString("display_name"));
|
||||||
|
ctx.setVariable("service_name", increment.getString("channel"));
|
||||||
|
ctx.setVariable("title", applyInfo.getString("title"));
|
||||||
|
ctx.setVariable("currency", "AUD");
|
||||||
|
ctx.setVariable("amount", applyInfo.getBigDecimal("amount").toPlainString());
|
||||||
|
ctx.setVariable("create_time", DateFormatUtils.format(applyInfo.getDate("create_time"),"yyyy-MM-dd HH:mm:ss"));
|
||||||
|
final String content = thymeleaf.process("mail/rservices_email_notice", ctx);
|
||||||
|
royalThreadPoolExecutor.execute(() -> {
|
||||||
|
try {
|
||||||
|
mailService.sendEmail("[RoyalPay]" + increment.getString("channel") + "付费成功通知", account.getString("contact_email"), "", content);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("R-services-{}付费成功邮件发送失败 - {}",client.getIntValue("client_id"),account.getString("contact_email"), e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(account.getString("wechat_openid"))) {
|
||||||
|
try {
|
||||||
|
MpWechatApi mpWechatApi = mpWechatApiProvider.getApiFromOpenId(account.getString("wechat_openid"));
|
||||||
|
if (mpWechatApi == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String templateId = mpWechatApi.getTemplateId("payment-success-cashier");
|
||||||
|
if (templateId == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
TemplateMessage message = new TemplateMessage(account.getString("wechat_openid"), templateId, null);
|
||||||
|
message.put("first", "[RoyalPay]" + increment.getString("channel") + "付费成功通知", "#ff0000");
|
||||||
|
message.put("keyword1", applyInfo.getString("title"), "#0000ff");
|
||||||
|
message.put("keyword2", "支付金额: $" + applyInfo.getString("amount"), "#000000");
|
||||||
|
message.put("keyword3", "签约时间" + DateFormatUtils.format(applyInfo.getDate("create_time"),"yyyy-MM-dd HH:mm:ss"), "#000000");
|
||||||
|
message.put("keyword4", "申请人:" + account.getString("display_name"), "#000000");
|
||||||
|
message.put("remark", "感谢您的使用,如有疑问或需帮助,请拨打我们的客服电话:1300 107 750或添加RoyalPay官方客服号:royalpay_1详询.", "#ff0000");
|
||||||
|
mpWechatApi.sendTemplateMessage(message);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("R-services-{}付费成功微信模版发送失败 - {}",client.getIntValue("client_id"),account.getString("wechat_openid"), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
package au.com.royalpay.payment.manage.rservices.web;
|
||||||
|
|
||||||
|
|
||||||
|
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
|
||||||
|
import au.com.royalpay.payment.manage.rservices.bean.RServicesApplyQuery;
|
||||||
|
import au.com.royalpay.payment.manage.rservices.core.RServicesApplyService;
|
||||||
|
import au.com.royalpay.payment.tools.CommonConsts;
|
||||||
|
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(value = "/sys/rservices")
|
||||||
|
public class RServicesApplyController {
|
||||||
|
@Resource
|
||||||
|
private RServicesApplyService rServicesApplyService;
|
||||||
|
|
||||||
|
@ManagerMapping(value = "/apply", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.FINANCIAL_STAFF, ManagerRole.DIRECTOR})
|
||||||
|
@GetMapping(value = "/apply")
|
||||||
|
public JSONObject getServicesApply(RServicesApplyQuery applyQuery) {
|
||||||
|
return rServicesApplyService.getServicesApply(applyQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ManagerMapping(value = "/apply/{applyId}/pass", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR})
|
||||||
|
public void passServicesApply(@PathVariable String applyId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
|
||||||
|
rServicesApplyService.passServicesApply(applyId, manager);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ManagerMapping(value = "/apply/{applyId}/refuse", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR})
|
||||||
|
public void refuseServicesApply(@PathVariable String applyId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
|
||||||
|
rServicesApplyService.refuseServicesApply(applyId, manager);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.ClientServicesApplyMapper">
|
||||||
|
<select id="listServicesApply" resultType="com.alibaba.fastjson.JSONObject">
|
||||||
|
SELECT c.client_moniker,c.short_name,c.bd_user_name,c.approve_result,c.approve_time,c.open_status,
|
||||||
|
c.source as client_source,a.*,inc.channel
|
||||||
|
FROM sys_client_services_apply a
|
||||||
|
INNER JOIN sys_clients c on c.client_id = a.client_id and c.is_valid = 1
|
||||||
|
INNER JOIN sys_incremental_channels inc on a.service_code = inc.source_code and inc.is_valid = 1
|
||||||
|
<where>
|
||||||
|
<if test="client_moniker!=null">
|
||||||
|
and c.client_moniker = #{client_moniker}
|
||||||
|
</if>
|
||||||
|
<if test="service_name!=null">
|
||||||
|
and inc.service_code = #{service_name}
|
||||||
|
</if>
|
||||||
|
<if test="status!=null">
|
||||||
|
and a.status = #{status}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,81 @@
|
|||||||
|
/**
|
||||||
|
* Created by kira on 01/06/2017.
|
||||||
|
*/
|
||||||
|
define(['angular'], function (angular) {
|
||||||
|
'use strict';
|
||||||
|
var app = angular.module('RServicesApplyApp', ['ui.router']);
|
||||||
|
app.config(['$stateProvider', function ($stateProvider) {
|
||||||
|
$stateProvider.state('r_services_apply', {
|
||||||
|
url: '/r_services_apply',
|
||||||
|
templateUrl: '/static/rservicesapply/templates/r-services-apply.html',
|
||||||
|
controller: 'RServicesApplyCtrl'
|
||||||
|
});
|
||||||
|
}]);
|
||||||
|
app.controller('RServicesApplyCtrl', ['$scope', '$http', 'commonDialog', '$sce', '$state',
|
||||||
|
function ($scope, $http, commonDialog, $sce, $state) {
|
||||||
|
$scope.pagination = {};
|
||||||
|
$scope.params = {};
|
||||||
|
$scope.loadServicesApply = function (page) {
|
||||||
|
var params = angular.copy($scope.params);
|
||||||
|
params.page = page || $scope.pagination.page || 1;
|
||||||
|
$http.get('/sys/rservices/apply', {params: params}).then(function (resp) {
|
||||||
|
$scope.apply = resp.data;
|
||||||
|
$scope.pagination = resp.data.pagination;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
$scope.loadServicesApply(1);
|
||||||
|
$scope.statusSelected = function (arr) {
|
||||||
|
return $scope.params.status != null && $scope.params.status.filter(function (status) {
|
||||||
|
return arr.indexOf(status) >= 0
|
||||||
|
}).length > 0
|
||||||
|
};
|
||||||
|
$scope.serviceTypeSelected = function (arr) {
|
||||||
|
return $scope.params.serviceName != null && $scope.params.serviceName.filter(function (status) {
|
||||||
|
return arr.indexOf(status) >= 0
|
||||||
|
}).length > 0
|
||||||
|
};
|
||||||
|
$scope.passApply = function (apply) {
|
||||||
|
var contentHtml = $sce.trustAsHtml(
|
||||||
|
'[<b><span style="color: red">' + apply.client_moniker + '</span></b>]即将签约[' +
|
||||||
|
'<b><span style="color: red">' + apply.channel + '</span></b>]服务<br>服务内容:[' +
|
||||||
|
'<b><span style="color: red">' + apply.title + '</span></b>]<br>需要扣款[' +
|
||||||
|
'<b><span style="color: red">AUD ' + apply.amount + '</span></b>]<br>申请人[' +
|
||||||
|
'<b><span style="color: red"> ' + apply.apply_username + '</span></b>]' +
|
||||||
|
'<br>请确认扣款信息是否正确'
|
||||||
|
);
|
||||||
|
commonDialog.confirm({
|
||||||
|
title: '请确认扣款信息',
|
||||||
|
contentHtml: contentHtml
|
||||||
|
}).then(function () {
|
||||||
|
$http.put('/sys/rservices/apply/'+ apply.apply_id +'/pass').then(function () {
|
||||||
|
commonDialog.alert({type: 'success', title: 'Success', content: '扣款成功!'});
|
||||||
|
$state.reload();
|
||||||
|
}, function (resp) {
|
||||||
|
commonDialog.alert({type: 'error', title: 'Error', content: resp.data.message});
|
||||||
|
})
|
||||||
|
})
|
||||||
|
};
|
||||||
|
$scope.refuseApply = function (apply) {
|
||||||
|
var contentHtml = $sce.trustAsHtml(
|
||||||
|
'[<b><span style="color: red">' + apply.client_moniker + '</span></b>]签约[' +
|
||||||
|
'<b><span style="color: red">' + apply.channel + '</span></b>]服务服务内容:[' +
|
||||||
|
'<b><span style="color: red">' + apply.title + '</span></b>]需要扣款[' +
|
||||||
|
'<b><span style="color: red">AUD ' + apply.amount + '</span></b>]申请人[' +
|
||||||
|
'<b><span style="color: red"> ' + apply.apply_username + '</span>]' +
|
||||||
|
'<br>请确认是否拒绝申请'
|
||||||
|
);
|
||||||
|
commonDialog.confirm({
|
||||||
|
title: '拒绝R-Services扣款申请',
|
||||||
|
contentHtml: contentHtml
|
||||||
|
}).then(function () {
|
||||||
|
$http.put('/sys/rservices/apply/'+ apply.apply_id +'/refuse').then(function () {
|
||||||
|
commonDialog.alert({type: 'success', title: 'Success', content: '拒绝成功!'});
|
||||||
|
$state.reload();
|
||||||
|
}, function (resp) {
|
||||||
|
commonDialog.alert({type: 'error', title: 'Error', content: resp.data.message});
|
||||||
|
})
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}]);
|
||||||
|
return app;
|
||||||
|
});
|
||||||
Loading…
Reference in new issue