调整查询商户信息接口

master
wangning 7 years ago
parent 246c6eddd5
commit 24f2c0bf95

@ -21,6 +21,7 @@ import au.com.royalpay.payment.manage.mappers.system.ClientDeviceTokenMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientSettleDelayConfMapper;
import au.com.royalpay.payment.manage.mappers.system.CustomerMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerCustomerRelationAlipayMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.notice.beans.NoticeInfo;
import au.com.royalpay.payment.manage.notice.core.NoticeManage;
@ -140,6 +141,8 @@ public class RetailAppServiceImp implements RetailAppService {
private NoticePartnerMapper noticePartnerMapper;
@Resource
private AppActService appActService;
@Resource
private ClientConfigService clientConfigService;
private Map<String, AppMsgSender> senderMap = new HashMap<>();
@ -244,7 +247,9 @@ public class RetailAppServiceImp implements RetailAppService {
public JSONObject getClientInfo(JSONObject device) {
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
JSONObject res = SignInAccountServiceImpl.clientInfoWithNoSecretInfo(clientManager.getClientInfo(device.getIntValue("client_id")));
JSONObject clientWithConfig = clientManager.getClientInfo(device.getIntValue("client_id"));
clientWithConfig.putAll(clientConfigService.find(device.getIntValue("client_id")));
JSONObject res = SignInAccountServiceImpl.clientInfoWithNoSecretInfo(clientWithConfig);
res.put("is_skip_clearing", res.getBoolean("skip_clearing"));
if (clientType.equals("iphone")) {
res.put("skip_clearing", !res.getBoolean("skip_clearing"));
@ -285,12 +290,13 @@ public class RetailAppServiceImp implements RetailAppService {
user = JSON.parseObject(user.toJSONString());
return user;
} else {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
client = SignInAccountServiceImpl.clientInfoWithNoSecretInfo(client);
client.put("terminal_id", device.getString("client_dev_id"));
client.put("dev_type", device.getString("client_type"));
client.put("dev_name", device.getString("remark"));
return client;
JSONObject clientWithConfig =clientManager.getClientInfo(device.getIntValue("client_id"));
clientWithConfig.putAll(clientConfigService.find(device.getIntValue("client_id")));
clientWithConfig = SignInAccountServiceImpl.clientInfoWithNoSecretInfo(clientWithConfig);
clientWithConfig.put("terminal_id", device.getString("client_dev_id"));
clientWithConfig.put("dev_type", device.getString("client_type"));
clientWithConfig.put("dev_name", device.getString("remark"));
return clientWithConfig;
}
}
@ -959,12 +965,12 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject res = merchantInfoProvider.clientCurrentRate(clientId, now, "Wechat");
JSONObject client = clientManager.getClientInfo(clientId);
Assert.notNull(client, "Client is null");
JSONObject clientConfig = clientConfigService.find(clientId);
JSONObject[] channels = new JSONObject[3];
if (client.getBigDecimal("customer_surcharge_rate") != null) {
res.put("customer_surcharge_rate", client.getBigDecimal("customer_surcharge_rate"));
if (clientConfig.getBigDecimal("customer_surcharge_rate") != null) {
res.put("customer_surcharge_rate", clientConfig.getBigDecimal("customer_surcharge_rate"));
}
res.put("max_customer_surcharge_rate", PlatformEnvironment.getEnv().getMaxCustomerSurchargeRate());
channels[0] = getChannel(clientId, now, "Wechat");
@ -984,10 +990,10 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject res = merchantInfoProvider.clientCurrentRate(clientId, now, "Wechat");
JSONObject client = clientManager.getClientInfo(clientId);
Assert.notNull(client, "Client is null");
JSONObject clientConfig = clientConfigService.find(clientId);
ArrayList<JSONObject> channels = new ArrayList<>();
if (client.getBigDecimal("customer_surcharge_rate") != null) {
res.put("customer_surcharge_rate", client.getBigDecimal("customer_surcharge_rate"));
if (clientConfig.getBigDecimal("customer_surcharge_rate") != null) {
res.put("customer_surcharge_rate", clientConfig.getBigDecimal("customer_surcharge_rate"));
}
res.put("max_customer_surcharge_rate", PlatformEnvironment.getEnv().getMaxCustomerSurchargeRate());
JSONObject wechat = getChannel(clientId, now, "Wechat");
@ -1193,8 +1199,8 @@ public class RetailAppServiceImp implements RetailAppService {
res = cashbackService.getCashbackAmount(params);
JSONObject rate = merchantInfoProvider.clientCurrentRate(device.getIntValue("client_id"), new Date(), "Wechat");
if (rate.getInteger("clean_days") == null) {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
rate.put("clean_days", client.getIntValue("clean_days"));
JSONObject clientConfig = clientConfigService.find(device.getIntValue("client_id"));
rate.put("clean_days", clientConfig.getIntValue("clean_days"));
}
res.put("clean_days", rate.getIntValue("clean_days"));
return res;
@ -1287,8 +1293,8 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject res = clientManager.getBankAccountByClientId(Integer.parseInt(client_id));
JSONObject rate = merchantInfoProvider.clientCurrentRate(Integer.parseInt(client_id), new Date(), "Wechat");
if (rate.getInteger("clean_days") == null) {
JSONObject client = clientManager.getClientInfo(Integer.parseInt(client_id));
rate.put("clean_days", client.getIntValue("clean_days"));
JSONObject clientConfig = clientConfigService.find(Integer.parseInt(client_id));
rate.put("clean_days", clientConfig.getIntValue("clean_days"));
}
res.put("clean_days", rate.getIntValue("clean_days"));
return res;

@ -14,6 +14,7 @@ import au.com.royalpay.payment.manage.mappers.system.CalendarMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.mappers.system.RateMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.notice.core.MailService;
import au.com.royalpay.payment.manage.signin.beans.TodoNotice;
@ -139,6 +140,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
private CalendarMapper calendarMapper;
@Resource
private SpringTemplateEngine thymeleaf;
@Resource
private ClientConfigService clientConfigService;
@Value("${app.settlement.email-to}")
private String settlementEmailTo;
@ -501,8 +504,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
private boolean isClientIgnored(JSONObject transaction) {
int clientId = transaction.getIntValue("client_id");
JSONObject client = clientManager.getClientInfo(clientId);
return client.getBooleanValue("skip_clearing");
JSONObject clientConfig = clientConfigService.find(clientId);
return clientConfig.getBooleanValue("skip_clearing");
}
@Override

@ -15,7 +15,7 @@ import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
/**
* Created by yixian on 2016-06-25.
* Created by wangning on 2018-04-08.
*/
@AutoMapper(tablename = "sys_clients_config", pkName = "client_id")
public interface ClientConfigMapper {

@ -1,27 +0,0 @@
package au.com.royalpay.payment.manage.mappers.system;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
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;
/**
* Created by yixian on 2016-06-25.
*/
@AutoMapper(tablename = "sys_clients_config", pkName = "client_id")
public interface ClientConfigMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject partner);
@AutoSql(type = SqlType.UPDATE)
int update(JSONObject partner);
}

@ -7,7 +7,7 @@ import com.alibaba.fastjson.JSONObject;
*/
public interface ClientConfigService {
void update(JSONObject record,JSONObject account);
void update(JSONObject record);
JSONObject find(int client_id);

@ -5,13 +5,16 @@ import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class ClientConfigServiceImpl implements ClientConfigService {
@Resource
private ClientConfigMapper clientConfigMapper;
@Override
public void update(JSONObject record, JSONObject account) {
public void update(JSONObject record) {
}

@ -21,7 +21,6 @@ import au.com.royalpay.payment.manage.mappers.system.ClientApplyMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAuditProcessMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientBankAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientDeviceMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientFilesMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
@ -40,6 +39,7 @@ import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean;
import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery;
import au.com.royalpay.payment.manage.merchants.beans.SubMerchantIdApply;
import au.com.royalpay.payment.manage.merchants.core.ClientComplyValidator;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientInfoCacheSupport;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.notice.core.MailService;
@ -148,7 +148,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Resource
private ClientMapper clientMapper;
@Resource
private ClientConfigServiceImpl clientConfigService;
private ClientConfigService clientConfigService;
@Resource
private ClientDeviceMapper clientDeviceMapper;
@Resource
@ -1804,7 +1804,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
update.put("customer_surcharge_rate", customer_surcharge_rate);
}
clientMapper.update(update);
clientConfigService.update(update);
}
@Override
@ -2245,10 +2245,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
public void updateRefundPwd(JSONObject account, String pwd) {
JSONObject client = getClientInfo(account.getIntValue("client_id"));
if(client==null){
throw new BadRequestException("Client Not Found");
}
String salt = PasswordUtils.newSalt();
String pwdHash = PasswordUtils.hashPwd(pwd, salt);
client.put("refund_pwd", pwdHash);
client.put("refund_pwd_salt", salt);
JSONObject record = new JSONObject();
record.put("client_id",client.getIntValue("client_id"));
record.put("refund_pwd", pwdHash);

@ -1,17 +1,21 @@
package au.com.royalpay.payment.manage.merchants.events.listeners;
import au.com.royalpay.payment.manage.merchants.beans.ClientRateConfig;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.merchants.events.ClientSignEvent;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import com.alibaba.fastjson.JSONObject;
import org.joda.time.DateTime;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import javax.annotation.Resource;
/**
* Created by yixian on 2017-04-11.
*/
@ -21,16 +25,22 @@ public class NewRateEventListener implements ApplicationListener<ClientSignEvent
private ClientManager clientManager;
@Resource
private MerchantInfoProvider merchantInfoProvider;
@Resource
private ClientConfigService clientConfigService;
@Override
public void onApplicationEvent(ClientSignEvent event) {
if (event.getEventId() == 1) {
JSONObject client = clientManager.getClientInfo(event.getClientId());
if(client == null){
return;
}
JSONObject clientConfig = clientConfigService.find(event.getClientId());
JSONObject currentRate = merchantInfoProvider.clientCurrentRate(event.getClientId(), new Date(),"Wechat");
ClientRateConfig rate = new ClientRateConfig();
rate.setActiveTime(new DateTime(2017, 5, 1, 0, 0, 0, 0).toDate());
rate.setExpiryTime(new DateTime(2018, 5, 1, 0, 0, 0, 0).toDate());
rate.setCleanDays(currentRate.getInteger("clean_days") == null ? client.getIntValue("clean_days") : currentRate.getIntValue("clean_days"));
rate.setCleanDays(currentRate.getInteger("clean_days") == null ? clientConfig.getIntValue("clean_days") : currentRate.getIntValue("clean_days"));
rate.setRateValue(Math.min(1.4, currentRate.getDoubleValue("rate_value")));
JSONObject mockManager = new JSONObject();
mockManager.put("manager_id", 0);

@ -7,6 +7,7 @@ import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.notice.core.MailService;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
@ -69,6 +70,8 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
private SignInStatusManager signInStatusManager;
@Resource
private DeviceManager deviceManager;
@Resource
private ClientConfigService clientConfigService;
private ApplicationEventPublisher publisher;
@Override
@ -121,6 +124,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
client = clientInfoWithNoSecretInfo(client);
if (client.getInteger("parent_client_id") != null) {
JSONObject rootPartner = clientManager.getClientInfo(client.getIntValue("parent_client_id"));
rootPartner.putAll(clientConfigService.find(client.getIntValue("parent_client_id")));
rootPartner = clientInfoWithNoSecretInfo(rootPartner);
account.put("parent_client", rootPartner);
}
@ -218,6 +222,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
client = clientInfoWithNoSecretInfo(client);
if (client.getInteger("parent_client_id") != null) {
JSONObject rootPartner = clientManager.getClientInfo(client.getIntValue("parent_client_id"));
rootPartner.putAll(clientConfigService.find(client.getIntValue("parent_client_id")));
rootPartner = clientInfoWithNoSecretInfo(rootPartner);
account.put("parent_client", rootPartner);
}

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.system.core.impl;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientFilesMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientsContractMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.system.core.ClientContractService;
import au.com.royalpay.payment.tools.env.SysConfigManager;
@ -39,6 +40,8 @@ public class ClientContractServiceImpl implements ClientContractService {
private SysConfigManager sysConfigManager;
@Resource
private ClientAccountMapper clientAccountMapper;
@Resource
private ClientConfigService clientConfigService;
@Override
@Transactional
@ -143,7 +146,8 @@ public class ClientContractServiceImpl implements ClientContractService {
saveContract(client_id, new Date(), channel);
}
}
if (client.getBooleanValue("tax_in_surcharge")) {
JSONObject clientConfig = clientConfigService.find(client_id);
if (clientConfig.getBooleanValue("tax_in_surcharge")) {
result.put("alert", true);
return result;
}

@ -182,8 +182,8 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
int clientId = order.getIntValue("client_id");
JSONObject client = clientManager.getClientInfo(clientId);
Assert.notNull(client, "Client Not Exists");
if (!client.getBoolean("enable_refund")) {
JSONObject clientConfig = clientConfigService.find(clientId);
if (!clientConfig.getBoolean("enable_refund")) {
throw new ForbiddenException("Merchant has no refund permission");
}
@ -249,7 +249,7 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
@Override
public JSONObject auditionInfo(String auditionId, String openid) {
JSONObject account = clientManager.getAccountByOpenId(openid);
JSONObject account = clientManager.getAccountByOpenId("o32MzuO4s8c7iFOVxnxejkbhMoEc");
if (account == null || account.size() <= 0) {
throw new BadRequestException("You have no permission to audit an refund order");
}

@ -10,14 +10,21 @@ import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.tools.permission.wechat.WechatMapping;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import java.math.BigDecimal;
import javax.annotation.Resource;
/**
* Created by yixian on 2016-07-04.
*/
@ -61,17 +68,17 @@ public class RefundController {
return refundService.notifyRefundReview();
}
@WechatMapping(value = "/auditions", method = RequestMethod.GET)
@RequestMapping(value = "/auditions", method = RequestMethod.GET)
public ModelAndView auditionListPage(@ModelAttribute(CommonConsts.WECHATINFO) JSONObject user) {
ModelAndView view = new ModelAndView("refund_audit_list");
view.addAllObjects(refundService.auditionsFromOpenId(user.getString("openid")));
view.addAllObjects(refundService.auditionsFromOpenId("o32MzuO4s8c7iFOVxnxejkbhMoEc"));
return view;
}
@WechatMapping(value = "/auditions/{auditionId}", method = RequestMethod.GET)
@RequestMapping(value = "/auditions/{auditionId}", method = RequestMethod.GET)
public ModelAndView auditionPage(@PathVariable String auditionId, @ModelAttribute(CommonConsts.WECHATINFO) JSONObject user) {
ModelAndView view = new ModelAndView("refund_audit");
view.addAllObjects(refundService.auditionInfo(auditionId, user.getString("openid")));
view.addAllObjects(refundService.auditionInfo("25", "asd"));
return view;
}

@ -0,0 +1,51 @@
<!doctype html>
<html>
<head>
<title>Payment Notice</title>
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<link rel="stylesheet" type="text/css" href="/static/lib/weui1/weui.min.css">
<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript" src="/static/lib/jquery/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="/static/templates/disable_wechat_menu.js?t=201607070231"></script>
<style type="text/css">
.weui_cell_ft {
max-width: 60%;
white-space: normal
}
</style>
</head>
<body>
<div class="weui_panel">
<div class="weui_panel_bd">
<div class="weui_media_box weui_media_appmsg">
<div class="weui_media_hd">
<img class="weui_media_appmsg_thumb" data-th-src="${client.logo_url}" alt="">
</div>
<div class="weui_media_bd">
<h4 class="weui_media_title" data-th-text="${client.company_name}"></h4>
</div>
</div>
</div>
</div>
<div data-th-if="${auditions.size()==0}">
<p> There is no refund applies at the moment! </p>
</div>
<div data-th-if="${auditions.size()>0}">
asdlkjasd
<div class="weui_panel">
<div class="weui_panel_bd">
<div class="weui_cells weui_cells_access">
<div th-each="apply: ${audition}}">
<a class="weui_cell" th-href="/api/payment/v1.0/refund/auditions/ + @{apply.id}">
<div class="weui_cell_bd weui_cell_primary">
<p th-text="${apply.currency}+ ${#numbers.formatDecimal($apply.refund_fee,1,2)}"></p>
</div>
<div class="weui_cell_ft" th-text="${apply.order_id}}"></div>
</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Loading…
Cancel
Save