diff --git a/pom.xml b/pom.xml
index b5c1abe9d..fcc8224a2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -156,6 +156,7 @@
gson
2.2.4
+
junit
@@ -164,7 +165,11 @@
test
-
+
+ com.taobao.api
+ taobao-sdk-java-auto
+ 1502853394064-20180710
+
diff --git a/src/db/modify.sql b/src/db/modify.sql
index f5605ad5d..b5b1a885c 100644
--- a/src/db/modify.sql
+++ b/src/db/modify.sql
@@ -611,4 +611,62 @@ CREATE TABLE `pre_apply_handle_log` (
ALTER TABLE `sys_client_pre_apply`
ADD COLUMN `status` tinyint(2) NULL DEFAULT 0 COMMENT '0:未处理,1:处理中,2:处理完成';
-alter table sys_clients add column hfindustry varchar(10) DEFAULT NULL COMMENT 'HF行业';
\ No newline at end of file
+alter table sys_clients add column hfindustry varchar(10) DEFAULT NULL COMMENT 'HF行业';
+
+alter table financial_bd_prize_rate_config add column `kpi_range` smallint(6) NOT NULL;
+alter table financial_bd_config add column `kpi_amount` decimal(15,2) DEFAULT NULL;
+alter table financial_bd_prize_log add column `kpi_amount` decimal(15,2) DEFAULT NULL;
+
+CREATE TABLE sys_permission_partner_modules (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ module_name varchar(50) NOT NULL COMMENT '模块名称',
+ js_module varchar(50) DEFAULT NULL COMMENT 'js module name',
+ js_path varchar(255) DEFAULT NULL COMMENT 'js module path',
+ remark varchar(50) DEFAULT NULL,
+ PRIMARY KEY (id)
+) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4;
+
+CREATE TABLE sys_permission_partner_modules_clients (
+ id bigint(20) NOT NULL,
+ client_id int(11) NOT NULL COMMENT '客户编号',
+ client_moniker varchar(20) NOT NULL COMMENT '客户简写识别码',
+ module_id int(11) NOT NULL COMMENT '模块id',
+ is_valid tinyint(1) DEFAULT '1' COMMENT '1:启用,0:不启用',
+ PRIMARY KEY (id),
+ UNIQUE KEY unique_client_id_module_id (client_id,module_id),
+ KEY index_client_id (client_id),
+ KEY index_client_moniker (client_moniker)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+CREATE TABLE sys_permission_partner_functions (
+ func_id varchar(80) NOT NULL,
+ module_id int(11) DEFAULT NULL COMMENT '模块id',
+ role int(11) NOT NULL DEFAULT '0' COMMENT '有权限角色(mask)',
+ class_name varchar(30) NOT NULL COMMENT '类名',
+ method_name varchar(50) NOT NULL COMMENT '方法名',
+ uri varchar(200) NOT NULL COMMENT '请求地址',
+ req_methods varchar(50) NOT NULL,
+ module varchar(30) DEFAULT NULL COMMENT '所属模块',
+ name varchar(50) DEFAULT NULL COMMENT '别名(用于前端按钮指定权限)',
+ remark varchar(50) DEFAULT NULL COMMENT '备注',
+ is_valid tinyint(1) DEFAULT '1' COMMENT '是否有效',
+ PRIMARY KEY (func_id),
+ UNIQUE KEY uk_func_name (name)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+CREATE TABLE `act_charity` (
+ `client_id` int(11) DEFAULT NULL,
+ `client_moniker` varchar(20) NOT NULL COMMENT '客户简写识别码',
+ `active_time` date DEFAULT NULL,
+ PRIMARY KEY (`client_moniker`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+CREATE TABLE `risk_attention_merchants` (
+ `client_id` int(11) NOT NULL,
+ `client_moniker` varchar(20) NOT NULL,
+ `is_valid` tinyint(1) NOT NULL DEFAULT 1,
+ `create_time` datetime NOT NULL,
+ `update_time` datetime DEFAULT NULL,
+ PRIMARY KEY (`client_id`),
+ KEY `client_moniker` (`client_moniker`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
diff --git a/src/document/cn/apis.js b/src/document/cn/apis.js
index 19c7ec665..bec207b8a 100644
--- a/src/document/cn/apis.js
+++ b/src/document/cn/apis.js
@@ -687,7 +687,7 @@
* @apiDescription
* 接入微信小程序需完成海外主体认证,并且认证主体需要与在RoyalPay开通的商户主体一致。具体如何认证请查看微信公众平台相关文档。
* 用于小程序中发起支付,创建订单后返回小程序支付所需参数,该接口现仅支持微信小程序。
- * 接入参考文档
+ * 接入参考文档
*
*
* @apiVersion 1.0.0
diff --git a/src/main/java/au/com/royalpay/payment/manage/actchairty/core/ActChairtyService.java b/src/main/java/au/com/royalpay/payment/manage/actchairty/core/ActChairtyService.java
index 0a868a187..e94e09f40 100644
--- a/src/main/java/au/com/royalpay/payment/manage/actchairty/core/ActChairtyService.java
+++ b/src/main/java/au/com/royalpay/payment/manage/actchairty/core/ActChairtyService.java
@@ -17,12 +17,12 @@ public interface ActChairtyService {
JSONObject listChairClients(int page, int limit);
- void disableClient(String clientMoniker);
-
List getWeekendAnalysis(JSONObject params);
PageList getClientRank(JSONObject params);
+ JSONObject gettotal();
+
diff --git a/src/main/java/au/com/royalpay/payment/manage/actchairty/core/impls/ActChairtyServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/actchairty/core/impls/ActChairtyServiceImp.java
index ade6ede8b..494d041c8 100644
--- a/src/main/java/au/com/royalpay/payment/manage/actchairty/core/impls/ActChairtyServiceImp.java
+++ b/src/main/java/au/com/royalpay/payment/manage/actchairty/core/impls/ActChairtyServiceImp.java
@@ -10,10 +10,15 @@ import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.lang3.time.DateFormatUtils;
+import org.apache.commons.lang3.time.DateUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@@ -24,7 +29,7 @@ import java.util.List;
*/
@Service
public class ActChairtyServiceImp implements ActChairtyService {
-
+ Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private ClientManager clientManager;
@Resource
@@ -58,29 +63,54 @@ public class ActChairtyServiceImp implements ActChairtyService {
return PageListUtils.buildPageListResult(clients);
}
- @Override
- public void disableClient(String clientMoniker) {
- actChairtyMapper.disableClient(clientMoniker);
- }
-
-
@Override
public List getWeekendAnalysis(JSONObject params) {
List result = new ArrayList<>();
- List getWeekstartanalysis = actChairtyMapper.getChairtyWeekstartAnalysis(params.getDate("begin"), params.getDate("end"));
- for (JSONObject getWeekendAnalysis : getWeekstartanalysis) {
- Calendar rightNow = Calendar.getInstance();
- rightNow.setTime(getWeekendAnalysis.getDate("weekstart"));
- rightNow.add(Calendar.DAY_OF_YEAR,7);
- Date dt1=rightNow.getTime();
- JSONObject getAnalysis = actChairtyMapper.getChairtyWeekAnalysis(getWeekendAnalysis.getDate("weekstart"), dt1);
- getWeekendAnalysis.put("count_ordernum", getAnalysis.getIntValue("count_ordernum"));
- getWeekendAnalysis.put("sum_ordernum", getAnalysis.getBigDecimal("sum_ordernum"));
- BigDecimal bg = new BigDecimal(getAnalysis.getIntValue("count_ordernum") * 0.01);
- double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
- getWeekendAnalysis.put("chairty_amount", f1);
- result.add(getWeekendAnalysis);
+ List getAnalysis = actChairtyMapper.getChairtyWeekAnalysis(params.getDate("begin"), params.getDate("end"));
+ DateFormatUtils df = new DateFormatUtils();
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(params.getDate("begin"));
+ cal.add(cal.DAY_OF_MONTH, -1);
+ long beginTime = params.getDate("begin").getTime();
+ long endTime = params.getDate("end").getTime();
+ long betweenDays = (long)((endTime - beginTime) / (1000 * 60 * 60 *24));
+ List weekStart = new ArrayList<>();
+ for(int i=0;i<=betweenDays;i++){
+ cal.add(cal.DAY_OF_MONTH, 1);//DATE=日
+ if ((cal.get(Calendar.DAY_OF_WEEK)) == 2) {
+ weekStart.add(df.format(cal.getTime(),"yyyy-MM-dd"));
+ }
}
+ for(int i=0;i= dateStar.getTime() && orderDate < dateEnd.getTime()) {
+ count_ordernum = count_ordernum.add(getAnalysis.get(b).getBigDecimal("count_ordernum"));
+ sum_ordernum = sum_ordernum.add(getAnalysis.get(b).getBigDecimal("sum_ordernum"));
+ }
+ }
+ BigDecimal chairty = new BigDecimal(0.01);
+ BigDecimal chairty_amount = count_ordernum.multiply(chairty);
+ BigDecimal f1 = sum_ordernum.setScale(2, BigDecimal.ROUND_HALF_UP);
+ BigDecimal f2 = chairty_amount.setScale(2, BigDecimal.ROUND_HALF_UP);
+ weekDay.put("weekstart", weekStart.get(i));
+ weekDay.put("count_ordernum", count_ordernum);
+ weekDay.put("sum_ordernum", f1);
+ weekDay.put("chairty_amount",f2 );
+ result.add(weekDay);
+ } catch (Exception e) {
+ logger.info("Act_Chairty Error:",e);
+
+ }
+ }
+
return result;
}
@@ -90,6 +120,24 @@ public class ActChairtyServiceImp implements ActChairtyService {
return getChairtyWeekRaking;
}
+ @Override
+ public JSONObject gettotal() {
+ List gettotalnum = actChairtyMapper.chairtyClientNum();
+ BigDecimal amount= new BigDecimal(0) ;
+ double chairty=0.00;
+ for (JSONObject gettotals : gettotalnum) {
+ amount = amount.add(gettotals.getBigDecimal("sum_ordernum"));
+ chairty += gettotals.getIntValue("count_ordernum") * 0.01;
+ }
+ BigDecimal bg = new BigDecimal(chairty);
+ double f1 = amount.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+ double f2 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+ JSONObject gettotal = new JSONObject();
+ gettotal.put("amount", f1);
+ gettotal.put("chairty", f2);
+ return gettotal;
+ }
+
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/actchairty/web/ActChairtyController.java b/src/main/java/au/com/royalpay/payment/manage/actchairty/web/ActChairtyController.java
index d041c5e81..5535f93e6 100644
--- a/src/main/java/au/com/royalpay/payment/manage/actchairty/web/ActChairtyController.java
+++ b/src/main/java/au/com/royalpay/payment/manage/actchairty/web/ActChairtyController.java
@@ -29,29 +29,24 @@ public class ActChairtyController {
@Resource
private ActChairtyService actChairtyService;
- @ManagerMapping(value = "/clients", method = RequestMethod.GET, role = { ManagerRole.ADMIN })
+ @ManagerMapping(value = "/clients", method = RequestMethod.GET, role = { ManagerRole.ADMIN,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER })
public JSONObject listAttendingClients(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int limit) {
// todo params
return actChairtyService.listChairClients(page, limit);
}
- @ManagerMapping(value = "/clients/{clientMoniker}", method = RequestMethod.PUT, role = { ManagerRole.ADMIN })
+ @ManagerMapping(value = "/clients/{clientMoniker}", method = RequestMethod.PUT, role = { ManagerRole.ADMIN,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER })
public void configClient(@PathVariable String clientMoniker, @RequestBody @Valid ActChairtyBean config, Errors errors,
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
HttpUtils.handleValidErrors(errors);
actChairtyService.configClient(clientMoniker, config, manager);
}
- @ManagerMapping(value = "/clients/{clientMoniker}", method = RequestMethod.DELETE, role = { ManagerRole.ADMIN })
- public void disableClient(@PathVariable String clientMoniker) {
- actChairtyService.disableClient(clientMoniker);
- }
-
- @ManagerMapping(value = "/traAnalysis", method = RequestMethod.GET, role = { ManagerRole.ADMIN })
+ @ManagerMapping(value = "/traAnalysis", method = RequestMethod.GET, role = { ManagerRole.ADMIN,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER })
public List traAnalysis(ActChairtyQuery params) {
return actChairtyService.getWeekendAnalysis(params.params());
}
- @ManagerMapping(value = "/ranking", method = RequestMethod.GET, role = { ManagerRole.ADMIN })
+ @ManagerMapping(value = "/ranking", method = RequestMethod.GET, role = { ManagerRole.ADMIN,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER })
public JSONObject getRanking(ActChairtyQuery params) {
PageList clientRank = actChairtyService.getClientRank(params.params());
if(clientRank==null){
@@ -59,4 +54,9 @@ public class ActChairtyController {
}
return PageListUtils.buildPageListResult(clientRank);
}
+
+ @ManagerMapping(value = "/total", method = RequestMethod.GET, role = { ManagerRole.ADMIN,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER })
+ public JSONObject getTotal() {
+ return actChairtyService.gettotal();
+ }
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java
index c3cfc669f..c96ee2e82 100644
--- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java
+++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java
@@ -149,4 +149,11 @@ public interface RetailAppService {
void applyToCompliance(JSONObject device);
JSONObject sendVerifyEmail(JSONObject device);
+
+ JSONObject openimCheck(JSONObject device);
+
+ void addUnreadMsg(JSONObject device,JSONObject param);
+
+ JSONObject getRefunds(JSONObject device, AppQueryBean appQueryBean);
+
}
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 57dadf95b..e11eb9228 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
@@ -30,6 +30,7 @@ import au.com.royalpay.payment.manage.merchants.entity.impls.SwitchPermissionMod
import au.com.royalpay.payment.manage.notice.beans.NoticeInfo;
import au.com.royalpay.payment.manage.notice.core.NoticeManage;
import au.com.royalpay.payment.manage.notice.core.NoticePartner;
+import au.com.royalpay.payment.manage.openim.core.CustomerServiceService;
import au.com.royalpay.payment.manage.pushMessage.APNSMessageHelper;
import au.com.royalpay.payment.manage.pushMessage.bean.AppManagerMessageBuilder;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
@@ -37,6 +38,7 @@ import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
import au.com.royalpay.payment.manage.signin.core.impls.SignInAccountServiceImpl;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
+import au.com.royalpay.payment.manage.tradelog.refund.RefundService;
import au.com.royalpay.payment.tools.cms.RoyalPayCMSSupport;
import au.com.royalpay.payment.tools.device.DeviceSupport;
import au.com.royalpay.payment.tools.device.message.AppMessage;
@@ -163,9 +165,13 @@ public class RetailAppServiceImp implements RetailAppService {
@Resource
private ClientMapper clientMapper;
@Resource
+ private RefundService refundService;
+ @Resource
private ClientModifySupport clientModifySupport;
@Resource
private ClearingLogMapper clearingLogMapper;
+ @Resource
+ private CustomerServiceService customerServiceService;
private Map senderMap = new HashMap<>();
private final String fileName[] = { "client_bank_file", "client_id_file", "client_company_file" };
@@ -329,11 +335,11 @@ public class RetailAppServiceImp implements RetailAppService {
}
tradeLogQuery.setClient_ids(appQueryBean.getApp_client_ids().split(","));
JSONObject client = clientManager.getClientInfo(Integer.parseInt(tradeLogQuery.getClient_ids()[0]));
- if(client==null){
+ if (client == null) {
throw new NotFoundException("Client Not Exists");
}
device.put("client_moniker", client.getString("client_moniker"));
- device.put("client",client);
+ device.put("client", client);
tradeLogService.exportTransFlow(tradeLogQuery, device, httpResponse);
}
@@ -410,6 +416,27 @@ public class RetailAppServiceImp implements RetailAppService {
return result;
}
+ @Override
+ public JSONObject openimCheck(JSONObject device) {
+ JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
+ return customerServiceService.checkAndSave(account);
+ }
+
+ @Override
+ public void addUnreadMsg(JSONObject device, JSONObject param) {
+ customerServiceService.addUnreadMsg(param);
+ }
+
+ @Override
+ public JSONObject getRefunds(JSONObject device, AppQueryBean appQueryBean) {
+ JSONObject appParam = appQueryBean.toParams();
+ JSONObject param = new JSONObject();
+ 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()));
+ }
+
@Override
public void updateClient(JSONObject device, AppClientBean appClientBean) {
String clientType = device.getString("client_type");
@@ -554,11 +581,11 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject result = PageListUtils.buildPageListResult(logs);
if (appQueryBean.getPage() == 1) {
if (!logs.isEmpty() && logs.size() > 0) {
- JSONObject clearingLog = clearingLogMapper.findById(logs.get(0).getIntValue("clearing_id"));
- if(clearingLog.getBoolean("editable")){
- result.put("padding", true);
- logs.get(0).put("padding",true);
- }
+ JSONObject clearingLog = clearingLogMapper.findById(logs.get(0).getIntValue("clearing_id"));
+ if (clearingLog.getBoolean("editable")) {
+ result.put("padding", true);
+ logs.get(0).put("padding", true);
+ }
}
}
return result;
@@ -1160,6 +1187,7 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject unReadParams = new JSONObject();
unReadParams.put("client_id", client_id);
unReadParams.put("status", 0);
+ unReadParams.put("is_to_app", 1);
int counts = noticePartnerMapper.countNoticePartner(unReadParams);
notice.put("unReadCounts", counts);
notice.put("type", "notice");
@@ -1204,7 +1232,7 @@ public class RetailAppServiceImp implements RetailAppService {
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
JSONObject bankInfo = clientManager.getBankAccountByClientId(device.getIntValue("client_id"));
- bankInfo.put("account_no","***"+ StringUtils.substring(bankInfo.getString("account_no"), -4));
+ bankInfo.put("account_no", "***" + StringUtils.substring(bankInfo.getString("account_no"), -4));
return bankInfo;
}
@@ -1268,6 +1296,10 @@ public class RetailAppServiceImp implements RetailAppService {
if (AlipayOnline.containsKey("channel")) {
channels.add(AlipayOnline);
}
+ JSONObject Hf = getChannel(clientId,now,"hf");
+ if (Hf.containsKey("channel")){
+ channels.add(Hf);
+ }
res.put("channels", channels);
return res;
}
@@ -1295,7 +1327,7 @@ public class RetailAppServiceImp implements RetailAppService {
public JSONObject listDailyTransactions(String dateStr, String timezone, boolean thisDevOnly, JSONObject device, String app_client_ids) {
try {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
- if(client==null){
+ if (client == null) {
return null;
}
timezone = client.getString("timezone");
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 9caa888d2..ff78abf7d 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
@@ -1,34 +1,5 @@
package au.com.royalpay.payment.manage.appclient.web;
-import static au.com.royalpay.payment.tools.CommonConsts.RETAIL_DEVICE;
-
-import java.math.BigDecimal;
-import java.text.ParseException;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
-import javax.validation.Valid;
-
-import org.apache.commons.lang3.time.DateUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-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;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.servlet.ModelAndView;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-
import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
import au.com.royalpay.payment.manage.activities.app_index.core.AppActService;
import au.com.royalpay.payment.manage.activities.monsettledelay.core.ActMonDelaySettleService;
@@ -55,6 +26,35 @@ import au.com.royalpay.payment.tools.http.HttpUtils;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+
+import org.apache.commons.lang3.time.DateUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.ModelAndView;
+
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+
+import static au.com.royalpay.payment.tools.CommonConsts.RETAIL_DEVICE;
+
/**
* Created by yishuqian on 28/03/2017.
*/
@@ -109,6 +109,10 @@ public class RetailAppController {
public JSONObject getTradeCommonData(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, AppQueryBean appQueryBean) {
return retailAppService.getTradeCommonDate(device, appQueryBean);
}
+ @RequestMapping(value = "/trade/refund", method = RequestMethod.GET)
+ public JSONObject getRefunds(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, AppQueryBean appQueryBean) {
+ return retailAppService.getRefunds(device, appQueryBean);
+ }
@RequestMapping(value = "/trade_common_new", method = RequestMethod.GET)
public JSONObject getTradeCommonDataNew(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, AppQueryBean appQueryBean) {
@@ -540,4 +544,14 @@ public class RetailAppController {
return attachmentClient.uploadFile(file,false);
}
+ @RequestMapping(value = "/openim/check",method = RequestMethod.POST)
+ public JSONObject openimCheck(@ModelAttribute(RETAIL_DEVICE) JSONObject device) {
+ return retailAppService.openimCheck(device);
+ }
+
+ @RequestMapping(value = "/openim/chat",method = RequestMethod.POST)
+ public void openimChat(@ModelAttribute(RETAIL_DEVICE) JSONObject device,@RequestBody JSONObject param) {
+ retailAppService.openimCheck(device);
+ }
+
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/BDPrizeService.java b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/BDPrizeService.java
index 3277fd49e..ad7970323 100644
--- a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/BDPrizeService.java
+++ b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/BDPrizeService.java
@@ -12,7 +12,7 @@ import com.alibaba.fastjson.JSONObject;
* Created by yixian on 2017-02-07.
*/
public interface BDPrizeService {
- void generateRecord();
+ void generateRecord(String month);
@Transactional
void recordGenerateProcess(Calendar now);
@@ -38,4 +38,6 @@ public interface BDPrizeService {
void insertOrUpdateCommissionConfig(String month, List config, JSONObject manager) throws ParseException;
void deleteCommConfig(String config_id);
+
+ void updateBdKpiConfig(List configs, JSONObject manager)throws ParseException;
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java
index 7d3d47954..c52dac881 100644
--- a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java
+++ b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java
@@ -78,10 +78,10 @@ public class BDPrizeServiceImpl implements BDPrizeService {
private static BigDecimal percent = new BigDecimal(100);
- private static String[] channels = new String[]{"Wechat", "Alipay", "Bestpay", "jd", "AlipayOnline"};
+ private static String[] channels = new String[]{"Wechat", "Alipay", "Bestpay", "jd", "AlipayOnline","hf"};
@Override
- public void generateRecord() {
+ public void generateRecord(String month) {
if (backupSystem) {
throw new ServerErrorException("Updating System,wait for a moment");
}
@@ -89,9 +89,15 @@ public class BDPrizeServiceImpl implements BDPrizeService {
throw new ServerErrorException("Processing task, wait for a moment");
}
try {
- final Calendar now = Calendar.getInstance();
- DateUtils.truncate(now, Calendar.MONTH);
- now.add(Calendar.MONTH, -1);
+ SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM");
+ Date date = null;
+ try {
+ date = sdf.parse(month);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ Calendar now = Calendar.getInstance();
+ now.setTime(date);
recordGenerateProcess(now);
} finally {
@@ -133,10 +139,14 @@ public class BDPrizeServiceImpl implements BDPrizeService {
}
}
//BD Leader Prize
+ //bd_type:1 销售总监 2 大客户经理 3悉尼分公司经理 4 COO 5 NGDepartment
+ //todo 10月开始悉尼分公司经理不享受悉尼销售组提成
List bdLeaders = managerMapper.listByRole(1, ManagerRole.BD_LEADER.getMask());
for (JSONObject leader : bdLeaders) {
BigDecimal groupAmount = transactionMapper.TotalAmountForBDLeaderPrize(now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1,leader.getString("manager_id"));
- JSONObject rateJson = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, groupAmount.toString(), 1);
+ JSONObject bdConfig = financialBDConfigMapper.getBdConfig(leader.getString("manager_id"));
+ int bd_type = bdConfig ==null?2:("Sydney").equals(bdConfig.getString("city"))?2:1;//sydney leader 即悉尼大客户经理
+ JSONObject rateJson = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, groupAmount.toString(), bd_type);
BigDecimal groupPrize = new BigDecimal(0);
if (rateJson != null) {
groupPrize = groupAmount.multiply(new BigDecimal(rateJson.getString("commission_rate")).divide(percent)).setScale(2, BigDecimal.ROUND_DOWN);
@@ -212,28 +222,44 @@ public class BDPrizeServiceImpl implements BDPrizeService {
DateTime monthDate = new DateTime(month);
//bd manager commission
- JSONObject cityPrizeLog = new JSONObject();
- cityPrizeLog.put("total_amount", cplTotalprize);
- JSONObject cplRate = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, cplTotalprize.toString(), 2);
- if (cplRate == null) {
- cityPrizeLog.put("total_prize", 0.00);
+// JSONObject cityPrizeLog = new JSONObject();
+// cityPrizeLog.put("total_amount", cplTotalprize);
+// JSONObject cplRate = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, cplTotalprize.toString(), 2);
+// if (cplRate == null) {
+// cityPrizeLog.put("total_prize", 0.00);
+// } else {
+// BigDecimal _commission_rate = new BigDecimal(cplRate.getString("commission_rate"));
+// BigDecimal _total_amount = new BigDecimal(cityPrizeLog.getString("total_amount"));
+// BigDecimal total_prize = _total_amount.multiply(_commission_rate.divide(percent)).setScale(2, BigDecimal.ROUND_DOWN);
+// cityPrizeLog.put("total_prize", total_prize);
+// }
+// report.put("cityPrizeLogs", cityPrizeLog);
+
+ //bd_type=3 悉尼分公司经理 悉尼销售组和大客户组流水提成
+
+ JSONObject sydneyPrizeLog = new JSONObject();
+ BigDecimal sydneyAmount = transactionMapper.TotalAmountForSydneyGMPrize(monthDate.getYear(), monthDate.getMonthOfYear());
+ sydneyPrizeLog.put("total_amount",sydneyAmount);
+ JSONObject sydneyGMRate = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, sydneyAmount.toString(), 3);
+ if (sydneyGMRate == null) {
+ sydneyPrizeLog.put("total_prize", 0.00);
} else {
- BigDecimal _commission_rate = new BigDecimal(cplRate.getString("commission_rate"));
- BigDecimal _total_amount = new BigDecimal(cityPrizeLog.getString("total_amount"));
- BigDecimal total_prize = _total_amount.multiply(_commission_rate.divide(percent)).setScale(2, BigDecimal.ROUND_DOWN);
- cityPrizeLog.put("total_prize", total_prize);
+ BigDecimal sydney_commission_rate = new BigDecimal(sydneyGMRate.getString("commission_rate"));
+ BigDecimal total_prize = sydneyAmount.multiply(sydney_commission_rate.divide(percent)).setScale(2, BigDecimal.ROUND_DOWN);
+ sydneyPrizeLog.put("total_prize", total_prize);
}
- report.put("cityPrizeLogs", cityPrizeLog);
+ report.put("sydneyPrizeLog", sydneyPrizeLog);
- //Director commission
- JSONObject directPrizeLogs = new JSONObject();
+ //COO & NJ commission
JSONObject params = new JSONObject();
params.put("begin", TimeZoneUtils.beginDate(TimeZoneUtils.getFirstDay(monthDate.toString())));
params.put("end", TimeZoneUtils.getPerFirstDayOfMonth(TimeZoneUtils.getLastDay(monthDate.toString())));
BigDecimal totalprize = transactionAnalysisMapper.analysisTotalAmount(params);
+
+ JSONObject directPrizeLogs = new JSONObject();
directPrizeLogs.put("total_amount", totalprize);
- JSONObject rate = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, totalprize.toString(), 3);
+ JSONObject rate = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, totalprize.toString(), 4);
if (rate == null) {
directPrizeLogs.put("total_prize", 0.00);
} else {
@@ -243,6 +269,18 @@ public class BDPrizeServiceImpl implements BDPrizeService {
directPrizeLogs.put("total_prize", total_prize);
}
report.put("directPrizeLogs", directPrizeLogs);
+
+ JSONObject ngDepartmentPrizeLog = new JSONObject();
+ ngDepartmentPrizeLog.put("total_amount", totalprize);
+ JSONObject ngRate = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, totalprize.toString(), 5);
+ if (ngRate == null) {
+ ngDepartmentPrizeLog.put("total_prize", 0.00);
+ } else {
+ BigDecimal ng_commission_rate = new BigDecimal(ngRate.getString("commission_rate"));
+ BigDecimal ng_total_prize = totalprize.multiply(ng_commission_rate.divide(percent)).setScale(2, BigDecimal.ROUND_DOWN);
+ ngDepartmentPrizeLog.put("total_prize", ng_total_prize);
+ }
+ report.put("ngDepartmentPrizeLog", ngDepartmentPrizeLog);
return report;
}
@@ -418,5 +456,12 @@ public class BDPrizeServiceImpl implements BDPrizeService {
return firLasDay;
}
-
+ @Override
+ public void updateBdKpiConfig(List configs, JSONObject manager) throws ParseException {
+ for (JSONObject config : configs){
+ config.put("LAST_UPDATE_DATE", new Date());
+ config.put("LAST_UPDATE_BY", manager.getString("display_name"));
+ financialBDConfigMapper.updateBDConfig(config);
+ }
+ }
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java b/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java
index 6980fa099..7107827b1 100644
--- a/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java
+++ b/src/main/java/au/com/royalpay/payment/manage/bdprize/support/impls/BDPrizeCalculatorDefaultImpl.java
@@ -46,16 +46,16 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator {
public BDPrizeCalculatorDefaultImpl rateConfig(List rateConfig) {
for (JSONObject rateCfgItem : rateConfig) {
int level = rateCfgItem.getIntValue("bd_level");
- int monthLevel = rateCfgItem.getIntValue("time_range");
+ int kpiRange = rateCfgItem.getIntValue("kpi_range");
Map> rates = rateConfigMap.get(level);
if (rates == null) {
rates = new HashMap<>();
rateConfigMap.put(level, rates);
}
- List rate = rates.get(monthLevel);
+ List rate = rates.get(kpiRange);
if (rate == null) {
rate = new ArrayList<>();
- rates.put(monthLevel, rate);
+ rates.put(kpiRange, rate);
}
rate.add(rateCfgItem);
}
@@ -81,18 +81,28 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator {
JSONObject bd = bdMap.get(resultItem.getKey());
int bdLevel = bd.getIntValue("bd_level");
log.put("bd_level", bdLevel);
+ log.put("kpi_amount", bd.getBigDecimal("kpi_amount"));
log.put("bd_name", bd.getString("bd_name"));
log.put("total_amount", 0);
log.put("total_prize", 0);
log.put("total_donation", 0);
+ BigDecimal totalAmount = log.getBigDecimal("total_amount");
List details = new ArrayList<>();
+ for (Map.Entry detail : resultItem.getValue().entrySet()) {
+ JSONObject detailItem = detail.getValue();
+ BigDecimal totalTransaction = detailItem.getBigDecimal("total_transaction");
+ BigDecimal coefficient = detailItem.getBigDecimal("coefficient");
+ BigDecimal realTransaction = totalTransaction.multiply(coefficient).setScale(2,BigDecimal.ROUND_DOWN);
+ totalAmount = totalAmount.add(realTransaction);
+ }
for (Map.Entry detail : resultItem.getValue().entrySet()) {
JSONObject detailItem = detail.getValue();
int clientId = detailItem.getIntValue("client_id");
- int months = detailItem.getIntValue("client_create_months");
- BigDecimal bdRate = getRate(bdLevel, months, detailItem.getIntValue("client_source"), detailItem.getBigDecimal("rate_value"));
+// int months = detailItem.getIntValue("client_create_months");
BigDecimal totalTransaction = detailItem.getBigDecimal("total_transaction");
BigDecimal coefficient = detailItem.getBigDecimal("coefficient");
+ int prizeLevel = getKpiPrizeLevel(totalAmount,log.getBigDecimal("kpi_amount"));
+ BigDecimal bdRate = getNewRate(bdLevel, prizeLevel, detailItem.getIntValue("client_source"), detailItem.getBigDecimal("rate_value"));
BigDecimal prizeValue = totalTransaction.multiply(coefficient).multiply(bdRate).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_DOWN);
BigDecimal donation = BigDecimal.ZERO;
if (clientsWithBDAwayDeterminor.clientWithBDAway(clientId, month)) {
@@ -208,4 +218,42 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator {
}
throw new ServerErrorException("Prize Rate Config has no equalize:bdLevel=" + bdLevel + ",months=" + months + ",clientRate=" + clientRate.doubleValue());
}
+
+
+ private BigDecimal getNewRate(int bdLevel, int kpiRange, int clientSource, BigDecimal clientRate) {
+ BigDecimal prizeRate = BigDecimal.ZERO;
+ Map> rates = rateConfigMap.get(bdLevel);
+ List rate = rates.get(kpiRange);
+ for (JSONObject rateCfg : rate) {
+ if (rateCfg.getBigDecimal("rate_from").compareTo(clientRate) <= 0 && rateCfg.getBigDecimal("rate_to").compareTo(clientRate) >= 0) {
+ prizeRate= rateCfg.getBigDecimal("prize_rate");
+ continue;
+ }
+ }
+ if (clientSource == 1) {
+ return prizeRate;
+ } else {
+ return prizeRate.divide(BigDecimal.valueOf(2),3,BigDecimal.ROUND_HALF_DOWN);
+ }
+ }
+
+ private int getKpiPrizeLevel(BigDecimal transactionAmount,BigDecimal kpiAmount){
+ if (kpiAmount.compareTo(BigDecimal.ZERO)==0){//未设置kpi金额的按照最小完成度来计算
+ return 1;
+ }
+ BigDecimal rate = transactionAmount.divide(kpiAmount,2,BigDecimal.ROUND_HALF_DOWN);
+ if (rate.compareTo(BigDecimal.valueOf(0.5))<0){
+ return 1;
+ }
+ if (rate.compareTo(BigDecimal.valueOf(0.8))<0){
+ return 2;
+ }
+ if (rate.compareTo(BigDecimal.valueOf(1))<0){
+ return 3;
+ }
+ if (rate.compareTo(BigDecimal.valueOf(1.2))<0){
+ return 4;
+ }
+ return 5;
+ }
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/bdprize/web/BDPrizeController.java b/src/main/java/au/com/royalpay/payment/manage/bdprize/web/BDPrizeController.java
index bc5485c30..e3e75e552 100644
--- a/src/main/java/au/com/royalpay/payment/manage/bdprize/web/BDPrizeController.java
+++ b/src/main/java/au/com/royalpay/payment/manage/bdprize/web/BDPrizeController.java
@@ -29,9 +29,9 @@ public class BDPrizeController {
@Resource
private BDPrizeService bdPrizeService;
- @ManagerMapping(value = "/generate_record", method = RequestMethod.POST, role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.ADMIN})
- public void generateRecord() {
- bdPrizeService.generateRecord();
+ @ManagerMapping(value = "/generate_record/{month}", method = RequestMethod.POST, role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.ADMIN})
+ public void generateRecord(@PathVariable String month) {
+ bdPrizeService.generateRecord(month);
}
@ManagerMapping(value = "/records", method = RequestMethod.GET, role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.BD_USER})
@@ -92,4 +92,9 @@ public class BDPrizeController {
public List newCommissionConfig(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) throws ParseException {
return bdPrizeService.listNeedConfigCommission();
}
+
+ @ManagerMapping(value = "/commission/kpi/update/{month}",method = RequestMethod.POST, role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.ADMIN})
+ public void updatKpiConfig(@PathVariable String month , @RequestBody List info , @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) throws ParseException {
+ bdPrizeService.updateBdKpiConfig(info,manager);
+ }
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/customers/core/EncourageService.java b/src/main/java/au/com/royalpay/payment/manage/customers/core/EncourageService.java
index 5408473bf..a0aa8f94f 100644
--- a/src/main/java/au/com/royalpay/payment/manage/customers/core/EncourageService.java
+++ b/src/main/java/au/com/royalpay/payment/manage/customers/core/EncourageService.java
@@ -30,4 +30,6 @@ public interface EncourageService {
JSONObject listReceiveLogs(String eventId, ReceiveLogQueryBean query);
JSONObject listUseLogs(String eventId, int page, int limit);
+
+ void prepareUserInfo(JSONObject user, String user_id);
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/EncourageUseProcessor.java b/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/EncourageUseProcessor.java
index c6aa8a30b..8c6ac3208 100644
--- a/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/EncourageUseProcessor.java
+++ b/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/EncourageUseProcessor.java
@@ -1,27 +1,7 @@
package au.com.royalpay.payment.manage.customers.core.impls;
-import java.math.BigDecimal;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.RandomUtils;
-import org.apache.commons.lang3.time.DateFormatUtils;
-import org.apache.commons.lang3.time.DateUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.core.Ordered;
-import org.springframework.stereotype.Service;
-
-import com.alibaba.fastjson.JSONObject;
-import com.github.miemiedev.mybatis.paginator.domain.Order;
-import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
-import com.github.miemiedev.mybatis.paginator.domain.PageList;
-
+import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig;
+import au.com.royalpay.payment.channels.wechat.config.WechatPayEnvironment;
import au.com.royalpay.payment.core.TransactionService;
import au.com.royalpay.payment.manage.customers.beans.EncourageEventParameters;
import au.com.royalpay.payment.manage.customers.beans.ReceiveLogQueryBean;
@@ -32,13 +12,38 @@ import au.com.royalpay.payment.manage.mappers.customers.CustomerEncourageMoneyUs
import au.com.royalpay.payment.manage.mappers.customers.CustomerMembershipMapper;
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import au.com.royalpay.payment.manage.mappers.system.CustomerMapper;
+import au.com.royalpay.payment.manage.mappers.system.ManagerCustomerRelationAlipayMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.tools.CommonConsts;
+import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
+import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.utils.PageListUtils;
+import com.alibaba.fastjson.JSONObject;
+import com.github.miemiedev.mybatis.paginator.domain.Order;
+import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
+import com.github.miemiedev.mybatis.paginator.domain.PageList;
+
+import org.apache.commons.lang3.RandomUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateFormatUtils;
+import org.apache.commons.lang3.time.DateUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.core.Ordered;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import javax.annotation.Resource;
+
/**
* 鼓励金 Created by yixian on 2017-04-24.
*/
@@ -57,11 +62,15 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
@Resource
private TransactionService transactionService;
@Resource
+ private MpWechatApiProvider mpWechatApiProvider;
+ @Resource
private CustomerMapper customerMapper;
@Resource
private ManagerMapper managerMapper;
@Resource
private OrderMapper orderMapper;
+ @Resource
+ private ManagerCustomerRelationAlipayMapper managerCustomerRelationAlipayMapper;
@Override
public int getOrder() {
@@ -76,6 +85,7 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
@Override
public JSONObject takeEncourageMoney(String orderId, String visitorOpenId) {
+ logger.info("=====takeEncourageMoney+"+orderId);
JSONObject config = currentEncourageConfig();
if (config != null) {
if (customerEncourageMoneyAccessLogMapper.findByOrderId(orderId) != null) {
@@ -94,29 +104,64 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
logger.debug("不在有效期");
return new JSONObject();
}
- if (!StringUtils.equals(openId, visitorOpenId)) {
- logger.debug("不是同一人");
- return new JSONObject();
+ String channel = order.getString("channel");
+ if ("Wechat".equals(channel)) {
+ JSONObject relation = customerMapper.findCustomerByOpenId(visitorOpenId);
+ if (relation == null) {
+ logger.debug("用户关系不存在");
+ return new JSONObject();
+ }
+ JSONObject wxUser = customerMapper.findCustomerByOpenId(visitorOpenId);
+ String merchantId = order.getString("merchant_id");
+ WeChatPayConfig.Merchant mch = WechatPayEnvironment.getEnv().getMerchantConfig(merchantId);
+ MpWechatApi api = mpWechatApiProvider.getApi(mch.getMpId());
+ if (!StringUtils.equals(wxUser.getString(api.getOpenIdKey()), openId)) {
+ logger.debug("不是同一人");
+ return new JSONObject();
+ }
+ }
+ if ("Alipay".equals(channel)) {
+ if (!StringUtils.equals(visitorOpenId, openId)) {
+ logger.debug("不是同一人");
+ return new JSONObject();
+ }
}
- if (config.getBooleanValue("debug_mode") && !checkIsDeveloper(openId)) {
+ if (config.getBooleanValue("debug_mode") && !checkIsDeveloper(visitorOpenId)) {
logger.debug("测试模式,不是管理员");
return new JSONObject();
}
- JSONObject member = customerMembershipMapper.findByPaymentOpenId(openId);
+ JSONObject member = customerMembershipMapper.findByPaymentOpenId(visitorOpenId);
if (member == null) {
member = new JSONObject();
- JSONObject relation = customerMapper.findCustomerByOpenId(openId);
- if (relation == null) {
- logger.debug("用户关系不存在");
- return new JSONObject();
+ if ("Wechat".equals(channel)) {
+ JSONObject relation = customerMapper.findCustomerByOpenId(visitorOpenId);
+ if (relation == null) {
+ logger.debug("用户关系不存在");
+ return new JSONObject();
+ }
+ member.put("payment_openid", visitorOpenId);
+ member.put("kanga_openid", relation.getString("kanga_openid"));
+ member.put("redpack_openid", relation.getString("redpack_openid"));
+ member.put("attend_time", new Date());
+ member.put("member_point", -1);
+ member.put("encourage_balance", 0);
+ customerMembershipMapper.saveMember(member);
}
- member.put("payment_openid", openId);
- member.put("kanga_openid", relation.getString("kanga_openid"));
- member.put("redpack_openid", relation.getString("redpack_openid"));
- member.put("attend_time", new Date());
- member.put("member_point", -1);
- member.put("encourage_balance", 0);
- customerMembershipMapper.saveMember(member);
+ if ("Alipay".equals(channel)) {
+ JSONObject relation = managerCustomerRelationAlipayMapper.findCustomerByUserId(openId);
+ if (relation == null) {
+ logger.debug("用户关系不存在");
+ return new JSONObject();
+ }
+ member.put("payment_openid", openId);
+ member.put("kanga_openid", openId.concat("-kanga_openid"));
+ member.put("redpack_openid", openId.concat("-redpack_openid"));
+ member.put("attend_time", new Date());
+ member.put("member_point", -1);
+ member.put("encourage_balance", 0);
+ customerMembershipMapper.saveMember(member);
+ }
+
}
String memberId = member.getString("member_id");
int usedOrders = customerEncourageMoneyAccessLogMapper.countOrders(memberId, new Date());
@@ -124,8 +169,8 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
logger.debug("超出领取次数");
return new JSONObject();
}
- int rand = RandomUtils
- .nextInt(0,config.getBigDecimal("max_amount").subtract(config.getBigDecimal("min_amount")).multiply(CommonConsts.HUNDRED).intValue());
+ int rand = RandomUtils.nextInt(0,
+ config.getBigDecimal("max_amount").subtract(config.getBigDecimal("min_amount")).multiply(CommonConsts.HUNDRED).intValue());
BigDecimal amount = config.getBigDecimal("min_amount").add(BigDecimal.valueOf(rand).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_DOWN));
customerMembershipMapper.addEncourage(memberId, amount);
JSONObject customer = customerMembershipMapper.findByMemberId(memberId);
@@ -165,8 +210,8 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
}
if (log.getBigDecimal("factor").compareTo(BigDecimal.ONE) == 0) {
int critRate = config.getIntValue("crit_rate");
- if (RandomUtils.nextInt(0,100) < critRate) {
- int factorInt = RandomUtils.nextInt(0,config.getBigDecimal("max_crit").multiply(CommonConsts.HUNDRED).intValue() - 100);
+ if (RandomUtils.nextInt(0, 100) < critRate) {
+ int factorInt = RandomUtils.nextInt(0, config.getBigDecimal("max_crit").multiply(CommonConsts.HUNDRED).intValue() - 100);
BigDecimal factor = BigDecimal.valueOf(factorInt + 100).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_DOWN);
BigDecimal actural = log.getBigDecimal("access_amount").multiply(factor).setScale(2, BigDecimal.ROUND_DOWN);
BigDecimal sub = actural.subtract(log.getBigDecimal("actural_amount"));
@@ -195,16 +240,22 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
Date toDate = config.getDate("to_date");
status.put("to", DateFormatUtils.format(toDate, "MM-dd"));
JSONObject member = customerMembershipMapper.findByPaymentOpenId(openid);
+ JSONObject use = customerEncourageMoneyAccessLogMapper.sumMoney(member.getString("memeber_id"),config.getString("event_id"));
+ BigDecimal balance = BigDecimal.ZERO;
+ if(use!=null){
+ balance = use.getBigDecimal("use_amount");
+ }
+ member.put("used_amount",balance.setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
if (member != null) {
status.put("member_info", member);
List balanceLogs = customerMembershipMapper.listEncourageBalanceHistory(fromDate, toDate, member.getString("member_id"));
status.put("logs", balanceLogs);
- BigDecimal usedAmount = customerEncourageMoneyUseLogMapper.sumUsed(member.getString("member_id"), fromDate, toDate);
- member.put("used_amount", usedAmount);
+// BigDecimal usedAmount = customerEncourageMoneyUseLogMapper.sumUsed(member.getString("member_id"), fromDate, toDate);
+// member.put("used_amount", usedAmount);
} else {
member = new JSONObject();
member.put("encourage_balance", 0);
- member.put("used_amount", 0);
+// member.put("used_amount", 0);
}
status.put("member", member);
return status;
@@ -285,4 +336,14 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
PageList receiveLogs = customerEncourageMoneyUseLogMapper.list(params, new PageBounds(page, limit, Order.formString("use_time.desc")));
return PageListUtils.buildPageListResult(receiveLogs);
}
+
+ @Override
+ public void prepareUserInfo(JSONObject user, String user_id) {
+ if ("wechat".equals(user.getString("channel"))) {
+ user.put("headimg", customerMapper.findCustomerByOpenId(user_id).getString("headimg"));
+ }
+ if ("alipay".equals(user.getString("channel"))) {
+ user.put("headimg", managerCustomerRelationAlipayMapper.findCustomerByUserId(user_id).getString("headimg"));
+ }
+ }
}
\ No newline at end of file
diff --git a/src/main/java/au/com/royalpay/payment/manage/customers/web/EncourageMoneyController.java b/src/main/java/au/com/royalpay/payment/manage/customers/web/EncourageMoneyController.java
index 6aa15d077..8a753f4e4 100644
--- a/src/main/java/au/com/royalpay/payment/manage/customers/web/EncourageMoneyController.java
+++ b/src/main/java/au/com/royalpay/payment/manage/customers/web/EncourageMoneyController.java
@@ -2,10 +2,17 @@ package au.com.royalpay.payment.manage.customers.web;
import au.com.royalpay.payment.manage.customers.core.EncourageService;
import au.com.royalpay.payment.tools.CommonConsts;
-import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType;
-import au.com.royalpay.payment.tools.permission.wechat.WechatMapping;
+
import com.alibaba.fastjson.JSONObject;
-import org.springframework.web.bind.annotation.*;
+
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
@@ -16,15 +23,25 @@ import javax.annotation.Resource;
@RestController
@RequestMapping("/act/encourage_money")
public class EncourageMoneyController {
+ Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private EncourageService encourageService;
- @RequestMapping(value = "/orders/{orderId}", method = RequestMethod.PUT)
- public JSONObject takeEncourageMoney(@PathVariable String orderId, @ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser) {
+
+ @RequestMapping(value = "/orders/{orderId}", method = RequestMethod.GET)
+ public JSONObject takeEncourageMoney(@PathVariable String orderId, @ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser,
+ @ModelAttribute(CommonConsts.ALIUSER) JSONObject aliuser) {
+ String user_id = "";
if (wxUser == null) {
+ user_id = aliuser.getString("user_id");
+ } else {
+ logger.info("====wxUser==" + wxUser.toJSONString());
+ user_id = wxUser.getString("openid");
+ }
+ if (StringUtils.isEmpty(user_id)) {
return new JSONObject();
}
- return encourageService.takeEncourageMoney(orderId, wxUser.getString("openid"));
+ return encourageService.takeEncourageMoney(orderId, user_id);
}
@RequestMapping(value = "/orders/{orderId}/crit", method = RequestMethod.PUT)
@@ -32,22 +49,36 @@ public class EncourageMoneyController {
return encourageService.doubleEncourageMoney(orderId);
}
- @WechatMapping(value = "/my", method = RequestMethod.GET, oauthType = WxOauthType.USERINFO)
- public ModelAndView encourageLogs(@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser) {
+ @RequestMapping(value = "/my", method = RequestMethod.GET)
+ public ModelAndView encourageLogs(@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser, @ModelAttribute(CommonConsts.ALIUSER) JSONObject aliuser) {
ModelAndView mav = new ModelAndView("activity/encourage_money/my");
- mav.addObject("wxUser", wxUser);
- JSONObject balanceStatus = encourageService.getBalanceStatus(wxUser.getString("openid"));
+ JSONObject user = new JSONObject();
+ String user_id = "";
+ if (wxUser == null) {
+ user.put("headimg", aliuser.getString("avatar"));
+ user.put("channel","alipay");
+ user_id = aliuser.getString("user_id");
+ } else {
+ user.put("headimg", wxUser.getString("headimgurl"));
+ user.put("channel","wechat");
+ user_id = wxUser.getString("openid");
+ }
+ if(StringUtils.isEmpty(user.getString("headimg"))) {
+ encourageService.prepareUserInfo(user, user_id);
+ }
+ JSONObject balanceStatus = encourageService.getBalanceStatus(user_id);
+ mav.addObject("user", user);
mav.addObject("balance_status", balanceStatus);
return mav;
}
- @WechatMapping(value = "/desc",method = RequestMethod.GET)
- public ModelAndView descPage(){
+ @RequestMapping(value = "/desc", method = RequestMethod.GET)
+ public ModelAndView descPage() {
return new ModelAndView("activity/encourage_money/desc");
}
- @WechatMapping(value = "/merchants",method = RequestMethod.GET)
- public ModelAndView merchantsPage(){
+ @RequestMapping(value = "/merchants", method = RequestMethod.GET)
+ public ModelAndView merchantsPage() {
return new ModelAndView("activity/encourage_money/merchants");
}
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java
index d62f770d9..845c76876 100644
--- a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java
+++ b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java
@@ -5,9 +5,10 @@ import au.com.royalpay.payment.manage.dev.core.AliforexcelService;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.IOUtils;
-import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -25,8 +26,8 @@ public class AliforexcelServiceImpl implements AliforexcelService {
public JSONObject listClients(HttpServletResponse httpResponse,JSONObject manager, AliExcel query) {
OutputStream ous = null;
try{
- JSONObject params = query.toJsonParam();
- List partners = clientMapper.passPartners(params);
+ JSONObject params = query.toJsonParam();
+ List partners = clientMapper.passPartners(params);
httpResponse.setContentType("application/octet-stream;");
httpResponse.setCharacterEncoding("utf-8");
String fileName = "支付宝进件专用--";
@@ -34,18 +35,12 @@ public class AliforexcelServiceImpl implements AliforexcelService {
httpResponse.addHeader("Content-Disposition", "attachment; filename=" + codedFileName +query.getDatefrom() + "~" +query.getDateto() + ".xls");
ous = httpResponse.getOutputStream();
HSSFWorkbook wb = new HSSFWorkbook();
- HSSFFont font = wb.createFont();
- font.setBoldweight(Font.BOLDWEIGHT_BOLD);
- font.setFontHeightInPoints((short) 15);
- CellStyle analysisStyle = wb.createCellStyle();
- analysisStyle.setFont(font);
Sheet sheet = wb.createSheet("支付宝进件专用" );
sheet.createFreezePane(1, 2);
sheet.setDefaultColumnWidth((short) 25);
int rowNum = 0;
Row row = sheet.createRow(rowNum);
- String[] title = {"公司注册名称", "对外营业名称", "","所属行业(数字代码即可)","地址","eg. Monday-Friday 09:00-20:00,Saturday-Sunday 10:00-22:00\n请注意格式","+61 452296105\n" +
- "请注意格式","youtube视频介绍链接(若有)","门店介绍","标签"};
+ String[] title = {"Company name", "Store name", "Partner Code","Industry","Store address","Business hours","Contact information","Video link (optional)","Store description","Tags"};
for (int i = 0; i < title.length; i++) {
row.createCell(i, Cell.CELL_TYPE_STRING).setCellValue(title[i]);
}
@@ -59,7 +54,7 @@ public class AliforexcelServiceImpl implements AliforexcelService {
row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(partner.getString("business_hours"));
row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue(partner.getString("company_phone"));
row.createCell(7, Cell.CELL_TYPE_STRING).setCellValue(partner.getString(""));
- row.createCell(8, Cell.CELL_TYPE_STRING).setCellValue(partner.getString("description"));
+ row.createCell(8, Cell.CELL_TYPE_STRING).setCellValue(partner.getString("merchant_introduction"));
row.createCell(9, Cell.CELL_TYPE_STRING).setCellValue(partner.getString(""));
}
wb.write(ous);
diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.java
index 1515f7fde..de5793c77 100644
--- a/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.java
+++ b/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.java
@@ -23,16 +23,13 @@ public interface ActChairtyMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject chairtyClient);
- @AutoSql(type = SqlType.DELETE)
- void disableClient(@Param("client_moniker") String clientMoniker);
-
PageList chairtyClientNum(PageBounds pageBounds);
- List getChairtyWeekstartAnalysis(@Param("begin") Date begin, @Param("end") Date end);
-
- JSONObject getChairtyWeekAnalysis(@Param("begin") Date begin, @Param("end") Date end);
+ List getChairtyWeekAnalysis(@Param("begin") Date begin, @Param("end") Date end);
PageList getChairtyWeekRaking(@Param("begin") Date begin, @Param("end") Date end,PageBounds pageBounds);
+ List chairtyClientNum();
+
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/customers/CustomerEncourageMoneyAccessLogMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/customers/CustomerEncourageMoneyAccessLogMapper.java
index 04ab8b807..469a62172 100644
--- a/src/main/java/au/com/royalpay/payment/manage/mappers/customers/CustomerEncourageMoneyAccessLogMapper.java
+++ b/src/main/java/au/com/royalpay/payment/manage/mappers/customers/CustomerEncourageMoneyAccessLogMapper.java
@@ -31,4 +31,7 @@ public interface CustomerEncourageMoneyAccessLogMapper {
PageList list(JSONObject params, PageBounds pageBounds);
List analysisByDate(@Param("event_id") String eventId);
+
+ JSONObject sumMoney(@Param("memberId") String memberId,@Param("eventId")String eventId);
+
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/customers/CustomerEncourageMoneyUseLogMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/customers/CustomerEncourageMoneyUseLogMapper.java
index f9ca6116e..a82dc96c7 100644
--- a/src/main/java/au/com/royalpay/payment/manage/mappers/customers/CustomerEncourageMoneyUseLogMapper.java
+++ b/src/main/java/au/com/royalpay/payment/manage/mappers/customers/CustomerEncourageMoneyUseLogMapper.java
@@ -34,4 +34,7 @@ public interface CustomerEncourageMoneyUseLogMapper {
List analysisByDate(@Param("event_id") String eventId);
List listUnsettled();
+
+ JSONObject sumMoney(@Param("memberId") String memberId,@Param("eventId")String eventId);
+
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/financial/FinancialBDPrizeLogMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/financial/FinancialBDPrizeLogMapper.java
index adb0bc5a1..cbd0e1005 100644
--- a/src/main/java/au/com/royalpay/payment/manage/mappers/financial/FinancialBDPrizeLogMapper.java
+++ b/src/main/java/au/com/royalpay/payment/manage/mappers/financial/FinancialBDPrizeLogMapper.java
@@ -19,7 +19,7 @@ public interface FinancialBDPrizeLogMapper {
@AutoSql(type = SqlType.INSERT)
void save(JSONObject log);
- @Select("SELECT fbpl.prize_log_id,fbpl.record_id,fbpl.manager_id,fbpl.bd_name,fbpl.bd_level,SUM(fbpl.total_amount) total_amount, " +
+ @Select("SELECT fbpl.prize_log_id,fbpl.record_id,fbpl.manager_id,fbpl.bd_name,fbpl.kpi_amount,fbpl.bd_level,SUM(fbpl.total_amount) total_amount, " +
"SUM(fbpl.total_prize) total_prize,SUM(fbpl.total_donation) total_donation, SUM(fbpl.send_prize) send_prize, " +
"SUM(fbpl.hold_prize) hold_prize,fbpl.last_punish,fbpl.prize_type,sysm.is_valid FROM financial_bd_prize_log fbpl, " +
"sys_managers sysm " +
diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/log/LogClientSubMerchantIdMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/log/LogClientSubMerchantIdMapper.java
index 9bb01369e..d1d46b979 100644
--- a/src/main/java/au/com/royalpay/payment/manage/mappers/log/LogClientSubMerchantIdMapper.java
+++ b/src/main/java/au/com/royalpay/payment/manage/mappers/log/LogClientSubMerchantIdMapper.java
@@ -4,6 +4,7 @@ import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
+import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -15,5 +16,5 @@ public interface LogClientSubMerchantIdMapper {
void save(JSONObject log);
@AutoSql(type = SqlType.SELECT)
- List listLogsByClientId(@Param("client_id") int client_id);
+ List listLogsByClientId(@Param("client_id") int client_id, PageBounds pageBounds);
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/RefundMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/RefundMapper.java
index 72ba19086..64ff2ecd8 100644
--- a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/RefundMapper.java
+++ b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/RefundMapper.java
@@ -1,16 +1,19 @@
package au.com.royalpay.payment.manage.mappers.payment;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+
+import com.alibaba.fastjson.JSONObject;
+import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
+import com.github.miemiedev.mybatis.paginator.domain.PageList;
+
import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
-import com.alibaba.fastjson.JSONObject;
-import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
-import org.apache.ibatis.annotations.Param;
-
-import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
/**
* Created by yixian on 2016-06-25.
@@ -55,4 +58,7 @@ public interface RefundMapper {
List listRefundDate(@Param("begin") Date begin, @Param("end") Date end);
List listClientRefund(JSONObject param);
+
+ PageList listUnionAllApply(JSONObject params, PageBounds pagination);
+
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java
index 5e153fda9..be48b0efc 100644
--- a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java
+++ b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java
@@ -94,6 +94,8 @@ public interface TransactionMapper {
List listTransactionsForBDPrize(@Param("year") int year, @Param("month") int month, @Param("channel") String channel);
BigDecimal TotalAmountForBDLeaderPrize(@Param("year") int year, @Param("month") int month, @Param("bd_group") String bd_group);
+ BigDecimal TotalAmountForSydneyGMPrize(@Param("year") int year, @Param("month") int month);
+
List listTransactionsForCityPartnerCommission(@Param("year") int year, @Param("month") int month);
diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskAttentionMerchantsAMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskAttentionMerchantsAMapper.java
new file mode 100644
index 000000000..46f817c70
--- /dev/null
+++ b/src/main/java/au/com/royalpay/payment/manage/mappers/risk/RiskAttentionMerchantsAMapper.java
@@ -0,0 +1,31 @@
+package au.com.royalpay.payment.manage.mappers.risk;
+
+import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
+import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
+import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
+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;
+
+/**
+ * Create by yixian at 2017-12-21 11:45
+ */
+@AutoMapper(tablename = "risk_attention_merchants", pkName = "client_id")
+public interface RiskAttentionMerchantsAMapper {
+ @AutoSql(type = SqlType.UPDATE)
+ void update(JSONObject client);
+
+ @AutoSql(type = SqlType.INSERT)
+ void save(JSONObject client);
+
+ @AutoSql(type = SqlType.SELECT)
+ JSONObject findById(@Param("id") String id);
+
+ @AutoSql(type = SqlType.SELECT)
+ JSONObject findByClientMoniker(@Param("client_moniker") String client_moniker);
+
+ @AutoSql(type = SqlType.SELECT)
+ PageList query(JSONObject params, PageBounds pagination);
+
+}
diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAccountMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAccountMapper.java
index f3e3428d3..f8e8db188 100644
--- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAccountMapper.java
+++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAccountMapper.java
@@ -75,4 +75,5 @@ public interface ClientAccountMapper {
@AdvanceSelect(addonWhereClause = "is_valid=1 and role=1 and wechat_openid is not null and wx_unionid is null", excludeColumns = {"salt", "password_hash"})
List listNullUnionIdAccounts();
+ List query(JSONObject params);
}
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 de604e416..712ac48ca 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
@@ -6,6 +6,7 @@ import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
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;
@@ -32,7 +33,7 @@ public interface ManagerMapper {
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject account);
- List listAvailable(JSONObject params, PageBounds pageBounds);
+ PageList listAvailable(JSONObject params, PageBounds pageBounds);
@AutoSql(type = SqlType.INSERT)
void save(JSONObject manager);
@@ -59,4 +60,6 @@ public interface ManagerMapper {
List findByIds(List ids);
List listOpenIdByRole(@Param("mask") int mask);
+
+ List listServants(@Param("mask") int mask);
}
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
new file mode 100644
index 000000000..8e119f1ed
--- /dev/null
+++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysCustomerServiceMapper.java
@@ -0,0 +1,34 @@
+package au.com.royalpay.payment.manage.mappers.system;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+
+import com.alibaba.fastjson.JSONObject;
+
+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 yixian on 2016-06-29.
+ */
+@AutoMapper(tablename = "sys_customer_service", pkName = "manager_id")
+public interface SysCustomerServiceMapper {
+ List findOnline();
+
+ @AutoSql(type = SqlType.SELECT)
+ JSONObject findByManagerId(@Param("manager_id")String manager_id);
+
+ @AutoSql(type = SqlType.INSERT)
+ void save(JSONObject record);
+
+ @AutoSql(type = SqlType.UPDATE)
+ void update(JSONObject record);
+
+ void onoff(@Param("managerId") String managerId, @Param("status") int status);
+
+ @AutoSql(type = SqlType.SELECT)
+ List findAllWithDetail();
+}
+
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 de4e4b37a..a5d36dfeb 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
@@ -333,7 +333,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
int role = manager != null ? manager.getIntValue("role") : 0;
if (manager != null) {
if (ManagerRole.OPERATOR.hasRole(role)) {
- List log = logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"));
+ List log = logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"),new PageBounds(Order.formString("create_time.desc")));
client.put("sub_merchant_id_log", log.size() > 0 ? true : false);
}
if (ManagerRole.BD_USER.hasRole(role)) {
@@ -3579,7 +3579,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
- return logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"));
+ return logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"),new PageBounds(Order.formString("create_time.desc")));
}
@Override
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 2697b2c4c..00675ce7a 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
@@ -536,7 +536,7 @@ public class PartnerManageController {
clientManager.removeSub(clientMoniker,manager);
}
- @ManagerMapping(value = "/{clientMoniker}/hf", method = RequestMethod.PUT, role = {ManagerRole.SERVANT, ManagerRole.DEVELOPER})
+ @ManagerMapping(value = "/{clientMoniker}/hf", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public void switchHfPermission(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchHfLink(manager, clientMoniker, pass.getBooleanValue("allow"));
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/NoticePartnerImpl.java b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/NoticePartnerImpl.java
index 27c13e86e..af0773143 100644
--- a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/NoticePartnerImpl.java
+++ b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/NoticePartnerImpl.java
@@ -1,21 +1,21 @@
package au.com.royalpay.payment.manage.notice.core.impls;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import org.springframework.stereotype.Service;
+import au.com.royalpay.payment.manage.mappers.notice.NoticePartnerMapper;
+import au.com.royalpay.payment.manage.notice.core.NoticePartner;
+import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
-import au.com.royalpay.payment.manage.mappers.notice.NoticePartnerMapper;
-import au.com.royalpay.payment.manage.notice.core.NoticePartner;
-import au.com.royalpay.payment.tools.utils.PageListUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import javax.annotation.Resource;
/**
* Created by yishuqian on 29/09/2016.
@@ -36,6 +36,7 @@ public class NoticePartnerImpl implements NoticePartner {
JSONObject unReadParams = new JSONObject();
unReadParams.put("client_id",partner.getIntValue("client_id"));
unReadParams.put("status",0);
+ unReadParams.put("is_to_app",1);
int counts = noticePartnerMapper.countNoticePartner(unReadParams);
PageList partnerNotices =noticePartnerMapper.listNoticesByClientId(params,
new PageBounds(params.getIntValue("page"), params.getIntValue("limit"), Order.formString("status.asc,send_time.desc")));
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
new file mode 100644
index 000000000..f3ce94657
--- /dev/null
+++ b/src/main/java/au/com/royalpay/payment/manage/openim/OpenimController.java
@@ -0,0 +1,58 @@
+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.tools.CommonConsts;
+import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
+
+import com.alibaba.fastjson.JSONObject;
+
+import org.springframework.web.bind.annotation.ModelAttribute;
+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.RestController;
+
+import java.util.List;
+
+import javax.annotation.Resource;
+
+/**
+ * @author kira
+ * @date 2018/7/11
+ */
+@RestController
+@RequestMapping("/sys/openim")
+public class OpenimController {
+
+ @Resource
+ private CustomerServiceService customerServiceService;
+
+ @RequestMapping(value = "/check", method = RequestMethod.PUT)
+ @RequireManager
+ public JSONObject sendMsg(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
+ return customerServiceService.checkAndSave(manager);
+ }
+
+ @RequestMapping(value = "/findOne", method = RequestMethod.GET)
+ public OpenimUserVO findOne(@RequestParam int clientId, @RequestParam String userName) {
+ return customerServiceService.findOne(clientId, userName);
+ }
+
+ @RequestMapping(value = "/list",method = RequestMethod.GET)
+ public List query(@RequestParam(required = false) String clientMoniker,@RequestParam(required = false) String userNames){
+ JSONObject params = new JSONObject();
+ params.put("clientMoniker",clientMoniker);
+ params.put("userNames",userNames);
+ 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"));
+ }
+
+}
diff --git a/src/main/java/au/com/royalpay/payment/manage/openim/beans/OpenimUser.java b/src/main/java/au/com/royalpay/payment/manage/openim/beans/OpenimUser.java
new file mode 100644
index 000000000..52162d649
--- /dev/null
+++ b/src/main/java/au/com/royalpay/payment/manage/openim/beans/OpenimUser.java
@@ -0,0 +1,170 @@
+package au.com.royalpay.payment.manage.openim.beans;
+
+/**
+ * @author kira
+ * @date 2018/7/11
+ */
+public class OpenimUser {
+ private String nick;
+ private String icon_url;
+ private String email;
+ private String mobile;
+ private String taobaoid;
+ private String userid;
+ private String passowrd;
+ private String remark;
+ private String extra;
+ private String career;
+ private String vip;
+ private String address;
+ private String name;
+ private Integer age;
+ private String gender;
+ private String wechat;
+ private String qq;
+ private String weibo;
+
+ public String getNick() {
+ return nick;
+ }
+
+ public void setNick(String nick) {
+ this.nick = nick;
+ }
+
+ public String getIcon_url() {
+ return icon_url;
+ }
+
+ public void setIcon_url(String icon_url) {
+ this.icon_url = icon_url;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getMobile() {
+ return mobile;
+ }
+
+ public void setMobile(String mobile) {
+ this.mobile = mobile;
+ }
+
+ public String getTaobaoid() {
+ return taobaoid;
+ }
+
+ public void setTaobaoid(String taobaoid) {
+ this.taobaoid = taobaoid;
+ }
+
+ public String getUserid() {
+ return userid;
+ }
+
+ public void setUserid(String userid) {
+ this.userid = userid;
+ }
+
+ public String getPassowrd() {
+ return passowrd;
+ }
+
+ public void setPassowrd(String passowrd) {
+ this.passowrd = passowrd;
+ }
+
+ public String getRemark() {
+ return remark;
+ }
+
+ public void setRemark(String remark) {
+ this.remark = remark;
+ }
+
+ public String getExtra() {
+ return extra;
+ }
+
+ public void setExtra(String extra) {
+ this.extra = extra;
+ }
+
+ public String getCareer() {
+ return career;
+ }
+
+ public void setCareer(String career) {
+ this.career = career;
+ }
+
+ public String getVip() {
+ return vip;
+ }
+
+ public void setVip(String vip) {
+ this.vip = vip;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public String getGender() {
+ return gender;
+ }
+
+ public void setGender(String gender) {
+ this.gender = gender;
+ }
+
+ public String getWechat() {
+ return wechat;
+ }
+
+ public void setWechat(String wechat) {
+ this.wechat = wechat;
+ }
+
+ public String getQq() {
+ return qq;
+ }
+
+ public void setQq(String qq) {
+ this.qq = qq;
+ }
+
+ public String getWeibo() {
+ return weibo;
+ }
+
+ public void setWeibo(String weibo) {
+ this.weibo = weibo;
+ }
+}
diff --git a/src/main/java/au/com/royalpay/payment/manage/openim/beans/OpenimUserVO.java b/src/main/java/au/com/royalpay/payment/manage/openim/beans/OpenimUserVO.java
new file mode 100644
index 000000000..a00e73df7
--- /dev/null
+++ b/src/main/java/au/com/royalpay/payment/manage/openim/beans/OpenimUserVO.java
@@ -0,0 +1,26 @@
+package au.com.royalpay.payment.manage.openim.beans;
+
+/**
+ * @author kira
+ * @date 2018/7/17
+ */
+public class OpenimUserVO {
+ private String nick;
+ private String userid;
+
+ public String getNick() {
+ return nick;
+ }
+
+ public void setNick(String nick) {
+ this.nick = nick;
+ }
+
+ public String getUserid() {
+ return userid;
+ }
+
+ public void setUserid(String userid) {
+ this.userid = userid;
+ }
+}
diff --git a/src/main/java/au/com/royalpay/payment/manage/openim/beans/PushMsgBean.java b/src/main/java/au/com/royalpay/payment/manage/openim/beans/PushMsgBean.java
new file mode 100644
index 000000000..314dd3ebd
--- /dev/null
+++ b/src/main/java/au/com/royalpay/payment/manage/openim/beans/PushMsgBean.java
@@ -0,0 +1,48 @@
+package au.com.royalpay.payment.manage.openim.beans;
+
+import java.util.List;
+
+/**
+ * @author kira
+ * @date 2018/7/11
+ */
+public class PushMsgBean {
+
+ private String from_user;
+ private List to_users;
+ private String summary;
+ private String data;
+
+
+ public String getFrom_user() {
+ return from_user;
+ }
+
+ public void setFrom_user(String from_user) {
+ this.from_user = from_user;
+ }
+
+ public List getTo_users() {
+ return to_users;
+ }
+
+ public void setTo_users(List to_users) {
+ this.to_users = to_users;
+ }
+
+ public String getSummary() {
+ return summary;
+ }
+
+ public void setSummary(String summary) {
+ this.summary = summary;
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+}
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
new file mode 100644
index 000000000..d00549626
--- /dev/null
+++ b/src/main/java/au/com/royalpay/payment/manage/openim/core/CustomerServiceService.java
@@ -0,0 +1,27 @@
+package au.com.royalpay.payment.manage.openim.core;
+
+import au.com.royalpay.payment.manage.openim.beans.OpenimUserVO;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.List;
+
+/**
+ * @author kira
+ * @date 2018/7/11
+ */
+public interface CustomerServiceService {
+
+ JSONObject checkAndSave(JSONObject account);
+
+ OpenimUserVO findOne(int clientId,String userName);
+
+ List query(String clientMoniker,String userNames);
+
+ void onoff(JSONObject manager,boolean status);
+
+ 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
new file mode 100644
index 000000000..fb380b84f
--- /dev/null
+++ b/src/main/java/au/com/royalpay/payment/manage/openim/core/OpenimApi.java
@@ -0,0 +1,20 @@
+package au.com.royalpay.payment.manage.openim.core;
+
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * @author kira
+ * @date 2018/7/11
+ */
+public interface OpenimApi {
+
+ void addUser(JSONObject record);
+
+ void updateUser();
+
+ void pushMsh();
+
+ JSONObject getUserInfo(String userId);
+
+
+}
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
new file mode 100644
index 000000000..488a36e6d
--- /dev/null
+++ b/src/main/java/au/com/royalpay/payment/manage/openim/core/OpenimClient.java
@@ -0,0 +1,138 @@
+package au.com.royalpay.payment.manage.openim.core;
+
+import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
+
+import com.alibaba.fastjson.JSONObject;
+import com.taobao.api.ApiException;
+import com.taobao.api.DefaultTaobaoClient;
+import com.taobao.api.TaobaoClient;
+import com.taobao.api.domain.Userinfos;
+import com.taobao.api.request.OpenimCustmsgPushRequest;
+import com.taobao.api.request.OpenimUsersAddRequest;
+import com.taobao.api.request.OpenimUsersGetRequest;
+import com.taobao.api.request.OpenimUsersUpdateRequest;
+import com.taobao.api.response.OpenimCustmsgPushResponse;
+import com.taobao.api.response.OpenimUsersAddResponse;
+import com.taobao.api.response.OpenimUsersGetResponse;
+import com.taobao.api.response.OpenimUsersUpdateResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author kira
+ * @date 2018/7/11
+ */
+@Service
+public class OpenimClient {
+ Logger logger = LoggerFactory.getLogger(getClass());
+ @Value("${im.openim.appkey}")
+ private String appkey;
+ @Value("${im.openim.secret}")
+ private String secret;
+ private final String url = "https://eco.taobao.com/router/rest";
+
+ public JSONObject getUser(String userId) {
+ TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
+ OpenimUsersGetRequest req = new OpenimUsersGetRequest();
+ // 批量为userid逗号分隔字符串
+ req.setUserids(userId);
+ OpenimUsersGetResponse rsp = null;
+ try {
+ rsp = client.execute(req);
+ } catch (ApiException e) {
+ logger.info("openim get user fail", e);
+ }
+ JSONObject openInfo = JSONObject.parseObject(rsp.getBody());
+ if (openInfo.getJSONObject("openim_users_get_response").getJSONObject("userinfos").size() < 1) {
+ return null;
+ }
+ return openInfo;
+ }
+
+ public void addUser(List users) {
+ TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
+ OpenimUsersAddRequest req = new OpenimUsersAddRequest();
+ req.setUserinfos(users);
+ OpenimUsersAddResponse rsp = null;
+ try {
+ rsp = client.execute(req);
+ } catch (ApiException e) {
+ logger.info("openim add user fail", e);
+ }
+ JSONObject result = JSONObject.parseObject(rsp.getBody());
+ JSONObject failMsg = result.getJSONObject("openim_users_add_response").getJSONObject("fail_msg");
+ if (failMsg.size() > 0) {
+ if ("data exist".equals(failMsg.getJSONArray("string").get(0))) {
+ return;
+ }
+ logger.info("openim add user fail reason:" + failMsg.getJSONArray("string").toJSONString());
+ throw new ServerErrorException("System error");
+ }
+ }
+
+ public void updateUser(List users) {
+ TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
+ OpenimUsersUpdateRequest req = new OpenimUsersUpdateRequest();
+ req.setUserinfos(users);
+ OpenimUsersUpdateResponse rsp = null;
+ try {
+ rsp = client.execute(req);
+ } catch (ApiException e) {
+ logger.info("openim update user fail", e);
+ }
+ JSONObject result = JSONObject.parseObject(rsp.getBody());
+ if (result.getJSONObject("openim_users_update_response").getJSONObject("fail_msg").size() > 0) {
+ logger.info("openim update user fail reason:"
+ + result.getJSONObject("openim_users_update_response").getJSONObject("fail_msg").getJSONArray("string").toJSONString());
+ throw new ServerErrorException("System error");
+ }
+ }
+
+ public void pushMsg(OpenimCustmsgPushRequest.CustMsg msg) {
+ TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
+ OpenimCustmsgPushRequest req = new OpenimCustmsgPushRequest();
+ req.setCustmsg(msg);
+ OpenimCustmsgPushResponse rsp = null;
+ try {
+ rsp = client.execute(req);
+ } catch (ApiException e) {
+ logger.info("openim push msg fail", e);
+ }
+ JSONObject result = JSONObject.parseObject(rsp.getBody());
+ if (result.getJSONObject("openim_custmsg_push_response").getJSONObject("fail_msg").size() > 0) {
+ logger.info("openim push message fail reason:"
+ + result.getJSONObject("openim_custmsg_push_response").getJSONObject("fail_msg").getJSONArray("string").toJSONString());
+ throw new ServerErrorException("System error");
+ }
+ }
+
+ public static void main(String[] args) {
+ String appkey = "24980715";
+ String secret = "60b1ba680a6f27ffc701f10b6d5be00e";
+ 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;
+ try {
+ rsp = client.execute(req);
+ } catch (ApiException e) {
+ e.printStackTrace();
+ }
+ System.out.println(rsp.getBody());
+ }
+}
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
new file mode 100644
index 000000000..3ba1ce652
--- /dev/null
+++ b/src/main/java/au/com/royalpay/payment/manage/openim/core/impl/CustomerServiceServiceImpl.java
@@ -0,0 +1,214 @@
+package au.com.royalpay.payment.manage.openim.core.impl;
+
+import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
+import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
+import au.com.royalpay.payment.manage.mappers.system.SysCustomerServiceMapper;
+import au.com.royalpay.payment.manage.merchants.core.ClientManager;
+import au.com.royalpay.payment.manage.openim.beans.OpenimUserVO;
+import au.com.royalpay.payment.manage.openim.core.CustomerServiceService;
+import au.com.royalpay.payment.manage.openim.core.OpenimApi;
+import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
+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 com.alibaba.fastjson.JSONObject;
+
+import org.apache.commons.codec.digest.DigestUtils;
+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 java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+/**
+ * @author kira
+ * @date 2018/7/11
+ */
+@Service
+public class CustomerServiceServiceImpl implements CustomerServiceService {
+
+ @Resource
+ private OpenimApi openimApi;
+ @Resource
+ private ClientManager clientManager;
+ @Resource
+ private ClientAccountMapper clientAccountMapper;
+ @Resource
+ private ManagerMapper managerMapper;
+ @Resource
+ private SysCustomerServiceMapper sysCustomerServiceMapper;
+ @Resource
+ private MpWechatApiProvider mpWechatApiProvider;
+ @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;
+ }
+ 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 OpenimUserVO findOne(int clientId, String userName) {
+ JSONObject client = clientManager.getClientInfo(clientId);
+ if (client == null) {
+ throw new BadRequestException("Merchant Not Found");
+ }
+ JSONObject account = clientAccountMapper.findByUsername(userName);
+ if (account == null) {
+ throw new BadRequestException("Account Not Found");
+ }
+ if (account.getIntValue("client_id") != clientId) {
+ throw new ForbiddenException("No Rights");
+ }
+ OpenimUserVO result = new OpenimUserVO();
+ result.setNick(account.getString("display_name"));
+ result.setUserid(account.getString("username") + "_" + client.getString("client_moniker"));
+ return result;
+ }
+
+ @Override
+ public List query(String clientMoniker, String userNames) {
+ JSONObject queryParams = new JSONObject();
+ if (StringUtils.isNotEmpty(clientMoniker)) {
+ JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
+ if (client == null) {
+ return Collections.EMPTY_LIST;
+ }
+ queryParams.put("clientId", client.getIntValue("client_id"));
+ }
+ if (StringUtils.isNotEmpty(userNames)) {
+ queryParams.put("userNames", Arrays.asList(userNames.split(",")));
+ }
+ if (queryParams.size() < 1) {
+ return Collections.emptyList();
+ }
+ List accounts = clientAccountMapper.query(queryParams);
+ List result = new ArrayList<>(accounts.size());
+ accounts.forEach(p -> {
+ JSONObject openimUser = new JSONObject();
+ openimUser.put("userid", p.getString("username") + "_" + p.getString("client_moniker"));
+ openimUser.put("nick", p.getString("username") + "_" + p.getString("client_moniker"));
+ openimUser.put("headimg", p.getString("wechat_headimg"));
+ result.add(openimUser);
+ });
+ return result;
+ }
+
+ @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);
+ }
+
+ @Override
+ public void addUnreadMsg(JSONObject params) {
+ String uid = params.getString("uid");
+ String tuid = params.getString("tuid");
+ if (StringUtils.isEmpty(uid) || StringUtils.isEmpty(tuid)) {
+ return;
+ }
+ 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)) {
+ JSONObject record = JSONObject.parseObject(jStr);
+ record.put("unreadMsg", record.getIntValue("unreadMsg") + 1);
+ ops.set(i, record.toJSONString());
+ return;
+ }
+ }
+ params.put("unreadMsg", 1);
+ ops.rightPush(params.toJSONString());
+ }
+
+ @Override
+ public void sendUnreadWxMsg() {
+ List servants = sysCustomerServiceMapper.findAllWithDetail();
+ MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi();
+ servants.parallelStream().forEach(p -> {
+ p.getString("user_id");
+ BoundListOperations ops = stringRedisTemplate.boundListOps("REDIS_UNREADMSG_PREFIX" + p.getString("user_id"));
+ if (ops.size() < 1) {
+ return;
+ }
+ int clients = 0;
+ int unreadMsg = 0;
+ for (int i = 0; i < ops.size(); i++) {
+ clients++;
+ unreadMsg += JSONObject.parseObject(ops.index(i)).getIntValue("unreadMsg");
+ }
+ TemplateMessage msg = initUnreadMsg(unreadMsg, clients, p.getString("wx_openid"), paymentApi.getTemplateId("commission"));
+ paymentApi.sendTemplateMessage(msg);
+ stringRedisTemplate.delete("REDIS_UNREADMSG_PREFIX" + p.getString("user_id"));
+ });
+
+ }
+
+ private TemplateMessage initUnreadMsg(int unreadMsg, int clients, String openId, String templateId) {
+ TemplateMessage msg = new TemplateMessage(openId, templateId, null);
+ msg.put("first", "你好,你有" + unreadMsg + "个未读消息", "#000000");
+ msg.put("keyword1", "商户", "#000000");
+ msg.put("keyword2", "问题咨询", "#000000");
+ msg.put("keyword3", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"), "#000000");
+ msg.put("keyword4", "你有" + clients + "个商户咨询待处理", "#0000ff");
+ msg.put("remark", "", "#000000");
+ 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"));
+ sysCustomerServiceMapper.save(servant);
+ } else {
+ sysCustomerServiceMapper.update(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
new file mode 100644
index 000000000..509f14f8c
--- /dev/null
+++ b/src/main/java/au/com/royalpay/payment/manage/openim/core/impl/OpenimApiImpl.java
@@ -0,0 +1,55 @@
+package au.com.royalpay.payment.manage.openim.core.impl;
+
+import au.com.royalpay.payment.manage.openim.core.OpenimApi;
+import au.com.royalpay.payment.manage.openim.core.OpenimClient;
+
+import com.alibaba.fastjson.JSONObject;
+import com.taobao.api.domain.Userinfos;
+
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+/**
+ * @author kira
+ * @date 2018/7/11
+ */
+@Service
+public class OpenimApiImpl implements OpenimApi {
+
+ @Resource
+ private OpenimClient openimClient;
+
+ @Override
+ public void addUser(JSONObject user) {
+ JSONObject opemInfo = openimClient.getUser(user.getString("user_id"));
+ if(opemInfo!=null){
+ return;
+ }
+ List saveList = new ArrayList<>();
+ Userinfos record = new Userinfos();
+ record.setUserid(user.getString("user_id"));
+ record.setNick(user.getString("nick"));
+ record.setPassword(user.getString("password"));
+ saveList.add(record);
+ openimClient.addUser(saveList);
+ }
+
+ @Override
+ public void updateUser() {
+
+ }
+
+ @Override
+ public void pushMsh() {
+
+ }
+
+ @Override
+ public JSONObject getUserInfo(String userId) {
+ return openimClient.getUser(userId);
+ }
+}
diff --git a/src/main/java/au/com/royalpay/payment/manage/permission/manager/ManagerUserInterceptor.java b/src/main/java/au/com/royalpay/payment/manage/permission/manager/ManagerUserInterceptor.java
index 644449dcd..124ffe67c 100644
--- a/src/main/java/au/com/royalpay/payment/manage/permission/manager/ManagerUserInterceptor.java
+++ b/src/main/java/au/com/royalpay/payment/manage/permission/manager/ManagerUserInterceptor.java
@@ -104,13 +104,13 @@ public class ManagerUserInterceptor extends HandlerInterceptorAdapter implements
}
}
- JSONObject func = permissionPartnerManager.getPartnerFuncById(funcId);
- if(func!=null && StringUtils.isNotEmpty(func.getString("module_id"))){
- JSONArray arr = loginUser.getJSONArray("available_module_ids");
- if (arr == null || !arr.contains(func.getString("module_id"))) {
- throw new ForbiddenException("error.permission.nopermission");
- }
- }
+// JSONObject func = permissionPartnerManager.getPartnerFuncById(funcId);
+// if(func!=null && StringUtils.isNotEmpty(func.getString("module_id"))){
+// JSONArray arr = loginUser.getJSONArray("available_module_ids");
+// if (arr == null || !arr.contains(func.getString("module_id"))) {
+// throw new ForbiddenException("error.permission.nopermission");
+// }
+// }
request.setAttribute(CommonConsts.PARTNER_STATUS, loginUser);
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryAttentionMerchants.java b/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryAttentionMerchants.java
new file mode 100644
index 000000000..231803ee5
--- /dev/null
+++ b/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryAttentionMerchants.java
@@ -0,0 +1,49 @@
+package au.com.royalpay.payment.manage.risk.bean;
+
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * Created by yuan on 2018/7/13.
+ */
+public class QueryAttentionMerchants {
+ private String client_moniker;
+
+ private int page = 1;
+ private int limit = 10;
+
+
+
+ public JSONObject toParams() {
+ JSONObject params = new JSONObject();
+ if(StringUtils.isNotEmpty(client_moniker)){
+ params.put("client_moniker", this.client_moniker);
+ }
+ params.put("is_valid", 1);
+ return params;
+ }
+
+ public String getClient_moniker() {
+ return client_moniker;
+ }
+
+ public void setClient_moniker(String client_moniker) {
+ this.client_moniker = client_moniker;
+ }
+
+ 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;
+ }
+}
diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/core/RiskMerchantService.java b/src/main/java/au/com/royalpay/payment/manage/risk/core/RiskMerchantService.java
index a8a2109af..895c501ec 100644
--- a/src/main/java/au/com/royalpay/payment/manage/risk/core/RiskMerchantService.java
+++ b/src/main/java/au/com/royalpay/payment/manage/risk/core/RiskMerchantService.java
@@ -1,10 +1,6 @@
package au.com.royalpay.payment.manage.risk.core;
-import au.com.royalpay.payment.manage.risk.bean.AddRiskDetailLog;
-import au.com.royalpay.payment.manage.risk.bean.DealRiskRecord;
-import au.com.royalpay.payment.manage.risk.bean.QueryRiskDetail;
-import au.com.royalpay.payment.manage.risk.bean.QueryRiskOrder;
-import au.com.royalpay.payment.manage.risk.bean.QueryRiskRecord;
+import au.com.royalpay.payment.manage.risk.bean.*;
import com.alibaba.fastjson.JSONObject;
@@ -32,6 +28,9 @@ public interface RiskMerchantService {
JSONObject getRiskDetails(QueryRiskDetail queryRiskDetail);
+ JSONObject listAttentionMerchants(JSONObject account,QueryAttentionMerchants queryAttention);
+ void addAttentionMerchants(JSONObject account,String client_moniker);
+ void updateAttentionMerchants(JSONObject account,String client_moniker);
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java
index f8f8651a6..0d9b3fdec 100644
--- a/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java
+++ b/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java
@@ -1,21 +1,15 @@
package au.com.royalpay.payment.manage.risk.core.impl;
-import au.com.royalpay.payment.manage.mappers.risk.RiskMerchantDetailLogMapper;
-import au.com.royalpay.payment.manage.mappers.risk.RiskMerchantRecordMapper;
-import au.com.royalpay.payment.manage.mappers.risk.RiskTransactionLogMapper;
-import au.com.royalpay.payment.manage.mappers.risk.RiskWhiteListMapper;
+import au.com.royalpay.payment.manage.mappers.risk.*;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
-import au.com.royalpay.payment.manage.risk.bean.AddRiskDetailLog;
-import au.com.royalpay.payment.manage.risk.bean.DealRiskRecord;
-import au.com.royalpay.payment.manage.risk.bean.QueryRiskDetail;
-import au.com.royalpay.payment.manage.risk.bean.QueryRiskOrder;
-import au.com.royalpay.payment.manage.risk.bean.QueryRiskRecord;
+import au.com.royalpay.payment.manage.risk.bean.*;
import au.com.royalpay.payment.manage.risk.core.RiskMerchantService;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject;
+import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.commons.lang3.StringUtils;
@@ -39,6 +33,8 @@ public class RiskMerchantServiceImpl implements RiskMerchantService {
private RiskWhiteListMapper riskWhiteListMapper;
@Resource
private ClientManager clientManager;
+ @Resource
+ private RiskAttentionMerchantsAMapper riskAttentionMerchantsAMapper;
@Override
@Transactional
@@ -213,4 +209,55 @@ public class RiskMerchantServiceImpl implements RiskMerchantService {
riskMerchantDetailLogMapper.query(queryRiskDetail.toParams(), new PageBounds(queryRiskDetail.getPage(), queryRiskDetail.getLimit())));
}
+
+ @Override
+ public JSONObject listAttentionMerchants(JSONObject account, QueryAttentionMerchants queryAttention) {
+ if (account == null) {
+ throw new BadRequestException("account not exists");
+ }
+ return PageListUtils.buildPageListResult(
+ riskAttentionMerchantsAMapper.query(queryAttention.toParams(), new PageBounds(queryAttention.getPage(), queryAttention.getLimit(), Order.formString("create_time.desc"))));
+ }
+
+ @Override
+ public void addAttentionMerchants(JSONObject account, String client_moniker) {
+ if (account == null) {
+ throw new BadRequestException("account not exists");
+ }
+ JSONObject attentionMerchant = riskAttentionMerchantsAMapper.findByClientMoniker(client_moniker);
+ if(attentionMerchant != null){
+ if(attentionMerchant.getBoolean("is_valid")){
+ throw new BadRequestException("The client has already existed");
+ }else {
+ attentionMerchant.put("is_valid",1);
+ attentionMerchant.put("update_time",new Date());
+ riskAttentionMerchantsAMapper.update(attentionMerchant);
+ return;
+ }
+ }
+ JSONObject client = clientManager.getClientInfoByMoniker(client_moniker);
+ if(client == null){
+ throw new BadRequestException("The client does not exist");
+ }
+ JSONObject attention = new JSONObject();
+ attention.put("client_id",client.getIntValue("client_id"));
+ attention.put("client_moniker",client.getString("client_moniker"));
+ attention.put("is_valid",1);
+ attention.put("create_time",new Date());
+ riskAttentionMerchantsAMapper.save(attention);
+ }
+
+ @Override
+ public void updateAttentionMerchants(JSONObject account, String client_moniker) {
+ if (account == null) {
+ throw new BadRequestException("account not exists");
+ }
+ JSONObject attentionMerchant = riskAttentionMerchantsAMapper.findByClientMoniker(client_moniker);
+ if(attentionMerchant == null){
+ throw new BadRequestException("The client does not exist");
+ }
+ attentionMerchant.put("is_valid",0);
+ attentionMerchant.put("update_time",new Date());
+ riskAttentionMerchantsAMapper.update(attentionMerchant);
+ }
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/web/RiskController.java b/src/main/java/au/com/royalpay/payment/manage/risk/web/RiskController.java
index 45775e2a4..651345395 100644
--- a/src/main/java/au/com/royalpay/payment/manage/risk/web/RiskController.java
+++ b/src/main/java/au/com/royalpay/payment/manage/risk/web/RiskController.java
@@ -1,11 +1,7 @@
package au.com.royalpay.payment.manage.risk.web;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
-import au.com.royalpay.payment.manage.risk.bean.AddRiskDetailLog;
-import au.com.royalpay.payment.manage.risk.bean.DealRiskRecord;
-import au.com.royalpay.payment.manage.risk.bean.QueryRiskDetail;
-import au.com.royalpay.payment.manage.risk.bean.QueryRiskOrder;
-import au.com.royalpay.payment.manage.risk.bean.QueryRiskRecord;
+import au.com.royalpay.payment.manage.risk.bean.*;
import au.com.royalpay.payment.manage.risk.core.RiskMerchantService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
@@ -94,4 +90,18 @@ public class RiskController {
riskMerchantService.addDetailLog(addRiskDetailLog,manager);
}
+ @RequestMapping(value = "/attention", method = RequestMethod.GET)
+ public JSONObject listMerchants(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,QueryAttentionMerchants queryAttention ) {
+ return riskMerchantService.listAttentionMerchants(manager,queryAttention);
+ }
+
+ @RequestMapping(value = "/attention/{client_moniker}", method = RequestMethod.POST)
+ public void addMerchants(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String client_moniker) {
+ riskMerchantService.addAttentionMerchants(manager,client_moniker);
+ }
+
+ @RequestMapping(value = "/attention/{client_moniker}", method = RequestMethod.PUT)
+ public void updateMerchants(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String client_moniker) {
+ riskMerchantService.updateAttentionMerchants(manager,client_moniker);
+ }
}
diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/beans/QueryManagerBean.java b/src/main/java/au/com/royalpay/payment/manage/signin/beans/QueryManagerBean.java
new file mode 100644
index 000000000..da4529722
--- /dev/null
+++ b/src/main/java/au/com/royalpay/payment/manage/signin/beans/QueryManagerBean.java
@@ -0,0 +1,127 @@
+package au.com.royalpay.payment.manage.signin.beans;
+
+import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * Created by yuan on 2018/7/13.
+ */
+public class QueryManagerBean {
+ private String org_id;
+ private String org_id2;
+ private String role;
+ private String username;
+
+ private int page = 1;
+ private int limit = 10;
+
+ public JSONObject toJson(){
+ JSONObject params = new JSONObject();
+ if (StringUtils.isNotEmpty(org_id)){
+ params.put("org_id",org_id);
+ }
+ if (StringUtils.isNotEmpty(org_id2)){
+ params.put("org_id2",org_id2);
+ }
+ if (StringUtils.isNotEmpty(role)){
+ int mask = 0;
+ if(role.equals("1")){
+ mask = ManagerRole.ADMIN.getMask();
+ }
+ if(role.equals("10")){
+ mask = ManagerRole.OPERATOR.getMask();
+ }
+ if(role.equals("100")){
+ mask = ManagerRole.BD_USER.getMask();
+ }
+ if(role.equals("1000")){
+ mask = ManagerRole.FINANCIAL_STAFF.getMask();
+ }
+ if(role.equals("10000")){
+ mask = ManagerRole.SERVANT.getMask();
+ }
+ if(role.equals("100000")){
+ mask = ManagerRole.ACCOUNT_MANAGER.getMask();
+ }
+ if(role.equals("1000000")){
+ mask = ManagerRole.DIRECTOR.getMask();
+ }
+ if(role.equals("10000000")){
+ mask = ManagerRole.SITE_MANAGER.getMask();
+ }
+ if(role.equals("100000000")){
+ mask = ManagerRole.DEVELOPER.getMask();
+ }
+ if(role.equals("1000000000")){
+ mask = ManagerRole.BD_LEADER.getMask();
+ }
+ if(role.equals("10000000000")){
+ mask = ManagerRole.RISK_MANAGER.getMask();
+ }
+ if(role.equals("100000000000")){
+ mask = ManagerRole.GUEST.getMask();
+ }
+ if(role.equals("1000000000000")){
+ mask = ManagerRole.ORG_MANAGER.getMask();
+ }
+ if(mask != 0){
+ params.put("mask",mask);
+ }
+ }
+ if (StringUtils.isNotEmpty(username)){
+ params.put("username",username);
+ }
+ params.put("page",page);
+ params.put("limit",10);
+ return params;
+ }
+
+ public String getOrg_id() {
+ return org_id;
+ }
+
+ public void setOrg_id(String org_id) {
+ this.org_id = org_id;
+ }
+
+ public String getOrg_id2() {
+ return org_id2;
+ }
+
+ public void setOrg_id2(String org_id2) {
+ this.org_id2 = org_id2;
+ }
+
+ public String getRole() {
+ return role;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ 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;
+ }
+}
diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/ManagerAccountsService.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/ManagerAccountsService.java
index 99bb93a41..9cfe39363 100644
--- a/src/main/java/au/com/royalpay/payment/manage/signin/core/ManagerAccountsService.java
+++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/ManagerAccountsService.java
@@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.signin.core;
import au.com.royalpay.payment.manage.signin.beans.ManagerInfo;
import com.alibaba.fastjson.JSONObject;
+import com.github.miemiedev.mybatis.paginator.domain.PageList;
import java.util.List;
@@ -9,7 +10,7 @@ import java.util.List;
* Created by yixian on 2016-07-05.
*/
public interface ManagerAccountsService {
- List listManagers(JSONObject loginManager,JSONObject params);
+ PageList listManagers(JSONObject loginManager, JSONObject params);
void saveManager(ManagerInfo manager, JSONObject loginManager);
@@ -24,4 +25,6 @@ public interface ManagerAccountsService {
List listGroupBds(JSONObject loginManager);
JSONObject getBDConfig(String bd_id);
-}
+
+ List listServants(JSONObject loginManager);
+}
\ No newline at end of file
diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerAccountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerAccountServiceImpl.java
index 8bdc155b6..0d58548cc 100644
--- a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerAccountServiceImpl.java
+++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerAccountServiceImpl.java
@@ -4,20 +4,24 @@ import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
-import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.signin.beans.ManagerInfo;
import au.com.royalpay.payment.manage.signin.core.ManagerAccountsService;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
+import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
+
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
+import com.github.miemiedev.mybatis.paginator.domain.PageList;
+
import org.springframework.stereotype.Service;
-import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
+import javax.annotation.Resource;
+
/**
* Created by yixian on 2016-07-06.
*/
@@ -35,12 +39,12 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
private OrgManager orgManager;
@Override
- public List listManagers(JSONObject loginManager,JSONObject params) {
+ public PageList listManagers(JSONObject loginManager,JSONObject params) {
/* if (loginManager.getInteger("org_id") != null) {
params.put("org_id", loginManager.getIntValue("org_id"));
}*/
orgManager.checkOrgIds(loginManager,params);
- List managers = managerMapper.listAvailable(params, new PageBounds(Order.formString("create_time.desc")));
+ PageList managers = managerMapper.listAvailable(params, new PageBounds(params.getIntValue("page"),params.getIntValue("limit"),Order.formString("create_time.desc")));
for (JSONObject manager : managers) {
int role = manager.getIntValue("role");
manager.put("admin", ManagerRole.ADMIN.hasRole(role));
@@ -133,6 +137,11 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
return financialBDConfigMapper.getBdConfig(bd_id);
}
+ @Override
+ public List listServants(JSONObject loginManager) {
+ return managerMapper.listServants(ManagerRole.SERVANT.getMask());
+ }
+
private void checkOrg(JSONObject loginManager,JSONObject manager){
if (loginManager.getInteger("org_id")!=null){
List orgs = orgMapper.listOrgAndChild(loginManager.getIntValue("org_id"));
diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerAccountsController.java b/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerAccountsController.java
index e1f3652cd..cdb8cd904 100644
--- a/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerAccountsController.java
+++ b/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerAccountsController.java
@@ -2,23 +2,33 @@ package au.com.royalpay.payment.manage.signin.web;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
-import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.permission.manager.RequireManager;
import au.com.royalpay.payment.manage.signin.beans.ManagerInfo;
+import au.com.royalpay.payment.manage.signin.beans.QueryManagerBean;
import au.com.royalpay.payment.manage.signin.core.ManagerAccountsService;
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 au.com.royalpay.payment.tools.utils.PageListUtils;
+
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
-import org.apache.commons.lang3.StringUtils;
+
import org.springframework.validation.Errors;
-import org.springframework.web.bind.annotation.*;
+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.RestController;
-import javax.annotation.Resource;
-import javax.validation.Valid;
import java.util.List;
import java.util.Map;
+import javax.annotation.Resource;
+import javax.validation.Valid;
+
/**
* Created by yixian on 2016-07-05.
*/
@@ -38,15 +48,9 @@ public class ManagerAccountsController {
@RequestMapping(method = RequestMethod.GET)
@RequireManager(role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER})
- public List listManagerss(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager, @RequestParam(required = false) String org_id,@RequestParam(required = false) String org_id2) {
- JSONObject params = new JSONObject();
- if(org_id != null){
- params.put("org_id",org_id);
- }
- if (StringUtils.isNotEmpty(org_id2)) {
- params.put("org_id2", org_id2);
- }
- return managerAccountsService.listManagers(loginManager,params);
+ public JSONObject listManagerss(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager, QueryManagerBean queryManagerBean) {
+
+ return PageListUtils.buildPageListResult(managerAccountsService.listManagers(loginManager,queryManagerBean.toJson()));
}
@RequestMapping(method = RequestMethod.POST)
@@ -83,10 +87,15 @@ public class ManagerAccountsController {
return managerAccountsService.listBDLeaders(loginManager);
}
-
@ManagerMapping(value = "/group/group_bds", method = RequestMethod.GET)
public List listGroupBds(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager) {
return managerAccountsService.listGroupBds(loginManager);
}
+ @ManagerMapping(value = "/roles/servant", method = RequestMethod.GET,role = {ManagerRole.ADMIN})
+ public List listServants(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager) {
+ return managerAccountsService.listServants(loginManager);
+ }
+
+
}
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
new file mode 100644
index 000000000..43094024f
--- /dev/null
+++ b/src/main/java/au/com/royalpay/payment/manage/task/SendUnreadMsgWechatTask.java
@@ -0,0 +1,23 @@
+package au.com.royalpay.payment.manage.task;
+
+import au.com.royalpay.payment.manage.openim.core.CustomerServiceService;
+
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+/**
+ * Created by wangning on 2018/1/2.
+ */
+@Component
+@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true")
+public class SendUnreadMsgWechatTask {
+ @Resource
+ private CustomerServiceService customerServiceService;
+
+// @Scheduled(cron = "0 0/10 * * * ?")
+ public void ofeiOrderCheck() {
+ customerServiceService.sendUnreadWxMsg();
+ }
+}
diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/refund/RefundService.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/refund/RefundService.java
index 4ebe34c71..34c68c90a 100644
--- a/src/main/java/au/com/royalpay/payment/manage/tradelog/refund/RefundService.java
+++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/refund/RefundService.java
@@ -1,7 +1,10 @@
package au.com.royalpay.payment.manage.tradelog.refund;
import au.com.royalpay.payment.manage.analysis.beans.RefundReviewBean;
+
import com.alibaba.fastjson.JSONObject;
+import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
+
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
@@ -44,4 +47,6 @@ public interface RefundService {
JSONObject findReviewOrder(String reviewId);
JSONObject checkRefundAuditFlag();
+
+ JSONObject listUnionAllApply(JSONObject params,PageBounds pagination);
}
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 f37f39041..54635f160 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
@@ -87,7 +87,8 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
throw new RefundExistException();
}
if (apply.isEmpty()) {
- order.put("available", BigDecimal.valueOf(order.getDoubleValue("customer_payment_amount")).subtract(BigDecimal.valueOf(order.getDoubleValue("refund_fee"))).doubleValue());
+ order.put("available", BigDecimal.valueOf(order.getDoubleValue("customer_payment_amount"))
+ .subtract(BigDecimal.valueOf(order.getDoubleValue("refund_fee"))).doubleValue());
return order;
} else {
if (account != null) {
@@ -118,7 +119,8 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
if (undoRefundOrder != null) {
throw new BadRequestException("该笔订单有退款正在处理,请稍后再试!");
}
- order.put("available", BigDecimal.valueOf(order.getDoubleValue("customer_payment_amount")).subtract(BigDecimal.valueOf(order.getDoubleValue("refund_fee"))).doubleValue());
+ order.put("available", BigDecimal.valueOf(order.getDoubleValue("customer_payment_amount"))
+ .subtract(BigDecimal.valueOf(order.getDoubleValue("refund_fee"))).doubleValue());
return order;
}
@@ -143,12 +145,13 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
int clientId = order.getIntValue("client_id");
String currency = order.getString("currency");
- //增加角色审核
+ // 增加角色审核
JSONObject client = clientManager.getClientInfo(clientId);
Assert.notNull(client, "client not exists");
JSONObject clientConfig = clientConfigService.find(clientId);
OperatorType type = account != null ? OperatorType.PARTNER : OperatorType.MANAGER;
- boolean requireAudit = type == OperatorType.PARTNER && PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER && clientConfig.getBooleanValue("enable_refund_auth");
+ boolean requireAudit = type == OperatorType.PARTNER && PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER
+ && clientConfig.getBooleanValue("enable_refund_auth");
logger.debug("applyer type=" + type + "; require audit=" + requireAudit);
paymentApi.clientRefundBalanceCheck(clientId, orderId, currency, feeAmount);
@@ -189,9 +192,9 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
BigDecimal realAmount = original ? fee : CurrencyAmountUtils.toAmount(fee, order.getString("currency"));
JSONObject refundConfig = checkRefundAuditFlag();
- if (partnerAccount!=null && refundConfig != null && refundConfig.size() > 0 && refundConfig.getBoolean("refundAudit")) {
+ if (partnerAccount != null && refundConfig != null && refundConfig.size() > 0 && refundConfig.getBoolean("refundAudit")) {
if (realAmount.compareTo(refundConfig.getBigDecimal("refundAuditAmount")) > 0) {
- //订单需要审核
+ // 订单需要审核
boolean casherRefund = reviewNewRefundOrder(orderId, realAmount, remark, partnerAccount, manager);
if (casherRefund) {
return executeRefund(orderId, realAmount, remark, partnerAccount, manager, order, client);
@@ -204,7 +207,8 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
}
- private JSONObject executeRefund(String orderId, BigDecimal amount, String remark, JSONObject partnerAccount, JSONObject manager, JSONObject order, JSONObject client) {
+ private JSONObject executeRefund(String orderId, BigDecimal amount, String remark, JSONObject partnerAccount, JSONObject manager, JSONObject order,
+ JSONObject client) {
checkOrderUseCustomerCoupon(order, amount);
JSONObject clientConfig = clientConfigService.find(client.getIntValue("client_id"));
OperatorType type = partnerAccount != null ? OperatorType.PARTNER : OperatorType.MANAGER;
@@ -220,12 +224,13 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
operator.put("operator_id", manager.getIntValue("manager_id"));
operator.put("operator", manager.getString("display_name"));
}
- boolean requireAudit = type == OperatorType.PARTNER && PartnerRole.getRole(partnerAccount.getIntValue("role")) == PartnerRole.CASHIER && clientConfig.getBooleanValue("enable_refund_auth");
+ boolean requireAudit = type == OperatorType.PARTNER && PartnerRole.getRole(partnerAccount.getIntValue("role")) == PartnerRole.CASHIER
+ && clientConfig.getBooleanValue("enable_refund_auth");
logger.debug("applyer type=" + type + "; require audit=" + requireAudit);
return paymentApi.refundOrder(orderId, null, amount, remark, operator, type, requireAudit);
}
- //订单使用积分商城优惠券,仅支持全额退款
+ // 订单使用积分商城优惠券,仅支持全额退款
private void checkOrderUseCustomerCoupon(JSONObject order, BigDecimal feeAmount) {
JSONObject couponLogs = couponAccuessLogMapper.findUsedCouponByOrderId(order.getString("order_id"));
if (couponLogs != null) {
@@ -237,7 +242,7 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
}
@Override
-// @Transactional
+ // @Transactional
public JSONObject newReviewRefundOrder(String orderId, BigDecimal fee, boolean original, String remark, JSONObject manager) {
JSONObject reviewOrder = refundReviewMapper.findUnResolveByOrderId(orderId);
reviewOrder.put("status", 1);
@@ -338,7 +343,8 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
private void submitRefund(JSONObject account, JSONObject audition) {
JSONObject refundLog = refundMapper.find(audition.getString("refund_id"));
- boolean platformAuditFlag = auditRefundAndCommitToPlatform(refundLog.getBigDecimal("amount"), audition.getString("remark"), refundLog.getString("order_id"), account);
+ boolean platformAuditFlag = auditRefundAndCommitToPlatform(refundLog.getBigDecimal("amount"), audition.getString("remark"),
+ refundLog.getString("order_id"), account);
if (!platformAuditFlag) {
paymentApi.submitRefund(audition.getString("refund_id"));
}
@@ -347,13 +353,12 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
private boolean auditRefundAndCommitToPlatform(BigDecimal amount, String remark, String orderId, JSONObject account) {
if (amount.compareTo(BigDecimal.ZERO) > 0) {
JSONObject refundConfig = checkRefundAuditFlag();
- if (refundConfig != null && refundConfig.getBoolean("refundAudit") &&
- amount.compareTo(refundConfig.getBigDecimal("refundAuditAmount")) >= 0) {
- //订单需要审核
+ if (refundConfig != null && refundConfig.getBoolean("refundAudit") && amount.compareTo(refundConfig.getBigDecimal("refundAuditAmount")) >= 0) {
+ // 订单需要审核
reviewNewRefundOrder(orderId, amount, remark, account, null);
return true;
}
- //退款
+ // 退款
return false;
} else {
throw new BadRequestException("Refund amount can not be 0");
@@ -411,7 +416,8 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
}
review.put("bd_name", bdNameStr.deleteCharAt(bdNameStr.length() - 1).toString());
JSONObject order = orderMapper.find(review.getString("order_id"));
- review.put("available", BigDecimal.valueOf(order.getDoubleValue("customer_payment_amount")).subtract(BigDecimal.valueOf(order.getDoubleValue("refund_fee"))).doubleValue());
+ review.put("available", BigDecimal.valueOf(order.getDoubleValue("customer_payment_amount"))
+ .subtract(BigDecimal.valueOf(order.getDoubleValue("refund_fee"))).doubleValue());
review.put("create_time", order.getDate("create_time"));
review.put("channel", order.getString("channel"));
return review;
@@ -427,6 +433,15 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
return refundConfig;
}
+ @Override
+ public JSONObject listUnionAllApply(JSONObject params, PageBounds pagination) {
+ if(params.get("cleint_id")==null && params.get("client_ids")==null){
+ return null;
+ }
+ return PageListUtils.buildPageListResult(refundMapper.listUnionAllApply(params, pagination));
+
+ }
+
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.publisher = applicationEventPublisher;
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index a5ac9569e..a533935d1 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -112,6 +112,9 @@ 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
+
#清算银行配置
settle.abafile.default-bank=CBA
diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml
index 63a760c86..addc41843 100644
--- a/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml
+++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml
@@ -2,40 +2,27 @@
-select client_moniker,active_time,IFNULL(count(org_id),0) as count_ordernum,ifnull(sum(pmt_transactions.transaction_amount),0) as sum_ordernum
-from act_charity
-left JOIN pmt_transactions on act_charity.client_id = pmt_transactions.client_id
-and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=act_charity.active_time
-
-GROUP BY act_charity.client_id order by sum_ordernum desc
+ select count(DISTINCT order_id) as count_ordernum ,client_moniker,active_time,ifnull(sum(pmt_transactions.clearing_amount),0) as sum_ordernum
+ from act_charity
+ left JOIN pmt_transactions on act_charity.client_id = pmt_transactions.client_id
+ and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=act_charity.active_time
+ and pmt_transactions.transaction_time<'2018-09-01' and pmt_transactions.transaction_time>='2018-07-09'
+ and pmt_transactions.channel != 'Settlement'
+ GROUP BY act_charity.client_id order by count_ordernum desc
-
-
-
- select DATE_FORMAT(pmt_transactions.transaction_time,'%Y-%m-%d') as weekstart from act_charity
- inner JOIN pmt_transactions on act_charity.client_id = pmt_transactions.client_id
- where dayofweek(pmt_transactions.transaction_time)=2 and pmt_transactions.transaction_time>=#{begin} and pmt_transactions.transaction_time<=#{end}
- group by weekstart order by weekstart asc;
-
-
- select count(pmt_transactions.org_id) as count_ordernum,ifnull(sum(pmt_transactions.transaction_amount),0) as sum_ordernum from act_charity left JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id
- and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=#{begin} and pmt_transactions.transaction_time<=#{end}
+ select count(DISTINCT order_id) as count_ordernum,date_format(pmt_transactions.transaction_time,'%Y-%m-%d') as orderdate,client_moniker,ifnull(sum(pmt_transactions.clearing_amount),0) as sum_ordernum from act_charity inner JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id
+ and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=#{begin} and pmt_transactions.transaction_time<=#{end} and pmt_transactions.transaction_time>=act_charity.active_time
+ and pmt_transactions.channel != 'Settlement'
+ and pmt_transactions.transaction_time<'2018-09-01' and pmt_transactions.transaction_time>='2018-07-09'
+ group by date_format(pmt_transactions.transaction_time,'%Y-%m-%d')
- select act_charity.client_moniker,((count(pmt_transactions.org_id)) * 0.01) as chair_ordernum,ifnull(sum(pmt_transactions.transaction_amount),0) as sum_ordernum from act_charity left JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id
- and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=#{begin} and pmt_transactions.transaction_time<=#{end}
- GROUP BY act_charity.client_moniker order by sum_ordernum desc
-
+ select count(DISTINCT pmt_transactions.order_id) *0.01 as chair_ordernum,act_charity.client_moniker,ifnull(sum(pmt_transactions.clearing_amount),0) as sum_ordernum from act_charity left JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id
+ and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=#{begin} and pmt_transactions.transaction_time<=#{end} and pmt_transactions.transaction_time>=act_charity.active_time
+ and pmt_transactions.transaction_time<'2018-09-01' and pmt_transactions.transaction_time>='2018-07-09'
+ GROUP BY act_charity.client_moniker order by chair_ordernum desc
\ No newline at end of file
diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/customers/CustomerEncourageMoneyAccessLogMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/customers/CustomerEncourageMoneyAccessLogMapper.xml
index 83a1ab531..4f115c7d3 100644
--- a/src/main/resources/au/com/royalpay/payment/manage/mappers/customers/CustomerEncourageMoneyAccessLogMapper.xml
+++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/customers/CustomerEncourageMoneyAccessLogMapper.xml
@@ -42,4 +42,7 @@
GROUP BY access_date
ORDER BY access_date DESC
+
+ select sum(actural_amount) actural_amount from cus_encourage_money_access_log where member_id = #{memberId} and event_id = #{eventId};
+
\ No newline at end of file
diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/customers/CustomerEncourageMoneyUseLogMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/customers/CustomerEncourageMoneyUseLogMapper.xml
index 4610889fc..4d025397b 100644
--- a/src/main/resources/au/com/royalpay/payment/manage/mappers/customers/CustomerEncourageMoneyUseLogMapper.xml
+++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/customers/CustomerEncourageMoneyUseLogMapper.xml
@@ -43,4 +43,7 @@
INNER JOIN pmt_orders o ON o.order_id=u.order_id AND o.status>4
WHERE u.transaction_id is null
+
+ select sum(use_amount) use_amount from cus_encourage_money_use_log where member_id = #{memberId} and event_id = #{eventId} and transaction_id is not null
+
\ No newline at end of file
diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/financial/FinancialBDConfigMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/financial/FinancialBDConfigMapper.xml
index 25eadc450..55dd4eb35 100644
--- a/src/main/resources/au/com/royalpay/payment/manage/mappers/financial/FinancialBDConfigMapper.xml
+++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/financial/FinancialBDConfigMapper.xml
@@ -9,7 +9,8 @@
c.bd_level,
c.city,
c.get_prize,
- c.bd_group
+ c.bd_group,
+ c.kpi_amount
FROM sys_managers m
LEFT JOIN financial_bd_config c ON c.manager_id = m.manager_id
WHERE m.role & 4 > 0 AND m.is_valid = 1 AND (m.org_id = 1 OR m.org_id IS NULL)
diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/financial/FinancialBDPrizeRecordMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/financial/FinancialBDPrizeRecordMapper.xml
index 63430d2be..24f56ef19 100644
--- a/src/main/resources/au/com/royalpay/payment/manage/mappers/financial/FinancialBDPrizeRecordMapper.xml
+++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/financial/FinancialBDPrizeRecordMapper.xml
@@ -8,7 +8,7 @@
SELECT
- r.*,
+ r.*,l.kpi_amount,
sum(total_prize) total_prize,
sum(send_prize) total_send_prize,
sum(total_donation) total_donation
diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/notice/NoticePartnerMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/notice/NoticePartnerMapper.xml
index 9ce2d1e10..6f0b045a0 100644
--- a/src/main/resources/au/com/royalpay/payment/manage/mappers/notice/NoticePartnerMapper.xml
+++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/notice/NoticePartnerMapper.xml
@@ -28,4 +28,12 @@
LEFT JOIN sys_accounts a ON a.account_id = nc.read_id
WHERE nc.status = '1' AND nc.notice_id = #{notice_id}
+
+
+ select count(*) from sys_notice_client c left join sys_notice n on n.notice_id = c.notice_id
+ where c.`status` = #{status} and c.client_id = #{client_id}
+
+ and n.is_to_app=#{is_to_app}
+
+
\ 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 1d4502713..d2c2b55de 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
@@ -69,4 +69,62 @@
and DATE_FORMAT(create_time,'%Y-%m-%d') = DATE_FORMAT(#{today},'%Y-%m-%d');
+
+ SELECT
+ order_id order_id,
+ client_id client_id,
+ create_time create_time,
+ confirm_time confirm_time,
+ operator_name operator_name,
+ `status` `status` ,
+ 1 type
+ FROM
+ pmt_refunds
+
+
+ and client_id = #{client_id}
+
+
+ and create_time <= #{start_time}
+
+
+ and create_time >= #{end_time}
+
+
+ client_id in
+
+ #{item}
+
+
+
+ UNION ALL
+ SELECT
+ order_id order_id,
+ client_id client_id,
+ applytime create_time,
+ audittime confirm_time,
+ auditorname operator_name,
+ audit_result `status` ,
+ 2 type
+ FROM
+ pmt_refund_applies
+
+
+ and client_id = #{client_id}
+
+
+ and applytime <= #{start_time}
+
+
+ and applytime >= #{end_time}
+
+
+ client_id in
+
+ #{item}
+
+
+
+ order by create_time desc
+
\ No newline at end of file
diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml
index ad74bfa4d..c6911c549 100644
--- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml
+++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml
@@ -100,14 +100,14 @@
SELECT
- count(t.transaction_id) order_count,
- ifnull(sum(if(t.transaction_type='Credit' and t.refund_id is null and o.currency!='CNY',o.display_amount,0)),0)
+ count(DISTINCT o.order_id) order_count,
+ ifnull(sum(if(t.transaction_type='Credit' and t.refund_id is null and t.system_generate=0 and o.currency!='CNY',o.display_amount,0)),0)
display_amount,
- ifnull(sum(if(t.transaction_type='Credit' and t.refund_id is null and o.currency!='CNY' and
+ ifnull(sum(if(t.transaction_type='Credit' and t.refund_id is null and t.system_generate=0 and o.currency!='CNY' and
o.pre_authorization=1,o.display_amount,0)),0) pre_display_amount,
- ifnull(sum(if(t.transaction_type='Credit' and t.refund_id is null and o.currency='CNY',o.display_amount,0)),0)
+ ifnull(sum(if(t.transaction_type='Credit' and t.refund_id is null and t.system_generate=0 and o.currency='CNY',o.display_amount,0)),0)
cny_display_amount,
- ifnull(sum(if(t.transaction_type='Credit' and t.refund_id is null and o.currency='CNY' and
+ ifnull(sum(if(t.transaction_type='Credit' and t.refund_id is null and t.system_generate=0 and o.currency='CNY' and
o.pre_authorization=1,o.display_amount,0)),0) pre_cny_display_amount,
ifnull(sum(if(t.transaction_type='Credit',t.clearing_amount,0)),0) paid_fee,
sum(if(t.transaction_type='Debit' AND t.refund_id is NOT NULL,t.clearing_amount,0))*-1
@@ -495,10 +495,7 @@
INNER JOIN pmt_orders o ON o.order_id = t.order_id
INNER JOIN sys_clients c ON c.client_id = o.client_id AND c.org_id = 1
WHERE year(o.create_time) = #{year} AND month(o.create_time) = #{month} AND t.channel != 'Settlement'
-
- and t.channel not in ('Alipay','Bestpay')
-
-
+
and t.channel = #{channel}
GROUP BY o.client_id, trade_date
@@ -507,7 +504,7 @@
SELECT
- sum(if(t.transaction_type = 'Credit', t.clearing_amount, -t.clearing_amount))
+ ifnull(sum(if(t.transaction_type = 'Credit', t.clearing_amount, -t.clearing_amount)),0)
total
FROM pmt_transactions t
INNER JOIN pmt_orders o ON o.order_id = t.order_id
@@ -528,6 +525,30 @@
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})
+
+
+ SELECT
+ sum(if(t.transaction_type = 'Credit', t.clearing_amount, -t.clearing_amount))
+ total
+ FROM pmt_transactions t
+ INNER JOIN pmt_orders o ON o.order_id = t.order_id
+ INNER JOIN sys_clients c ON c.client_id = o.client_id AND c.org_id = 1
+ WHERE year(o.create_time) = #{year} AND month(o.create_time) = #{month}
+ AND(
+ t.transaction_type = 'Credit'
+ OR t.refund_id IS NOT NULL
+ )
+ AND(
+ o. STATUS =5
+ OR o. STATUS =6
+ OR o. STATUS =7
+ )
+ and t.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.city='Sydney')
+
+
+
+
+ SELECT a.*,c.client_moniker client_moniker FROM sys_accounts a left join sys_clients c on c.client_id = a.client_id
+
+
+ and a.client_id = #{clientId}
+
+
+ and a.username in (
+
+ #{item}
+
+ )
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientBDMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientBDMapper.xml
index e7a73f702..d525812a4 100644
--- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientBDMapper.xml
+++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientBDMapper.xml
@@ -20,7 +20,8 @@
SELECT
b.*,
c.bd_level,
- c.get_prize
+ c.get_prize,
+ c.kpi_amount
FROM sys_client_bd b
LEFT JOIN financial_bd_config c ON c.manager_id = b.bd_id
WHERE client_id = #{client_id} AND start_date <= #{date} AND (end_date > #{date} OR end_date IS NULL) AND
diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml
index 7224d8e2d..ef9a4a2ff 100644
--- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml
+++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml
@@ -168,7 +168,7 @@
SELECT
- company_name,short_name,client_moniker,alipayindustry,address,suburb,state,postcode,business_hours,company_phone,description
+ company_name,short_name,client_moniker,alipayindustry,address,suburb,state,postcode,business_hours,company_phone,merchant_introduction
from sys_clients
(approve_result=1 or (approve_result=2 and (source=1 or source=2)))
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 7f94617cf..3237c85c0 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
@@ -27,8 +27,15 @@
) o
ON m.wx_openid = o.wechat_openid
- m.org_id=#{org_id}
- m.org_id in
+
+
+ and m.username like #{username_pattern}
+
+
+ and 0 ]]>
+
+ AND m.org_id=#{org_id}
+ AND m.org_id in
#{org_id}
and m.is_valid=1
@@ -87,4 +94,14 @@
WHERE role & #{mask} >0 AND wx_openid IS NOT NULL AND is_valid = 1
]]>
+
+
+ 0 AND org_id IS NULL AND is_valid = 1
+ ]]>
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysCustomerServiceMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysCustomerServiceMapper.xml
new file mode 100644
index 000000000..ff15768e0
--- /dev/null
+++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysCustomerServiceMapper.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ select user_id from sys_customer_service
+ where `onoff` = 1
+
+
+
+ udpate sys_customer_servie
+ set status = #{status}
+ where manager_id = #{managerId}
+
+
+ select s.user_id,s.onoff,m.* from
+ sys_customer_service s left join sys_managers m
+ on s.manager_id = m.manager_id
+
+
\ No newline at end of file
diff --git a/src/main/resources/templates/activity/encourage_money/desc.html b/src/main/resources/templates/activity/encourage_money/desc.html
index e5822f21d..595bfe20e 100644
--- a/src/main/resources/templates/activity/encourage_money/desc.html
+++ b/src/main/resources/templates/activity/encourage_money/desc.html
@@ -21,7 +21,7 @@
-
欢迎使用微信支付
+
欢迎使用RoyalPay支付
奖励再翻倍
@@ -32,7 +32,7 @@
- 用户在支持微信支付的商户进行消费,金额≥10澳币 时,
+ 用户在支持RoyalPay的商户使用微信、支付宝进行消费,金额≥10澳币 时,
立即获得随机鼓励金。最高可达888元,每人每天可领取三次 。
@@ -68,9 +68,9 @@
鼓励金仅在活动期间有效,活动结束鼓励金自动清零。
-
- 查看活动商家
-
+
+
+
-
+
活动期间任意消费满10澳币,获随机鼓励金
@@ -29,26 +32,26 @@
diff --git a/src/main/resources/templates/customer_service.html b/src/main/resources/templates/customer_service.html
new file mode 100644
index 000000000..6a28a917e
--- /dev/null
+++ b/src/main/resources/templates/customer_service.html
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/main/ui/manage.html b/src/main/ui/manage.html
index a5e3f5bdb..f8e71615b 100644
--- a/src/main/ui/manage.html
+++ b/src/main/ui/manage.html
@@ -120,6 +120,12 @@ margin-bottom: 10%;"/>
diff --git a/src/main/ui/static/actchairty/templates/act_chairty_merchants.html b/src/main/ui/static/actchairty/templates/act_chairty_merchants.html
index b66d46696..dd6f2f8b9 100644
--- a/src/main/ui/static/actchairty/templates/act_chairty_merchants.html
+++ b/src/main/ui/static/actchairty/templates/act_chairty_merchants.html
@@ -23,7 +23,7 @@
-
+
diff --git a/src/main/ui/static/activity/loving_merchants/loving_merchants_intro.html b/src/main/ui/static/activity/loving_merchants/loving_merchants_intro.html
index fa4b039fd..1c53bc149 100644
--- a/src/main/ui/static/activity/loving_merchants/loving_merchants_intro.html
+++ b/src/main/ui/static/activity/loving_merchants/loving_merchants_intro.html
@@ -28,7 +28,7 @@
-
+
diff --git a/src/main/ui/static/boot/managerMainApp.js b/src/main/ui/static/boot/managerMainApp.js
index a0d12ce53..b649f08a1 100644
--- a/src/main/ui/static/boot/managerMainApp.js
+++ b/src/main/ui/static/boot/managerMainApp.js
@@ -176,6 +176,11 @@ define(['angular', 'angularSanitize', 'angularAnimate', 'angularMessages', 'uiRo
// $scope.showQrCode(resp.data.url);
})
}
+ $scope.customerService = function () {
+ $http.put('/sys/openim/check').then(function (resp) {
+ window.open('/service_client.html?key='+resp.data.appkey+'&p='+resp.data.password+'&uid='+resp.data.user_id,'_blank');
+ });
+ }
}]);
app.controller('changePwdCtrl', ['$scope', '$http', function ($scope, $http) {
diff --git a/src/main/ui/static/config/bdprize/bdprize.js b/src/main/ui/static/config/bdprize/bdprize.js
index 1d61028af..d444fb858 100644
--- a/src/main/ui/static/config/bdprize/bdprize.js
+++ b/src/main/ui/static/config/bdprize/bdprize.js
@@ -39,9 +39,12 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
})
}]);
- app.controller('bdPrizeRootCtrl', ['$scope', '$http', '$uibModal', 'commonDialog', function ($scope, $http, $uibModal, commonDialog) {
+ app.controller('bdPrizeRootCtrl', ['$scope', '$http', '$uibModal', 'commonDialog','$filter', function ($scope, $http, $uibModal, commonDialog,$filter) {
$scope.params = {year: new Date().getFullYear()};
+ $scope.generate = {};
$scope.availableYears = [new Date().getFullYear() - 1, new Date().getFullYear()];
+ $scope.kpiRanges = [{value: 1, label: '0-50%'}, {value: 2, label: '50%~80%'}, {value: 3, label: '80%~100%'},
+ {value: 4, label: '100%-120%'}, {value: 5, label: '>=120%'}];
$scope.initMonth = function (year) {
$scope.params.year = year;
$scope.months = [];
@@ -72,27 +75,37 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
};
$scope.getYearReports(new Date().getFullYear());
$scope.generateReport = function () {
+ if (!$scope.generate.month) {
+ commonDialog.alert({
+ type: 'error', title: 'Error', content: 'Select a month first!'
+ });
+ return;
+ }
commonDialog.confirm({
title: 'Warning',
content: 'This operation will clear the result of last month generated before. Are you sure?'
}).then(function () {
- $http.post('/sys/bd_prize/generate_record', null, {timeout: 60000}).then(function () {
+ $scope.generate.status = {};
+ var params = {month: $filter('date')($scope.generate.month, 'yyyy-MM')};
+ $http.post('/sys/bd_prize/generate_record/'+params.month, null, {timeout: 60000}).then(function (resp) {
+ $scope.generate.status = null;
commonDialog.alert({title: 'Success', content: 'Generate Finished', type: 'success'});
$scope.getYearReports($scope.params.year);
}, function (resp) {
- commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
+ commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
+ $scope.generate.status = null;
})
})
};
$scope.loadRateConfigs = function () {
$http.get('/sys/bd_prize/config/rates').then(function (resp) {
$scope.bd_rate_configs = resp.data;
- $scope.bd_rate_ranges = [];
- var rangeStart = [];
+ $scope.kpi_ranges = [];
+ var kpiStart = [];
angular.forEach($scope.bd_rate_configs, function (cfg) {
- if (rangeStart.indexOf(cfg.rate_from) < 0) {
- rangeStart.push(cfg.rate_from);
- $scope.bd_rate_ranges.push(cfg);
+ if (kpiStart.indexOf(cfg.kpi_range) < 0) {
+ kpiStart.push(cfg.kpi_range);
+ $scope.kpi_ranges.push(cfg);
}
})
})
@@ -136,7 +149,10 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
value: 3,
label: '>=7 Months'
}];
- $scope.filter = {bd_level: 1, months: 1};
+ $scope.kpiRanges = [{value: 1, label: '0-50%'}, {value: 2, label: '50%~80%'}, {value: 3, label: '80%~100%'},
+ {value: 4, label: '100%-120%'}, {value: 5, label: '>=120%'}];
+ $scope.clientRate = [{value: 0.6, label: '0.6-0.79'}, {value: 0.8, label: '0.8-2.0'}];
+ $scope.filter = {bd_level: 1,rate_from:0.6};
$scope.rates = rates;
$scope.submitRates = function () {
var validation = null;
@@ -191,7 +207,7 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
app.controller('bdCommissionConfigCtrl', ['$scope', '$state', '$http', '$filter', 'monModal', function ($scope, $state, $http, $filter, monModal) {
$scope.monModal = monModal;
$scope.params = {year: new Date().getFullYear()};
- $scope.bdtypes = [{id: 1, label: 'Leader'}, {id: 2, label: 'Manager'}, {id: 3, label: 'Director'}];
+ $scope.bdtypes = [{id: 1, label: 'BD Manager'}, {id: 2, label: 'KA Manager'}, {id: 3, label: 'Sydney GM'},{id: 4, label: 'COO'},{id: 5, label: 'NJ Department'}];
// $scope.bdmon;
// $scope.newSwitch;
$scope.initMonth = function (year) {
@@ -209,6 +225,34 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
var end = $filter('date')(new Date(), 'yyyy-MM');
return start <= mon && end >= mon
};
+ $scope.getBDLevels = function () {
+ $http.get('/sys/bd_prize/config/bd_levels').then(function (resp) {
+ $scope.bds = resp.data;
+ })
+ };
+ $scope.getBDLevels();
+ $scope.chooseLastConfig = function (mon) {
+ var index = $scope.months.indexOf(mon);
+ if(index == 0){
+ var year = new Date().getFullYear();
+ year--;
+ mon = year + '-12';
+ }else {
+ mon = $scope.months[index-1];
+ }
+ $http.get('/sys/bd_prize/commission/le_ma/' + mon).then(function (resp) {
+ $scope.bdlm = [];
+ angular.forEach(resp.data,function (e) {
+ var bdC = {};
+ bdC.commission_start_amount = e.commission_start_amount;
+ bdC.commission_end_amount = e.commission_end_amount;
+ bdC.bd_commission_rate = e.bd_commission_rate;
+ bdC.bd_type = e.bd_type;
+ $scope.bdlm.push(bdC);
+ });
+ $scope.listConfig = true;
+ })
+ };
$scope.listCurrentMonBDCommission = function (mon) {
$http.get('/sys/bd_prize/commission/le_ma/' + mon).then(function (resp) {
$scope.bdlm = resp.data;
@@ -266,6 +310,24 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
})
}
}
+ $scope.submitBdCommmissionConfig = function (mon, bds) {
+ $scope.check = true;
+ $scope.errmsg = null;
+ angular.forEach(bds, function (data, index) {
+ if(data.get_prize){
+ if (!data.kpi_amount) {
+ $scope.errmsg = "BD kpi Amount not be null";
+ $scope.check = false;
+ return;
+ }
+ }
+ });
+ if ($scope.check) {
+ $http.post('/sys/bd_prize/commission/kpi/update/' + mon, bds).then(function (resp) {
+ $scope.$close();
+ })
+ }
+ }
}]);
app.controller('bdPrizeMonthReportCtrl', ['$scope', '$http', 'report', function ($scope, $http, report) {
$scope.report = report.data;
diff --git a/src/main/ui/static/config/bdprize/templates/bd_commission_config_dialog.html b/src/main/ui/static/config/bdprize/templates/bd_commission_config_dialog.html
index 377cc43ca..4a5a96951 100644
--- a/src/main/ui/static/config/bdprize/templates/bd_commission_config_dialog.html
+++ b/src/main/ui/static/config/bdprize/templates/bd_commission_config_dialog.html
@@ -1,54 +1,144 @@
+
-
+
+
+
+
+
+
+
+
+
+ 完成当月指标低于 51%,提成按照 0.005%提取
+ 完成当月指标高于 80%,提成按照 0.008%提取
+ 完成当月指标 100%,提成按照 0.01%
+
+
+
+
+
+ 完成月度指标,当月部门提成为该部门总流水的 0.01%
+ 未完成月度指标,当月部门提成为该部门总流水的 0.005%;
+
+
+
+
+
+ 完成月度指标,当月提成为该分公司总流水的 0.005%
+ 未完成月度指标,当月提成为该分公司总流水的 0.0025%
+
+
+
+
+
+ 完成月度指标,当月提成为公司总流水的 0.01%
+ 未完成月度指标,当月提成为公司总流水的 0.005%
+
+
+
+
+
+ 完成 KPI 按照 0.03%提取;未完成 KPI 按照 0.02%提取
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/ui/static/config/bdprize/templates/bd_prize_month_report.html b/src/main/ui/static/config/bdprize/templates/bd_prize_month_report.html
index 7734b95f5..c8ccb0cef 100644
--- a/src/main/ui/static/config/bdprize/templates/bd_prize_month_report.html
+++ b/src/main/ui/static/config/bdprize/templates/bd_prize_month_report.html
@@ -41,9 +41,9 @@
-
BD Taotal Commission: ${{report.WechatReport.total_prize}}
- BD Taotal Send: ${{report.WechatReport.total_send_prize}}
- BD Taotal Fund: ${{report.WechatReport.total_donation}}
+ BD Total Commission: ${{report.WechatReport.total_prize}}
+ BD Total Send: ${{report.WechatReport.total_send_prize}}
+ BD Total Fund: ${{report.WechatReport.total_donation}}
@@ -54,7 +54,7 @@
BD Total Commission: ${{report.AlipayReport.total_prize}}
- BD Taotal Send: ${{report.AlipayReport.total_send_prize}}
+ BD Total Send: ${{report.AlipayReport.total_send_prize}}
BD Total Fund: ${{report.AlipayReport.total_donation}}
@@ -65,9 +65,9 @@
-
BD Taotal Commission: ${{report.BestpayReport.total_prize}}
- BD Taotal Send: ${{report.BestpayReport.total_send_prize}}
- BD Taotal Fund: ${{report.BestpayReport.total_donation}}
+ BD Total Commission: ${{report.BestpayReport.total_prize}}
+ BD Total Send: ${{report.BestpayReport.total_send_prize}}
+ BD Total Fund: ${{report.BestpayReport.total_donation}}
@@ -79,6 +79,7 @@
BD Name
+ KPI
BD Level
Transaction Amount
Total Commission
@@ -91,8 +92,12 @@
{{log.bd_name}}
{{log.bd_name}} (Left Company)
+
+ {{log.kpi_amount}}
+ 0.00
+
-
+ {{log.total_amount|currency:'AUD '}}
@@ -110,7 +115,7 @@
-
+
@@ -152,18 +157,44 @@
-->
-
-
-
-
- Transaction Amount:
-
-
- Total Commission:
-
+
+
+
+
+ Transaction Amount:
+
+
+ Total Commission:
+
+
+
+
+
+
+ Transaction Amount:
+
+
+ Total Commission:
+
+
+
+
+
+
+
+
+
+ Transaction Amount:
+
+
+ Total Commission:
+
+
+
+
diff --git a/src/main/ui/static/config/bdprize/templates/bd_prize_root.html b/src/main/ui/static/config/bdprize/templates/bd_prize_root.html
index 460135274..23183fd11 100644
--- a/src/main/ui/static/config/bdprize/templates/bd_prize_root.html
+++ b/src/main/ui/static/config/bdprize/templates/bd_prize_root.html
@@ -9,9 +9,25 @@
-
Generate Report
-
Edit Rate Config
-
Edit BD Level
+
+
+
@@ -36,15 +52,15 @@
@@ -59,49 +75,48 @@
BD Level
- 费率
- 费率
- Junior BD
- Intermediate BD
- Senior BD
+ KPI完成度
+ Junior BD
+ Intermediate BD
+ Senior BD
- 商户开通时长
- 1-3个月
- 4-6个月
- >=7个月
- 1-3个月
- 4-6个月
- >=7个月
- 1-3个月
- 4-6个月
- >=7个月
+ 费率
+ 0.6-0.79
+ 0.8-2.0
+ 0.6-0.79
+ 0.8-2.0
+ 0.6-0.79
+ 0.8-2.0
-
+
-
-
+
-
+ ng-bind="(bd_rate_configs|filter:{kpi_range:range.kpi_range,bd_level:level,rate_from:0.6})[0].prize_rate+'%'">
+ ng-bind="(bd_rate_configs|filter:{kpi_range:range.kpi_range,bd_level:level,rate_from:0.8})[0].prize_rate+'%'">
补充说明
- 商户费率变更,提成比随之变更
- 商户开通时长从商户开通时间起算
- 后台系统自主申请商户,提成按照前三个月0.05%,后期0.01%发放,自主申请商户在详情列表中的Client Source标注为Apply
- 调岗人员移交的商户,移交后6个月内移交人员和接收人员平分提成,应在商户BD配置里进行设置,分配比例请关注详情列表中的Coefficient,正常情况下应当为1
- 离职人员移交的商户,接收人员享受一半提成,另一半作为BD福利基金,离职转交商户在详情列表中用红色标注
- BD提成按月发放
- 每月发放总额的80%,剩余20%于每年年底,即12月25日圣诞节前发放
+ 按月度发放
+ 每月发放总提成额度的 80%,剩余 20%按照“年度考评分数比例”于每年年底即 12 月 25 日圣诞前发放
提前离职者,20%提成不予发放
+ 年度考评(根据销管中心每月考评表打分制进行统计)按照考评分数对应比例发放 20%的占比部分,扣下部分如果第二年考评超出一定评分 110%可以补发;同样,如果年度考评分数超过 100 分按照同比例发放
+ 商户开通后连续 1 个月未产生流水的,上交主管,由主管重新分配
+ 连续 2 个月不产生流水的商户,由销管部统一收回,重新分配
+ 分配后的商户流水客户专员只能占一半
+ 离职及调岗人员商户统一上交销管中心,由销管中心 leader 及跨境事业部总监相互协商及相互监督,按照公平公正的原则, 做出分配方案,并由总监确认后统一分配。调岗人员移交的商户,在移交后 1 个月内移交人员和接收人员平分该商家产生的提成,移交人员需配合接收人员做好商户对接和短期内的商户维护;
+ 离职人员交接的商户提成,接收人员享受一半的提成,另一半作为跨境客服专员福利会基金
+ 被客户投诉情况严重者,此商户由销管中心无条件收回重新分配
+ 活动执行未传达到位且出现舞弊、徇私、懒惰等行为的,商户上交由销管中心统一分配
+ 后期维护不及时,连续一个月不跟踪者,此商户上交销管中心,统一重新分配
+ 以上分配,销管中心 leader 和跨境支付事业部商量好之后需做好方案后经 COO 审批方可执行
diff --git a/src/main/ui/static/config/bdprize/templates/rate_config_dialog.html b/src/main/ui/static/config/bdprize/templates/rate_config_dialog.html
index f35ca90d7..397bc2ec9 100644
--- a/src/main/ui/static/config/bdprize/templates/rate_config_dialog.html
+++ b/src/main/ui/static/config/bdprize/templates/rate_config_dialog.html
@@ -9,23 +9,29 @@
-
- Client Rate
+ KPI完成度
BD Rate
-
- {{rate.rate_from}}-{{rate.rate_to}}
+
+
-
+
{{manager.nickname}}
@@ -377,6 +383,22 @@
+
diff --git a/src/main/ui/static/config/sysconfigs/sysconfigs.js b/src/main/ui/static/config/sysconfigs/sysconfigs.js
index ccda9b062..a6f0bcfc9 100644
--- a/src/main/ui/static/config/sysconfigs/sysconfigs.js
+++ b/src/main/ui/static/config/sysconfigs/sysconfigs.js
@@ -34,6 +34,10 @@ define(['angular', 'uiRouter'], function (angular) {
url: '/mail',
templateUrl: '/static/config/sysconfigs/templates/mail_subscribe.html',
controller: 'mailSubscribeCtrl'
+ }).state('sysconfig.servantsConfig', {
+ url: '/servantsConfig',
+ templateUrl: '/static/config/sysconfigs/templates/servants_config.html',
+ controller: 'servantsConfigCtrl'
})/*.state('sysconfig.payment_config',{
url: '/payment_config',
templateUrl: '/static/config/sysconfigs/templates/payemnt_config.html',
@@ -61,6 +65,25 @@ define(['angular', 'uiRouter'], function (angular) {
app.controller('sysConfigCtrl', ['$scope', function ($scope) {
}]);
+
+ app.controller('servantsConfigCtrl', ['$scope','$http','commonDialog', function ($scope,$http,commonDialog) {
+ $scope.loadServants = function () {
+ $http.get('/sys/manager_accounts/roles/servant').then(function (resp) {
+ $scope.servants = resp.data;
+ })
+ };
+ $scope.loadServants();
+ $scope.onoff = function (servant) {
+ var param = {onoff:servant.onoff};
+ $http.put('/sys/openim/servant/onoff',param).then(function (resp) {
+ },function (resp) {
+ commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
+ });
+ };
+ }]);
+
+
+
app.controller('basicConfigCtrl', ['$scope', '$http', 'commonDialog', function ($scope, $http, commonDialog) {
$scope.loadSysConfigs = function () {
$http.get('/sysconfig/base').then(function (resp) {
diff --git a/src/main/ui/static/config/sysconfigs/templates/servants_config.html b/src/main/ui/static/config/sysconfigs/templates/servants_config.html
new file mode 100644
index 000000000..0db5725b7
--- /dev/null
+++ b/src/main/ui/static/config/sysconfigs/templates/servants_config.html
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/ui/static/config/sysconfigs/templates/sysconfig.html b/src/main/ui/static/config/sysconfigs/templates/sysconfig.html
index 4a8705ecd..78162910a 100644
--- a/src/main/ui/static/config/sysconfigs/templates/sysconfig.html
+++ b/src/main/ui/static/config/sysconfigs/templates/sysconfig.html
@@ -30,6 +30,11 @@
Partner Permission Config
+
+
+ Servants Config
+
+
diff --git a/src/main/resources/templates/activity/encourage_money/my.html b/src/main/resources/templates/activity/encourage_money/my.html
index 6d15bf1db..a5b4f9cf4 100644
--- a/src/main/resources/templates/activity/encourage_money/my.html
+++ b/src/main/resources/templates/activity/encourage_money/my.html
@@ -1,5 +1,5 @@
-
+