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

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

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