master
wangning 7 years ago
parent 05d325db47
commit 9f428e2bd8

@ -3,7 +3,6 @@ package au.com.royalpay.payment.manage.merchants.entity;
import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
@ -14,8 +13,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.Date;
/**
* Create by yixian at 2018-04-12 16:19
@ -51,9 +49,9 @@ public abstract class ClientConfigModify {
return;
}
boolean isPartner = true;
Map<String, Object> beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, client::get));
JSONObject modifyHistory = new JSONObject();
modifyHistory.put("client_id", client.getIntValue("client_id"));
modifyHistory.put("client_moniker", client.getIntValue("client_moniker"));
modifyHistory.put("business", business());
if (StringUtils.isNotEmpty(account.getString("account_id"))) {
isPartner = true;
@ -64,8 +62,9 @@ public abstract class ClientConfigModify {
modifyHistory.put("user_type", isPartner ? "Merchant" : "Manager");
modifyHistory.put("user_id", isPartner ? account.getString("account_id") : account.getString("manager_id"));
modifyHistory.put("username", isPartner ? account.getString("display_name") : account.getString("display_name"));
modifyHistory.put("origin_data", JSON.toJSONString(beforeModify));
modifyHistory.put("new_data", modifyResult.toJSONString());
modifyHistory.put("origin_data", modifyResult.toJSONString());
modifyHistory.put("update_column", modifyResult.toJSONString());
modifyHistory.put("create_time", new Date());
BufferedWriter out = null;
try {

@ -45,8 +45,7 @@ import java.util.Map;
import javax.annotation.Resource;
/**
* account service for sign in
* Created by yixian on 2016-06-29.
* account service for sign in Created by yixian on 2016-06-29.
*/
@Service
public class SignInAccountServiceImpl implements SignInAccountService, ApplicationEventPublisherAware {
@ -121,7 +120,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
if (client == null) {
throw new ForbiddenException("用户不存在或已禁用");
}
client.putAll(clientConfigService.find(client.getIntValue("parent_client_id")));
client.putAll(clientConfigService.find(client_id));
client = clientInfoWithNoSecretInfo(client);
if (client.getInteger("parent_client_id") != null) {
JSONObject rootPartner = clientManager.getClientInfo(client.getIntValue("parent_client_id"));
@ -150,11 +149,9 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
JSONObject account = managerMapper.findAvailableByLoginId(loginInfo.getLoginId());
validLoginInfo(loginInfo, account);
JSONObject client = clientManager.getClientInfoIgnoreInvalid(account.getIntValue("client_id"));
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
if (client != null && !client.getBooleanValue("is_valid")) {
throw new BadRequestException(LocaleSupport.localeMessage("error.login.password"));
}
validLoginInfo(loginInfo, account);
publisher.publishEvent(new ManagerLoginEvent(this, account.getString("manager_id"), RequestEnvironment.getClientIp(), "PASSWORD"));
return account;
}
@ -174,7 +171,8 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
public JSONObject clientLoginCheck(LoginInfo loginInfo) {
JSONObject account = clientAccountMapper.findByUsername(loginInfo.getLoginId());
validLoginInfo(loginInfo, account);
publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "PASSWORD"));
publisher.publishEvent(
new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "PASSWORD"));
return account;
}
@ -221,7 +219,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
}
JSONObject account = new JSONObject();
client = clientManager.getClientDetailById(client.getIntValue("client_id"));
client.putAll(clientConfigService.find(client.getIntValue("parent_client_id")));
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
client = clientInfoWithNoSecretInfo(client);
if (client.getInteger("parent_client_id") != null) {
JSONObject rootPartner = clientManager.getClientInfo(client.getIntValue("parent_client_id"));
@ -254,7 +252,8 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
if (account == null) {
throw new ForbiddenException("Your WeChat Account haven't bind to a client user");
}
publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "wechat"));
publisher.publishEvent(
new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "wechat"));
return account;
}
@ -264,7 +263,8 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
if (account == null) {
return null;
}
publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "wechat"));
publisher.publishEvent(
new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "wechat"));
return account;
}
@ -293,17 +293,18 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
String codeKey = signInStatusManager.addChangepasswordVerifyCode(client_moniker);
String url = PlatformEnvironment.getEnv().concatUrl("/global/userstatus/partner_changepassword_page/" + codeKey);
// JSONObject map = new JSONObject();
// map.put("url", url);
// map.put("accounts", accounts);
// map.put("client_moniker", client_moniker);
//todo velocityEngine
// JSONObject map = new JSONObject();
// map.put("url", url);
// map.put("accounts", accounts);
// map.put("client_moniker", client_moniker);
// todo velocityEngine
Context ctx = new Context();
ctx.setVariable("url", url);
ctx.setVariable("accounts", accounts);
ctx.setVariable("client_moniker", client_moniker);
final String content = thymeleaf.process( "mail/reset_password", ctx);
//final String content = VelocityEngineUtils.mergeTemplateIntoString(null, "mail/reset_password.vm", "utf-8", map);
final String content = thymeleaf.process("mail/reset_password", ctx);
// final String content = VelocityEngineUtils.mergeTemplateIntoString(null, "mail/reset_password.vm",
// "utf-8", map);
new Thread(() -> {
try {
@ -324,18 +325,17 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
public static JSONObject clientInfoWithNoSecretInfo(JSONObject client) {
JSONObject simpleClient = new JSONObject();
String[] columns = {"client_id", "client_moniker", "parent_client_id",
"company_name", "address","business_name","business_structure", "abn","acn","company_phone","suburb","postcode","state","contact_person","contact_phone","contact_email",
"short_name", "logo_url", "enable_refund", "enable_refund_auth", "retail_surcharge", "require_custinfo", "require_remark",
"logo_thumbnail", "creator", "create_time", "approver", "approve_result", "approve_time", "timezone",
"has_children", "source", "customer_surcharge_rate", "enable_alipay", "enable_wechat", "enable_bestpay","manual_settle","skip_clearing"};
String[] columns = { "client_id", "client_moniker", "parent_client_id", "company_name", "address", "business_name", "business_structure", "abn", "acn",
"company_phone", "suburb", "postcode", "state", "contact_person", "contact_phone", "contact_email", "short_name", "logo_url", "enable_refund",
"enable_refund_auth", "retail_surcharge", "require_custinfo", "require_remark", "logo_thumbnail", "creator", "create_time", "approver",
"approve_result", "approve_time", "timezone", "has_children", "source", "customer_surcharge_rate", "enable_alipay", "enable_wechat",
"enable_bestpay", "manual_settle", "skip_clearing" };
for (String col : columns) {
simpleClient.put(col, client.get(col));
}
return simpleClient;
}
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.publisher = applicationEventPublisher;

@ -7,7 +7,8 @@
FROM
task_client_manual_settle s
right join sys_clients c on s.client_id = c.client_id
inner join sys_client_config cc on cc.client_id = c.client_id
where (s.request_time=(select max(B.request_time) from task_client_manual_settle B where s.client_id =B.client_id) or s.request_time is null)
and c.manual_settle = 1
and cc.manual_settle = 1
</select>
</mapper>

@ -13,6 +13,7 @@
syscl.longitude,
syscl.location_id
FROM sys_clients c
INNER join sys_client_config cc on cc.client_id = c.client_id
inner join sys_org o
on o.org_id=c.org_id
LEFT JOIN sys_clients_locations syscl on c.client_id = syscl.client_id
@ -82,7 +83,7 @@
and c.state=#{state}
</if>
<if test="temp_mch_id!=null">
and locate(c.sub_merchant_id,#{temp_mch_id})&gt;0 and c.skip_clearing=0 and
and locate(c.sub_merchant_id,#{temp_mch_id})&gt;0 and cc.skip_clearing=0 and
locate(c.client_moniker,#{temp_mch_id_source})&lt;=0
</if>
<if test="quickPass">

@ -28,6 +28,7 @@
<select id="listPartners" resultType="com.alibaba.fastjson.JSONObject">
SELECT DISTINCT c.*,o.name org_name
FROM sys_clients c
inner join sys_client_config cc on cc.client_id = c.client_id
inner join sys_org o
on o.org_id=c.org_id
<if test="bd_user!=null">
@ -102,7 +103,7 @@
and c.state=#{state}
</if>
<if test="temp_mch_id!=null">
and locate(c.sub_merchant_id,#{temp_mch_id})&gt;0 and c.skip_clearing=0 and
and locate(c.sub_merchant_id,#{temp_mch_id})&gt;0 and cc.skip_clearing=0 and
locate(c.client_moniker,#{temp_mch_id_source})&lt;=0
</if>
<if test="quickPass">
@ -277,7 +278,7 @@
AND (cb.end_date IS NULL OR cb.end_date &gt;= #{date})
</select>
<select id="listClientByCleanDays" resultType="java.lang.String">
SELECT client_id FROM sys_clients c
SELECT c.client_id FROM sys_clients c
inner join sys_client_config cc
WHERE c.is_valid = 1 and cc.clean_days = #{clean_days}
</select>

@ -39,7 +39,8 @@
r.expiry_time
FROM sys_clients c
LEFT JOIN sys_client_rates r ON r.client_id = c.client_id
WHERE c.skip_clearing = 0 AND (c.approve_result = 1 or (c.approve_result=2 and (c.source=1 or c.source=2)))
inner join sys_client_config cc on cc.client_id = c.client_id
WHERE cc.skip_clearing = 0 AND (c.approve_result = 1 or (c.approve_result=2 and (c.source=1 or c.source=2)))
AND c.is_valid = 1
AND (r.expiry_time = (SELECT max(expiry_time)
FROM sys_client_rates r3
@ -64,10 +65,11 @@
INNER JOIN sys_client_rates r
ON r.client_id = c.client_id AND r.active_time <= curdate() AND r.expiry_time >= curdate()
AND ADDDATE(curdate(), #{warning_days}) >= r.expiry_time
inner join sys_client_config cc on cc.client_id = c.client_id
WHERE (SELECT count(r2.client_rate_id)
FROM sys_client_rates r2
WHERE r2.client_id = c.client_id AND r2.expiry_time > r.expiry_time AND r2.rate_name=r.rate_name) = 0
AND c.skip_clearing = 0 AND c.approve_result = 1 AND c.is_valid = 1
AND cc.skip_clearing = 0 AND c.approve_result = 1 AND c.is_valid = 1
GROUP BY c.client_id
]]>
</select>

Loading…
Cancel
Save