Merge remote-tracking branch 'origin/develop' into develop

master
yixian 6 years ago
commit 755f64a3f8

@ -670,3 +670,10 @@ CREATE TABLE `risk_attention_merchants` (
PRIMARY KEY (`client_id`),
KEY `client_moniker` (`client_moniker`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
ALTER TABLE `sys_clients`
ADD COLUMN `wechat_institution_merchant_id` varchar(6) NULL AFTER `wechat_institution_merchant_id`;
ALTER TABLE `log_client_sub_merchant_id`
ADD COLUMN `wechat_institution_merchant_id` varchar(6) NULL AFTER `client_id`;

@ -72,6 +72,6 @@ public class PaymentManageApplication {
@Bean
public MongoClientOptions mongoOptions() {
return MongoClientOptions.builder().maxConnectionIdleTime(6000).build();
return MongoClientOptions.builder().maxConnectionIdleTime(6000).socketTimeout(3000).maxWaitTime(3000).serverSelectionTimeout(3000).build();
}
}

@ -13,4 +13,6 @@ public interface PartnersAnalysisService {
List<JSONObject> getTradePartnersAnalysis(JSONObject params);
List<JSONObject> getPartnersTypesAnalysis(JSONObject params);
List<JSONObject> getPartnersSettlementAnalysis(JSONObject params);
}

@ -70,53 +70,7 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService {
@Override
public JSONObject getChannelAmountAnalysis(JSONObject params) {
JSONObject result = new JSONObject();
// params.put("client_id",0);
params.put("channel", "Wechat");
JSONObject wechatPayAmount = customerAndOrdersStatisticsMapper.getSumCustomersChannelAnalysis(params);
if (wechatPayAmount != null) {
result.put("wechatPayAmount", wechatPayAmount.getBigDecimal("total_amount"));
} else {
result.put("wechatPayAmount", 0.00);
}
params.put("channel", "Bestpay");
JSONObject bestPayAmount = customerAndOrdersStatisticsMapper.getSumCustomersChannelAnalysis(params);
if (bestPayAmount != null) {
result.put("bestPayAmount", bestPayAmount.getBigDecimal("total_amount"));
} else {
result.put("bestPayAmount", 0.00);
}
params.put("channel", "Alipay");
JSONObject aliPayAmount = customerAndOrdersStatisticsMapper.getSumCustomersChannelAnalysis(params);
if (aliPayAmount != null) {
result.put("aliPayAmount", aliPayAmount.getBigDecimal("total_amount"));
} else {
result.put("aliPayAmount", 0.00);
}
params.put("channel", "jd");
JSONObject jdPayAmount = customerAndOrdersStatisticsMapper.getSumCustomersChannelAnalysis(params);
if (jdPayAmount != null) {
result.put("jdPayAmount", jdPayAmount.getBigDecimal("total_amount"));
} else {
result.put("jdPayAmount", 0.00);
}
params.put("channel", "AlipayOnline");
JSONObject aliOnlineAmount = customerAndOrdersStatisticsMapper.getSumCustomersChannelAnalysis(params);
if (aliOnlineAmount != null) {
result.put("aliOnlineAmount", aliOnlineAmount.getBigDecimal("total_amount"));
} else {
result.put("aliOnlineAmount", 0.00);
}
params.put("channel", "hf");
JSONObject hfPayAmount = customerAndOrdersStatisticsMapper.getSumCustomersChannelAnalysis(params);
if (hfPayAmount != null) {
result.put("hfPayAmount", hfPayAmount.getBigDecimal("total_amount"));
} else {
result.put("hfPayAmount", 0.00);
}
return result;
return customerAndOrdersStatisticsMapper.getChannelCommonCount(params);
}
@Override

@ -492,12 +492,12 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
}
params.put("channel",record.getString("channel"));
int newCustomers = 0;
int oldCustomers = transactionAnalysisMapper.countOldCustomers(params);
if (client.getIntValue("client_id")==0){
newCustomers = transactionAnalysisMapper.getCountCustomers(params.getDate("end")) - transactionAnalysisMapper.getCountCustomers(params.getDate("begin"));
newCustomers = record.getIntValue("customers")-oldCustomers;
}else {
newCustomers = transactionAnalysisMapper.countNewCustomers(params);
}
int oldCustomers = transactionAnalysisMapper.countOldCustomers(params);
record.put("new_customers",newCustomers);
record.put("old_customers",oldCustomers);
record.put("client_id",client.getIntValue("client_id"));

@ -47,6 +47,11 @@ public class PartnersAnalysisServiceImpl implements PartnersAnalysisService {
return getPartnerTypes(key_2,result,2,6,types);
}
@Override
public List<JSONObject> getPartnersSettlementAnalysis(JSONObject params) {
return clientAnalysisMapper.countClientsSettlementCycle(params);
}
private List<JSONObject> getPartnerTypes(String keys[], List<JSONObject> result, int short_length, int long_length, List<JSONObject> types){
for(String key : keys){
int countValue = 0;

@ -35,4 +35,6 @@ public interface ClientAnalysisMapper {
List<JSONObject> countClientsTypes(JSONObject params);
List<JSONObject> notTradeSubMerchantId();
List<JSONObject> countClientsSettlementCycle(JSONObject params);
}

@ -66,4 +66,19 @@ public class PartnersAnalysisController {
}
return partnersAnalysisService.getPartnersTypesAnalysis(params);
}
@ManagerMapping("/settlement")
public List<JSONObject> getPartnersSettlementAnalysis(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
if (analysis.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) {
params.put("bd_group", manager.getString("manager_id"));
if (analysis.getGroup_bd()>0){
params.put("bd_group_bd",analysis.getGroup_bd());
}
}
return partnersAnalysisService.getPartnersSettlementAnalysis(params);
}
}

@ -419,9 +419,10 @@ public class RetailAppServiceImp implements RetailAppService {
@Override
public JSONObject openimCheck(JSONObject device) {
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
return customerServiceService.checkAndSave(account);
return customerServiceService.checkAndSavePartner(account);
}
//暂不使用
@Override
public void addUnreadMsg(JSONObject device, JSONObject param) {
customerServiceService.addUnreadMsg(param);
@ -431,7 +432,9 @@ public class RetailAppServiceImp implements RetailAppService {
public JSONObject getRefunds(JSONObject device, AppQueryBean appQueryBean) {
JSONObject appParam = appQueryBean.toParams();
JSONObject param = new JSONObject();
if(appParam.get("client_ids")==null) {
param.put("client_id", device.getIntValue("client_id"));
}
param.put("start_time",appParam.getDate("begin"));
param.put("end_time",appParam.getDate("end"));
return refundService.listUnionAllApply(param, new PageBounds(appQueryBean.getPage(), appQueryBean.getLimit()));

@ -551,7 +551,7 @@ public class RetailAppController {
@RequestMapping(value = "/openim/chat",method = RequestMethod.POST)
public void openimChat(@ModelAttribute(RETAIL_DEVICE) JSONObject device,@RequestBody JSONObject param) {
retailAppService.openimCheck(device);
retailAppService.addUnreadMsg(device,param);
}
}

@ -0,0 +1,67 @@
package au.com.royalpay.payment.manage.custom.beans;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
/**
* @author kira
* @date 2018/7/27
*/
public class AddCustomVO {
private String order_id;
private String custom;
private String mch_custom_no;
private boolean has_sub;
private String mch_custom_name;
private List<JSONObject> subOrders;
public String getMch_custom_name() {
return mch_custom_name;
}
public void setMch_custom_name(String mch_custom_name) {
this.mch_custom_name = mch_custom_name;
}
public String getOrder_id() {
return order_id;
}
public void setOrder_id(String order_id) {
this.order_id = order_id;
}
public String getCustom() {
return custom;
}
public void setCustom(String custom) {
this.custom = custom;
}
public String getMch_custom_no() {
return mch_custom_no;
}
public void setMch_custom_no(String mch_custom_no) {
this.mch_custom_no = mch_custom_no;
}
public boolean isHas_sub() {
return has_sub;
}
public void setHas_sub(boolean has_sub) {
this.has_sub = has_sub;
}
public List<JSONObject> getSubOrders() {
return subOrders;
}
public void setSubOrders(List<JSONObject> subOrders) {
this.subOrders = subOrders;
}
}

@ -0,0 +1,80 @@
package au.com.royalpay.payment.manage.custom.beans;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
/**
* @author kira
* @date 2018/7/27
*/
public class QueryCustomVo {
private String date;
private String channel;
private String report_status;
private int page = 1;
private int limit = 10;
public JSONObject toParam() {
JSONObject result = new JSONObject();
if (StringUtils.isNotEmpty(date)) {
date = date.replace("Z", " UTC");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");
try {
result.put("date", format.parse(date));
} catch (ParseException e) {
}
}
if (StringUtils.isNotEmpty(channel)) {
result.put("channel", channel);
}
if(StringUtils.isNotEmpty(report_status)){
result.put("report_status", report_status);
}
return result;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getLimit() {
return limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public String getReport_status() {
return report_status;
}
public void setReport_status(String report_status) {
this.report_status = report_status;
}
}

@ -0,0 +1,23 @@
package au.com.royalpay.payment.manage.custom.core;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
/**
* @author kira
* @date 2018/7/27
*/
public interface CustomService {
JSONObject findOneWithDetail(String report_id);
void add(String orderId, String mchCustomId, String custom, String mchCustomName, List<JSONObject> subOrders);
boolean check(int client_id, String channel);
JSONObject query(JSONObject param, int page, int limit);
List<JSONObject> channelCustomConfigs(String channel);
}

@ -0,0 +1,85 @@
package au.com.royalpay.payment.manage.custom.core.impl;
import au.com.royalpay.payment.core.CustomSupport;
import au.com.royalpay.payment.core.beans.CustomReport;
import au.com.royalpay.payment.core.beans.OrderStatus;
import au.com.royalpay.payment.manage.custom.core.CustomService;
import au.com.royalpay.payment.manage.mappers.custom.CustomReportDetailsMapper;
import au.com.royalpay.payment.manage.mappers.custom.CustomReportsMapper;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.List;
import javax.annotation.Resource;
/**
* @author kira
* @date 2018/7/27
*/
@Service
public class CustomServiceImpl implements CustomService {
@Resource
private CustomSupport customSupport;
@Resource
private CustomReportsMapper customReportsMapper;
@Resource
private CustomReportDetailsMapper customReportDetailsMapper;
@Override
public JSONObject findOneWithDetail(String report_id) {
JSONObject result = customReportsMapper.findOne(report_id);
result.put("sub_orders", customReportDetailsMapper.findByReportId(report_id));
return result;
}
@Override
public void add(String orderId, String mchCustomId, String custom,String mchCustomName, List<JSONObject> subOrders) {
CustomReport customReport = new CustomReport(orderId, mchCustomId, mchCustomName,custom);
if (!CollectionUtils.isEmpty(subOrders)) {
subOrders.forEach(p -> {
customReport.addSubOrder(p.getBigDecimal("order_fee"), p.getBigDecimal("order_fee").subtract(p.getBigDecimal("transport_fee")));
});
}
JSONObject result = customSupport.saveCustom(customReport);
customSupport.sendCustom(result.getString("report_id"));
}
@Override
public boolean check(int client_id, String channel) {
List<String> supportChannel = customSupport.customSupportedChannels(client_id);
boolean result = false;
for (String p : supportChannel) {
if (p.equals(channel)) {
result = true;
break;
}
}
return result;
}
@Override
public JSONObject query(JSONObject param, int page, int limit) {
param.put("orderStatus", OrderStatus.SUCCESS.getStatus());
List<String> channels = customSupport.customSupportedChannels(param.getIntValue("client_id"));
param.put("channels",channels);
if(!StringUtils.isEmpty(param.getString("channel"))) {
channels.clear();
channels.add(param.getString("channel"));
param.put("channels",channels);
}
return PageListUtils.buildPageListResult(customReportsMapper.queryWithTrans(param, new PageBounds(page, limit)));
}
@Override
public List<JSONObject> channelCustomConfigs(String channel) {
return customSupport.channelCustomConfigs(channel);
}
}

@ -0,0 +1,5 @@
/**
* @author kira
* @date 2018/7/27
*/
package au.com.royalpay.payment.manage.custom;

@ -0,0 +1,53 @@
package au.com.royalpay.payment.manage.custom.web;
import au.com.royalpay.payment.manage.custom.beans.AddCustomVO;
import au.com.royalpay.payment.manage.custom.beans.QueryCustomVo;
import au.com.royalpay.payment.manage.custom.core.CustomService;
import au.com.royalpay.payment.manage.permission.manager.PartnerMapping;
import au.com.royalpay.payment.tools.CommonConsts;
import com.alibaba.fastjson.JSONObject;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import javax.annotation.Resource;
@RestController
@PartnerMapping(value = "/custom")
public class CustomController {
@Resource
private CustomService customService;
@RequestMapping(value = "/{report_id}",method = RequestMethod.GET)
public JSONObject findOne(@PathVariable String report_id) {
return customService.findOneWithDetail(report_id);
}
@RequestMapping(value = "/query",method = RequestMethod.GET)
public JSONObject queryWithTran(@ModelAttribute(CommonConsts.PARTNER_STATUS)JSONObject partner, QueryCustomVo queryCustomVo) {
JSONObject param = queryCustomVo.toParam();
param.put("client_id",partner.getIntValue("client_id"));
return customService.query(param,queryCustomVo.getPage(),queryCustomVo.getLimit());
}
@RequestMapping(value = "",method = RequestMethod.POST)
@ResponseBody
public void add(@RequestBody AddCustomVO addCustomVO) {
customService.add(addCustomVO.getOrder_id(),addCustomVO.getMch_custom_no(),addCustomVO.getCustom(),addCustomVO.getMch_custom_name(),addCustomVO.getSubOrders());
}
@RequestMapping(value = "/channelCustom",method = RequestMethod.GET)
public List<JSONObject> channelCustomConfigs(@RequestParam String channel) {
return customService.channelCustomConfigs(channel);
}
}

@ -3,6 +3,8 @@ package au.com.royalpay.payment.manage.management.sysconfig.core;
import au.com.royalpay.payment.manage.management.sysconfig.beans.FuncInfo;
import au.com.royalpay.payment.manage.management.sysconfig.beans.PartnerModuleInfo;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
@ -27,7 +29,7 @@ public interface PermissionPartnerManager {
List<String> listRoleFunctions(ManagerRole role);
void authorizeRole(ManagerRole role, List<String> functions);
void authorizeRole(PartnerRole role, List<String> functions);
List<JSONObject> listUserFunctions(int role);

@ -12,6 +12,7 @@ import au.com.royalpay.payment.manage.permission.manager.scanner.PermissionPartn
import au.com.royalpay.payment.manage.system.core.PermissionClientModulesService;
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.utils.id.IdUtil;
import com.alibaba.fastjson.JSONObject;
@ -175,7 +176,7 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager {
}
@Override
@CacheEvict(value = ":login:managers:", allEntries = true)
@CacheEvict(value = ":login:partners:", allEntries = true)
public void setFunctionModule(String funcId, String moduleName) {
if (moduleName == null) {
throw new BadRequestException("module name not provided");
@ -204,10 +205,11 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager {
@Override
@Transactional
@CacheEvict(value = ":login:managers:", allEntries = true)
public void authorizeRole(ManagerRole role, List<String> functions) {
permissionPartnerFunctionMapper.clearRolePermission(role.getInverseMask());
permissionPartnerFunctionMapper.authorizeRole(role.getMask(), functions);
@CacheEvict(value = ":login:partners:", allEntries = true)
public void authorizeRole(PartnerRole role, List<String> functions) {
permissionPartnerFunctionMapper.clearRolePermission(role.getCode());
permissionPartnerFunctionMapper.authorizeRole(role.getCode(), functions);
}
@Override

@ -5,6 +5,7 @@ import au.com.royalpay.payment.manage.management.sysconfig.beans.PartnerModuleIn
import au.com.royalpay.payment.manage.management.sysconfig.core.PermissionPartnerManager;
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 com.alibaba.fastjson.JSONObject;
@ -81,8 +82,8 @@ public class SysPermissionPartnerConfigController {
public void authorizeRole(@PathVariable String roleMask, @RequestBody List<String> functions){
try {
int mask = Integer.parseInt(roleMask, 2);
for (ManagerRole role : ManagerRole.values()) {
if (mask == role.getMask()) {
for (PartnerRole role : PartnerRole.values()) {
if (mask == role.getCode()) {
permissionPartnerManager.authorizeRole(role,functions);
return;
}

@ -0,0 +1,23 @@
package au.com.royalpay.payment.manage.mappers.custom;
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;
import java.util.List;
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 yishuqian on 9/1/16.
*/
@AutoMapper(tablename = "pmt_custom_report_details", pkName = "sub_order_no")
public interface CustomReportDetailsMapper {
@AutoSql(type = SqlType.SELECT)
List<JSONObject> findByReportId(@Param("report_id") String report_id);
}

@ -0,0 +1,24 @@
package au.com.royalpay.payment.manage.mappers.custom;
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;
import java.util.List;
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 yishuqian on 9/1/16.
*/
@AutoMapper(tablename = "pmt_custom_reports", pkName = "report_id")
public interface CustomReportsMapper {
@AutoSql(type = SqlType.SELECT)
JSONObject findOne(@Param("report_id") String report_id);
PageList<JSONObject> queryWithTrans(JSONObject param,PageBounds pagination);
}

@ -88,4 +88,7 @@ public interface ClientMapper {
PageList<JSONObject> simpleQuery(JSONObject params, PageBounds pagination);
@AutoSql(type = SqlType.SELECT)
JSONObject findByWechatInstitutionMerchantId(@Param("wechat_institution_merchant_id") String wechat_institution_merchant_id);
}

@ -45,6 +45,7 @@ public interface ManagerMapper {
List<JSONObject> listByRole(JSONObject params);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1")
JSONObject findByWxOpenId(@Param("wx_openid") String openid);
List<String> listOpenIdsOfCompliances();

@ -30,5 +30,8 @@ public interface SysCustomerServiceMapper {
@AutoSql(type = SqlType.SELECT)
List<JSONObject> findAllWithDetail();
@AutoSql(type = SqlType.COUNT)
int countAll();
}

@ -63,6 +63,9 @@ public interface ClientManager {
@Transactional
void updateAliSubMerchantId(JSONObject manager, String clientMoniker, JSONObject aliSubMerchantInfo);
@Transactional
void refreshWechatInstitutionMerchantId(JSONObject manager, String clientMoniker, JSONObject refreshWechatInstitutionMerchantId);
@Transactional(noRollbackFor = EmailException.class)
void auditClient(JSONObject manager, String clientMoniker, int pass);

@ -742,11 +742,40 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientInfoCacheSupport.clearClientCache(clientId);
}
@Override
public void refreshWechatInstitutionMerchantId(JSONObject manager, String clientMoniker, JSONObject refreshWechatInstitutionMerchantId) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
JSONObject update = new JSONObject();
int clientId = client.getIntValue("client_id");
update.put("client_id", clientId);
String wechatInstitutionMerchantId = RandomStringUtils.random(6, true, true).toUpperCase();
if(StringUtils.isEmpty(refreshWechatInstitutionMerchantId.getString("wechat_institution_merchant_id"))){
update.put("wechat_institution_merchant_id",wechatInstitutionMerchantId);
}else {
update.put("wechat_institution_merchant_id",createWechatInstitutionMerchantId(wechatInstitutionMerchantId)) ;
}
clientMapper.update(update);
clientInfoCacheSupport.clearClientCache(clientId);
}
private String createWechatInstitutionMerchantId(String wechatInstitutionMerchantId){
JSONObject client = clientMapper.findByWechatInstitutionMerchantId(wechatInstitutionMerchantId);
if(client == null){
return wechatInstitutionMerchantId;
}else {
return createWechatInstitutionMerchantId(RandomStringUtils.random(6, true, true).toUpperCase());
}
}
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("wechat_institution_merchant_id", client.getString("wechat_institution_merchant_id"));
log.put("client_id", client.getIntValue("client_id"));
log.put("sub_merchant_id_before", client.getString("sub_merchant_id"));
logClientSubMerchantIdMapper.save(log);

@ -35,7 +35,6 @@ public abstract class ClientConfigModify {
protected abstract JSONObject getModifyResult();
@Transactional
public int doModify(MerchantInfoProvider merchantInfoProvider, ClientConfigMapper clientConfigMapper, ClientMapper clientMapper, MongoTemplate mongoTemplate) {
JSONObject client = merchantInfoProvider.getClientInfoByMoniker(clientMoniker);
JSONObject modifyResult = getModifyResult();

@ -159,6 +159,11 @@ public class PartnerManageController {
clientManager.updateAliSubMerchantId(manager, clientMoniker, aliSubMerchantInfo);
}
@ManagerMapping(value = "/{clientMoniker}/wechat_institution_merchant_id", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR})
public void refreshWechatInsMerchantId(@PathVariable String clientMoniker, @RequestBody JSONObject refreshWechatInstitutionMerchantId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.refreshWechatInstitutionMerchantId(manager, clientMoniker, refreshWechatInstitutionMerchantId);
}
@ManagerMapping(value = "/{clientMoniker}/qrcode_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.SERVANT})
public void setClientPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientQRCodePaySurCharge(manager,clientMoniker, config.getBooleanValue("qrcode_surcharge"));

@ -1,15 +1,19 @@
package au.com.royalpay.payment.manage.openim;
import au.com.royalpay.payment.manage.openim.beans.OpenimUserVO;
import au.com.royalpay.payment.manage.openim.core.CustomerServiceService;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.permission.manager.RequireManager;
import au.com.royalpay.payment.manage.signin.beans.LoginInfo;
import au.com.royalpay.payment.manage.signin.core.SignInStatusManager;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.http.HttpUtils;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSONObject;
import org.springframework.validation.Errors;
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;
@ -19,6 +23,8 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
/**
* @author kira
@ -27,19 +33,21 @@ import javax.annotation.Resource;
@RestController
@RequestMapping("/sys/openim")
public class OpenimController {
@Resource
private SignInStatusManager signInStatusManager;
@Resource
private CustomerServiceService customerServiceService;
@RequestMapping(value = "/check", method = RequestMethod.PUT)
@RequireManager
public JSONObject sendMsg(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return customerServiceService.checkAndSave(manager);
public JSONObject check(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return customerServiceService.checkAndSaveManager(manager);
}
@RequestMapping(value = "/findOne", method = RequestMethod.GET)
public OpenimUserVO findOne(@RequestParam int clientId, @RequestParam String userName) {
return customerServiceService.findOne(clientId, userName);
@RequestMapping(value = "/signin", method = RequestMethod.POST)
public void partnerSignIn(@RequestBody @Valid LoginInfo loginInfo, Errors errors, HttpServletResponse response) throws Exception {
HttpUtils.handleValidErrors(errors);
HttpUtils.setCookie(response, CommonConsts.MANAGER_STATUS,signInStatusManager.managerSignIn(loginInfo));
}
@RequestMapping(value = "/list",method = RequestMethod.GET)
@ -50,9 +58,16 @@ public class OpenimController {
return customerServiceService.query(clientMoniker,userNames);
}
@ManagerMapping(value = "/servant/onoff", method = RequestMethod.PUT,role = {ManagerRole.ADMIN})
public void listServants(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager, @RequestBody JSONObject param) {
customerServiceService.onoff(loginManager,param.getBoolean("onoff"));
@ManagerMapping(value = "/servant/{manager_id}/onoff", method = RequestMethod.PUT,role = {ManagerRole.ADMIN})
public void onoff(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager,@PathVariable String manager_id, @RequestBody JSONObject param) {
param.put("manager_id",manager_id);
customerServiceService.onoff(param);
}
@ManagerMapping(value = "/servant/{manager_id}/nick", method = RequestMethod.PUT,role = {ManagerRole.ADMIN})
public void changeNick(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager,@PathVariable String manager_id, @RequestBody JSONObject param) {
param.put("manager_id",manager_id);
customerServiceService.changeNick(param);
}
}

@ -12,16 +12,21 @@ import java.util.List;
*/
public interface CustomerServiceService {
JSONObject checkAndSave(JSONObject account);
JSONObject checkAndSavePartner(JSONObject account);
JSONObject checkAndSaveManager(JSONObject manager);
OpenimUserVO findOne(int clientId,String userName);
List<JSONObject> query(String clientMoniker,String userNames);
void onoff(JSONObject manager,boolean status);
void onoff(JSONObject param);
void changeNick(JSONObject param);
void addUnreadMsg(JSONObject params);
void sendUnreadWxMsg();
}

@ -10,7 +10,7 @@ public interface OpenimApi {
void addUser(JSONObject record);
void updateUser();
void updateUser(JSONObject record);
void pushMsh();

@ -21,7 +21,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
@ -118,21 +117,19 @@ public class OpenimClient {
String url = "https://eco.taobao.com/router/rest";
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
OpenimUsersAddRequest req = new OpenimUsersAddRequest();
List<Userinfos> list2 = new ArrayList<Userinfos>();
Userinfos obj3 = new Userinfos();
list2.add(obj3);
obj3.setNick("king");
obj3.setIconUrl("https://ss0.baidu.com/73t1bjeh1BF3odCf/it/u=1948403834,955109320&fm=85&s=0D06E5134AD145F30C8D6D680300303A");
obj3.setUserid("kira1");
obj3.setPassword("xxxxxx");
req.setUserinfos(list2);
OpenimUsersAddResponse rsp = null;
OpenimUsersGetRequest req = new OpenimUsersGetRequest();
// 批量为userid逗号分隔字符串
req.setUserids("kiraservant");
OpenimUsersGetResponse rsp = null;
try {
rsp = client.execute(req);
} catch (ApiException e) {
e.printStackTrace();
}
System.out.println(rsp.getBody());
JSONObject openInfo = JSONObject.parseObject(rsp.getBody());
System.out.println(openInfo.toJSONString());
System.out.println(openInfo.toJSONString());
System.out.println(openInfo.toJSONString());
}
}

@ -12,16 +12,19 @@ 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.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.BoundListOperations;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
@ -53,40 +56,49 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
@Resource
private StringRedisTemplate stringRedisTemplate;
private final String REDIS_UNREADMSG_PREFIX = "REDIS_UNREADMSG_PREFIX";
private final String REDIS_UNREADMSG_SEND_PREFIX = "REDIS_UNREADMSG_SEND_PREFIX";
@Value("${im.openim.appkey}")
private String appkey;
@Override
public JSONObject checkAndSave(JSONObject account) {
JSONObject client = null;
boolean isPartner = true;
if (StringUtils.isNotEmpty(account.getString("account_id"))) {
client = clientManager.getClientInfo(account.getIntValue("client_id"));
public JSONObject checkAndSavePartner(JSONObject account) {
JSONObject client = clientManager.getClientInfo(account.getIntValue("client_id"));
if (client == null) {
throw new BadRequestException("Merchant Not Found");
}
account = clientAccountMapper.findById(account.getString("account_id"));
isPartner = true;
JSONObject userInfo = clientAccountMapper.findById(account.getString("account_id"));
JSONObject checkRecord = new JSONObject();
checkRecord.put("nick", userInfo.getString("username") + "_" + client.getString("client_moniker"));
checkRecord.put("user_id", userInfo.getString("username") + "_" + client.getString("client_moniker"));
checkRecord.put("password", DigestUtils.md5Hex("uid"));
checkRecord.put("icon_url",client.getString("logo_thumbnail"));
openimApi.addUser(checkRecord);
checkRecord.put("servants", sysCustomerServiceMapper.findOnline());
checkRecord.put("appkey", appkey);
return checkRecord;
}
if (StringUtils.isNotEmpty(account.getString("manager_id"))) {
account = managerMapper.findDetail(account.getString("manager_id"));
isPartner = false;
}
String uid = account.getString("username") + (isPartner ? "_" + client.getString("client_moniker") : "");
JSONObject saveRecord = new JSONObject();
saveRecord.put("nick", account.getString("display_name"));
saveRecord.put("password", DigestUtils.md5Hex("uid"));
if (isPartner) {
saveRecord.put("user_id", uid);
saveRecord.put("servants", sysCustomerServiceMapper.findOnline());
} else {
saveRecord.put("user_id", uid);
}
openimApi.addUser(saveRecord);
saveRecord.put("appkey", appkey);
return saveRecord;
@Override
public JSONObject checkAndSaveManager(JSONObject manager) {
if (StringUtils.isEmpty(manager.getString("manager_id"))) {
throw new ServerErrorException("manager id is null");
}
JSONObject result = sysCustomerServiceMapper.findByManagerId(manager.getString("manager_id"));
if (result == null) {
JSONObject managerDetail = managerMapper.findDetail(manager.getString("manager_id"));
JSONObject checkRecord = new JSONObject();
checkRecord.put("user_id", managerDetail.getString("username"));
int num = sysCustomerServiceMapper.countAll();
checkRecord.put("nick", "客服" + num);
checkRecord.put("icon_url","https://file.royalpay.com.au/open/2017/10/17/1508233432777_7X9kTmbsHUDv0iFD1zmYrDzNkrsBBk.jpg");
checkRecord.put("password", RandomStringUtils.random(12, true, true).toLowerCase());
openimApi.addUser(checkRecord);
result = checkRecord;
}
result.put("appkey", appkey);
result.remove("manager_id");
result.remove("onoff");
return result;
}
@Override
@ -119,7 +131,11 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
queryParams.put("clientId", client.getIntValue("client_id"));
}
if (StringUtils.isNotEmpty(userNames)) {
queryParams.put("userNames", Arrays.asList(userNames.split(",")));
List<String> userNams = Arrays.asList(userNames.split(","));
if (CollectionUtils.isEmpty(userNams)) {
return Collections.EMPTY_LIST;
}
queryParams.put("userNames", userNams);
}
if (queryParams.size() < 1) {
return Collections.emptyList();
@ -137,11 +153,13 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
}
@Override
public void onoff(JSONObject manager, boolean onoff) {
JSONObject record = new JSONObject();
record.put("manager_id", manager.getString("manager_id"));
record.put("onoff", onoff);
udpateOrSave(record);
public void onoff(JSONObject manager) {
saveOrUpdate(manager,false);
}
@Override
public void changeNick(JSONObject param) {
saveOrUpdate(param,true);
}
@Override
@ -151,7 +169,7 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
if (StringUtils.isEmpty(uid) || StringUtils.isEmpty(tuid)) {
return;
}
BoundListOperations<String, String> ops = stringRedisTemplate.boundListOps("REDIS_UNREADMSG_PREFIX" + tuid);
BoundListOperations<String, String> ops = stringRedisTemplate.boundListOps(REDIS_UNREADMSG_PREFIX + tuid);
for (int i = 0; i < ops.size(); i++) {
String jStr = ops.index(i);
if (jStr.contains(uid)) {
@ -171,7 +189,7 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi();
servants.parallelStream().forEach(p -> {
p.getString("user_id");
BoundListOperations<String, String> ops = stringRedisTemplate.boundListOps("REDIS_UNREADMSG_PREFIX" + p.getString("user_id"));
BoundListOperations<String, String> ops = stringRedisTemplate.boundListOps(REDIS_UNREADMSG_PREFIX + p.getString("user_id"));
if (ops.size() < 1) {
return;
}
@ -183,7 +201,7 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
}
TemplateMessage msg = initUnreadMsg(unreadMsg, clients, p.getString("wx_openid"), paymentApi.getTemplateId("commission"));
paymentApi.sendTemplateMessage(msg);
stringRedisTemplate.delete("REDIS_UNREADMSG_PREFIX" + p.getString("user_id"));
stringRedisTemplate.delete(REDIS_UNREADMSG_PREFIX + p.getString("user_id"));
});
}
@ -199,16 +217,24 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
return msg;
}
private void udpateOrSave(JSONObject servant) {
JSONObject record = sysCustomerServiceMapper.findByManagerId(servant.getString("manager_id"));
if (record == null) {
JSONObject manager = managerMapper.findDetail(servant.getString("manager_id"));
servant.put("manager_id", manager.getString("manager_id"));
servant.put("user_id", manager.getString("username"));
private void saveOrUpdate(JSONObject servant, boolean updateOpenim) {
if (StringUtils.isEmpty(servant.getString("manager_id"))) {
throw new ServerErrorException("manager id is null");
}
JSONObject existCS = sysCustomerServiceMapper.findByManagerId(servant.getString("manager_id"));
if (existCS == null) {
JSONObject userInfo = checkAndSaveManager(servant);
servant.put("password", userInfo.getString("password"));
servant.put("nick", userInfo.getString("nick"));
servant.put("user_id", userInfo.getString("user_id"));
sysCustomerServiceMapper.save(servant);
} else {
sysCustomerServiceMapper.update(servant);
}
if (updateOpenim) {
servant.put("user_id", existCS.getString("user_id"));
openimApi.updateUser(servant);
}
}
}
}

@ -6,6 +6,7 @@ import au.com.royalpay.payment.manage.openim.core.OpenimClient;
import com.alibaba.fastjson.JSONObject;
import com.taobao.api.domain.Userinfos;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -34,13 +35,21 @@ public class OpenimApiImpl implements OpenimApi {
record.setUserid(user.getString("user_id"));
record.setNick(user.getString("nick"));
record.setPassword(user.getString("password"));
if(StringUtils.isNotEmpty(user.getString("icon_url"))){
record.setIconUrl(user.getString("icon_url"));
}
saveList.add(record);
openimClient.addUser(saveList);
}
@Override
public void updateUser() {
public void updateUser(JSONObject user) {
List<Userinfos> updateList = new ArrayList<>();
Userinfos record = new Userinfos();
record.setUserid(user.getString("user_id"));
record.setNick(user.getString("nick"));
updateList.add(record);
openimClient.updateUser(updateList);
}
@Override

@ -61,14 +61,14 @@ public class ManagerInfo {
if (admin) {
role |= ManagerRole.ADMIN.getMask();
bd = false;
servant = false;
//servant = false;
accountmanager = false;
orgId = null;
}
if (operator) {
role |= ManagerRole.OPERATOR.getMask();
bd = false;
servant = false;
//servant = false;
accountmanager = false;
orgId = null;
}

@ -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.mappers.system.SysCustomerServiceMapper;
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;
@ -22,6 +23,7 @@ import au.com.royalpay.payment.tools.env.RequestEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.utils.PasswordUtils;
import com.alibaba.fastjson.JSONObject;
@ -74,6 +76,8 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
@Resource
private ClientConfigService clientConfigService;
@Resource
private SysCustomerServiceMapper sysCustomerServiceMapper;
@Resource
private PermissionClientModulesService permissionClientModulesService;
private ApplicationEventPublisher publisher;
private static final List<String> tags = new ArrayList<>();
@ -114,6 +118,10 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
manager.put("available_func_names", funcNames);
manager.put("modules", modules.values());
manager.put("module_names", modules.keySet());
if((manager.getIntValue("role")& ManagerRole.SERVANT.getMask())>0){
JSONObject cs = sysCustomerServiceMapper.findByManagerId(accountId);
manager.put("onoff",cs.getBoolean("onoff"));
}
return manager;
}
@ -429,5 +437,4 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
account.put("is_password_expired", 0);
clientAccountMapper.update(account);
}
}

@ -73,6 +73,7 @@ public class PermissionClientModulesServiceImpl implements PermissionClientModul
}
private void saveMongoLog(JSONObject account, JSONObject oldRecord, JSONObject modifyData, String business) {
try {
modifyData.remove("id");
PermissionClientModuleLog mongoRecord = new PermissionClientModuleLog();
mongoRecord.setBusiness(business);
@ -86,5 +87,7 @@ public class PermissionClientModulesServiceImpl implements PermissionClientModul
Map<String, Object> beforeModify = modifyData.keySet().stream().collect(Collectors.toMap(key -> key, oldRecord::get));
mongoRecord.setOriginData(JSON.toJSONString(beforeModify));
mongoTemplate.insert(mongoRecord);
}catch (Exception ignore){
}
}
}

@ -9,6 +9,7 @@ import javax.annotation.Resource;
/**
* Created by wangning on 2018/1/2.
*
*/
@Component
@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true")
@ -17,7 +18,8 @@ public class SendUnreadMsgWechatTask {
private CustomerServiceService customerServiceService;
// @Scheduled(cron = "0 0/10 * * * ?")
public void ofeiOrderCheck() {
customerServiceService.sendUnreadWxMsg();
}
// public void ofeiOrderCheck() {
// customerServiceService.sendUnreadWxMsg();
// }
}

@ -479,12 +479,14 @@ public class TradeLogServiceImpl implements TradeLogService {
clientManager.validateClients(client_id, params);
params.put("client_id", client_id);
List<JSONObject> logs = transactionMapper.listTransFlow(params);
if (client_id!=1563){
logs.stream().forEach(p -> {
String login_id = p.getString("login_id");
if (StringUtils.isNotEmpty(login_id)) {
p.put("order_detail", (StringUtils.isEmpty(p.getString("order_detail")) ? "" : p.getString("order_detail")) + "(alipay_id:" + login_id + ")");
}
});
}
TimeZoneUtils.switchTimeZoneToString(logs, timezone, "dd/MM/yyyy HH:mm:ss", Arrays.asList("transaction_time"));
final JSONObject analysis = analysisTransLogs(logs);

@ -435,7 +435,7 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
@Override
public JSONObject listUnionAllApply(JSONObject params, PageBounds pagination) {
if(params.get("cleint_id")==null && params.get("client_ids")==null){
if(params.get("client_id")==null && params.get("client_ids")==null){
return null;
}
return PageListUtils.buildPageListResult(refundMapper.listUnionAllApply(params, pagination));

@ -112,8 +112,8 @@ mail.mailgun.default.merchantlist=merchants@mail.royalpay.com.au
royalpay.sms.appid=1400094878
royalpay.sms.appkey=43390d81e20c5191c278fbf4cd275be2
im.openim.appkey=24980715
im.openim.secret=60b1ba680a6f27ffc701f10b6d5be00e
im.openim.appkey=24986533
im.openim.secret=96e28e7be21a874177211c31834b5174
#清算银行配置

@ -148,4 +148,41 @@
GROUP by c.sub_merchant_id
</select>
<select id="countClientsSettlementCycle" resultType="com.alibaba.fastjson.JSONObject">
SELECT COUNT(DISTINCT c.client_id) client_count,
CASE c.clean_days
WHEN 1
THEN 'T+1'
WHEN 2
THEN 'T+2'
WHEN 3
THEN 'T+3'
END AS clean_days
FROM sys_clients c
<where>
(c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1
<if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if>
<if test="org_ids!=null">and org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<if test="bd_group!=null">and c.client_id in
(SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
where b.is_valid=1 and b.start_date&lt;=now() and (b.end_date is null or b.end_date &gt;= now())
AND (c.bd_group=#{bd_group} or c.manager_id=#{bd_group})
<if test="bd_group_bd">and c.manager_id=#{bd_group_bd}</if>)
</if>
<if test="begin!=null">
AND c.client_id in (SELECT o.client_id FROM statistics_customer_order o
<where>
<if test="begin!=null">
o.date >=#{begin}
</if>
<if test="eng!=null">
o.date > #{end}
</if>
</where>)
</if>
</where>
GROUP by c.clean_days
</select>
</mapper>

@ -322,8 +322,16 @@
]]>
<where>
s.client_id != 0
<if test="bd_group!=null">and c.client_id in
(SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
where b.is_valid=1 and b.start_date&lt;=now() and (b.end_date is null or b.end_date &gt;= now())
AND (c.bd_group=#{bd_group} or c.manager_id=#{bd_group})
<if test="bd_group_bd">and c.manager_id=#{bd_group_bd}</if>
)
</if>
<if test="begin!=null">and s.date &gt;= #{begin} </if>
<if test="end!=null">and s.date &lt;= #{end}</if>
<if test="end!=null">and s.date &lt; #{end}</if>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>

@ -0,0 +1,6 @@
<?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.custom.CustomReportDetailsMapper">
</mapper>

@ -0,0 +1,45 @@
<?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.custom.CustomReportsMapper">
<select id="queryWithTrans" resultType="com.alibaba.fastjson.JSONObject">
select
o.order_id order_id, t.transaction_time transaction_time, t.transaction_amount transaction_amount,
t.cny_amount cny_amount ,r.report_status report_status,r.report_id report_id,o.channel channel
from
pmt_orders o
left join
pmt_transactions t
on o.order_id = t.order_id
left join
pmt_custom_reports r
on r.order_id = o.order_id
where
o.channel in (
<foreach collection="channels" separator="," item="item">
#{item}
</foreach>
)
and o.client_id = #{client_id}
and transaction_type = 'Credit'
and
o.status in (
<foreach collection="orderStatus" item="item" separator=",">
#{item}
</foreach>
)
<!--<if test="channel!=null">-->
<!--and o.channel = #{channel}-->
<!--</if>-->
<if test="date!=null">
and DATE(t.transaction_time) = #{date}
</if>
<if test="report_status!=null">
and r.report_status = #{report_status}
</if>
order by transaction_time desc
</select>
</mapper>

@ -77,6 +77,8 @@
confirm_time confirm_time,
operator_name operator_name,
`status` `status` ,
amount amount,
currency currency,
1 type
FROM
pmt_refunds
@ -85,10 +87,10 @@
and client_id = #{client_id}
</if>
<if test="start_time!=null">
and create_time &lt;= #{start_time}
and create_time &gt;= #{start_time}
</if>
<if test="start_time!=null">
and create_time &gt;= #{end_time}
and create_time &lt;= #{end_time}
</if>
<if test="client_ids!=null">
client_id in
@ -99,27 +101,29 @@
</where>
UNION ALL
SELECT
order_id order_id,
client_id client_id,
applytime create_time,
audittime confirm_time,
auditorname operator_name,
audit_result `status` ,
ra.order_id order_id,
ra.client_id client_id,
ra.applytime create_time,
ra.audittime confirm_time,
ra.auditorname operator_name,
ra.audit_result `status` ,
r.amount amount,
r.currency currency,
2 type
FROM
pmt_refund_applies
pmt_refund_applies ra left join pmt_refunds r on ra.refund_id = r.refund_id
<where>
<if test="client_id!=null">
and client_id = #{client_id}
and ra.client_id = #{client_id}
</if>
<if test="start_time!=null">
and applytime &lt;= #{start_time}
and ra.applytime &gt;= #{start_time}
</if>
<if test="start_time!=null">
and applytime &gt;= #{end_time}
and ra.applytime &lt;= #{end_time}
</if>
<if test="client_ids!=null">
client_id in
ra.client_id in
<foreach collection="client_ids" open="(" close=")" separator="," item="item">
#{item}
</foreach>

@ -11,21 +11,19 @@
<if test="org_id!=null">and m.org_id=#{org_id}</if>
</select>
<select id="listAvailable" resultType="com.alibaba.fastjson.JSONObject">
SELECT manager_id,
SELECT m.manager_id,
m.org_id,
display_name,
username,role,m.is_valid,m.create_time,last_login,o.name org_name,
email,phone,wechat,
o.headimg,
o.nickname,
m.display_name,
m.username,m.role,m.is_valid,m.create_time,m.last_login,o.name org_name,
m.email,m.phone,m.wechat,
co.headimg,
co.nickname,
o.parent_org_id
FROM
sys_managers m
LEFT JOIN sys_org o ON o.org_id=m.org_id
LEFT JOIN (
SELECT co.nickname, co.headimg, co.wechat_openid FROM sys_customer_relation co
) o
ON m.wx_openid = o.wechat_openid
LEFT JOIN sys_customer_relation co
ON m.wx_openid = co.wechat_openid
<where>
<if test="username!=null">
<bind name="username_pattern" value="'%'+username+'%'"/>
@ -97,9 +95,9 @@
<select id="listServants" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT display_name
FROM sys_managers
WHERE role & #{mask} >0 AND org_id IS NULL AND is_valid = 1
SELECT m.display_name display_name,m.manager_id manager_id, cs.nick nick, cs.password password,cs.onoff onoff
FROM sys_managers m left join sys_customer_service cs on m.manager_id = cs.manager_id
WHERE m.role & #{mask} >0 AND (m.org_id IS NULL or m.org_id=1) AND m.is_valid = 1
]]>
</select>

@ -13,13 +13,13 @@
<update id="clearRolePermission">
<![CDATA[
UPDATE sys_permission_partner_functions
SET role = role & #{mask}
SET role = replace(role,#{mask},'')
]]>
</update>
<update id="authorizeRole">
<![CDATA[
UPDATE sys_permission_partner_functions
SET role = role | #{mask}
SET role = concat(role,#{mask})
WHERE func_id in
]]>
<foreach collection="func_ids" item="id" open="(" close=")" separator=",">
@ -29,7 +29,7 @@
<select id="listByRoleMask" resultType="com.alibaba.fastjson.JSONObject">
<include refid="joinModule"/>
<![CDATA[
WHERE f.role & #{mask} >0
WHERE f.role like concat('%',#{mask},'%')
]]>
</select>
<select id="listAll" resultType="com.alibaba.fastjson.JSONObject">

@ -13,7 +13,8 @@
<select id="listByClientMoniker" resultType="com.alibaba.fastjson.JSONObject">
select pmc.*,pm.module_name from sys_permission_partner_modules_clients pmc left join sys_permission_partner_modules pm
on pmc.module_id = pm.id and pmc.client_moniker = #{client_moniker}
on pmc.module_id = pm.id
where pmc.client_moniker = #{client_moniker}
</select>
</mapper>

@ -22,7 +22,7 @@
<!--<script async defer src="http://maps.google.cn/maps/api/js?key=AIzaSyDNx0I5o5U0HWPjpHqB4N-y4_f-GLZq4oQ&callback=initMap"-->
<!--type="text/javascript"></script>-->
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDNx0I5o5U0HWPjpHqB4N-y4_f-GLZq4oQ&region=aus&language=zh-CN&callback=initMap"
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDUu6qXRV-j24rSdbPOMfVdTN1-2OfC2o8&region=aus&language=zh-CN&callback=initMap"
type="text/javascript"></script>
<script>
var industryLabel = {

@ -931,6 +931,12 @@ margin-bottom: 10%;"/>
Bill QR Code
</a>
</li>
<li ng-if="currentUser.client.client_moniker=='WOWW' || currentUser.client.client_moniker=='PINE'">
<a ui-sref="custom">
Report Custom
</a>
</li>
</ul>
</li>

@ -120,7 +120,7 @@ margin-bottom: 10%;"/>
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<li class="user-menu">
<li class="user-menu" ng-if="currentUser.onoff">
<a role="button" ng-click="customerService()">
<i class="fa fa-wechat"></i> contact service
</a>

@ -42,7 +42,7 @@
<body>
<input id="pac-input" hidden class="controls" type="text" placeholder="Search Merchant Location">
<div id="map"></div>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDNx0I5o5U0HWPjpHqB4N-y4_f-GLZq4oQ&libraries=places"
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDUu6qXRV-j24rSdbPOMfVdTN1-2OfC2o8&libraries=places"
type="text/javascript"></script>
<!--<script src="http://maps.google.cn/maps/api/js?sensor=true&key=AIzaSyDNx0I5o5U0HWPjpHqB4N-y4_f-GLZq4oQ&region=aus&language=zh-CN"-->

@ -22,7 +22,7 @@
uid: window.uid,
appkey: window.appKey,
credential: window.password,
touid: window.touid,
touid: window.uid,
pluginUrl: '/service_contact_list.html?uid='
+ window.uid,
onLoginSuccess: function (data) {
@ -38,15 +38,16 @@
}
function switchTouid(touid) {
window.uid = touid;
window.touid = touid;
var low_touid = WKIT.Conn.sdk.Base.getNick(touid).toLowerCase();
WKIT.switchTouid({
touid: touid,
touid: low_touid,
logo: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531805782509&di=98f7fa48980696f8eddf7eb617a834a3&imgtype=0&src=http%3A%2F%2Fi2.hdslb.com%2Fbfs%2Fface%2F98dbd049061292bca8625caf91cff1b41ee999cd.jpg',
Avatar: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531805782509&di=98f7fa48980696f8eddf7eb617a834a3&imgtype=0&src=http%3A%2F%2Fi2.hdslb.com%2Fbfs%2Fface%2F98dbd049061292bca8625caf91cff1b41ee999cd.jpg',
toAvatar: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531805782509&di=98f7fa48980696f8eddf7eb617a834a3&imgtype=0&src=http%3A%2F%2Fi2.hdslb.com%2Fbfs%2Fface%2F98dbd049061292bca8625caf91cff1b41ee999cd.jpg'
});
WKIT.Conn.sdk.Chat.setReadState({
touid: touid,
touid: low_touid,
timestamp: Math.floor((+new Date()) / 1000),
success: function (data) {
},
@ -65,8 +66,9 @@
var cnts = data.data.cnts;
for (var i = cnts.length - 1; i >= 0; i--) {
var unreadmapEle = {msgCount: 0};
window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick(
cnts[i].from)] = unreadmapEle;
window.sdk.unreadMap[getName(
WKIT.Conn.sdk.Base.getNick(
cnts[i].from))] = unreadmapEle;
}
getUnreadMsgCount();
},
@ -81,17 +83,16 @@
WKIT.Conn.sdk.Base.getUnreadMsgCount({
count: 40,
success: function (data) {
console.log(data);
var unreads = data.data;
var uids = "";
for (var i = unreads.length - 1; i >= 0; i--) {
if(window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick(unreads[i].contact)]){
window.sdk.unreadMap[getName(WKIT.Conn.sdk.Base.getNick(unreads[i].contact))].msgCount = unreads[i].msgCount;
var nick = getName(WKIT.Conn.sdk.Base.getNick(unreads[i].contact));
if (nick.substring(nick.length - 5, nick.length - 4) == '_') {
uids += nick + ",";
} else {
uids += nick.substring(0, uid.length - 5) + ",";
}
window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick(unreads[i].contact)].msgCount =
unreads[i].msgCount;
var nick = WKIT.Conn.sdk.Base.getNick(unreads[i].contact)
uids += nick.substr(0,nick.length-6) + ",";
}
window.sdk.loadContactList(uids);
},
@ -103,7 +104,19 @@
function updateContractList(data) {
var msg = data.msgs[0];
var msg_uid = WKIT.Conn.sdk.Base.getNick(msg.from);
var low_msg_uid = WKIT.Conn.sdk.Base.getNick(msg.from);
var msg_uid = getName(low_msg_uid);
if (window.uid == msg_uid) {
WKIT.Conn.sdk.Chat.setReadState({
touid: low_msg_uid,
timestamp: Math.floor((+new Date()) / 1000),
success: function (data) {
},
error: function (error) {
console.log('set read state fail', error);
}
});
}else {
if (window.sdk.unreadMap[msg_uid]) {
window.sdk.unreadMap[msg_uid].msgCount = window.sdk.unreadMap[msg_uid].msgCount + 1;
} else {
@ -112,6 +125,7 @@
}
window.sdk.loadContactList(msg_uid.substr(0, msg_uid - 6));
}
}
function initLayout() {
$("#J_wkitUserInfo").hide();
@ -119,10 +133,22 @@
$("#J_wkitPluginFrameWrap").css("margin", "0 0 0 0");
}
function getName(uid) {
if (uid.substring(uid.length - 5, uid.length - 4) == '_') {
var prefix = uid.substring(0, uid.length - 5);
var suffix = uid.substring(uid.length - 5, uid.length).toUpperCase();
return prefix + suffix;
}
return uid;
}
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
if (r != null) {
return unescape(r[2]);
}
return null;
}
</script>

@ -0,0 +1,159 @@
<html>
<!--[if lt IE 9]>
<meta charset="utf-8"/>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>
<script src="https://g.alicdn.com/aliww/ww/json/json.js" charset="utf-8"></script>
<![endif]-->
<!-- 自动适配移动端与pc端 -->
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
<meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=yes" />
<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
<script src="https://g.alicdn.com/aliww/??h5.openim.sdk/1.0.6/scripts/wsdk.js,h5.openim.kit/0.4.0/scripts/kit.js"
charset="utf-8"></script>
<script src="https://g.alicdn.com/aliww/h5.openim.sdk/1.0.6/scripts/wsdk.js"></script>
<script>
window.onload = function () {
$.ajax({
url: '/sys/openim/check',
method: 'PUT',
contentType: 'application/json',
success: function (resp) {
console.log(resp);
window.uid = resp.user_id;
window.touid = resp.user_id;
window.password = resp.password;
window.appKey = resp.appkey;
loginOpenim();
},
error: function (jqXHR) {
}
});
$("#back").bind('click',function () {
parent.hideContent();
})
};
function loginOpenim() {
WKIT.init({
container: document.getElementById('J_demo'),
width: 700,
height: 500,
uid: window.uid,
appkey: window.appKey,
credential: window.password,
touid: window.touid,
onLoginSuccess: function (data) {
initLayout();
WKIT.Conn.sdk.Event.on('MSG_RECEIVED', function (data) {
updateContractList(data.data);
});
initUnreadMsgAndContact();
WKIT.Conn.sdk.Base.startListenAllMsg();
window.sdk = parent.document.getElementById("subPageList").contentWindow;
}
});
}
function switchTouid(touid) {
window.uid = touid;
WKIT.switchTouid({
touid: touid
});
WKIT.Conn.sdk.Chat.setReadState({
touid: touid,
timestamp: Math.floor((+new Date()) / 1000),
success: function (data) {
},
error: function (error) {
console.log('set read state fail', error);
}
});
window.sdk.unreadMap[touid].msgCount = 0;
window.sdk.showContactList(window.sdk.unreadMap);
}
function initUnreadMsgAndContact() {
WKIT.Conn.sdk.Base.getRecentContact({
count: 40,
success: function (data) {
var cnts = data.data.cnts;
for (var i = cnts.length - 1; i >= 0; i--) {
var unreadmapEle = {msgCount: 0};
window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick(
cnts[i].from)] = unreadmapEle;
}
getUnreadMsgCount();
},
error: function (error) {
console.log('get contact msg count fail',
error);
}
})
}
function getUnreadMsgCount() {
WKIT.Conn.sdk.Base.getUnreadMsgCount({
count: 40,
success: function (data) {
console.log(data);
var unreads = data.data;
var uids = "";
for (var i = unreads.length - 1; i >= 0; i--) {
if (window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick(
unreads[i].contact)]) {
}
window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick(
unreads[i].contact)].msgCount =
unreads[i].msgCount;
var nick = WKIT.Conn.sdk.Base.getNick(
unreads[i].contact)
uids +=
nick.substr(0, nick.length - 6) + ",";
}
window.sdk.loadContactList(uids);
},
error: function (error) {
console.log('get recent contact fail', error);
}
});
}
function updateContractList(data) {
var msg = data.msgs[0];
var msg_uid = WKIT.Conn.sdk.Base.getNick(msg.from).toUpperCase();
if (window.sdk.unreadMap[msg_uid]) {
window.sdk.unreadMap[msg_uid].msgCount = window.sdk.unreadMap[msg_uid].msgCount + 1;
window.sdk.unreadMap[msg_uid].lastMsg =msg.msg ;
} else {
var unreadMapEle = {msgCount: 1,msg:msg.msg}
window.sdk.unreadMap[msg_uid] = unreadMapEle;
}
window.sdk.loadContactList(msg_uid.substr(0, msg_uid - 6));
}
function initLayout() {
$("#J_wkitUserInfo").hide();
$("#J_wkitPluginFrameWrap").height("100%");
$("#J_wkitPluginFrameWrap").css("margin", "0 0 0 0");
}
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) {
return unescape(r[2]);
}
return null;
}
</script>
<body>
<div style="width: 2rem;height: 2rem;position: absolute;z-index:99999;" id="back">
<img style="width: 2rem" src="/static/images/im/back.png">
</div>
</body>
</html>

@ -0,0 +1,92 @@
<html>
<!--[if lt IE 9]>
<meta charset="utf-8"/>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>
<script src="https://g.alicdn.com/aliww/ww/json/json.js" charset="utf-8"></script>
<link href="static/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
<![endif]-->
<!-- 自动适配移动端与pc端 -->
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
<meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=yes" />
<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
<script src="https://g.alicdn.com/aliww/??h5.openim.sdk/1.0.6/scripts/wsdk.js,h5.openim.kit/0.4.0/scripts/kit.js"
charset="utf-8"></script>
<script src="https://g.alicdn.com/aliww/h5.openim.sdk/1.0.6/scripts/wsdk.js"></script>
<style>
.content{
width: 99%;
height: 99%;
}
</style>
<script>
window.onload = function () {
$('#submit').bind("click", function () {
var data = {};
data.loginId = $("#uid").val();
data.password = $("#pwd").val();
data.verifyCode = 'noop';
$.ajax({
url: '/sys/openim/signin',
method: 'POST',
data: JSON.stringify(data),
contentType: 'application/json',
success: function () {
window.subPage = document.getElementById("subPage").contentWindow;
window.subPageList =
document.getElementById("subPageList").contentWindow;
window.subPage.location.href = "/service_client_app.html";
window.subPageList.location.href = "/service_contact_list_app.html";
$("#subPageDiv").show();
hideList();
},
error: function (jqXHR) {
}
});
});
}
function hideList() {
$("#loginInput").hide();
$("#subPageDiv").show();
$("#subPageListDiv").hide();
}
function hideContent() {
$("#loginInput").hide();
$("#subPageDiv").hide();
$("#subPageListDiv").show();
}
</script>
<body>
<div id="loginInput" class="col-xs-12 login-box-body login-box-bg">
<form action="" method="post">
<div class="form-group has-feedback">
<input type="text" id="uid" class="form-control" placeholder="账号">
<span class="glyphicon glyphicon-user form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<input type="password" id="pwd" class="form-control" placeholder="密码">
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
</div>
<div class="row">
<div class="col-xs-12 margin-bottom">
<button type="button" id="submit" style="background-color: #f06010" class="btn btn-warning btn-block btn-flat">Sign In</button>
</div>
</div>
</form>
</div>
<div id="subPageDiv" style="display: none" class="content">
<iframe id="subPage" class="content">
</iframe>
</div>
<div id="subPageListDiv" style="display: none" class="content">
<iframe id="subPageList" class="content">
</iframe>
</div>
</body>
</html>

@ -7,7 +7,6 @@
<script src="https://g.alicdn.com/aliww/h5.openim.sdk/1.0.6/scripts/wsdk.js"
charset="UTF-8"></script>
<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
<style>
li {
float: left;
@ -112,6 +111,7 @@
</style>
<script>
var unreadMap = {};
function searchContact() {
var uid = $('#searchText').val();
var searchContactList = {};
@ -151,7 +151,10 @@
dataType: 'json',
success: function (resp) {
for (var i = 0; i <= resp.length - 1; i++) {
unreadMap[resp[i].nick].headimg = resp[i].headimg;
var ele = unreadMap[resp[i].nick];
if (ele) {
ele.headimg = resp[i].headimg;
}
}
showContactList(unreadMap);
}
@ -161,13 +164,14 @@
function showContactList(map) {
var contact_list = '';
for (var key in map) {
var ele= map[key];
var css = 'hover';
if (key == parent.window.uid) {
if (key == parent.window.touid) {
css = 'active';
}
var headImUrl = '';
if (map[key].headimg) {
headImUrl = map[key].headimg;
if (ele.headimg) {
headImUrl = ele.headimg;
} else {
headImUrl = "/static/images/act/encourage_money/default_headimg.png";
}
@ -176,8 +180,10 @@
+ "')>"
+ "<div class=\"headimg\" style='background-image:url(" + headImUrl
+ "')>"
+ "<div class=\"notice\">" + map[key].msgCount + "</div>"
+ "</div>"
if(ele.msgCount>0){
contact_list+="<div class=\"notice\">" + ele.msgCount + "</div>";
}
contact_list += "</div>"
+ "<div class=\"avatar\">" + key + "</div>"
+ "</li>"
}

@ -0,0 +1,212 @@
<html>
<!--[if lt IE 9]>
<meta charset="utf-8"/>
<script src="https://g.alicdn.com/aliww/ww/json/json.js" charset="utf-8"></script>
<![endif]-->
<!-- 自动适配移动端与pc端 -->
<script src="https://g.alicdn.com/aliww/h5.openim.sdk/1.0.6/scripts/wsdk.js"
charset="UTF-8"></script>
<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
<style>
li {
float: left;
list-style-type: none;
transition: background-color .1s;
margin-bottom: 13px;
width: 100%;
height: 2rem;
}
ul {
padding: 0;
}
body{
width: 98%;
height: 98%;
}
.search-div {
height: 3%;
}
.search-div input {
background: #D8D8D8;
border-radius: 5px;
}
.hover {
color: black;
background-color: rgba(255, 255, 255, 0.03);
}
.active {
color: red;
background-color: rgba(255, 255, 255, 0.1);
}
.avatar {
border-radius: 2px;
}
.headimg {
float: left;
border-radius: 50%;
width: 25px;
height: 25px;
border: 1px solid #000;
border-radius: 50%;
background-position: center;
background-attachment: inherit;
}
.headimg-img {
width: 10px;
}
.avatar {
margin-top: 11px;
padding-left: 42px;
}
.msg {
margin-top: 11px;
padding-left: 42px;
}
.notice {
width: 1.2rem;
height: 1.2rem;
line-height: 1.2rem;
font-size: 10px;
color: #fff;
text-align: center;
background-color: #f00;
border-radius: 50%;
position: relative;
right: -23px;
top: -8px;
}
.frm_search {
width: 98%;
height: 32px;
line-height: 32px;
border: 0;
border-radius: 2px;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
background-color: #D8D8D8;
color: #fff;
padding-left: 30px;
font-size: 12px;
}
.search_bar {
position: relative;
width: 100%;
margin: 0 auto 6px;
}
.web_wechat_search {
background: url(/static/images/search.png) no-repeat;
display: inline-block;
vertical-align: middle;
width: 25px;
height: 30px;
position: absolute;
line-height: 1.6;
background-size: 16px;
background-position: 5px;
}
</style>
<script>
var unreadMap = {};
function searchContact() {
var uid = $('#searchText').val();
var searchContactList = {};
for (var key in unreadMap) {
if (key.search(uid) > -1) {
searchContactList[key] = unreadMap[key];
}
}
var param = {clientMoniker: uid};
$.ajax({
url: '/sys/openim/list',
method: 'GET',
data: param,
contentType: 'application/json',
dataType: 'json',
success: function (resp) {
for (var i = 0; i <= resp.length - 1; i++) {
resp[i].msgCount = 0;
searchContactList[resp[i].nick] = resp[i];
unreadMap[resp[i].nick] = resp[i];
}
showContactList(searchContactList);
},
error: function () {
showContactList(searchContactList);
}
});
}
function loadContactList(uids) {
var param = {userNames: uids};
$.ajax({
url: '/sys/openim/list',
method: 'GET',
data: param,
contentType: 'application/json',
dataType: 'json',
success: function (resp) {
for (var i = 0; i <= resp.length - 1; i++) {
unreadMap[resp[i].nick].headimg = resp[i].headimg;
}
showContactList(unreadMap);
}
})
};
function showContactList(map) {
var contact_list = '';
for (var key in map) {
var ele= map[key];
var headImUrl = '';
if (ele.headimg) {
headImUrl = ele.headimg;
} else {
headImUrl = "/static/images/act/encourage_money/default_headimg.png";
}
contact_list +=
"<li onclick=switchToUser('" + key
+ "')>"
+ "<div class=\"headimg\" style='background-image:url(" + headImUrl
+ "')>"
+ "<div class=\"notice\">" + ele.msgCount + "</div>"
+ "</div>"
+ "<div class=\"avatar\">" + key + "</div>";
if(ele.lastMsg){
contact_list +="<div class=\"msg\">" + ele.lastMsg + "</div>";
}
contact_list+= "</li>";
}
$("#contact_list").html(contact_list);
}
function switchToUser(touid) {
parent.document.getElementById("subPage").contentWindow.switchTouid(touid);
parent.hideList();
}
</script>
<body>
<div class="search_bar">
<i class="web_wechat_search"></i>
<input id="searchText" class="frm_search" type="text" onchange="searchContact()">
</div>
<div class="list">
<ul id="contact_list">
</ul>
</div>
</body>
</html>

@ -12,10 +12,10 @@
container: document.getElementById('J_demo'),
width: 700,
height: 500,
uid: 'kira1',
uid: 'kira3_PINE',
appkey: 24980715,
credential: 'xxxxxx',
touid: 'dalong',
touid: 'kiraservanttest1',
logo: 'http://img.alicdn.com/tps/i3/TB12LD9IFXXXXb3XpXXSyFWJXXX-82-82.png',
});
}

@ -12,7 +12,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an
app.controller('partnersAnalysisCtrl', ['$scope', '$http', '$filter', '$timeout', 'commonDialog', 'chartParser','industryMap',
function ($scope, $http, $filter, $timeout, commonDialog, chartParser,industryMap) {
$scope.params = {};
$scope.analysis = {};
if (($scope.currentUser.role & parseInt('1000000000', 2)) > 0 && $scope.currentUser.org_id) {
$http.get('/sys/manager_accounts/group/group_bds').then(function (resp) {
$scope.bd_group_bds = resp.data;
@ -23,6 +23,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an
if (!$scope.params.onlyGroup){
$scope.loadPartnersInTypes();
$scope.doAnalysis();
$scope.loadTradePartnersBySettlementCycle();
return;
}
if (groupBD == 'all') {
@ -36,6 +37,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an
}
$scope.loadPartnersInTypes();
$scope.doAnalysis();
$scope.loadTradePartnersBySettlementCycle();
};
$scope.loadRoyalpayindustry = function () {
$http.get('/static/data/royalpayindustry.json').then(function (resp) {
@ -176,6 +178,71 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an
series: series
}
};
$scope.loadTradePartnersBySettlementCycle = function () {
var params = angular.copy($scope.analysis);
params.onlyGroup = $scope.params.onlyGroup;
if ($scope.params.group_bd){
params.group_bd=angular.copy($scope.params.group_bd);
}
$http.get('/analysis/partners/settlement', {params:params}).then(function (resp) {
$scope.settlementCycle = resp.data;
$scope.partners_settlement_chart = chartParser.parse(partnersBySettlementCycle, resp.data);
});
};
$scope.loadTradePartnersBySettlementCycle();
$scope.chooseAll = function () {
$scope.analysis = {};
$scope.loadTradePartnersBySettlementCycle()
};
$scope.chooseThirtyDays = function () {
$scope.analysis = {};
$scope.analysis.end = $filter('date')(new Date(), 'yyyyMMdd');
var day = new Date();
day.setDate(day.getDate() - 30);
$scope.analysis.begin = $filter('date')(day, 'yyyyMMdd');
$scope.loadTradePartnersBySettlementCycle();
};
$scope.chooseLastMonth = function () {
$scope.analysis = {};
var monthFinish = new Date();
monthFinish.setDate(0);
$scope.analysis.end = $filter('date')(monthFinish, 'yyyyMMdd');
var monthBegin = new Date();
monthBegin.setDate(0);
monthBegin.setDate(1);
$scope.analysis.begin = $filter('date')(monthBegin, 'yyyyMMdd');
$scope.loadTradePartnersBySettlementCycle();
};
var partnersBySettlementCycle = {
chart: {
tooltip: {
trigger: 'item',
formatter :"{a} {b} : {c} ({d}%)"
},
color: colors
},
series: [{
basic: {
name: '周期', type: 'pie',
radius: '60%',
center: ['50%', '40%'],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
},
normal : {
label : {
position : 'outer',
formatter :"{a} {b} : {c} ({d}%)"
}
}
}
},
column: {key: 'client_count', name: 'clean_days'}
}]
};
/*var partnerTypesConfig = function (legend) {
return {
chart: {

@ -59,7 +59,13 @@
</div>
</div>
<div class="box box-warning">
<div class="box-header">
<div class="box-header pull-right">
<div class="btn-group" role="group">
<button type="button" class="btn btn-info" ng-click="display=false" ng-class="{'active':!display}">行业</button>
<button type="button" class="btn btn-info" ng-click="display=true" ng-class="{'active':display}">清算周期</button>
</div>
</div>
<div class="box-body" ng-if="!display">
<div class="col-sm-12">
<div class="col-sm-6 col-xs-12">
<p class="text-center">各类型商家数量分布</p>
@ -92,6 +98,41 @@
</label>
</div>
</div>
<div class="box-body" ng-if="display">
<div class="col-sm-12">
<div class="col-sm-6 col-xs-12">
<p class="text-center">商户清算周期分布</p>
<div class="chart" style="height: 300px" echarts="partners_settlement_chart"
chart-setter="partner_type_chart($chart)"
ng-class="{nodata:partners_settlement_chart.nodata}"></div>
</div>
<div class="col-sm-6 col-xs-12">
<div class="text-center">
<p class="btn-group text-center" role="group">
<button type="button" class="btn btn-primary btn-xs" ng-click="chooseAll()">All</button>
<button type="button" class="btn btn-primary btn-xs" ng-click="chooseThirtyDays();">recent 30 days</button>
<button type="button" class="btn btn-primary btn-xs" ng-click="chooseLastMonth();">Last Month</button>
</p>
<p></p>
<p>清算周期列表</p>
</div>
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th>Clean Days</th>
<th>Partners</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="cycle in settlementCycle">
<td ng-bind="cycle.clean_days"></td>
<td ng-bind="cycle.client_count"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="box box-warning">
<div class="box-header">

@ -52,10 +52,10 @@
datepicker-options="{minDate:params.begin,maxDate:today}">
</div>
<div class="btn-group">
<!--<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseToday()">Today</a>
</div>
</div>-->
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseYesterday()">Yesterday</a>
@ -143,7 +143,7 @@
<div class="description-header text-bold"><img src="/static/images/wechatpay_sign.png"/>Wechat</div>
<div class="description-text">
<label class="description-text text-red"
ng-bind="totalChannelAmount.wechatPayAmount|currency: ' $ '"></label>
ng-bind="totalChannelAmount.wechatamount|currency: ' $ '"></label>
</div>
</div>
@ -153,7 +153,7 @@
<div class="description-text">
<div class="description-header text-bold"><img src="/static/images/bestpay_sign.png"/>Bestpay</div>
<label class="description-text text-red"
ng-bind="totalChannelAmount.bestPayAmount|currency: ' $ '"></label>
ng-bind="totalChannelAmount.bestpayamount|currency: ' $ '"></label>
</div>
</div>
@ -163,7 +163,7 @@
<div class="description-header text-bold"><img src="/static/images/alipay_sign.png"/>Alipay</div>
<div class="description-text text-red">
<label class="description-text"
ng-bind="totalChannelAmount.aliPayAmount|currency: ' $ '"></label>
ng-bind="totalChannelAmount.alipayamount|currency: ' $ '"></label>
</div>
</div>
@ -173,17 +173,17 @@
<div class="description-header text-bold"><img src="/static/images/alipay_sign.png"/>AlipayOnline</div>
<div class="description-text text-red">
<label class="description-text"
ng-bind="totalChannelAmount.aliOnlineAmount|currency: ' $ '"></label>
ng-bind="totalChannelAmount.alipayonlineamount|currency: ' $ '"></label>
</div>
</div>
</div>
<div class="col-sm-2 col-xs-6">
<div class="description-block">
<div class="description-header text-bold"><img src="/static/images/wechatpay_sign.png"/>JD Pay</div>
<div class="description-header text-bold"><img src="/static/images/jd_sign.png"/>JD Pay</div>
<div class="description-text text-red">
<label class="description-text"
ng-bind="totalChannelAmount.wechatPayAmount|currency: ' $ '"></label>
ng-bind="totalChannelAmount.jdamount|currency: ' $ '"></label>
</div>
</div>
@ -193,7 +193,7 @@
<div class="description-header text-bold"><img src="/static/images/hf_sign.png"/>HF Pay</div>
<div class="description-text text-red">
<label class="description-text"
ng-bind="totalChannelAmount.hfPayAmount|currency: ' $ '"></label>
ng-bind="totalChannelAmount.hfamount|currency: ' $ '"></label>
</div>
</div>
</div>

@ -103,7 +103,7 @@
<div class="description-header text-bold"><img src="/static/images/wechatpay_sign.png"/>Wechat</div>
<div class="description-text">
<label class="description-text text-red"
ng-bind="totalChannelAmount.wechatPayAmount|currency: ' $ '"></label>
ng-bind="totalChannelAmount.wechatamount|currency: ' $ '"></label>
</div>
</div>
@ -113,7 +113,7 @@
<div class="description-text">
<div class="description-header text-bold"><img src="/static/images/bestpay_sign.png"/>Bestpay</div>
<label class="description-text text-red"
ng-bind="totalChannelAmount.bestPayAmount|currency: ' $ '"></label>
ng-bind="totalChannelAmount.bestpayamount|currency: ' $ '"></label>
</div>
</div>
@ -123,7 +123,7 @@
<div class="description-header text-bold"><img src="/static/images/alipay_sign.png"/>Alipay</div>
<div class="description-text">
<label class="description-text text-red"
ng-bind="totalChannelAmount.aliPayAmount|currency: ' $ '"></label>
ng-bind="totalChannelAmount.alipayamount|currency: ' $ '"></label>
</div>
</div>
@ -133,17 +133,17 @@
<div class="description-header text-bold"><img src="/static/images/alipay_sign.png"/>AlipayOnline</div>
<div class="description-text">
<label class="description-text text-red"
ng-bind="totalChannelAmount.aliOnlineAmount|currency: ' $ '"></label>
ng-bind="totalChannelAmount.alipayonlineamount|currency: ' $ '"></label>
</div>
</div>
</div>
<div class="col-sm-2 col-xs-6">
<div class="description-block">
<div class="description-header text-bold"><img src="/static/images/wechatpay_sign.png"/>JD Pay</div>
<div class="description-header text-bold"><img src="/static/images/jd_sign.png"/>JD Pay</div>
<div class="description-text">
<label class="description-text text-red"
ng-bind="totalChannelAmount.wechatPayAmount|currency: ' $ '"></label>
ng-bind="totalChannelAmount.jdamount|currency: ' $ '"></label>
</div>
</div>
@ -153,7 +153,7 @@
<div class="description-header text-bold"><img src="/static/images/hf_sign.png"/>HF Pay</div>
<div class="description-text">
<label class="description-text text-red"
ng-bind="totalChannelAmount.hfPayAmount|currency: ' $ '"></label>
ng-bind="totalChannelAmount.hfamount|currency: ' $ '"></label>
</div>
</div>
</div>

@ -67,7 +67,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an
params.begin = $filter('date')(new Date(), 'yyyyMMdd');
}
if (params.end) {
params.end = $filter('date')(params.end, 'yyyyMMdd');
params.end = $filter('date')(params.end.setMonth(params.end.getMonth()+1), 'yyyyMMdd');
} else {
params.end = $filter('date')(new Date(), 'yyyyMMdd');
}

@ -38,7 +38,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an
}
$scope.listTransLogs();
$scope.params = {};
$scope.today = new Date();
$scope.today = new Date(new Date().getTime() - 24*60*60*1000);
if (($scope.currentUser.role & parseInt('1000000000', 2)) > 0 && $scope.currentUser.org_id) {
$http.get('/sys/manager_accounts/group/group_bds').then(function (resp) {
@ -74,14 +74,14 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an
$scope.doAnalysis(1);
};
$scope.chooseLast7Days = function () {
$scope.params.end = new Date();
$scope.params.end = new Date(new Date().getTime() - 24*60*60*1000);
var day = new Date();
day.setDate(day.getDate() - 7);
day.setDate(day.getDate() - 8);
$scope.params.begin = day;
$scope.doAnalysis(1);
};
$scope.thisMonth = function () {
$scope.params.end = new Date();
$scope.params.end = new Date(new Date().getTime() - 24*60*60*1000);
var monthBegin = new Date();
monthBegin.setDate(1);
$scope.params.begin = monthBegin;
@ -98,7 +98,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an
$scope.doAnalysis(1);
};
$scope.thisYear = function () {
var yearFinish = new Date();
var yearFinish = new Date(new Date().getTime() - 24*60*60*1000);
$scope.params.end = yearFinish;
var currentYearFirstDate = new Date(new Date().getFullYear(), 0, 1);
$scope.params.begin = currentYearFirstDate;

@ -59,6 +59,7 @@ var modules = [
{path: 'static/boot/indexMainApp', module: 'indexMainApp', roles: [1, 2, 3]},
{path: 'static/commons/commons', module: 'commons', roles: [1, 2, 3]},
{path: 'static/payment/good/good-manage', module: 'goodManagement', roles: [1, 2, 3]},
{path: 'static/payment/custom/custom', module: 'customManagement', roles: [1, 2, 3]},
{path: 'static/payment/partner/partner', module: 'partnerInfoApp', roles: [1, 2, 3]},
{path: 'static/payment/tradelog/tradelog', module: 'tradeLogApp', roles: [1, 2, 3]},
{path: 'static/payment/tradelog/transflow', module: 'balanceReport', roles: [1, 2, 3]},

@ -60,7 +60,7 @@
<label ng-if="('00001'|withRole)">
<input type="checkbox" ng-model="manager.finacial" name="finacial">Accountant
</label>
<label ng-if="('00001'|withRole) && !manager.admin && !manager.operator">
<label ng-if="('00001'|withRole)">
<input type="checkbox" ng-model="manager.servant" name="servant">Service
</label>
<label ng-if="!manager.admin && !manager.operator">

@ -67,6 +67,7 @@ define(['angular', 'uiRouter'], function (angular) {
}]);
app.controller('servantsConfigCtrl', ['$scope','$http','commonDialog', function ($scope,$http,commonDialog) {
$scope.ctrl={};
$scope.loadServants = function () {
$http.get('/sys/manager_accounts/roles/servant').then(function (resp) {
$scope.servants = resp.data;
@ -75,7 +76,22 @@ define(['angular', 'uiRouter'], function (angular) {
$scope.loadServants();
$scope.onoff = function (servant) {
var param = {onoff:servant.onoff};
$http.put('/sys/openim/servant/onoff',param).then(function (resp) {
$http.put('/sys/openim/servant/'+servant.manager_id+'/onoff',param).then(function (resp) {
if(!servant.password){
$scope.loadServants();
}
},function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
});
};
$scope.changeNick = function (servant) {
var param = {nick:servant.nick};
$http.put('/sys/openim/servant/'+servant.manager_id+'/nick',param).then(function (resp) {
$scope.ctrl.nick[servant.display_name] = false;
if(!servant.password){
$scope.loadServants();
}
},function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
});

@ -27,7 +27,7 @@
<i class="fa fa-user-secret"></i>
Administrator
</a>
<a class="btn btn-app" role="button" ng-click="authorizeRole('10')">
<a class="btn btn-app" role="button" ng-click="authorizeRole('3')">
<i class="fa fa-eye"></i>
Compliance
</a>

@ -1,10 +1,10 @@
<section class="content-header">
<h1>Mail Not Subscribe</h1>
<h1>Servants Config</h1>
<ol class="breadcrumb">
<li>
<a ui-sref="^"><i class="fa fa-cog"></i> System Config</a>
</li>
<li>Mail Not Subscribe</li>
<li>Servants Config</li>
</ol>
</section>
<div class="content">
@ -32,12 +32,36 @@
<thead>
<tr>
<th>Display Name</th>
<th>Nick</th>
<th>Password</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="servant in servants">
<td ng-bind="servant.display_name"></td>
<td>
<p class="form-control-static">
{{servant.nick}}
<a role="button" ng-click="ctrl.nick[servant.display_name]=true" ><i class="fa fa-edit"></i></a>
</p>
<div class="input-group" ng-if="ctrl.nick[servant.display_name] || false">
<input type="text" class="form-control" ng-model="servant.nick"
title="Ali Sub Merchant Id">
<div class="input-group-btn">
<button class="btn btn-success" ng-click="changeNick(servant)">
<i class="fa fa-check"></i>
</button>
</div>
<div class="input-group-btn">
<button class="btn btn-danger" ng-click="ctrl.nick[servant.display_name]=false">
<i class="fa fa-remove"></i>
</button>
</div>
</div>
</td>
<td ng-bind="servant.password"></td>
<td>
<input type="checkbox" ng-click="onoff(servant)" ng-model="servant.onoff">
</td>

@ -30,7 +30,7 @@
Partner Permission Config
</a>
<a class="btn btn-app" role="button" ui-sref=".servantsConfig">
<a class="btn btn-app" role="button" ui-sref=".servantsConfig" ng-if="('1'|withRole)">
<i class="fa fa-key"></i>
Servants Config
</a>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

@ -0,0 +1,204 @@
define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], function (angular) {
'use strict';
var app = angular.module('customManagement', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ngFileUpload']);
app.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('custom', {
url: '/custom',
templateUrl: '/static/payment/custom/templates/custom.html',
controller: 'customCtrl'
})
}]);
app.controller('customCtrl', ['$scope', '$http', 'commonDialog','$filter','$uibModal', function ($scope, $http, commonDialog,$filter,$uibModal) {
$scope.pagination = {};
$scope.customOrders = {};
$scope.params = {channel:'ALL',report_status:'ALL'};
$scope.loadList = function () {
var params = angular.copy($scope.params);
if (params.channel =='ALL'){
delete params.channel;
}
if (params.report_status =='ALL'){
delete params.report_status;
}
params.page = $scope.pagination.page || 1;
$http.get('/custom/query',{params: params}).then(function (resp) {
$scope.customOrders = resp.data.data;
$scope.pagination = resp.data.pagination;
})
};
$scope.loadList(1);
$scope.add = function (order) {
$uibModal.open({
templateUrl: '/static/payment/custom/templates/custom_add.html',
controller: 'customAddCtrl',
size: 'lg',
resolve: {
order_id: function () {
return order.order_id;
},
channelCustom:['$http', '$stateParams', function ($http, $stateParams) {
return $http.get('/custom/channelCustom?channel='+order.channel);
}]
}
}).result.then(function () {
$scope.loadList(1);
})
};
$scope.edit = function (order) {
$uibModal.open({
templateUrl: '/static/payment/custom/templates/custom_add.html',
controller: 'customEditCtrl',
size: 'lg',
resolve: {
customOrder: ['$http', '$stateParams', function ($http, $stateParams) {
return $http.get('/custom/'+order.report_id);
}],
order_id: function () {
return order.order_id;
},
channelCustom:['$http', '$stateParams', function ($http, $stateParams) {
return $http.get('/custom/channelCustom?channel='+order.channel);
}]
}
})
}
$scope.detail = function (order) {
$uibModal.open({
templateUrl: '/static/payment/custom/templates/custom_detail.html',
controller: 'customDetailCtrl',
size: 'lg',
resolve: {
customOrder: ['$http', '$stateParams', function ($http, $stateParams) {
return $http.get('/custom/'+order.report_id);
}]
}
})
}
}]);
app.controller('customAddCtrl', ['$scope', '$http','commonDialog','order_id','channelCustom', function ($scope, $http,commonDialog,order_id,channelCustom) {
$scope.custom = {has_sub:false,order_id:order_id,isSubmit:true};
$scope.subOrders = new Array();
$scope.subOrder = {};
$scope.channelCustom = channelCustom.data;
$scope.addSubOrders = function () {
var subOrder = angular.copy($scope.subOrder);
subOrder.idNum = $scope.subOrders.length+1;
$scope.subOrders.push(subOrder);
};
$scope.submit=function () {
if($scope.custom.custom==''){
alert('请输入海关名称');
}
if($scope.custom.mchCustomId==''){
alert('请输入备案号');
}
$scope.custom.subOrders = $scope.subOrders;
var param = angular.copy($scope.custom);
$http.post('/custom', param).then(function (resp) {
$scope.$close();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
$scope.$close();
})
}
$scope.removeSubOrders = function (order) {
for(var i= 0 ;i<$scope.subOrders.length;i++){
if($scope.subOrders[i].idNum == order.idNum){
$scope.subOrders.splice(i,1);
return;
}
}
}
}]);
app.controller('customEditCtrl', ['$scope', '$http','commonDialog','order_id','customOrder','channelCustom', function ($scope, $http,commonDialog,order_id,customOrder,channelCustom) {
$scope.custom =customOrder.data;
$scope.custom.has_sub = false;
$scope.custom.order_id = order_id;
$scope.custom.isSubmit = false;
$scope.subOrders = customOrder.data.sub_orders;
$scope.subOrder = {};
$scope.channelCustom = channelCustom.data;
if($scope.subOrders.length>0) {
for (var i = 0; i < $scope.subOrders.length; i++) {
var idNum = i;
$scope.subOrders[i].idNum = idNum;
}
$scope.custom.has_sub = true;
}else{
$scope.custom.has_sub = false;
}
$scope.addSubOrders = function () {
var subOrder = angular.copy($scope.subOrder);
subOrder.idNum = $scope.subOrders.length+1;
$scope.subOrders.push(subOrder);
};
$scope.submit=function () {
if($scope.custom.custom==''){
alert('请输入海关名称');
}
if($scope.custom.mchCustomId==''){
alert('请输入备案号');
}
$scope.custom.subOrders = $scope.subOrders;
var param = angular.copy($scope.custom);
$http.post('/custom', param).then(function (resp) {
$scope.$close();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
})
}
$scope.removeSubOrders = function (order) {
for(var i= 0 ;i<$scope.subOrders.length;i++){
if($scope.subOrders[i].idNum == order.idNum){
$scope.subOrders.splice(i,1);
return;
}
}
}
}]);
app.controller('customDetailCtrl', ['$scope', '$http','commonDialog','customOrder', function ($scope, $http,commonDialog,customOrder) {
$scope.custom = customOrder.data;
if(customOrder.data.sub_orders.length>0){
$scope.custom.has_sub = true;
$scope.subOrders = $scope.custom.sub_orders;
}else {
$scope.custom.has_sub = false;
}
}]);
app.filter('reportStatus', function () {
return function (status) {
switch (status + '') {
case '0':
return 'Saved';
case '1':
return 'Submitted';
case '2':
return 'Failed';
case '3':
return 'Success';
}
}
});
return app;
});

@ -0,0 +1,155 @@
<style>
.delete {
text-decoration-line: line-through;
}
</style>
<div ui-view>
<section class="content-header">
<h1>Custom</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-sitemap"></i> Custom
</li>
<li class="active">Report Custom </li>
</ol>
</section>
<div class="content">
<div class="row">
<div class="col-sm-12">
<div class="box-solid">
<div class="box box-warning">
<div class="box-header">
<div class="form-horizontal col-sm-8">
<!-- <div class="form-group">
<label class="control-label col-xs-4 col-sm-3">Channel</label>
<div class="col-xs-8 col-sm-6">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.channel=='ALL'}"
ng-click="params.channel='ALL';loadList()">All</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='Wechat'}"
ng-click="params.channel='Wechat';loadList()">Wechat Pay</a> |
<a role="button" ng-class="{'bg-primary':params.channel=='Alipay'}"
ng-click="params.channel='Alipay';loadList()">Alipay</a> |
</p>
</div>
</div>-->
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3">Report Status</label>
<div class="col-xs-8 col-sm-6">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.report_status=='ALL'}"
ng-click="params.report_status='ALL';loadList()">All</a> |
<a role="button" ng-class="{'bg-primary':params.report_status=='0'}"
ng-click="params.report_status='0';loadList()">Saved</a> |
<a role="button" ng-class="{'bg-primary':params.report_status=='1'}"
ng-click="params.report_status='1';loadList()">Submitted</a> |
<a role="button" ng-class="{'bg-primary':params.report_status=='2'}"
ng-click="params.report_status='2';loadList()">Failed</a> |
<a role="button" ng-class="{'bg-primary':params.report_status=='3'}"
ng-click="params.report_status='3';loadList()">Success</a> |
</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3">Date</label>
<div class="col-xs-8 col-sm-6">
<input class="form-control" ng-model="params.date"
uib-datepicker-popup size="10" is-open="ctrl.dateInput"
ng-click="ctrl.dateInput=true"
datepicker-options="{minDate:minDate,maxDate:maxDate}" name="date" required>
</div>
<button class="btn btn-primary" type="button" ng-click="loadList(1)"><i
class="fa fa-search"></i></button>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title">
Custom Order List
</h3>
</div>
<div class="box-body table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Order Id</th>
<th>Time</th>
<th>Order Amount</th>
<th>CNY Amount</th>
<th>Report Status</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="order in customOrders">
<td>
<p class="form-control-static">
<img src="/static/images/wechatpay_sign.png"
uib-tooltip="WechatPay" ng-if="order.channel=='Wechat'"/>
<img src="/static/images/wechatpay_sign.png"
uib-tooltip="Znyoo" ng-if="order.channel=='Znyoo'"/>
<img src="/static/images/bestpay_sign.png"
uib-tooltip="BestPay" ng-if="order.channel=='Bestpay'"/>
<img src="/static/images/alipay_sign.png"
uib-tooltip=Alipay" ng-if="order.channel=='Alipay'"/>
<img src="/static/images/alipay_sign.png"
uib-tooltip=AlipayOnline" ng-if="order.channel=='AlipayOnline'"/>
<img src="/static/images/jd_sign.png"
uib-tooltip="JD Pay" ng-if="order.channel=='jd'"/>
<img src="/static/images/hf_sign.png"
uib-tooltip="HF Pay" ng-if="order.channel=='hf'"/>
{{order.order_id}}
</td>
</p>
</td>
<th ng-bind="order.transaction_time"></th>
<td ng-bind="order.transaction_amount"></td>
<th ng-bind="order.cny_amount"></th>
<th ng-bind="order.report_status|reportStatus"></th>
<td>
<a ng-if="order.report_status==null" class="text-primary" role="button" title="Edit"
ng-click="add(order)">
Submit
</a>
<!--<a class="text-primary" role="button" title="Edit"-->
<!--ng-click="edit(order)">-->
<!--Edit-->
<!--</a>-->
<a ng-if="order.report_status!=null" class="text-primary" role="button" title="Detail"
ng-click="detail(order)">
<i class="fa fa-search"></i>
</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer" ng-if="customOrders.length">
<uib-pagination class="pagination"
total-items="pagination.totalCount"
boundary-links="true"
ng-model="pagination.page"
items-per-page="pagination.limit"
max-size="10"
ng-change="loadList(1)"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
<div class="row">
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total
Pages:{{pagination.totalPages}}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

@ -0,0 +1,96 @@
<div class="modal-header">
<h4 ng-if="custom.isSubmit">Submit Declare Custom</h4>
<h4 ng-if="!custom.isSubmit">Edit Declare Custom</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-12">
<form class="form-horizontal" novalidate name="rate_form">
<div class="form-group">
<label class="control-label col-sm-4">Customs</label>
<div class="col-sm-6">
<select class="form-control" name="industry"
ng-model="custom.custom"
ng-options="custom.code as custom.name for custom in channelCustom">
<option value="">Please Choose</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="mch_custom_no">Customs No</label>
<div class="col-sm-6">
<input class="form-control" ng-model="custom.mch_custom_no" id="mch_custom_no" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="mch_custom_name">Merchant Custom Record Name</label>
<div class="col-sm-6">
<input class="form-control" ng-model="custom.mch_custom_name" id="mch_custom_name" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="has_sub">Split</label>
<div class="col-sm-6">
<input ng-model="custom.has_sub" id="has_sub" type="checkbox">
</div>
</div>
<div class="form-group" ng-if="custom.has_sub">
<div class="col-sm-1"></div>
<div class="col-sm-10">
<table class="table table-striped">
<thead>
<tr>
<th>Order Amount</th>
<th>Transport Fee</th>
<!--<th>消费者名称</th>-->
<!--<th>消费者ID</th>-->
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="subOrder in subOrders">
<td ng-bind="subOrder.order_fee"></td>
<td ng-bind="subOrder.transport_fee"></td>
<!--<td ng-bind="subOrder.buyer_name"></td>-->
<!--<td ng-bind="subOrder.cert_id"></td>-->
<td>
<a role="button" class="text-danger text-bold ng-scope" ng-click="removeSubOrders(subOrder)">remove</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div ng-if="custom.has_sub">
<div class="form-group">
<label class="control-label col-sm-4" for="order_fee">Order Amount</label>
<div class="col-sm-6">
<input class="form-control" ng-model="subOrder.order_fee" id="order_fee" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="transport_fee">Transport Fee</label>
<div class="col-sm-6">
<input class="form-control" ng-model="subOrder.transport_fee" id="transport_fee" type="text">
</div>
</div>
<div class="form-group" style="text-align: right;margin-right: 17%;" ng-click="addSubOrders()">
<button class="btn btn-success" type="button"> add</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-success" type="button" ng-click="submit()" ng-disabled="ctrl.sending">Submit</button>
<button class="btn btn-danger" type="button" ng-click="$dismiss()">Cancel</button>
</div>

@ -0,0 +1,64 @@
<div class="modal-header">
<h4>Add Declare Custom</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-12">
<form class="form-horizontal" novalidate name="rate_form">
<div class="form-group">
<label class="control-label col-sm-4" for="custom">Customs</label>
<div class="col-sm-6">
<input class="form-control" ng-model="custom.custom" id="custom" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="mch_custom_no">Customs No</label>
<div class="col-sm-6">
<input class="form-control" ng-model="custom.mch_custom_no" id="mch_custom_no" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="mch_custom_name">Merchant Custom Record Name</label>
<div class="col-sm-6">
<input class="form-control" ng-model="custom.mch_custom_name" id="mch_custom_name" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="has_sub">Split</label>
<div class="col-sm-6">
<input ng-model="custom.has_sub" id="has_sub" type="checkbox">
</div>
</div>
<div class="form-group" ng-if="custom.has_sub">
<div class="col-sm-1"></div>
<div class="col-sm-10">
<table class="table table-striped">
<thead>
<tr>
<th>Order Amount</th>
<th>Transport Fee</th>
<!--<th>消费者名称</th>-->
<!--<th>消费者ID</th>-->
</tr>
</thead>
<tbody>
<tr ng-repeat="subOrder in subOrders">
<td ng-bind="subOrder.order_fee"></td>
<td ng-bind="subOrder.transport_fee"></td>
<!--<td ng-bind="subOrder.buyer_name"></td>-->
<!--<td ng-bind="subOrder.cert_id"></td>-->
</tr>
</tbody>
</table>
</div>
</div>
</form>
</div>
</div>
</div>

@ -522,6 +522,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
};
$scope.showFile();
$scope.passClient = function () {
if(!$scope.partner.wechat_institution_merchant_id){
commonDialog.alert({title: 'info', content: 'Wechat Institution Merchant Id not Refresh', type: 'info'});
return;
}
if ($scope.partner.enable_hf) {
if($scope.partner.hfindustry == null){
alert("已开启HF支付通道HF行业不可为空!");
@ -570,6 +574,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
});
};
$scope.pass2GreenChannel = function () {
if(!$scope.partner.wechat_institution_merchant_id){
commonDialog.alert({title: 'info', content: 'Wechat Institution Merchant Id not Refresh', type: 'info'});
return;
}
commonDialog.confirm({
title: 'Green Channel Audit Partner',
content: 'Are you sure to mark partner ' + $scope.partner.company_name + ' green channel audited '
@ -1108,6 +1116,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}
}]);
app.controller('partnerPaymentInfoCtrl', ['$scope', '$http', '$state', 'commonDialog','$uibModal', function ($scope, $http, $state, commonDialog,$uibModal) {
$scope.refresh = false;
$scope.loadPartnerPaymentInfo = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker).then(function (resp) {
$scope.paymentInfo = resp.data;
@ -1232,12 +1241,31 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
};
$scope.ctrl = {};
$scope.saveSubMerchantId = function () {
if(!$scope.refresh){
commonDialog.alert({title: 'info', content: 'Wechat Institution Merchant Id not Refresh', type: 'info'});
return;
}
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', {sub_merchant_id: $scope.paymentInfo.sub_merchant_id}).then(function (resp) {
commonDialog.alert({
title: 'Success',
content: 'Modify Wechat Sub Merchant ID successfully',
type: 'success'
});
$scope.refresh = false;
$scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
});
};
$scope.refreshWechatInstitutionMerchantId = function () {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/wechat_institution_merchant_id', {wechat_institution_merchant_id: $scope.paymentInfo.wechat_institution_merchant_id}).then(function (resp) {
commonDialog.alert({
title: 'Success',
content: 'Refresh Wechat Institution Merchant Id successfully',
type: 'success'
});
$scope.refresh = true;
$scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})

@ -332,7 +332,7 @@
<div class="form-group"
ng-class="{'has-error':partnerForm.description.$invalid && partnerForm.description.$dirty}">
<label class="control-label col-sm-2" for="desc-input">*
Description</label>
Major Products/Service</label>
<div class="col-sm-8">
<textarea class="form-control" required
ng-model="partner.description"

@ -271,7 +271,7 @@
</div>
<div class="form-group"
ng-class="{'has-error':partnerForm.description.$invalid && partnerForm.description.$dirty}">
<label class="control-label col-sm-2" for="desc-input">* Description</label>
<label class="control-label col-sm-2" for="desc-input">* Major Products/Service</label>
<div class="col-sm-8">
<textarea class="form-control" required ng-model="partner.description"
name="description" id="desc-input" maxlength="200"></textarea>

@ -160,7 +160,7 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">*Description</label>
<label class="control-label col-sm-2">Major Products/Service</label>
<div class="col-sm-10">
<p class="form-control-static" ng-bind="partner.description"></p>
@ -480,7 +480,7 @@
</div>
<div class="form-group"
ng-class="{'has-error':partnerForm.description.$invalid && partnerForm.description.$dirty}">
<label class="control-label col-sm-2" for="desc-input">Description</label>
<label class="control-label col-sm-2" for="desc-input">Major Products/Service</label>
<div class="col-sm-8">
<textarea class="form-control" ng-model="partner.description"
name="description" id="desc-input" maxlength="200" required

@ -157,7 +157,7 @@
</div>
<div class="form-group"
ng-class="{'has-error':partnerForm.description.$invalid && partnerForm.description.$dirty}">
<label class="control-label col-sm-2" for="desc-input">Description</label>
<label class="control-label col-sm-2" for="desc-input">Major Products/Service</label>
<div class="col-sm-8">
<textarea class="form-control" ng-model="partner.description"
name="description" id="desc-input" maxlength="200" required></textarea>

@ -19,6 +19,7 @@
<tr>
<th>Sub Merchant Id Before</th>
<th>Sub Merchant Id After</th>
<th>Wechat Institution Merchant Id</th>
<th>Operator</th>
<th>Create Time</th>
</tr>
@ -27,6 +28,7 @@
<tr ng-repeat="log in logs">
<td ng-bind="log.sub_merchant_id_before"></td>
<td ng-bind="log.sub_merchant_id_after"></td>
<td ng-bind="log.wechat_institution_merchant_id"></td>
<td ng-bind="log.operator"></td>
<td ng-bind="log.create_time"></td>
</tr>

@ -390,7 +390,7 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Description</label>
<label class="control-label col-sm-2">Major Products/Service</label>
<div class="col-sm-10">
<p class="form-control-static" ng-bind="partner.description"></p>

@ -307,7 +307,7 @@
</div>
<div class="form-group"
ng-class="{'has-error':partnerForm.description.$invalid && partnerForm.description.$dirty}">
<label class="control-label col-sm-2" for="desc-input">Description</label>
<label class="control-label col-sm-2" for="desc-input">Major Products/Service</label>
<div class="col-sm-8">
<textarea class="form-control" ng-model="partner.description"
name="description" id="desc-input" maxlength="200"></textarea>

@ -39,6 +39,16 @@
</div>
</div>
</div>
<div class="form-group" ng-if="'10'|withRole">
<label class="col-sm-3 control-label">Wechat Institution Merchant Id</label>
<div class="col-sm-9">
<p class="form-control-static">
{{paymentInfo.wechat_institution_merchant_id||'初始化'}}
<a role="button" ng-click="refreshWechatInstitutionMerchantId()"><i class="fa fa-refresh"></i></a>
</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Ali Sub Merchant Id</label>
<div class="col-sm-9">

@ -14,6 +14,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.ss.usermodel.Cell;
@ -22,16 +23,14 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.bind.annotation.RequestMethod;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.util.ArrayList;
@ -49,9 +48,9 @@ import cn.yixblog.platform.http.HttpRequestResult;
/**
* Created by wangning on 05/01/2018.
*/
@SpringBootTest
@ActiveProfiles({ "proxy", "alipay", "wechat", "jd", "bestpay" })
@RunWith(SpringRunner.class)
// @SpringBootTest
// @ActiveProfiles({ "local", "alipay", "wechat", "jd", "bestpay" })
// @RunWith(SpringRunner.class)
public class CustomerImpressionImplTest {
@Resource
private OrderMapper orderMapper;
@ -202,8 +201,8 @@ public class CustomerImpressionImplTest {
JSONObject var = new JSONObject();
var.put("client_moniker", client.getString("client_moniker"));
var.put("short_name", client.getString("short_name"));
JSONObject result = mailGunClient.addListMember(client.getString("contact_email"), "merchants@mail.royalpay.com.au", client.getString("contact_person"),"",
var);
JSONObject result = mailGunClient.addListMember(client.getString("contact_email"), "merchants@mail.royalpay.com.au", client.getString("contact_person"),
"", var);
}
@Test
@ -266,4 +265,115 @@ public class CustomerImpressionImplTest {
public void zxc() {
weekReporter.generateReport("2018-06-04", false);
}
@Test
public void royalpayIndustryTransform() {
String json = "[\n" + " {\n" + " \"children\": [\n" + " {\n" + " \"children\": [],\n" + " \"label\": \"机票\",\n"
+ " \"mccCode\": \"10001\"\n" + " },\n" + " {\n" + " \"children\": [],\n" + " \"label\": \"旅游行业\",\n"
+ " \"mccCode\": \"10002\"\n" + " },\n" + " {\n" + " \"children\": [],\n" + " \"label\": \"私人定制旅游\",\n"
+ " \"mccCode\": \"10003\"\n" + " },\n" + " {\n" + " \"children\": [],\n" + " \"label\": \"租车\",\n"
+ " \"mccCode\": \"10004\"\n" + " },\n" + " {\n" + " \"children\": [],\n" + " \"label\": \"巴士\",\n"
+ " \"mccCode\": \"10005\"\n" + " }\n" + " ],\n" + " \"label\": \"旅游出行\",\n" + " \"mccCode\": \"1\"\n" + " },\n" + " {\n"
+ " \"children\": [\n" + " {\n" + " \"children\": [],\n" + " \"label\": \"饭店\",\n" + " \"mccCode\": \"20001\"\n"
+ " },\n" + " {\n" + " \"children\": [],\n" + " \"label\": \"奶茶店\",\n" + " \"mccCode\": \"20002\"\n"
+ " },\n" + " {\n" + " \"children\": [],\n" + " \"label\": \"烧烤\",\n" + " \"mccCode\": \"20003\"\n"
+ " },\n" + " {\n" + " \"children\": [],\n" + " \"label\": \"火锅\",\n" + " \"mccCode\": \"20004\"\n"
+ " },\n" + " {\n" + " \"children\": [],\n" + " \"label\": \"Coffee\",\n" + " \"mccCode\": \"20005\"\n"
+ " },\n" + " {\n" + " \"children\": [],\n" + " \"label\": \"酒吧\",\n" + " \"mccCode\": \"20006\"\n" + " }\n"
+ " ],\n" + " \"label\": \"餐饮\",\n" + " \"mccCode\": \"2\"\n" + " },\n" + " {\n" + " \"children\": [\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"培训类\",\n" + " \"mccCode\": \"30001\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"移民留学\",\n" + " \"mccCode\": \"30002\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"私人幼儿园\",\n" + " \"mccCode\": \"30003\"\n" + " }\n" + " ],\n"
+ " \"label\": \"教育\",\n" + " \"mccCode\": \"3\"\n" + " },\n" + " {\n" + " \"children\": [\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"换汇\",\n" + " \"mccCode\": \"40001\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"房产\",\n" + " \"mccCode\": \"40002\"\n" + " }\n" + " ],\n"
+ " \"label\": \"商务咨询\",\n" + " \"mccCode\": \"4\"\n" + " },\n" + " {\n" + " \"children\": [\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"公众号服务商\",\n" + " \"mccCode\": \"50001\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"各种媒体类宣传\",\n" + " \"mccCode\": \"50002\"\n" + " }\n" + " ],\n"
+ " \"label\": \"传媒\",\n" + " \"mccCode\": \"5\",\n"
+ " \"value\": \"{\\\"category\\\":\\\"SERVICE\\\",\\\"code\\\":\\\"7542\\\",\\\"description\\\":\\\"Car Washes\\\",\\\"parentCode\\\":\\\"S10\\\"}\"\n"
+ " },\n" + " {\n" + " \"children\": [\n" + " {\n" + " \"children\": [],\n" + " \"label\": \"美容院\",\n"
+ " \"mccCode\": \"60001\"\n" + " },\n" + " {\n" + " \"children\": [],\n" + " \"label\": \"医疗美容\",\n"
+ " \"mccCode\": \"60002\"\n" + " }\n" + " ],\n" + " \"label\": \"医美\",\n" + " \"mccCode\": \"6\"\n" + " },\n" + " {\n"
+ " \"children\": [\n" + " {\n" + " \"label\": \"超市\",\n" + " \"mccCode\": \"70001\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"服装店\",\n" + " \"mccCode\": \"70002\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"鞋店\",\n" + " \"mccCode\": \"70003\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"珠宝店\",\n" + " \"mccCode\": \"70004\"\n" + " },{\n"
+ " \"children\": [],\n" + " \"label\": \"箱包\",\n" + " \"mccCode\": \"70005\"\n" + " }\n" + " ],\n"
+ " \"label\": \"零售\",\n" + " \"mccCode\": \"7\"\n" + " },\n" + " {\n" + " \"children\": [\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"桌游吧\",\n" + " \"mccCode\": \"80001\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"演唱会\",\n" + " \"mccCode\": \"80002\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"马术训练\",\n" + " \"mccCode\": \"80003\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"瑜伽\",\n" + " \"mccCode\": \"80004\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"健身\",\n" + " \"mccCode\": \"80005\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"社团\",\n" + " \"mccCode\": \"80006\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"网吧\",\n" + " \"mccCode\": \"80007\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"KTV\",\n" + " \"mccCode\": \"80008\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"电影\",\n" + " \"mccCode\": \"80009\"\n" + " }\n" + " ],\n"
+ " \"label\": \"休闲娱乐\",\n" + " \"mccCode\": \"8\"\n" + " },\n" + " {\n" + " \"children\": [\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"摄影\",\n" + " \"mccCode\": \"90001\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"massage\",\n" + " \"mccCode\": \"90002\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"通讯运营商\",\n" + " \"mccCode\": \"90003\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"车行\",\n" + " \"mccCode\": \"90004\"\n" + " },\n" + " {\n"
+ " \"children:\":[],\n" + " \"label\":\"软件服务\",\n" + " \"mccCode\":\"90005\"\n" + " }\n" + " ],\n"
+ " \"label\": \"其他服务类\",\n" + " \"mccCode\": \"9\"\n" + " },\n" + " {\n" + " \"children\": [\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"Hotel\",\n" + " \"mccCode\": \"100001\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"Motel\",\n" + " \"mccCode\": \"100002\"\n" + " }\n" + " ],\n"
+ " \"label\": \"酒店\",\n" + " \"mccCode\": \"10\"\n" + " },\n" + " {\n" + " \"children\": [\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"代购\",\n" + " \"mccCode\": \"110001\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"物流(大宗出口贸易)\",\n" + " \"mccCode\": \"110002\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"红酒出口\",\n" + " \"mccCode\": \"110003\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"综合电商\",\n" + " \"mccCode\": \"110004\"\n" + " }\n" + " ],\n"
+ " \"label\": \"出口贸易\",\n" + " \"mccCode\": \"11\"\n" + " },\n" + " {\n" + " \"children\": [\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"建材\",\n" + " \"mccCode\": \"120001\"\n" + " },\n" + " {\n"
+ " \"children\": [],\n" + " \"label\": \"家居\",\n" + " \"mccCode\": \"120002\"\n" + " }\n" + " ],\n"
+ " \"label\": \"家居建材\",\n" + " \"mccCode\": \"12\"\n" + " }\n" + "]";
JSONArray jsonArray = JSONObject.parseArray(json);
try {
XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(new File("/Users/wangning/Desktop/asd.xlsx")));
XSSFSheet sheet = workbook.getSheetAt(0);
Iterator<Row> rowIterator = sheet.rowIterator();
Row row = null;
Cell cell = null;
while (rowIterator.hasNext()) {
row = rowIterator.next();
cell = row.getCell(2);
if (cell == null) {
continue;
}
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
String industryChinese = recursionIndustry(jsonArray, cell.getStringCellValue());
cell.setCellValue(industryChinese);
}
OutputStream out = new FileOutputStream("/Users/wangning/Desktop/qwe.xlsx");
workbook.write(out);
workbook.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public String recursionIndustry(JSONArray jsonArray, String mccCode) {
String result = "";
for (Object o : jsonArray) {
if(StringUtils.isNotEmpty(result)){
break;
}
JSONObject tmp = (JSONObject) o;
if (tmp.getString("mccCode").equals(mccCode)) {
result = tmp.getString("label");
}else {
if(tmp.getJSONArray("children")!=null){
result = recursionIndustry(tmp.getJSONArray("children"), mccCode);
}else {
result = "";
}
}
}
return result;
}
}
Loading…
Cancel
Save