diff --git a/src/db/modify.sql b/src/db/modify.sql index b5b1a885c..2b04a74c7 100644 --- a/src/db/modify.sql +++ b/src/db/modify.sql @@ -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`; + diff --git a/src/main/java/au/com/royalpay/payment/manage/PaymentManageApplication.java b/src/main/java/au/com/royalpay/payment/manage/PaymentManageApplication.java index 020502652..f6b97e01f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/PaymentManageApplication.java +++ b/src/main/java/au/com/royalpay/payment/manage/PaymentManageApplication.java @@ -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(); } } diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/PartnersAnalysisService.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/PartnersAnalysisService.java index 1c2487e81..758a615ad 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/PartnersAnalysisService.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/PartnersAnalysisService.java @@ -13,4 +13,6 @@ public interface PartnersAnalysisService { List getTradePartnersAnalysis(JSONObject params); List getPartnersTypesAnalysis(JSONObject params); + + List getPartnersSettlementAnalysis(JSONObject params); } diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java index 8d05ba78b..62d967da8 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java @@ -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 diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java index a1591b5dd..75cff47fa 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java @@ -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")); diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnersAnalysisServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnersAnalysisServiceImpl.java index 5d5ab581a..eef793d33 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnersAnalysisServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnersAnalysisServiceImpl.java @@ -47,7 +47,12 @@ public class PartnersAnalysisServiceImpl implements PartnersAnalysisService { return getPartnerTypes(key_2,result,2,6,types); } - private List getPartnerTypes(String keys[],List result,int short_length,int long_length,List types){ + @Override + public List getPartnersSettlementAnalysis(JSONObject params) { + return clientAnalysisMapper.countClientsSettlementCycle(params); + } + + private List getPartnerTypes(String keys[], List result, int short_length, int long_length, List types){ for(String key : keys){ int countValue = 0; JSONObject object = new JSONObject(); diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java index a84810107..e74edaa7b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java @@ -35,4 +35,6 @@ public interface ClientAnalysisMapper { List countClientsTypes(JSONObject params); List notTradeSubMerchantId(); + + List countClientsSettlementCycle(JSONObject params); } diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnersAnalysisController.java b/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnersAnalysisController.java index 12c832edd..74608a157 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnersAnalysisController.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/web/PartnersAnalysisController.java @@ -66,4 +66,19 @@ public class PartnersAnalysisController { } return partnersAnalysisService.getPartnersTypesAnalysis(params); } + + @ManagerMapping("/settlement") + public List 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); + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index e11eb9228..90f12b218 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -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(); - param.put("client_id",device.getIntValue("client_id")); + 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())); diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java index ff78abf7d..b31557c8e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java @@ -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); } } diff --git a/src/main/java/au/com/royalpay/payment/manage/custom/beans/AddCustomVO.java b/src/main/java/au/com/royalpay/payment/manage/custom/beans/AddCustomVO.java new file mode 100644 index 000000000..cc0bfc36f --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/custom/beans/AddCustomVO.java @@ -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 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 getSubOrders() { + return subOrders; + } + + public void setSubOrders(List subOrders) { + this.subOrders = subOrders; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/custom/beans/QueryCustomVo.java b/src/main/java/au/com/royalpay/payment/manage/custom/beans/QueryCustomVo.java new file mode 100644 index 000000000..1297d19f7 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/custom/beans/QueryCustomVo.java @@ -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; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/custom/core/CustomService.java b/src/main/java/au/com/royalpay/payment/manage/custom/core/CustomService.java new file mode 100644 index 000000000..6eb040782 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/custom/core/CustomService.java @@ -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 subOrders); + + boolean check(int client_id, String channel); + + JSONObject query(JSONObject param, int page, int limit); + + List channelCustomConfigs(String channel); + +} diff --git a/src/main/java/au/com/royalpay/payment/manage/custom/core/impl/CustomServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/custom/core/impl/CustomServiceImpl.java new file mode 100644 index 000000000..f42f8fe74 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/custom/core/impl/CustomServiceImpl.java @@ -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 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 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 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 channelCustomConfigs(String channel) { + return customSupport.channelCustomConfigs(channel); + } + +} diff --git a/src/main/java/au/com/royalpay/payment/manage/custom/package-info.java b/src/main/java/au/com/royalpay/payment/manage/custom/package-info.java new file mode 100644 index 000000000..dfb3f0e26 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/custom/package-info.java @@ -0,0 +1,5 @@ +/** + * @author kira + * @date 2018/7/27 + */ +package au.com.royalpay.payment.manage.custom; \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/custom/web/CustomController.java b/src/main/java/au/com/royalpay/payment/manage/custom/web/CustomController.java new file mode 100644 index 000000000..a11082be8 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/custom/web/CustomController.java @@ -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 channelCustomConfigs(@RequestParam String channel) { + return customService.channelCustomConfigs(channel); + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/PermissionPartnerManager.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/PermissionPartnerManager.java index 2400f4759..c91f8f756 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/PermissionPartnerManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/PermissionPartnerManager.java @@ -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 listRoleFunctions(ManagerRole role); - void authorizeRole(ManagerRole role, List functions); + void authorizeRole(PartnerRole role, List functions); List listUserFunctions(int role); diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java index 42c34d40b..a70c7997d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java @@ -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 functions) { - permissionPartnerFunctionMapper.clearRolePermission(role.getInverseMask()); - permissionPartnerFunctionMapper.authorizeRole(role.getMask(), functions); + @CacheEvict(value = ":login:partners:", allEntries = true) + public void authorizeRole(PartnerRole role, List functions) { + + permissionPartnerFunctionMapper.clearRolePermission(role.getCode()); + permissionPartnerFunctionMapper.authorizeRole(role.getCode(), functions); } @Override diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionPartnerConfigController.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionPartnerConfigController.java index d24d76633..2e8c67b39 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionPartnerConfigController.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionPartnerConfigController.java @@ -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 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; } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/custom/CustomReportDetailsMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/custom/CustomReportDetailsMapper.java new file mode 100644 index 000000000..59316c558 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/custom/CustomReportDetailsMapper.java @@ -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 findByReportId(@Param("report_id") String report_id); + +} diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/custom/CustomReportsMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/custom/CustomReportsMapper.java new file mode 100644 index 000000000..462675dd6 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/custom/CustomReportsMapper.java @@ -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 queryWithTrans(JSONObject param,PageBounds pagination); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java index 0633dc328..cee3b2458 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java @@ -88,4 +88,7 @@ public interface ClientMapper { PageList simpleQuery(JSONObject params, PageBounds pagination); + @AutoSql(type = SqlType.SELECT) + JSONObject findByWechatInstitutionMerchantId(@Param("wechat_institution_merchant_id") String wechat_institution_merchant_id); + } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.java index 712ac48ca..8881b2a62 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.java @@ -45,6 +45,7 @@ public interface ManagerMapper { List listByRole(JSONObject params); @AutoSql(type = SqlType.SELECT) + @AdvanceSelect(addonWhereClause = "is_valid=1") JSONObject findByWxOpenId(@Param("wx_openid") String openid); List listOpenIdsOfCompliances(); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysCustomerServiceMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysCustomerServiceMapper.java index 8e119f1ed..dc31df478 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysCustomerServiceMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysCustomerServiceMapper.java @@ -30,5 +30,8 @@ public interface SysCustomerServiceMapper { @AutoSql(type = SqlType.SELECT) List findAllWithDetail(); + + @AutoSql(type = SqlType.COUNT) + int countAll(); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index 207d21377..79e5d760b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -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); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index a5d36dfeb..36683e2a7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -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); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientConfigModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientConfigModify.java index 207ce00b1..0320aa2c5 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientConfigModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientConfigModify.java @@ -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(); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index 00675ce7a..5958044d2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -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")); diff --git a/src/main/java/au/com/royalpay/payment/manage/openim/OpenimController.java b/src/main/java/au/com/royalpay/payment/manage/openim/OpenimController.java index f3ce94657..fd526f75c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/openim/OpenimController.java +++ b/src/main/java/au/com/royalpay/payment/manage/openim/OpenimController.java @@ -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); } } diff --git a/src/main/java/au/com/royalpay/payment/manage/openim/core/CustomerServiceService.java b/src/main/java/au/com/royalpay/payment/manage/openim/core/CustomerServiceService.java index d00549626..4b6c769e0 100644 --- a/src/main/java/au/com/royalpay/payment/manage/openim/core/CustomerServiceService.java +++ b/src/main/java/au/com/royalpay/payment/manage/openim/core/CustomerServiceService.java @@ -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 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(); + } diff --git a/src/main/java/au/com/royalpay/payment/manage/openim/core/OpenimApi.java b/src/main/java/au/com/royalpay/payment/manage/openim/core/OpenimApi.java index fb380b84f..92104d912 100644 --- a/src/main/java/au/com/royalpay/payment/manage/openim/core/OpenimApi.java +++ b/src/main/java/au/com/royalpay/payment/manage/openim/core/OpenimApi.java @@ -10,7 +10,7 @@ public interface OpenimApi { void addUser(JSONObject record); - void updateUser(); + void updateUser(JSONObject record); void pushMsh(); diff --git a/src/main/java/au/com/royalpay/payment/manage/openim/core/OpenimClient.java b/src/main/java/au/com/royalpay/payment/manage/openim/core/OpenimClient.java index 488a36e6d..9e4c8359c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/openim/core/OpenimClient.java +++ b/src/main/java/au/com/royalpay/payment/manage/openim/core/OpenimClient.java @@ -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 list2 = new ArrayList(); - 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()); } + + } diff --git a/src/main/java/au/com/royalpay/payment/manage/openim/core/impl/CustomerServiceServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/openim/core/impl/CustomerServiceServiceImpl.java index 3ba1ce652..d7286a94f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/openim/core/impl/CustomerServiceServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/openim/core/impl/CustomerServiceServiceImpl.java @@ -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")); - if (client == null) { - throw new BadRequestException("Merchant Not Found"); - } - account = clientAccountMapper.findById(account.getString("account_id")); - isPartner = true; + public JSONObject checkAndSavePartner(JSONObject account) { + JSONObject client = clientManager.getClientInfo(account.getIntValue("client_id")); + if (client == null) { + throw new BadRequestException("Merchant Not Found"); } - if (StringUtils.isNotEmpty(account.getString("manager_id"))) { - account = managerMapper.findDetail(account.getString("manager_id")); - isPartner = false; + 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; + } + + @Override + public JSONObject checkAndSaveManager(JSONObject manager) { + if (StringUtils.isEmpty(manager.getString("manager_id"))) { + throw new ServerErrorException("manager id is null"); } - 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); + 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; } - openimApi.addUser(saveRecord); - saveRecord.put("appkey", appkey); - return saveRecord; + 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 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 ops = stringRedisTemplate.boundListOps("REDIS_UNREADMSG_PREFIX" + tuid); + BoundListOperations 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 ops = stringRedisTemplate.boundListOps("REDIS_UNREADMSG_PREFIX" + p.getString("user_id")); + BoundListOperations 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); + } + } } } diff --git a/src/main/java/au/com/royalpay/payment/manage/openim/core/impl/OpenimApiImpl.java b/src/main/java/au/com/royalpay/payment/manage/openim/core/impl/OpenimApiImpl.java index 509f14f8c..44b7bd062 100644 --- a/src/main/java/au/com/royalpay/payment/manage/openim/core/impl/OpenimApiImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/openim/core/impl/OpenimApiImpl.java @@ -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 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 diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/beans/ManagerInfo.java b/src/main/java/au/com/royalpay/payment/manage/signin/beans/ManagerInfo.java index 6854edebb..752a8aedc 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/beans/ManagerInfo.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/beans/ManagerInfo.java @@ -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; } diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java index 18eba9c12..c6eabd65e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java @@ -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 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); } - } diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java index f94e4351b..05a99e1f0 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java @@ -73,18 +73,21 @@ public class PermissionClientModulesServiceImpl implements PermissionClientModul } private void saveMongoLog(JSONObject account, JSONObject oldRecord, JSONObject modifyData, String business) { - modifyData.remove("id"); - PermissionClientModuleLog mongoRecord = new PermissionClientModuleLog(); - mongoRecord.setBusiness(business); - mongoRecord.setClientId(oldRecord.getIntValue("client_id")); - mongoRecord.setClientMoniker(oldRecord.getString("client_moniker")); - mongoRecord.setCreateTime(new Date()); - mongoRecord.setId(IdUtil.getId()); - mongoRecord.setUserId(account.getString("manager_id")); - mongoRecord.setUserName(account.getString("display_name")); - mongoRecord.setNewData(modifyData.toJSONString()); - Map beforeModify = modifyData.keySet().stream().collect(Collectors.toMap(key -> key, oldRecord::get)); - mongoRecord.setOriginData(JSON.toJSONString(beforeModify)); - mongoTemplate.insert(mongoRecord); + try { + modifyData.remove("id"); + PermissionClientModuleLog mongoRecord = new PermissionClientModuleLog(); + mongoRecord.setBusiness(business); + mongoRecord.setClientId(oldRecord.getIntValue("client_id")); + mongoRecord.setClientMoniker(oldRecord.getString("client_moniker")); + mongoRecord.setCreateTime(new Date()); + mongoRecord.setId(IdUtil.getId()); + mongoRecord.setUserId(account.getString("manager_id")); + mongoRecord.setUserName(account.getString("display_name")); + mongoRecord.setNewData(modifyData.toJSONString()); + Map beforeModify = modifyData.keySet().stream().collect(Collectors.toMap(key -> key, oldRecord::get)); + mongoRecord.setOriginData(JSON.toJSONString(beforeModify)); + mongoTemplate.insert(mongoRecord); + }catch (Exception ignore){ + } } } diff --git a/src/main/java/au/com/royalpay/payment/manage/task/SendUnreadMsgWechatTask.java b/src/main/java/au/com/royalpay/payment/manage/task/SendUnreadMsgWechatTask.java index 43094024f..38df5d256 100644 --- a/src/main/java/au/com/royalpay/payment/manage/task/SendUnreadMsgWechatTask.java +++ b/src/main/java/au/com/royalpay/payment/manage/task/SendUnreadMsgWechatTask.java @@ -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(); +// } + } diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java index 337e2044e..98ca78c70 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java @@ -479,12 +479,14 @@ public class TradeLogServiceImpl implements TradeLogService { clientManager.validateClients(client_id, params); params.put("client_id", client_id); List logs = transactionMapper.listTransFlow(params); - 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 + ")"); - } - }); + 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); diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/refund/impls/RefundServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/refund/impls/RefundServiceImpl.java index 54635f160..13d61c09e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/refund/impls/RefundServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/refund/impls/RefundServiceImpl.java @@ -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)); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index a533935d1..4ad7dabda 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -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 #清算银行配置 diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml index 007950b60..c5462dae2 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml @@ -148,4 +148,41 @@ GROUP by c.sub_merchant_id + \ No newline at end of file diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml index aab25203f..fc20ac668 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml @@ -322,8 +322,16 @@ ]]> s.client_id != 0 - and s.date >= #{begin} - and s.date <= #{end} + 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<=now() and (b.end_date is null or b.end_date >= now()) + AND (c.bd_group=#{bd_group} or c.manager_id=#{bd_group}) + and c.manager_id=#{bd_group_bd} + ) + + and s.date >= #{begin} + and s.date < #{end} and c.org_id=#{org_id} and c.org_id in #{org_id} diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/custom/CustomReportDetailsMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/custom/CustomReportDetailsMapper.xml new file mode 100644 index 000000000..8f3c59631 --- /dev/null +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/custom/CustomReportDetailsMapper.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/custom/CustomReportsMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/custom/CustomReportsMapper.xml new file mode 100644 index 000000000..ec3880a92 --- /dev/null +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/custom/CustomReportsMapper.xml @@ -0,0 +1,45 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/RefundMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/RefundMapper.xml index d2c2b55de..ccb6688ce 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/RefundMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/RefundMapper.xml @@ -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} - and create_time <= #{start_time} + and create_time >= #{start_time} - and create_time >= #{end_time} + and create_time <= #{end_time} client_id in @@ -99,27 +101,29 @@ 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 - and client_id = #{client_id} + and ra.client_id = #{client_id} - and applytime <= #{start_time} + and ra.applytime >= #{start_time} - and applytime >= #{end_time} + and ra.applytime <= #{end_time} - client_id in + ra.client_id in #{item} diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.xml index 3237c85c0..7cac18eba 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.xml @@ -11,21 +11,19 @@ and m.org_id=#{org_id} 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 ]]> diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/PermissionPartnerFunctionMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/PermissionPartnerFunctionMapper.xml index cd677f123..0abaa2209 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/PermissionPartnerFunctionMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/PermissionPartnerFunctionMapper.xml @@ -13,13 +13,13 @@ @@ -29,7 +29,7 @@ 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} \ No newline at end of file diff --git a/src/main/ui/all_locations.html b/src/main/ui/all_locations.html index e3930803c..0ead36432 100644 --- a/src/main/ui/all_locations.html +++ b/src/main/ui/all_locations.html @@ -22,7 +22,7 @@ diff --git a/src/main/ui/service_client.html b/src/main/ui/service_client.html index bf008b3ce..4ff9bfcd6 100644 --- a/src/main/ui/service_client.html +++ b/src/main/ui/service_client.html @@ -11,10 +11,10 @@ diff --git a/src/main/ui/service_client_app.html b/src/main/ui/service_client_app.html new file mode 100644 index 000000000..e8cc439f6 --- /dev/null +++ b/src/main/ui/service_client_app.html @@ -0,0 +1,159 @@ + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/src/main/ui/service_client_app_outside.html b/src/main/ui/service_client_app_outside.html new file mode 100644 index 000000000..2eef92363 --- /dev/null +++ b/src/main/ui/service_client_app_outside.html @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/ui/service_contact_list.html b/src/main/ui/service_contact_list.html index cd01bb65d..c853ca00e 100644 --- a/src/main/ui/service_contact_list.html +++ b/src/main/ui/service_contact_list.html @@ -7,7 +7,6 @@ - + + + + + + +
+
    +
+
+ + \ No newline at end of file diff --git a/src/main/ui/service_customer.html b/src/main/ui/service_customer.html index 8ab67e6c6..d557dbecd 100644 --- a/src/main/ui/service_customer.html +++ b/src/main/ui/service_customer.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', }); } diff --git a/src/main/ui/static/analysis/partners-analysis.js b/src/main/ui/static/analysis/partners-analysis.js index 5661ebc37..fe4100c96 100644 --- a/src/main/ui/static/analysis/partners-analysis.js +++ b/src/main/ui/static/analysis/partners-analysis.js @@ -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: { diff --git a/src/main/ui/static/analysis/templates/partners_analysis.html b/src/main/ui/static/analysis/templates/partners_analysis.html index 47c786dfb..5240b0ca6 100644 --- a/src/main/ui/static/analysis/templates/partners_analysis.html +++ b/src/main/ui/static/analysis/templates/partners_analysis.html @@ -59,7 +59,13 @@
-
+
+
+ + +
+
+

各类型商家数量分布

@@ -92,6 +98,41 @@
+
+
+
+

商户清算周期分布

+
+
+
+
+

+ + + +

+

+

清算周期列表

+
+ + + + + + + + + + + + + +
Clean DaysPartners
+
+
+
diff --git a/src/main/ui/static/analysis/templates/trans_analysis.html b/src/main/ui/static/analysis/templates/trans_analysis.html index 89732d77f..17f6b602a 100644 --- a/src/main/ui/static/analysis/templates/trans_analysis.html +++ b/src/main/ui/static/analysis/templates/trans_analysis.html @@ -52,10 +52,10 @@ datepicker-options="{minDate:params.begin,maxDate:today}">
-
+
Yesterday @@ -143,7 +143,7 @@
Wechat
+ ng-bind="totalChannelAmount.wechatamount|currency: ' $ '">
@@ -153,7 +153,7 @@
Bestpay
+ ng-bind="totalChannelAmount.bestpayamount|currency: ' $ '">
@@ -163,7 +163,7 @@
Alipay
+ ng-bind="totalChannelAmount.alipayamount|currency: ' $ '">
@@ -173,17 +173,17 @@
AlipayOnline
+ ng-bind="totalChannelAmount.alipayonlineamount|currency: ' $ '">
-
JD Pay
+
JD Pay
+ ng-bind="totalChannelAmount.jdamount|currency: ' $ '">
@@ -193,7 +193,7 @@
HF Pay
+ ng-bind="totalChannelAmount.hfamount|currency: ' $ '">
diff --git a/src/main/ui/static/analysis/templates/trans_analysis_monthly.html b/src/main/ui/static/analysis/templates/trans_analysis_monthly.html index a9f28f395..c507e7de6 100644 --- a/src/main/ui/static/analysis/templates/trans_analysis_monthly.html +++ b/src/main/ui/static/analysis/templates/trans_analysis_monthly.html @@ -103,7 +103,7 @@
Wechat
+ ng-bind="totalChannelAmount.wechatamount|currency: ' $ '">
@@ -113,7 +113,7 @@
Bestpay
+ ng-bind="totalChannelAmount.bestpayamount|currency: ' $ '">
@@ -123,7 +123,7 @@
Alipay
+ ng-bind="totalChannelAmount.alipayamount|currency: ' $ '">
@@ -133,17 +133,17 @@
AlipayOnline
+ ng-bind="totalChannelAmount.alipayonlineamount|currency: ' $ '">
-
JD Pay
+
JD Pay
+ ng-bind="totalChannelAmount.jdamount|currency: ' $ '">
@@ -153,7 +153,7 @@
HF Pay
+ ng-bind="totalChannelAmount.hfamount|currency: ' $ '">
diff --git a/src/main/ui/static/analysis/trans-analysis-monthly.js b/src/main/ui/static/analysis/trans-analysis-monthly.js index 4a41f0726..a53eb2a79 100644 --- a/src/main/ui/static/analysis/trans-analysis-monthly.js +++ b/src/main/ui/static/analysis/trans-analysis-monthly.js @@ -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'); } diff --git a/src/main/ui/static/analysis/trans-analysis.js b/src/main/ui/static/analysis/trans-analysis.js index f19b571d6..2087785c3 100644 --- a/src/main/ui/static/analysis/trans-analysis.js +++ b/src/main/ui/static/analysis/trans-analysis.js @@ -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; diff --git a/src/main/ui/static/boot/index-boot.js b/src/main/ui/static/boot/index-boot.js index 55e98e262..ebd3a9b18 100644 --- a/src/main/ui/static/boot/index-boot.js +++ b/src/main/ui/static/boot/index-boot.js @@ -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]}, diff --git a/src/main/ui/static/config/managers/templates/modify.html b/src/main/ui/static/config/managers/templates/modify.html index c77c3e1a5..d2d86acb7 100644 --- a/src/main/ui/static/config/managers/templates/modify.html +++ b/src/main/ui/static/config/managers/templates/modify.html @@ -60,7 +60,7 @@ -