wangning 6 years ago
parent ead3536fab
commit 8ccde3e5a9

@ -62,7 +62,6 @@ public interface ClientMapper {
@AdvanceSelect(addonWhereClause = "is_valid=1 and approve_email_id is not null and approve_email_send=3")
List<JSONObject> listClientsWithEmailNotVerify();
List<JSONObject> listUnAuthPartners(@Param("auth_days") int auth_days);
JSONObject analysisClients(JSONObject params);
@ -75,6 +74,6 @@ public interface ClientMapper {
List<JSONObject> listBySubMerchantId(@Param("sub_merchant_id") String sub_merchant_id);
@AutoSql(type = SqlType.SELECT)
List<JSONObject> AllClients();
PageList<JSONObject> simpleQuery(JSONObject params, PageBounds pagination);
}

@ -299,4 +299,6 @@ public interface ClientManager {
void sendVerifyEmail(JSONObject client,String accountId);
JSONObject getWithConfig(int client_id);
JSONObject simpleQuery(JSONObject param, int page,int limit);
}

@ -291,11 +291,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Resource
private MpWechatApiProvider mpWechatApiProvider;
@PostConstruct
public void init(){
public void init() {
tags.add("account");
}
@Override
public JSONObject getSysRateConfig() {
String rateConfig = sysConfigManager.getSysConfig().getString("sys_rates");
@ -332,9 +332,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
client.put("show_all_permission", true);
int role = manager != null ? manager.getIntValue("role") : 0;
if (manager != null) {
if(ManagerRole.OPERATOR.hasRole(role)){
if (ManagerRole.OPERATOR.hasRole(role)) {
List<JSONObject> log = logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"));
client.put("sub_merchant_id_log", log.size()>0?true:false);
client.put("sub_merchant_id_log", log.size() > 0 ? true : false);
}
if (ManagerRole.BD_USER.hasRole(role)) {
int checkBDPermission = clientBDMapper.checkBDPermission(client.getIntValue("client_id"), manager.getString("manager_id"));
@ -565,8 +565,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
try {
clientMapper.save(partner);
JSONObject clientConfig = new JSONObject();
clientConfig.put("client_id",partner.getIntValue("client_id"));
clientConfig.put("client_moniker",partner.getString("client_moniker"));
clientConfig.put("client_id", partner.getIntValue("client_id"));
clientConfig.put("client_moniker", partner.getString("client_moniker"));
clientConfigService.save(clientConfig);
} catch (Exception e) {
throw new BadRequestException("error.partner.valid.dumplicate_client_moniker");
@ -594,8 +594,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
try {
mailGunService.addClientToMailList(partner);
}catch (Exception e){
logger.error("邮件列表添加成员失败",e);
} catch (Exception e) {
logger.error("邮件列表添加成员失败", e);
}
return partner;
}
@ -632,8 +632,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
}
clientMapper.update(updateInfo);
if(client.getString("contact_email").equals(updateInfo.getString("contact_email"))){
mailGunService.updateClientOfMailList(updateInfo,client);
if (client.getString("contact_email").equals(updateInfo.getString("contact_email"))) {
mailGunService.updateClientOfMailList(updateInfo, client);
}
clientInfoCacheSupport.clearClientCache(clientId);
}
@ -646,7 +646,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
int clientId = client.getIntValue("client_id");
List<JSONObject> clients = clientMapper.listChildClients(clientId);
String logoId= info.getString("logoId");
String logoId = info.getString("logoId");
if (StringUtils.isNotEmpty(logoId)) {
String fileUrl = attachmentClient.getFileUrl(logoId);
info.put("logo_url", fileUrl);
@ -670,8 +670,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
}
clientMapper.update(info);
if(client.getString("contact_email").equals(info.getString("contact_email"))){
mailGunService.updateClientOfMailList(info,client);
if (client.getString("contact_email").equals(info.getString("contact_email"))) {
mailGunService.updateClientOfMailList(info, client);
}
clientInfoCacheSupport.clearClientCache(clientId);
}
@ -691,33 +691,34 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
WeChatPayConfig.Merchant availableMerchant = mpPaymentApi.determineMerchant(subMerchantId);
update.put("merchant_id", availableMerchant == null ? null : availableMerchant.getMerchantId());
update.put("sub_merchant_id", subMerchantId);
try{
recordSubMerchantLog(client,subMerchantInfo,manager);
}catch(Exception e){
logger.error("记录log_client_sub_merchant_id失败",e);
try {
recordSubMerchantLog(client, subMerchantInfo, manager);
} catch (Exception e) {
logger.error("记录log_client_sub_merchant_id失败", e);
}
clientMapper.update(update);
List<JSONObject> children = clientMapper.listChildClients(clientId);
for (JSONObject child : children) {
if (Objects.equals(child.getString("sub_merchant_id"), originSubMerchantId)) {
update.put("client_id", child.getIntValue("client_id"));
try{
recordSubMerchantLog(child,subMerchantInfo,manager);
}catch(Exception e){
logger.error("记录log_client_sub_merchant_id失败",e);
try {
recordSubMerchantLog(child, subMerchantInfo, manager);
} catch (Exception e) {
logger.error("记录log_client_sub_merchant_id失败", e);
}
clientMapper.update(update);
}
}
clientInfoCacheSupport.clearClientCache(clientId);
}
private void recordSubMerchantLog(JSONObject client,JSONObject subMerchantInfo,JSONObject manager){
private void recordSubMerchantLog(JSONObject client, JSONObject subMerchantInfo, JSONObject manager) {
JSONObject log = new JSONObject();
log.put("sub_merchant_id_after",subMerchantInfo.getString("sub_merchant_id"));
log.put("operator",manager.getString("display_name"));
log.put("create_time",new Date());
log.put("client_id",client.getIntValue("client_id"));
log.put("sub_merchant_id_before",client.getString("sub_merchant_id"));
log.put("sub_merchant_id_after", subMerchantInfo.getString("sub_merchant_id"));
log.put("operator", manager.getString("display_name"));
log.put("create_time", new Date());
log.put("client_id", client.getIntValue("client_id"));
log.put("sub_merchant_id_before", client.getString("sub_merchant_id"));
logClientSubMerchantIdMapper.save(log);
}
@ -781,7 +782,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
private void initAdminUserAndSendEmail(JSONObject manager, String clientMoniker, JSONObject client) {
if(StringUtils.isEmpty(client.getString("sub_merchant_id"))){
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");
@ -1002,8 +1003,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
for (JSONObject client : clients) {
try {
String emailId = client.getString("approve_email_id");
JSONObject status = mailSendMapper.find(emailId,client.getString("contact_email"));
if (status!=null) {
JSONObject status = mailSendMapper.find(emailId, client.getString("contact_email"));
if (status != null) {
int statusNo = status.getIntValue("status");
logger.debug("get mail status:" + emailId + "--" + statusNo);
int mailStatus = 3;
@ -1677,14 +1678,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public String getQrCodeBoard(JSONObject client, QRCodeConfig config,JSONObject account,String plantform) {
public String getQrCodeBoard(JSONObject client, QRCodeConfig config, JSONObject account, String plantform) {
// JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
return merchantInfoProvider.getQrCodeBoard(client, config);
// return merchantInfoProvider.getQrCodeBoard(client, config,account,plantform);
// return merchantInfoProvider.getQrCodeBoard(client, config,account,plantform);
}
@Override
public void writeAggregateQrCodeBoard(JSONObject manager, String clientMoniker, QRCodeConfig config, OutputStream ous,String plantform) {
public void writeAggregateQrCodeBoard(JSONObject manager, String clientMoniker, QRCodeConfig config, OutputStream ous, String plantform) {
JSONObject client = clientDetail(manager, clientMoniker);
try {
JSONObject qrboardConfig = new JSONObject();
@ -1704,7 +1705,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
qrboardConfig.put("brandw", "600");
qrboardConfig.put("brandh", "200");
String type = qrboardConfig.getString("type");
// QRBoard board = QRBoardProvider.getQRBoard(type, qrboardConfig, client, config,mongoTemplate,manager,plantform);
// QRBoard board = QRBoardProvider.getQRBoard(type, qrboardConfig, client,
// config,mongoTemplate,manager,plantform);
QRBoard board = QRBoardProvider.getQRBoard(type, qrboardConfig, client, config);
board.drawBoardImage(ous);
} catch (Exception e) {
@ -1713,7 +1715,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void writeQrCodeBoard(JSONObject manager, String clientMoniker, QRCodeConfig config, OutputStream ous,String plantform) {
public void writeQrCodeBoard(JSONObject manager, String clientMoniker, QRCodeConfig config, OutputStream ous, String plantform) {
JSONObject client = clientDetail(manager, clientMoniker);
JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
try {
@ -1725,7 +1727,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
JSONObject qrboardConfig = JSON.parseObject(qrBoardConfigString);
String type = qrboardConfig.getString("type");
// QRBoard board = QRBoardProvider.getQRBoard(type, qrboardConfig, client, config,mongoTemplate,manager,plantform);
// QRBoard board = QRBoardProvider.getQRBoard(type, qrboardConfig, client,
// config,mongoTemplate,manager,plantform);
QRBoard board = QRBoardProvider.getQRBoard(type, qrboardConfig, client, config);
board.drawBoardImage(ous);
} catch (Exception e) {
@ -2283,7 +2286,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
file.put("file_id", existFile.getString("file_id"));
clientFilesMapper.update(file);
}
if (!renewal && client.getIntValue("source")!=4) {
if (!renewal && client.getIntValue("source") != 4) {
clientModifySupport.processClientModify(new OpenStatusModify(manager, clientMoniker, 2));
}
@ -2386,7 +2389,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
record.put("refund_pwd", pwdHash);
record.put("refund_pwd_salt", salt);
clientConfigService.update(record);
clientModifySupport.processClientConfigModify(new RefundPWDModify(account,client.getString("client_moniker"),pwd,salt));
clientModifySupport.processClientConfigModify(new RefundPWDModify(account, client.getString("client_moniker"), pwd, salt));
}
@Override
@ -2444,12 +2447,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void setClientCustomerTaxFree(JSONObject account,String clientMoniker, boolean customerTaxFree) {
public void setClientCustomerTaxFree(JSONObject account, String clientMoniker, boolean customerTaxFree) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,clientMoniker,"customer_tax_free",customerTaxFree));
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "customer_tax_free", customerTaxFree));
}
@Override
@ -2478,7 +2481,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
public void disableClient(String clientMoniker, JSONObject manager) {
JSONObject client = clientDetail(manager, clientMoniker);
Assert.notEmpty(client);
clientModifySupport.processClientModify(new DisableModify(manager,clientMoniker,false));
clientModifySupport.processClientModify(new DisableModify(manager, clientMoniker, false));
}
@Override
@ -2564,14 +2567,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
PageList<JSONObject> logs = transactionMapper.listSettlementLog(params,
new PageBounds(query.getPage(), query.getLimit(), Order.formString("clearing_time.desc")));
JSONObject result = PageListUtils.buildPageListResult(logs);
if (query.getPage()==1){
if (!logs.isEmpty() && logs.size()>0){
if (query.getPage() == 1) {
if (!logs.isEmpty() && logs.size() > 0) {
JSONObject sendMailLog = logSettleMailMapper.findByDate(logs.get(0).getDate("clearing_time"));
if (sendMailLog == null) {
result.put("padding",true);
result.put("padding", true);
}
if (sendMailLog!=null && sendMailLog.getIntValue("mail_status") != 1) {
result.put("padding",true);
if (sendMailLog != null && sendMailLog.getIntValue("mail_status") != 1) {
result.put("padding", true);
}
}
}
@ -2682,7 +2685,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
log.put("open_status_from", open_status_form);
}
log.put("open_status_to", open_status_to);
log.put("operator_id", StringUtils.isNotEmpty(manager.getString("manager_id"))?manager.getString("manager_id"):manager.getString("account_id"));
log.put("operator_id", StringUtils.isNotEmpty(manager.getString("manager_id")) ? manager.getString("manager_id") : manager.getString("account_id"));
log.put("operator", manager.getString("display_name"));
log.put("create_time", new Date());
log.put("remark", remark);
@ -2799,12 +2802,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
@Transactional
public void changeManualSettle(JSONObject account,int client_id, boolean manual_settle, String operator_id, int type, String operation) {
public void changeManualSettle(JSONObject account, int client_id, boolean manual_settle, String operator_id, int type, String operation) {
JSONObject client = getClientInfo(client_id);
if (client == null) {
throw new BadRequestException("merchant not found");
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"manual_settle",manual_settle));
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, client.getString("client_moniker"), "manual_settle", manual_settle));
JSONObject actClientLog = new JSONObject();
actClientLog.put("client_id", client_id);
actClientLog.put("operator_id", operator_id);
@ -2888,10 +2891,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} else {
auditModify.setOpen_status(open_status - 1);
}
if(client.getInteger("approve_result")==null || client.getIntValue("approve_result")==4){
if (client.getInteger("approve_result") == null || client.getIntValue("approve_result") == 4) {
auditModify.setApprove_result(5);
}
if(client.getIntValue("source")==4){
if (client.getIntValue("source") == 4) {
auditModify.setApprove_result(5);
}
if (refuse_remark != null && !refuse_remark.isEmpty()) {
@ -3199,7 +3202,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return;
}
if (client.getIntValue("open_status") == 4) {
if (client.getIntValue("source")==4 && !StringUtils.isNotEmpty(bd_user_name)){
if (client.getIntValue("source") == 4 && !StringUtils.isNotEmpty(bd_user_name)) {
bd_user_name = "自助开通商户";
}
List<JSONObject> complianceList = managerMapper.getOnlyCompliance();
@ -3484,10 +3487,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public void sendVerifyEmail(JSONObject client,String accountId) {
public void sendVerifyEmail(JSONObject client, String accountId) {
JSONObject clientAccount = clientAccountMapper.findById(accountId);
Assert.notNull(clientAccount);
simpleClientApplyService.sendVerifyEmail(client.getString("contact_email"),client.getIntValue("client_id"),clientAccount.getString("username"));
simpleClientApplyService.sendVerifyEmail(client.getString("contact_email"), client.getIntValue("client_id"), clientAccount.getString("username"));
}
@Override
@ -3496,4 +3499,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientWithConfig.putAll(clientConfigService.find(client_id));
return clientWithConfig;
}
@Override
public JSONObject simpleQuery(JSONObject param, int page, int limit) {
PageList<JSONObject> partners = clientMapper.listPartners(param, new PageBounds(page, limit, Order.formString("create_time.desc")));
return PageListUtils.buildPageListResult(partners);
}
}

@ -310,4 +310,14 @@
WHERE (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1 AND c.sub_merchant_id IS NOT NULL
AND c.merchant_id IS NOT NULL AND c.sub_merchant_id = #{sub_merchant_id}
</select>
<select id="simpleQuery" resultType="com.alibaba.fastjson.JSONObject">
select * from sys_clients
where is_vaild = 1
<if test="source!=null">
and source = #{source}
</if>
<if test="approve_result!=null">
and approve_result = #{approve_result}
</if>
</select>
</mapper>
Loading…
Cancel
Save