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

master
yixian 6 years ago
commit dd66355486

@ -156,6 +156,7 @@
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
<version>2.2.4</version> <version>2.2.4</version>
</dependency> </dependency>
<!--jpush end --> <!--jpush end -->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
@ -164,7 +165,11 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>com.taobao.api</groupId>
<artifactId>taobao-sdk-java-auto</artifactId>
<version>1502853394064-20180710</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>

@ -611,4 +611,62 @@ CREATE TABLE `pre_apply_handle_log` (
ALTER TABLE `sys_client_pre_apply` ALTER TABLE `sys_client_pre_apply`
ADD COLUMN `status` tinyint(2) NULL DEFAULT 0 COMMENT '0:未处理1处理中2处理完成'; 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行业'; 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;

@ -687,7 +687,7 @@
* @apiDescription * @apiDescription
* 接入微信小程序需完成海外主体认证并且认证主体需要与在RoyalPay开通的商户主体一致具体如何认证请查看微信公众平台相关文档 * 接入微信小程序需完成海外主体认证并且认证主体需要与在RoyalPay开通的商户主体一致具体如何认证请查看微信公众平台相关文档
* 用于小程序中发起支付创建订单后返回小程序支付所需参数该接口现仅支持微信小程序 * 用于小程序中发起支付创建订单后返回小程序支付所需参数该接口现仅支持微信小程序
* <a href="https://www.royalpay.com.au/downloads/ProductIdList.xlsx"> 接入参考文档</a> * <a href="https://www.royalpay.com.au/downloads/MiniProgram_WechatPay.pdf"> 接入参考文档</a>
* <br> * <br>
* <img src="img/microapp_cn.png"> * <img src="img/microapp_cn.png">
* @apiVersion 1.0.0 * @apiVersion 1.0.0

@ -17,12 +17,12 @@ public interface ActChairtyService {
JSONObject listChairClients(int page, int limit); JSONObject listChairClients(int page, int limit);
void disableClient(String clientMoniker);
List<JSONObject> getWeekendAnalysis(JSONObject params); List<JSONObject> getWeekendAnalysis(JSONObject params);
PageList<JSONObject> getClientRank(JSONObject params); PageList<JSONObject> getClientRank(JSONObject params);
JSONObject gettotal();

@ -10,10 +10,15 @@ import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.lang3.time.DateFormatUtils; 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 org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
@ -24,7 +29,7 @@ import java.util.List;
*/ */
@Service @Service
public class ActChairtyServiceImp implements ActChairtyService { public class ActChairtyServiceImp implements ActChairtyService {
Logger logger = LoggerFactory.getLogger(getClass());
@Resource @Resource
private ClientManager clientManager; private ClientManager clientManager;
@Resource @Resource
@ -58,29 +63,54 @@ public class ActChairtyServiceImp implements ActChairtyService {
return PageListUtils.buildPageListResult(clients); return PageListUtils.buildPageListResult(clients);
} }
@Override
public void disableClient(String clientMoniker) {
actChairtyMapper.disableClient(clientMoniker);
}
@Override @Override
public List<JSONObject> getWeekendAnalysis(JSONObject params) { public List<JSONObject> getWeekendAnalysis(JSONObject params) {
List<JSONObject> result = new ArrayList<>(); List<JSONObject> result = new ArrayList<>();
List<JSONObject> getWeekstartanalysis = actChairtyMapper.getChairtyWeekstartAnalysis(params.getDate("begin"), params.getDate("end")); List<JSONObject> getAnalysis = actChairtyMapper.getChairtyWeekAnalysis(params.getDate("begin"), params.getDate("end"));
for (JSONObject getWeekendAnalysis : getWeekstartanalysis) { DateFormatUtils df = new DateFormatUtils();
Calendar rightNow = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
rightNow.setTime(getWeekendAnalysis.getDate("weekstart")); cal.setTime(params.getDate("begin"));
rightNow.add(Calendar.DAY_OF_YEAR,7); cal.add(cal.DAY_OF_MONTH, -1);
Date dt1=rightNow.getTime(); long beginTime = params.getDate("begin").getTime();
JSONObject getAnalysis = actChairtyMapper.getChairtyWeekAnalysis(getWeekendAnalysis.getDate("weekstart"), dt1); long endTime = params.getDate("end").getTime();
getWeekendAnalysis.put("count_ordernum", getAnalysis.getIntValue("count_ordernum")); long betweenDays = (long)((endTime - beginTime) / (1000 * 60 * 60 *24));
getWeekendAnalysis.put("sum_ordernum", getAnalysis.getBigDecimal("sum_ordernum")); List<String> weekStart = new ArrayList<>();
BigDecimal bg = new BigDecimal(getAnalysis.getIntValue("count_ordernum") * 0.01); for(int i=0;i<=betweenDays;i++){
double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); cal.add(cal.DAY_OF_MONTH, 1);//DATE=日
getWeekendAnalysis.put("chairty_amount", f1); if ((cal.get(Calendar.DAY_OF_WEEK)) == 2) {
result.add(getWeekendAnalysis); weekStart.add(df.format(cal.getTime(),"yyyy-MM-dd"));
}
} }
for(int i=0;i<weekStart.size();i++){
JSONObject weekDay = new JSONObject();
BigDecimal count_ordernum = new BigDecimal(0);
BigDecimal sum_ordernum = new BigDecimal(0);
String weekS = weekStart.get(i);
try {
Date dateStar = DateUtils.parseDate(weekS,"yyyy-MM-dd");
Date dateEnd = DateUtils.addDays(dateStar, 7);
for (int b = 0; b < getAnalysis.size(); b++) {
long orderDate = getAnalysis.get(b).getDate("orderdate").getTime();
if (orderDate >= 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; return result;
} }
@ -90,6 +120,24 @@ public class ActChairtyServiceImp implements ActChairtyService {
return getChairtyWeekRaking; return getChairtyWeekRaking;
} }
@Override
public JSONObject gettotal() {
List<JSONObject> 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;
}
} }

@ -29,29 +29,24 @@ public class ActChairtyController {
@Resource @Resource
private ActChairtyService actChairtyService; 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) { public JSONObject listAttendingClients(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int limit) {
// todo params // todo params
return actChairtyService.listChairClients(page, limit); 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, public void configClient(@PathVariable String clientMoniker, @RequestBody @Valid ActChairtyBean config, Errors errors,
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
HttpUtils.handleValidErrors(errors); HttpUtils.handleValidErrors(errors);
actChairtyService.configClient(clientMoniker, config, manager); actChairtyService.configClient(clientMoniker, config, manager);
} }
@ManagerMapping(value = "/clients/{clientMoniker}", method = RequestMethod.DELETE, role = { ManagerRole.ADMIN }) @ManagerMapping(value = "/traAnalysis", method = RequestMethod.GET, role = { ManagerRole.ADMIN,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER })
public void disableClient(@PathVariable String clientMoniker) {
actChairtyService.disableClient(clientMoniker);
}
@ManagerMapping(value = "/traAnalysis", method = RequestMethod.GET, role = { ManagerRole.ADMIN })
public List<JSONObject> traAnalysis(ActChairtyQuery params) { public List<JSONObject> traAnalysis(ActChairtyQuery params) {
return actChairtyService.getWeekendAnalysis(params.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) { public JSONObject getRanking(ActChairtyQuery params) {
PageList<JSONObject> clientRank = actChairtyService.getClientRank(params.params()); PageList<JSONObject> clientRank = actChairtyService.getClientRank(params.params());
if(clientRank==null){ if(clientRank==null){
@ -59,4 +54,9 @@ public class ActChairtyController {
} }
return PageListUtils.buildPageListResult(clientRank); return PageListUtils.buildPageListResult(clientRank);
} }
@ManagerMapping(value = "/total", method = RequestMethod.GET, role = { ManagerRole.ADMIN,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER })
public JSONObject getTotal() {
return actChairtyService.gettotal();
}
} }

@ -149,4 +149,11 @@ public interface RetailAppService {
void applyToCompliance(JSONObject device); void applyToCompliance(JSONObject device);
JSONObject sendVerifyEmail(JSONObject device); JSONObject sendVerifyEmail(JSONObject device);
JSONObject openimCheck(JSONObject device);
void addUnreadMsg(JSONObject device,JSONObject param);
JSONObject getRefunds(JSONObject device, AppQueryBean appQueryBean);
} }

@ -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.beans.NoticeInfo;
import au.com.royalpay.payment.manage.notice.core.NoticeManage; import au.com.royalpay.payment.manage.notice.core.NoticeManage;
import au.com.royalpay.payment.manage.notice.core.NoticePartner; 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.APNSMessageHelper;
import au.com.royalpay.payment.manage.pushMessage.bean.AppManagerMessageBuilder; import au.com.royalpay.payment.manage.pushMessage.bean.AppManagerMessageBuilder;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean; 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.signin.core.impls.SignInAccountServiceImpl;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; 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.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.cms.RoyalPayCMSSupport;
import au.com.royalpay.payment.tools.device.DeviceSupport; import au.com.royalpay.payment.tools.device.DeviceSupport;
import au.com.royalpay.payment.tools.device.message.AppMessage; import au.com.royalpay.payment.tools.device.message.AppMessage;
@ -163,9 +165,13 @@ public class RetailAppServiceImp implements RetailAppService {
@Resource @Resource
private ClientMapper clientMapper; private ClientMapper clientMapper;
@Resource @Resource
private RefundService refundService;
@Resource
private ClientModifySupport clientModifySupport; private ClientModifySupport clientModifySupport;
@Resource @Resource
private ClearingLogMapper clearingLogMapper; private ClearingLogMapper clearingLogMapper;
@Resource
private CustomerServiceService customerServiceService;
private Map<String, AppMsgSender> senderMap = new HashMap<>(); private Map<String, AppMsgSender> senderMap = new HashMap<>();
private final String fileName[] = { "client_bank_file", "client_id_file", "client_company_file" }; 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(",")); tradeLogQuery.setClient_ids(appQueryBean.getApp_client_ids().split(","));
JSONObject client = clientManager.getClientInfo(Integer.parseInt(tradeLogQuery.getClient_ids()[0])); JSONObject client = clientManager.getClientInfo(Integer.parseInt(tradeLogQuery.getClient_ids()[0]));
if(client==null){ if (client == null) {
throw new NotFoundException("Client Not Exists"); throw new NotFoundException("Client Not Exists");
} }
device.put("client_moniker", client.getString("client_moniker")); device.put("client_moniker", client.getString("client_moniker"));
device.put("client",client); device.put("client", client);
tradeLogService.exportTransFlow(tradeLogQuery, device, httpResponse); tradeLogService.exportTransFlow(tradeLogQuery, device, httpResponse);
} }
@ -410,6 +416,27 @@ public class RetailAppServiceImp implements RetailAppService {
return result; 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 @Override
public void updateClient(JSONObject device, AppClientBean appClientBean) { public void updateClient(JSONObject device, AppClientBean appClientBean) {
String clientType = device.getString("client_type"); String clientType = device.getString("client_type");
@ -554,11 +581,11 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject result = PageListUtils.buildPageListResult(logs); JSONObject result = PageListUtils.buildPageListResult(logs);
if (appQueryBean.getPage() == 1) { if (appQueryBean.getPage() == 1) {
if (!logs.isEmpty() && logs.size() > 0) { if (!logs.isEmpty() && logs.size() > 0) {
JSONObject clearingLog = clearingLogMapper.findById(logs.get(0).getIntValue("clearing_id")); JSONObject clearingLog = clearingLogMapper.findById(logs.get(0).getIntValue("clearing_id"));
if(clearingLog.getBoolean("editable")){ if (clearingLog.getBoolean("editable")) {
result.put("padding", true); result.put("padding", true);
logs.get(0).put("padding",true); logs.get(0).put("padding", true);
} }
} }
} }
return result; return result;
@ -1160,6 +1187,7 @@ public class RetailAppServiceImp implements RetailAppService {
JSONObject unReadParams = new JSONObject(); JSONObject unReadParams = new JSONObject();
unReadParams.put("client_id", client_id); unReadParams.put("client_id", client_id);
unReadParams.put("status", 0); unReadParams.put("status", 0);
unReadParams.put("is_to_app", 1);
int counts = noticePartnerMapper.countNoticePartner(unReadParams); int counts = noticePartnerMapper.countNoticePartner(unReadParams);
notice.put("unReadCounts", counts); notice.put("unReadCounts", counts);
notice.put("type", "notice"); notice.put("type", "notice");
@ -1204,7 +1232,7 @@ public class RetailAppServiceImp implements RetailAppService {
String clientType = device.getString("client_type"); String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType); deviceSupport.findRegister(clientType);
JSONObject bankInfo = clientManager.getBankAccountByClientId(device.getIntValue("client_id")); 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; return bankInfo;
} }
@ -1268,6 +1296,10 @@ public class RetailAppServiceImp implements RetailAppService {
if (AlipayOnline.containsKey("channel")) { if (AlipayOnline.containsKey("channel")) {
channels.add(AlipayOnline); channels.add(AlipayOnline);
} }
JSONObject Hf = getChannel(clientId,now,"hf");
if (Hf.containsKey("channel")){
channels.add(Hf);
}
res.put("channels", channels); res.put("channels", channels);
return res; 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) { public JSONObject listDailyTransactions(String dateStr, String timezone, boolean thisDevOnly, JSONObject device, String app_client_ids) {
try { try {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id")); JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
if(client==null){ if (client == null) {
return null; return null;
} }
timezone = client.getString("timezone"); timezone = client.getString("timezone");

@ -1,34 +1,5 @@
package au.com.royalpay.payment.manage.appclient.web; 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.core.exceptions.ParamInvalidException;
import au.com.royalpay.payment.manage.activities.app_index.core.AppActService; import au.com.royalpay.payment.manage.activities.app_index.core.AppActService;
import au.com.royalpay.payment.manage.activities.monsettledelay.core.ActMonDelaySettleService; 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.QRCodeConfig;
import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO; 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. * 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) { public JSONObject getTradeCommonData(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, AppQueryBean appQueryBean) {
return retailAppService.getTradeCommonDate(device, 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) @RequestMapping(value = "/trade_common_new", method = RequestMethod.GET)
public JSONObject getTradeCommonDataNew(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, AppQueryBean appQueryBean) { public JSONObject getTradeCommonDataNew(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, AppQueryBean appQueryBean) {
@ -540,4 +544,14 @@ public class RetailAppController {
return attachmentClient.uploadFile(file,false); 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);
}
} }

@ -12,7 +12,7 @@ import com.alibaba.fastjson.JSONObject;
* Created by yixian on 2017-02-07. * Created by yixian on 2017-02-07.
*/ */
public interface BDPrizeService { public interface BDPrizeService {
void generateRecord(); void generateRecord(String month);
@Transactional @Transactional
void recordGenerateProcess(Calendar now); void recordGenerateProcess(Calendar now);
@ -38,4 +38,6 @@ public interface BDPrizeService {
void insertOrUpdateCommissionConfig(String month, List<JSONObject> config, JSONObject manager) throws ParseException; void insertOrUpdateCommissionConfig(String month, List<JSONObject> config, JSONObject manager) throws ParseException;
void deleteCommConfig(String config_id); void deleteCommConfig(String config_id);
void updateBdKpiConfig(List<JSONObject> configs, JSONObject manager)throws ParseException;
} }

@ -78,10 +78,10 @@ public class BDPrizeServiceImpl implements BDPrizeService {
private static BigDecimal percent = new BigDecimal(100); 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 @Override
public void generateRecord() { public void generateRecord(String month) {
if (backupSystem) { if (backupSystem) {
throw new ServerErrorException("Updating System,wait for a moment"); 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"); throw new ServerErrorException("Processing task, wait for a moment");
} }
try { try {
final Calendar now = Calendar.getInstance(); SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM");
DateUtils.truncate(now, Calendar.MONTH); Date date = null;
now.add(Calendar.MONTH, -1); try {
date = sdf.parse(month);
} catch (ParseException e) {
e.printStackTrace();
}
Calendar now = Calendar.getInstance();
now.setTime(date);
recordGenerateProcess(now); recordGenerateProcess(now);
} finally { } finally {
@ -133,10 +139,14 @@ public class BDPrizeServiceImpl implements BDPrizeService {
} }
} }
//BD Leader Prize //BD Leader Prize
//bd_type:1 销售总监 2 大客户经理 3悉尼分公司经理 4 COO 5 NGDepartment
//todo 10月开始悉尼分公司经理不享受悉尼销售组提成
List<JSONObject> bdLeaders = managerMapper.listByRole(1, ManagerRole.BD_LEADER.getMask()); List<JSONObject> bdLeaders = managerMapper.listByRole(1, ManagerRole.BD_LEADER.getMask());
for (JSONObject leader : bdLeaders) { for (JSONObject leader : bdLeaders) {
BigDecimal groupAmount = transactionMapper.TotalAmountForBDLeaderPrize(now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1,leader.getString("manager_id")); 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); BigDecimal groupPrize = new BigDecimal(0);
if (rateJson != null) { if (rateJson != null) {
groupPrize = groupAmount.multiply(new BigDecimal(rateJson.getString("commission_rate")).divide(percent)).setScale(2, BigDecimal.ROUND_DOWN); 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); DateTime monthDate = new DateTime(month);
//bd manager commission //bd manager commission
JSONObject cityPrizeLog = new JSONObject(); // JSONObject cityPrizeLog = new JSONObject();
cityPrizeLog.put("total_amount", cplTotalprize); // cityPrizeLog.put("total_amount", cplTotalprize);
JSONObject cplRate = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, cplTotalprize.toString(), 2); // JSONObject cplRate = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, cplTotalprize.toString(), 2);
if (cplRate == null) { // if (cplRate == null) {
cityPrizeLog.put("total_prize", 0.00); // 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 { } else {
BigDecimal _commission_rate = new BigDecimal(cplRate.getString("commission_rate")); BigDecimal sydney_commission_rate = new BigDecimal(sydneyGMRate.getString("commission_rate"));
BigDecimal _total_amount = new BigDecimal(cityPrizeLog.getString("total_amount")); BigDecimal total_prize = sydneyAmount.multiply(sydney_commission_rate.divide(percent)).setScale(2, BigDecimal.ROUND_DOWN);
BigDecimal total_prize = _total_amount.multiply(_commission_rate.divide(percent)).setScale(2, BigDecimal.ROUND_DOWN); sydneyPrizeLog.put("total_prize", total_prize);
cityPrizeLog.put("total_prize", total_prize);
} }
report.put("cityPrizeLogs", cityPrizeLog); report.put("sydneyPrizeLog", sydneyPrizeLog);
//Director commission //COO & NJ commission
JSONObject directPrizeLogs = new JSONObject();
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
params.put("begin", TimeZoneUtils.beginDate(TimeZoneUtils.getFirstDay(monthDate.toString()))); params.put("begin", TimeZoneUtils.beginDate(TimeZoneUtils.getFirstDay(monthDate.toString())));
params.put("end", TimeZoneUtils.getPerFirstDayOfMonth(TimeZoneUtils.getLastDay(monthDate.toString()))); params.put("end", TimeZoneUtils.getPerFirstDayOfMonth(TimeZoneUtils.getLastDay(monthDate.toString())));
BigDecimal totalprize = transactionAnalysisMapper.analysisTotalAmount(params); BigDecimal totalprize = transactionAnalysisMapper.analysisTotalAmount(params);
JSONObject directPrizeLogs = new JSONObject();
directPrizeLogs.put("total_amount", totalprize); directPrizeLogs.put("total_amount", totalprize);
JSONObject rate = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, totalprize.toString(), 3); JSONObject rate = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, totalprize.toString(), 4);
if (rate == null) { if (rate == null) {
directPrizeLogs.put("total_prize", 0.00); directPrizeLogs.put("total_prize", 0.00);
} else { } else {
@ -243,6 +269,18 @@ public class BDPrizeServiceImpl implements BDPrizeService {
directPrizeLogs.put("total_prize", total_prize); directPrizeLogs.put("total_prize", total_prize);
} }
report.put("directPrizeLogs", directPrizeLogs); 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; return report;
} }
@ -418,5 +456,12 @@ public class BDPrizeServiceImpl implements BDPrizeService {
return firLasDay; return firLasDay;
} }
@Override
public void updateBdKpiConfig(List<JSONObject> 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);
}
}
} }

@ -46,16 +46,16 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator {
public BDPrizeCalculatorDefaultImpl rateConfig(List<JSONObject> rateConfig) { public BDPrizeCalculatorDefaultImpl rateConfig(List<JSONObject> rateConfig) {
for (JSONObject rateCfgItem : rateConfig) { for (JSONObject rateCfgItem : rateConfig) {
int level = rateCfgItem.getIntValue("bd_level"); int level = rateCfgItem.getIntValue("bd_level");
int monthLevel = rateCfgItem.getIntValue("time_range"); int kpiRange = rateCfgItem.getIntValue("kpi_range");
Map<Integer, List<JSONObject>> rates = rateConfigMap.get(level); Map<Integer, List<JSONObject>> rates = rateConfigMap.get(level);
if (rates == null) { if (rates == null) {
rates = new HashMap<>(); rates = new HashMap<>();
rateConfigMap.put(level, rates); rateConfigMap.put(level, rates);
} }
List<JSONObject> rate = rates.get(monthLevel); List<JSONObject> rate = rates.get(kpiRange);
if (rate == null) { if (rate == null) {
rate = new ArrayList<>(); rate = new ArrayList<>();
rates.put(monthLevel, rate); rates.put(kpiRange, rate);
} }
rate.add(rateCfgItem); rate.add(rateCfgItem);
} }
@ -81,18 +81,28 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator {
JSONObject bd = bdMap.get(resultItem.getKey()); JSONObject bd = bdMap.get(resultItem.getKey());
int bdLevel = bd.getIntValue("bd_level"); int bdLevel = bd.getIntValue("bd_level");
log.put("bd_level", bdLevel); log.put("bd_level", bdLevel);
log.put("kpi_amount", bd.getBigDecimal("kpi_amount"));
log.put("bd_name", bd.getString("bd_name")); log.put("bd_name", bd.getString("bd_name"));
log.put("total_amount", 0); log.put("total_amount", 0);
log.put("total_prize", 0); log.put("total_prize", 0);
log.put("total_donation", 0); log.put("total_donation", 0);
BigDecimal totalAmount = log.getBigDecimal("total_amount");
List<JSONObject> details = new ArrayList<>(); List<JSONObject> details = new ArrayList<>();
for (Map.Entry<String, JSONObject> 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<String, JSONObject> detail : resultItem.getValue().entrySet()) { for (Map.Entry<String, JSONObject> detail : resultItem.getValue().entrySet()) {
JSONObject detailItem = detail.getValue(); JSONObject detailItem = detail.getValue();
int clientId = detailItem.getIntValue("client_id"); int clientId = detailItem.getIntValue("client_id");
int months = detailItem.getIntValue("client_create_months"); // int months = detailItem.getIntValue("client_create_months");
BigDecimal bdRate = getRate(bdLevel, months, detailItem.getIntValue("client_source"), detailItem.getBigDecimal("rate_value"));
BigDecimal totalTransaction = detailItem.getBigDecimal("total_transaction"); BigDecimal totalTransaction = detailItem.getBigDecimal("total_transaction");
BigDecimal coefficient = detailItem.getBigDecimal("coefficient"); 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 prizeValue = totalTransaction.multiply(coefficient).multiply(bdRate).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_DOWN);
BigDecimal donation = BigDecimal.ZERO; BigDecimal donation = BigDecimal.ZERO;
if (clientsWithBDAwayDeterminor.clientWithBDAway(clientId, month)) { 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()); 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<Integer, List<JSONObject>> rates = rateConfigMap.get(bdLevel);
List<JSONObject> 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;
}
} }

@ -29,9 +29,9 @@ public class BDPrizeController {
@Resource @Resource
private BDPrizeService bdPrizeService; private BDPrizeService bdPrizeService;
@ManagerMapping(value = "/generate_record", method = RequestMethod.POST, role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.ADMIN}) @ManagerMapping(value = "/generate_record/{month}", method = RequestMethod.POST, role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.ADMIN})
public void generateRecord() { public void generateRecord(@PathVariable String month) {
bdPrizeService.generateRecord(); bdPrizeService.generateRecord(month);
} }
@ManagerMapping(value = "/records", method = RequestMethod.GET, role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.BD_USER}) @ManagerMapping(value = "/records", method = RequestMethod.GET, role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.BD_USER})
@ -92,4 +92,9 @@ public class BDPrizeController {
public List<JSONObject> newCommissionConfig(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) throws ParseException { public List<JSONObject> newCommissionConfig(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) throws ParseException {
return bdPrizeService.listNeedConfigCommission(); 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<JSONObject> info , @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) throws ParseException {
bdPrizeService.updateBdKpiConfig(info,manager);
}
} }

@ -30,4 +30,6 @@ public interface EncourageService {
JSONObject listReceiveLogs(String eventId, ReceiveLogQueryBean query); JSONObject listReceiveLogs(String eventId, ReceiveLogQueryBean query);
JSONObject listUseLogs(String eventId, int page, int limit); JSONObject listUseLogs(String eventId, int page, int limit);
void prepareUserInfo(JSONObject user, String user_id);
} }

@ -1,27 +1,7 @@
package au.com.royalpay.payment.manage.customers.core.impls; package au.com.royalpay.payment.manage.customers.core.impls;
import java.math.BigDecimal; import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig;
import java.util.Calendar; import au.com.royalpay.payment.channels.wechat.config.WechatPayEnvironment;
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.core.TransactionService; import au.com.royalpay.payment.core.TransactionService;
import au.com.royalpay.payment.manage.customers.beans.EncourageEventParameters; import au.com.royalpay.payment.manage.customers.beans.EncourageEventParameters;
import au.com.royalpay.payment.manage.customers.beans.ReceiveLogQueryBean; 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.customers.CustomerMembershipMapper;
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; 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.CustomerMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerCustomerRelationAlipayMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper; import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.tools.CommonConsts; 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.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.utils.PageListUtils; 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. * Created by yixian on 2017-04-24.
*/ */
@ -57,11 +62,15 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
@Resource @Resource
private TransactionService transactionService; private TransactionService transactionService;
@Resource @Resource
private MpWechatApiProvider mpWechatApiProvider;
@Resource
private CustomerMapper customerMapper; private CustomerMapper customerMapper;
@Resource @Resource
private ManagerMapper managerMapper; private ManagerMapper managerMapper;
@Resource @Resource
private OrderMapper orderMapper; private OrderMapper orderMapper;
@Resource
private ManagerCustomerRelationAlipayMapper managerCustomerRelationAlipayMapper;
@Override @Override
public int getOrder() { public int getOrder() {
@ -76,6 +85,7 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
@Override @Override
public JSONObject takeEncourageMoney(String orderId, String visitorOpenId) { public JSONObject takeEncourageMoney(String orderId, String visitorOpenId) {
logger.info("=====takeEncourageMoney+"+orderId);
JSONObject config = currentEncourageConfig(); JSONObject config = currentEncourageConfig();
if (config != null) { if (config != null) {
if (customerEncourageMoneyAccessLogMapper.findByOrderId(orderId) != null) { if (customerEncourageMoneyAccessLogMapper.findByOrderId(orderId) != null) {
@ -94,29 +104,64 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
logger.debug("不在有效期"); logger.debug("不在有效期");
return new JSONObject(); return new JSONObject();
} }
if (!StringUtils.equals(openId, visitorOpenId)) { String channel = order.getString("channel");
logger.debug("不是同一人"); if ("Wechat".equals(channel)) {
return new JSONObject(); 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("测试模式,不是管理员"); logger.debug("测试模式,不是管理员");
return new JSONObject(); return new JSONObject();
} }
JSONObject member = customerMembershipMapper.findByPaymentOpenId(openId); JSONObject member = customerMembershipMapper.findByPaymentOpenId(visitorOpenId);
if (member == null) { if (member == null) {
member = new JSONObject(); member = new JSONObject();
JSONObject relation = customerMapper.findCustomerByOpenId(openId); if ("Wechat".equals(channel)) {
if (relation == null) { JSONObject relation = customerMapper.findCustomerByOpenId(visitorOpenId);
logger.debug("用户关系不存在"); if (relation == null) {
return new JSONObject(); 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); if ("Alipay".equals(channel)) {
member.put("kanga_openid", relation.getString("kanga_openid")); JSONObject relation = managerCustomerRelationAlipayMapper.findCustomerByUserId(openId);
member.put("redpack_openid", relation.getString("redpack_openid")); if (relation == null) {
member.put("attend_time", new Date()); logger.debug("用户关系不存在");
member.put("member_point", -1); return new JSONObject();
member.put("encourage_balance", 0); }
customerMembershipMapper.saveMember(member); 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"); String memberId = member.getString("member_id");
int usedOrders = customerEncourageMoneyAccessLogMapper.countOrders(memberId, new Date()); int usedOrders = customerEncourageMoneyAccessLogMapper.countOrders(memberId, new Date());
@ -124,8 +169,8 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
logger.debug("超出领取次数"); logger.debug("超出领取次数");
return new JSONObject(); return new JSONObject();
} }
int rand = RandomUtils int rand = RandomUtils.nextInt(0,
.nextInt(0,config.getBigDecimal("max_amount").subtract(config.getBigDecimal("min_amount")).multiply(CommonConsts.HUNDRED).intValue()); 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)); BigDecimal amount = config.getBigDecimal("min_amount").add(BigDecimal.valueOf(rand).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_DOWN));
customerMembershipMapper.addEncourage(memberId, amount); customerMembershipMapper.addEncourage(memberId, amount);
JSONObject customer = customerMembershipMapper.findByMemberId(memberId); JSONObject customer = customerMembershipMapper.findByMemberId(memberId);
@ -165,8 +210,8 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
} }
if (log.getBigDecimal("factor").compareTo(BigDecimal.ONE) == 0) { if (log.getBigDecimal("factor").compareTo(BigDecimal.ONE) == 0) {
int critRate = config.getIntValue("crit_rate"); int critRate = config.getIntValue("crit_rate");
if (RandomUtils.nextInt(0,100) < critRate) { if (RandomUtils.nextInt(0, 100) < critRate) {
int factorInt = RandomUtils.nextInt(0,config.getBigDecimal("max_crit").multiply(CommonConsts.HUNDRED).intValue() - 100); 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 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 actural = log.getBigDecimal("access_amount").multiply(factor).setScale(2, BigDecimal.ROUND_DOWN);
BigDecimal sub = actural.subtract(log.getBigDecimal("actural_amount")); BigDecimal sub = actural.subtract(log.getBigDecimal("actural_amount"));
@ -195,16 +240,22 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
Date toDate = config.getDate("to_date"); Date toDate = config.getDate("to_date");
status.put("to", DateFormatUtils.format(toDate, "MM-dd")); status.put("to", DateFormatUtils.format(toDate, "MM-dd"));
JSONObject member = customerMembershipMapper.findByPaymentOpenId(openid); 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) { if (member != null) {
status.put("member_info", member); status.put("member_info", member);
List<JSONObject> balanceLogs = customerMembershipMapper.listEncourageBalanceHistory(fromDate, toDate, member.getString("member_id")); List<JSONObject> balanceLogs = customerMembershipMapper.listEncourageBalanceHistory(fromDate, toDate, member.getString("member_id"));
status.put("logs", balanceLogs); status.put("logs", balanceLogs);
BigDecimal usedAmount = customerEncourageMoneyUseLogMapper.sumUsed(member.getString("member_id"), fromDate, toDate); // BigDecimal usedAmount = customerEncourageMoneyUseLogMapper.sumUsed(member.getString("member_id"), fromDate, toDate);
member.put("used_amount", usedAmount); // member.put("used_amount", usedAmount);
} else { } else {
member = new JSONObject(); member = new JSONObject();
member.put("encourage_balance", 0); member.put("encourage_balance", 0);
member.put("used_amount", 0); // member.put("used_amount", 0);
} }
status.put("member", member); status.put("member", member);
return status; return status;
@ -285,4 +336,14 @@ public class EncourageUseProcessor implements Ordered, EncourageService {
PageList<JSONObject> receiveLogs = customerEncourageMoneyUseLogMapper.list(params, new PageBounds(page, limit, Order.formString("use_time.desc"))); PageList<JSONObject> receiveLogs = customerEncourageMoneyUseLogMapper.list(params, new PageBounds(page, limit, Order.formString("use_time.desc")));
return PageListUtils.buildPageListResult(receiveLogs); 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"));
}
}
} }

@ -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.manage.customers.core.EncourageService;
import au.com.royalpay.payment.tools.CommonConsts; 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 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 org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -16,15 +23,25 @@ import javax.annotation.Resource;
@RestController @RestController
@RequestMapping("/act/encourage_money") @RequestMapping("/act/encourage_money")
public class EncourageMoneyController { public class EncourageMoneyController {
Logger logger = LoggerFactory.getLogger(getClass());
@Resource @Resource
private EncourageService encourageService; 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) { 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 new JSONObject();
} }
return encourageService.takeEncourageMoney(orderId, wxUser.getString("openid")); return encourageService.takeEncourageMoney(orderId, user_id);
} }
@RequestMapping(value = "/orders/{orderId}/crit", method = RequestMethod.PUT) @RequestMapping(value = "/orders/{orderId}/crit", method = RequestMethod.PUT)
@ -32,22 +49,36 @@ public class EncourageMoneyController {
return encourageService.doubleEncourageMoney(orderId); return encourageService.doubleEncourageMoney(orderId);
} }
@WechatMapping(value = "/my", method = RequestMethod.GET, oauthType = WxOauthType.USERINFO) @RequestMapping(value = "/my", method = RequestMethod.GET)
public ModelAndView encourageLogs(@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser) { public ModelAndView encourageLogs(@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser, @ModelAttribute(CommonConsts.ALIUSER) JSONObject aliuser) {
ModelAndView mav = new ModelAndView("activity/encourage_money/my"); ModelAndView mav = new ModelAndView("activity/encourage_money/my");
mav.addObject("wxUser", wxUser); JSONObject user = new JSONObject();
JSONObject balanceStatus = encourageService.getBalanceStatus(wxUser.getString("openid")); 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); mav.addObject("balance_status", balanceStatus);
return mav; return mav;
} }
@WechatMapping(value = "/desc",method = RequestMethod.GET) @RequestMapping(value = "/desc", method = RequestMethod.GET)
public ModelAndView descPage(){ public ModelAndView descPage() {
return new ModelAndView("activity/encourage_money/desc"); return new ModelAndView("activity/encourage_money/desc");
} }
@WechatMapping(value = "/merchants",method = RequestMethod.GET) @RequestMapping(value = "/merchants", method = RequestMethod.GET)
public ModelAndView merchantsPage(){ public ModelAndView merchantsPage() {
return new ModelAndView("activity/encourage_money/merchants"); return new ModelAndView("activity/encourage_money/merchants");
} }
} }

@ -5,9 +5,10 @@ import au.com.royalpay.payment.manage.dev.core.AliforexcelService;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; 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 org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -25,8 +26,8 @@ public class AliforexcelServiceImpl implements AliforexcelService {
public JSONObject listClients(HttpServletResponse httpResponse,JSONObject manager, AliExcel query) { public JSONObject listClients(HttpServletResponse httpResponse,JSONObject manager, AliExcel query) {
OutputStream ous = null; OutputStream ous = null;
try{ try{
JSONObject params = query.toJsonParam(); JSONObject params = query.toJsonParam();
List<JSONObject> partners = clientMapper.passPartners(params); List<JSONObject> partners = clientMapper.passPartners(params);
httpResponse.setContentType("application/octet-stream;"); httpResponse.setContentType("application/octet-stream;");
httpResponse.setCharacterEncoding("utf-8"); httpResponse.setCharacterEncoding("utf-8");
String fileName = "支付宝进件专用--"; String fileName = "支付宝进件专用--";
@ -34,18 +35,12 @@ public class AliforexcelServiceImpl implements AliforexcelService {
httpResponse.addHeader("Content-Disposition", "attachment; filename=" + codedFileName +query.getDatefrom() + "~" +query.getDateto() + ".xls"); httpResponse.addHeader("Content-Disposition", "attachment; filename=" + codedFileName +query.getDatefrom() + "~" +query.getDateto() + ".xls");
ous = httpResponse.getOutputStream(); ous = httpResponse.getOutputStream();
HSSFWorkbook wb = new HSSFWorkbook(); 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 sheet = wb.createSheet("支付宝进件专用" );
sheet.createFreezePane(1, 2); sheet.createFreezePane(1, 2);
sheet.setDefaultColumnWidth((short) 25); sheet.setDefaultColumnWidth((short) 25);
int rowNum = 0; int rowNum = 0;
Row row = sheet.createRow(rowNum); Row row = sheet.createRow(rowNum);
String[] title = {"公司注册名称", "对外营业名称", "","所属行业(数字代码即可)","地址","eg. Monday-Friday 09:00-20:00,Saturday-Sunday 10:00-22:00\n请注意格式","+61 452296105\n" + String[] title = {"Company name", "Store name", "Partner Code","Industry","Store address","Business hours","Contact information","Video link (optional)","Store description","Tags"};
"请注意格式","youtube视频介绍链接若有","门店介绍","标签"};
for (int i = 0; i < title.length; i++) { for (int i = 0; i < title.length; i++) {
row.createCell(i, Cell.CELL_TYPE_STRING).setCellValue(title[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(5, Cell.CELL_TYPE_STRING).setCellValue(partner.getString("business_hours"));
row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue(partner.getString("company_phone")); row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue(partner.getString("company_phone"));
row.createCell(7, Cell.CELL_TYPE_STRING).setCellValue(partner.getString("")); 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("")); row.createCell(9, Cell.CELL_TYPE_STRING).setCellValue(partner.getString(""));
} }
wb.write(ous); wb.write(ous);

@ -23,16 +23,13 @@ public interface ActChairtyMapper {
@AutoSql(type = SqlType.INSERT) @AutoSql(type = SqlType.INSERT)
void save(JSONObject chairtyClient); void save(JSONObject chairtyClient);
@AutoSql(type = SqlType.DELETE)
void disableClient(@Param("client_moniker") String clientMoniker);
PageList<JSONObject> chairtyClientNum(PageBounds pageBounds); PageList<JSONObject> chairtyClientNum(PageBounds pageBounds);
List<JSONObject> getChairtyWeekstartAnalysis(@Param("begin") Date begin, @Param("end") Date end); List<JSONObject> getChairtyWeekAnalysis(@Param("begin") Date begin, @Param("end") Date end);
JSONObject getChairtyWeekAnalysis(@Param("begin") Date begin, @Param("end") Date end);
PageList<JSONObject> getChairtyWeekRaking(@Param("begin") Date begin, @Param("end") Date end,PageBounds pageBounds); PageList<JSONObject> getChairtyWeekRaking(@Param("begin") Date begin, @Param("end") Date end,PageBounds pageBounds);
List<JSONObject> chairtyClientNum();
} }

@ -31,4 +31,7 @@ public interface CustomerEncourageMoneyAccessLogMapper {
PageList<JSONObject> list(JSONObject params, PageBounds pageBounds); PageList<JSONObject> list(JSONObject params, PageBounds pageBounds);
List<JSONObject> analysisByDate(@Param("event_id") String eventId); List<JSONObject> analysisByDate(@Param("event_id") String eventId);
JSONObject sumMoney(@Param("memberId") String memberId,@Param("eventId")String eventId);
} }

@ -34,4 +34,7 @@ public interface CustomerEncourageMoneyUseLogMapper {
List<JSONObject> analysisByDate(@Param("event_id") String eventId); List<JSONObject> analysisByDate(@Param("event_id") String eventId);
List<String> listUnsettled(); List<String> listUnsettled();
JSONObject sumMoney(@Param("memberId") String memberId,@Param("eventId")String eventId);
} }

@ -19,7 +19,7 @@ public interface FinancialBDPrizeLogMapper {
@AutoSql(type = SqlType.INSERT) @AutoSql(type = SqlType.INSERT)
void save(JSONObject log); 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.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, " + "SUM(fbpl.hold_prize) hold_prize,fbpl.last_punish,fbpl.prize_type,sysm.is_valid FROM financial_bd_prize_log fbpl, " +
"sys_managers sysm " + "sys_managers sysm " +

@ -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.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType; import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -15,5 +16,5 @@ public interface LogClientSubMerchantIdMapper {
void save(JSONObject log); void save(JSONObject log);
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)
List<JSONObject> listLogsByClientId(@Param("client_id") int client_id); List<JSONObject> listLogsByClientId(@Param("client_id") int client_id, PageBounds pageBounds);
} }

@ -1,16 +1,19 @@
package au.com.royalpay.payment.manage.mappers.payment; 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.AdvanceSelect;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType; 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. * Created by yixian on 2016-06-25.
@ -55,4 +58,7 @@ public interface RefundMapper {
List<JSONObject> listRefundDate(@Param("begin") Date begin, @Param("end") Date end); List<JSONObject> listRefundDate(@Param("begin") Date begin, @Param("end") Date end);
List<JSONObject> listClientRefund(JSONObject param); List<JSONObject> listClientRefund(JSONObject param);
PageList<JSONObject> listUnionAllApply(JSONObject params, PageBounds pagination);
} }

@ -94,6 +94,8 @@ public interface TransactionMapper {
List<JSONObject> listTransactionsForBDPrize(@Param("year") int year, @Param("month") int month, @Param("channel") String channel); List<JSONObject> 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 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<JSONObject> listTransactionsForCityPartnerCommission(@Param("year") int year, @Param("month") int month); List<JSONObject> listTransactionsForCityPartnerCommission(@Param("year") int year, @Param("month") int month);

@ -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<JSONObject> query(JSONObject params, PageBounds pagination);
}

@ -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"}) @AdvanceSelect(addonWhereClause = "is_valid=1 and role=1 and wechat_openid is not null and wx_unionid is null", excludeColumns = {"salt", "password_hash"})
List<JSONObject> listNullUnionIdAccounts(); List<JSONObject> listNullUnionIdAccounts();
List<JSONObject> query(JSONObject params);
} }

@ -6,6 +6,7 @@ import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType; import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -32,7 +33,7 @@ public interface ManagerMapper {
@AutoSql(type = SqlType.UPDATE) @AutoSql(type = SqlType.UPDATE)
void update(JSONObject account); void update(JSONObject account);
List<JSONObject> listAvailable(JSONObject params, PageBounds pageBounds); PageList<JSONObject> listAvailable(JSONObject params, PageBounds pageBounds);
@AutoSql(type = SqlType.INSERT) @AutoSql(type = SqlType.INSERT)
void save(JSONObject manager); void save(JSONObject manager);
@ -59,4 +60,6 @@ public interface ManagerMapper {
List<JSONObject> findByIds(List<Integer> ids); List<JSONObject> findByIds(List<Integer> ids);
List<JSONObject> listOpenIdByRole(@Param("mask") int mask); List<JSONObject> listOpenIdByRole(@Param("mask") int mask);
List<JSONObject> listServants(@Param("mask") int mask);
} }

@ -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<JSONObject> 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<JSONObject> findAllWithDetail();
}

@ -333,7 +333,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
int role = manager != null ? manager.getIntValue("role") : 0; int role = manager != null ? manager.getIntValue("role") : 0;
if (manager != null) { if (manager != null) {
if (ManagerRole.OPERATOR.hasRole(role)) { if (ManagerRole.OPERATOR.hasRole(role)) {
List<JSONObject> log = logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id")); List<JSONObject> log = logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"),new PageBounds(Order.formString("create_time.desc")));
client.put("sub_merchant_id_log", log.size() > 0 ? true : false); client.put("sub_merchant_id_log", log.size() > 0 ? true : false);
} }
if (ManagerRole.BD_USER.hasRole(role)) { if (ManagerRole.BD_USER.hasRole(role)) {
@ -3579,7 +3579,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
checkOrgPermission(manager, client); 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 @Override

@ -536,7 +536,7 @@ public class PartnerManageController {
clientManager.removeSub(clientMoniker,manager); 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) { public void switchHfPermission(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchHfLink(manager, clientMoniker, pass.getBooleanValue("allow")); clientManager.switchHfLink(manager, clientMoniker, pass.getBooleanValue("allow"));
} }

@ -1,21 +1,21 @@
package au.com.royalpay.payment.manage.notice.core.impls; package au.com.royalpay.payment.manage.notice.core.impls;
import java.util.Collections; import au.com.royalpay.payment.manage.mappers.notice.NoticePartnerMapper;
import java.util.Date; import au.com.royalpay.payment.manage.notice.core.NoticePartner;
import java.util.List; import au.com.royalpay.payment.tools.utils.PageListUtils;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import au.com.royalpay.payment.manage.mappers.notice.NoticePartnerMapper; import org.springframework.stereotype.Service;
import au.com.royalpay.payment.manage.notice.core.NoticePartner;
import au.com.royalpay.payment.tools.utils.PageListUtils; import java.util.Collections;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
/** /**
* Created by yishuqian on 29/09/2016. * Created by yishuqian on 29/09/2016.
@ -36,6 +36,7 @@ public class NoticePartnerImpl implements NoticePartner {
JSONObject unReadParams = new JSONObject(); JSONObject unReadParams = new JSONObject();
unReadParams.put("client_id",partner.getIntValue("client_id")); unReadParams.put("client_id",partner.getIntValue("client_id"));
unReadParams.put("status",0); unReadParams.put("status",0);
unReadParams.put("is_to_app",1);
int counts = noticePartnerMapper.countNoticePartner(unReadParams); int counts = noticePartnerMapper.countNoticePartner(unReadParams);
PageList<JSONObject> partnerNotices =noticePartnerMapper.listNoticesByClientId(params, PageList<JSONObject> partnerNotices =noticePartnerMapper.listNoticesByClientId(params,
new PageBounds(params.getIntValue("page"), params.getIntValue("limit"), Order.formString("status.asc,send_time.desc"))); new PageBounds(params.getIntValue("page"), params.getIntValue("limit"), Order.formString("status.asc,send_time.desc")));

@ -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<JSONObject> 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"));
}
}

@ -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;
}
}

@ -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;
}
}

@ -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<String> 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<String> getTo_users() {
return to_users;
}
public void setTo_users(List<String> 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;
}
}

@ -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<JSONObject> query(String clientMoniker,String userNames);
void onoff(JSONObject manager,boolean status);
void addUnreadMsg(JSONObject params);
void sendUnreadWxMsg();
}

@ -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);
}

@ -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<Userinfos> 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<Userinfos> 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<Userinfos> list2 = new ArrayList<Userinfos>();
Userinfos obj3 = new Userinfos();
list2.add(obj3);
obj3.setNick("king");
obj3.setIconUrl("https://ss0.baidu.com/73t1bjeh1BF3odCf/it/u=1948403834,955109320&fm=85&s=0D06E5134AD145F30C8D6D680300303A");
obj3.setUserid("kira1");
obj3.setPassword("xxxxxx");
req.setUserinfos(list2);
OpenimUsersAddResponse rsp = null;
try {
rsp = client.execute(req);
} catch (ApiException e) {
e.printStackTrace();
}
System.out.println(rsp.getBody());
}
}

@ -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<JSONObject> 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<JSONObject> accounts = clientAccountMapper.query(queryParams);
List<JSONObject> 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<String, String> ops = stringRedisTemplate.boundListOps("REDIS_UNREADMSG_PREFIX" + tuid);
for (int i = 0; i < ops.size(); i++) {
String jStr = ops.index(i);
if (jStr.contains(uid)) {
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<JSONObject> servants = sysCustomerServiceMapper.findAllWithDetail();
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi();
servants.parallelStream().forEach(p -> {
p.getString("user_id");
BoundListOperations<String, String> ops = stringRedisTemplate.boundListOps("REDIS_UNREADMSG_PREFIX" + p.getString("user_id"));
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);
}
}
}

@ -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<Userinfos> 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);
}
}

@ -104,13 +104,13 @@ public class ManagerUserInterceptor extends HandlerInterceptorAdapter implements
} }
} }
JSONObject func = permissionPartnerManager.getPartnerFuncById(funcId); // JSONObject func = permissionPartnerManager.getPartnerFuncById(funcId);
if(func!=null && StringUtils.isNotEmpty(func.getString("module_id"))){ // if(func!=null && StringUtils.isNotEmpty(func.getString("module_id"))){
JSONArray arr = loginUser.getJSONArray("available_module_ids"); // JSONArray arr = loginUser.getJSONArray("available_module_ids");
if (arr == null || !arr.contains(func.getString("module_id"))) { // if (arr == null || !arr.contains(func.getString("module_id"))) {
throw new ForbiddenException("error.permission.nopermission"); // throw new ForbiddenException("error.permission.nopermission");
} // }
} // }
request.setAttribute(CommonConsts.PARTNER_STATUS, loginUser); request.setAttribute(CommonConsts.PARTNER_STATUS, loginUser);
} }

@ -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;
}
}

@ -1,10 +1,6 @@
package au.com.royalpay.payment.manage.risk.core; 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.*;
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 com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@ -32,6 +28,9 @@ public interface RiskMerchantService {
JSONObject getRiskDetails(QueryRiskDetail queryRiskDetail); JSONObject getRiskDetails(QueryRiskDetail queryRiskDetail);
JSONObject listAttentionMerchants(JSONObject account,QueryAttentionMerchants queryAttention);
void addAttentionMerchants(JSONObject account,String client_moniker);
void updateAttentionMerchants(JSONObject account,String client_moniker);
} }

@ -1,21 +1,15 @@
package au.com.royalpay.payment.manage.risk.core.impl; 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.*;
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.merchants.core.ClientManager; 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.*;
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.core.RiskMerchantService; import au.com.royalpay.payment.manage.risk.core.RiskMerchantService;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject; 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.PageBounds;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -39,6 +33,8 @@ public class RiskMerchantServiceImpl implements RiskMerchantService {
private RiskWhiteListMapper riskWhiteListMapper; private RiskWhiteListMapper riskWhiteListMapper;
@Resource @Resource
private ClientManager clientManager; private ClientManager clientManager;
@Resource
private RiskAttentionMerchantsAMapper riskAttentionMerchantsAMapper;
@Override @Override
@Transactional @Transactional
@ -213,4 +209,55 @@ public class RiskMerchantServiceImpl implements RiskMerchantService {
riskMerchantDetailLogMapper.query(queryRiskDetail.toParams(), new PageBounds(queryRiskDetail.getPage(), queryRiskDetail.getLimit()))); 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);
}
} }

@ -1,11 +1,7 @@
package au.com.royalpay.payment.manage.risk.web; package au.com.royalpay.payment.manage.risk.web;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; 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.*;
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.core.RiskMerchantService; import au.com.royalpay.payment.manage.risk.core.RiskMerchantService;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
@ -94,4 +90,18 @@ public class RiskController {
riskMerchantService.addDetailLog(addRiskDetailLog,manager); 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);
}
} }

@ -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;
}
}

@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.signin.core;
import au.com.royalpay.payment.manage.signin.beans.ManagerInfo; import au.com.royalpay.payment.manage.signin.beans.ManagerInfo;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import java.util.List; import java.util.List;
@ -9,7 +10,7 @@ import java.util.List;
* Created by yixian on 2016-07-05. * Created by yixian on 2016-07-05.
*/ */
public interface ManagerAccountsService { public interface ManagerAccountsService {
List<JSONObject> listManagers(JSONObject loginManager,JSONObject params); PageList<JSONObject> listManagers(JSONObject loginManager, JSONObject params);
void saveManager(ManagerInfo manager, JSONObject loginManager); void saveManager(ManagerInfo manager, JSONObject loginManager);
@ -24,4 +25,6 @@ public interface ManagerAccountsService {
List<JSONObject> listGroupBds(JSONObject loginManager); List<JSONObject> listGroupBds(JSONObject loginManager);
JSONObject getBDConfig(String bd_id); JSONObject getBDConfig(String bd_id);
}
List<JSONObject> listServants(JSONObject loginManager);
}

@ -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.ManagerMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper; import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import au.com.royalpay.payment.manage.organizations.core.OrgManager; 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.beans.ManagerInfo;
import au.com.royalpay.payment.manage.signin.core.ManagerAccountsService; import au.com.royalpay.payment.manage.signin.core.ManagerAccountsService;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.annotation.Resource;
/** /**
* Created by yixian on 2016-07-06. * Created by yixian on 2016-07-06.
*/ */
@ -35,12 +39,12 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
private OrgManager orgManager; private OrgManager orgManager;
@Override @Override
public List<JSONObject> listManagers(JSONObject loginManager,JSONObject params) { public PageList<JSONObject> listManagers(JSONObject loginManager,JSONObject params) {
/* if (loginManager.getInteger("org_id") != null) { /* if (loginManager.getInteger("org_id") != null) {
params.put("org_id", loginManager.getIntValue("org_id")); params.put("org_id", loginManager.getIntValue("org_id"));
}*/ }*/
orgManager.checkOrgIds(loginManager,params); orgManager.checkOrgIds(loginManager,params);
List<JSONObject> managers = managerMapper.listAvailable(params, new PageBounds(Order.formString("create_time.desc"))); PageList<JSONObject> managers = managerMapper.listAvailable(params, new PageBounds(params.getIntValue("page"),params.getIntValue("limit"),Order.formString("create_time.desc")));
for (JSONObject manager : managers) { for (JSONObject manager : managers) {
int role = manager.getIntValue("role"); int role = manager.getIntValue("role");
manager.put("admin", ManagerRole.ADMIN.hasRole(role)); manager.put("admin", ManagerRole.ADMIN.hasRole(role));
@ -133,6 +137,11 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService {
return financialBDConfigMapper.getBdConfig(bd_id); return financialBDConfigMapper.getBdConfig(bd_id);
} }
@Override
public List<JSONObject> listServants(JSONObject loginManager) {
return managerMapper.listServants(ManagerRole.SERVANT.getMask());
}
private void checkOrg(JSONObject loginManager,JSONObject manager){ private void checkOrg(JSONObject loginManager,JSONObject manager){
if (loginManager.getInteger("org_id")!=null){ if (loginManager.getInteger("org_id")!=null){
List<JSONObject> orgs = orgMapper.listOrgAndChild(loginManager.getIntValue("org_id")); List<JSONObject> orgs = orgMapper.listOrgAndChild(loginManager.getIntValue("org_id"));

@ -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.organizations.core.OrgManager;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; 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.permission.manager.RequireManager;
import au.com.royalpay.payment.manage.signin.beans.ManagerInfo; 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.manage.signin.core.ManagerAccountsService;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.http.HttpUtils; 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.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.validation.Errors; 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.List;
import java.util.Map; import java.util.Map;
import javax.annotation.Resource;
import javax.validation.Valid;
/** /**
* Created by yixian on 2016-07-05. * Created by yixian on 2016-07-05.
*/ */
@ -38,15 +48,9 @@ public class ManagerAccountsController {
@RequestMapping(method = RequestMethod.GET) @RequestMapping(method = RequestMethod.GET)
@RequireManager(role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER}) @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER})
public List<JSONObject> listManagerss(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager, @RequestParam(required = false) String org_id,@RequestParam(required = false) String org_id2) { public JSONObject listManagerss(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager, QueryManagerBean queryManagerBean) {
JSONObject params = new JSONObject();
if(org_id != null){ return PageListUtils.buildPageListResult(managerAccountsService.listManagers(loginManager,queryManagerBean.toJson()));
params.put("org_id",org_id);
}
if (StringUtils.isNotEmpty(org_id2)) {
params.put("org_id2", org_id2);
}
return managerAccountsService.listManagers(loginManager,params);
} }
@RequestMapping(method = RequestMethod.POST) @RequestMapping(method = RequestMethod.POST)
@ -83,10 +87,15 @@ public class ManagerAccountsController {
return managerAccountsService.listBDLeaders(loginManager); return managerAccountsService.listBDLeaders(loginManager);
} }
@ManagerMapping(value = "/group/group_bds", method = RequestMethod.GET) @ManagerMapping(value = "/group/group_bds", method = RequestMethod.GET)
public List<JSONObject> listGroupBds(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager) { public List<JSONObject> listGroupBds(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager) {
return managerAccountsService.listGroupBds(loginManager); return managerAccountsService.listGroupBds(loginManager);
} }
@ManagerMapping(value = "/roles/servant", method = RequestMethod.GET,role = {ManagerRole.ADMIN})
public List<JSONObject> listServants(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager) {
return managerAccountsService.listServants(loginManager);
}
} }

@ -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();
}
}

@ -1,7 +1,10 @@
package au.com.royalpay.payment.manage.tradelog.refund; package au.com.royalpay.payment.manage.tradelog.refund;
import au.com.royalpay.payment.manage.analysis.beans.RefundReviewBean; import au.com.royalpay.payment.manage.analysis.beans.RefundReviewBean;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -44,4 +47,6 @@ public interface RefundService {
JSONObject findReviewOrder(String reviewId); JSONObject findReviewOrder(String reviewId);
JSONObject checkRefundAuditFlag(); JSONObject checkRefundAuditFlag();
JSONObject listUnionAllApply(JSONObject params,PageBounds pagination);
} }

@ -87,7 +87,8 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
throw new RefundExistException(); throw new RefundExistException();
} }
if (apply.isEmpty()) { 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; return order;
} else { } else {
if (account != null) { if (account != null) {
@ -118,7 +119,8 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
if (undoRefundOrder != null) { if (undoRefundOrder != null) {
throw new BadRequestException("该笔订单有退款正在处理,请稍后再试!"); 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; return order;
} }
@ -143,12 +145,13 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
int clientId = order.getIntValue("client_id"); int clientId = order.getIntValue("client_id");
String currency = order.getString("currency"); String currency = order.getString("currency");
//增加角色审核 // 增加角色审核
JSONObject client = clientManager.getClientInfo(clientId); JSONObject client = clientManager.getClientInfo(clientId);
Assert.notNull(client, "client not exists"); Assert.notNull(client, "client not exists");
JSONObject clientConfig = clientConfigService.find(clientId); JSONObject clientConfig = clientConfigService.find(clientId);
OperatorType type = account != null ? OperatorType.PARTNER : OperatorType.MANAGER; 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); logger.debug("applyer type=" + type + "; require audit=" + requireAudit);
paymentApi.clientRefundBalanceCheck(clientId, orderId, currency, feeAmount); 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")); BigDecimal realAmount = original ? fee : CurrencyAmountUtils.toAmount(fee, order.getString("currency"));
JSONObject refundConfig = checkRefundAuditFlag(); 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) { if (realAmount.compareTo(refundConfig.getBigDecimal("refundAuditAmount")) > 0) {
//订单需要审核 // 订单需要审核
boolean casherRefund = reviewNewRefundOrder(orderId, realAmount, remark, partnerAccount, manager); boolean casherRefund = reviewNewRefundOrder(orderId, realAmount, remark, partnerAccount, manager);
if (casherRefund) { if (casherRefund) {
return executeRefund(orderId, realAmount, remark, partnerAccount, manager, order, client); 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); checkOrderUseCustomerCoupon(order, amount);
JSONObject clientConfig = clientConfigService.find(client.getIntValue("client_id")); JSONObject clientConfig = clientConfigService.find(client.getIntValue("client_id"));
OperatorType type = partnerAccount != null ? OperatorType.PARTNER : OperatorType.MANAGER; 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_id", manager.getIntValue("manager_id"));
operator.put("operator", manager.getString("display_name")); 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); logger.debug("applyer type=" + type + "; require audit=" + requireAudit);
return paymentApi.refundOrder(orderId, null, amount, remark, operator, type, requireAudit); return paymentApi.refundOrder(orderId, null, amount, remark, operator, type, requireAudit);
} }
//订单使用积分商城优惠券,仅支持全额退款 // 订单使用积分商城优惠券,仅支持全额退款
private void checkOrderUseCustomerCoupon(JSONObject order, BigDecimal feeAmount) { private void checkOrderUseCustomerCoupon(JSONObject order, BigDecimal feeAmount) {
JSONObject couponLogs = couponAccuessLogMapper.findUsedCouponByOrderId(order.getString("order_id")); JSONObject couponLogs = couponAccuessLogMapper.findUsedCouponByOrderId(order.getString("order_id"));
if (couponLogs != null) { if (couponLogs != null) {
@ -237,7 +242,7 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
} }
@Override @Override
// @Transactional // @Transactional
public JSONObject newReviewRefundOrder(String orderId, BigDecimal fee, boolean original, String remark, JSONObject manager) { public JSONObject newReviewRefundOrder(String orderId, BigDecimal fee, boolean original, String remark, JSONObject manager) {
JSONObject reviewOrder = refundReviewMapper.findUnResolveByOrderId(orderId); JSONObject reviewOrder = refundReviewMapper.findUnResolveByOrderId(orderId);
reviewOrder.put("status", 1); reviewOrder.put("status", 1);
@ -338,7 +343,8 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
private void submitRefund(JSONObject account, JSONObject audition) { private void submitRefund(JSONObject account, JSONObject audition) {
JSONObject refundLog = refundMapper.find(audition.getString("refund_id")); 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) { if (!platformAuditFlag) {
paymentApi.submitRefund(audition.getString("refund_id")); 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) { private boolean auditRefundAndCommitToPlatform(BigDecimal amount, String remark, String orderId, JSONObject account) {
if (amount.compareTo(BigDecimal.ZERO) > 0) { if (amount.compareTo(BigDecimal.ZERO) > 0) {
JSONObject refundConfig = checkRefundAuditFlag(); JSONObject refundConfig = checkRefundAuditFlag();
if (refundConfig != null && refundConfig.getBoolean("refundAudit") && if (refundConfig != null && refundConfig.getBoolean("refundAudit") && amount.compareTo(refundConfig.getBigDecimal("refundAuditAmount")) >= 0) {
amount.compareTo(refundConfig.getBigDecimal("refundAuditAmount")) >= 0) { // 订单需要审核
//订单需要审核
reviewNewRefundOrder(orderId, amount, remark, account, null); reviewNewRefundOrder(orderId, amount, remark, account, null);
return true; return true;
} }
//退款 // 退款
return false; return false;
} else { } else {
throw new BadRequestException("Refund amount can not be 0"); 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()); review.put("bd_name", bdNameStr.deleteCharAt(bdNameStr.length() - 1).toString());
JSONObject order = orderMapper.find(review.getString("order_id")); 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("create_time", order.getDate("create_time"));
review.put("channel", order.getString("channel")); review.put("channel", order.getString("channel"));
return review; return review;
@ -427,6 +433,15 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
return refundConfig; 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 @Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) { public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.publisher = applicationEventPublisher; this.publisher = applicationEventPublisher;

@ -112,6 +112,9 @@ mail.mailgun.default.merchantlist=merchants@mail.royalpay.com.au
royalpay.sms.appid=1400094878 royalpay.sms.appid=1400094878
royalpay.sms.appkey=43390d81e20c5191c278fbf4cd275be2 royalpay.sms.appkey=43390d81e20c5191c278fbf4cd275be2
im.openim.appkey=24980715
im.openim.secret=60b1ba680a6f27ffc701f10b6d5be00e
#清算银行配置 #清算银行配置
settle.abafile.default-bank=CBA settle.abafile.default-bank=CBA

@ -2,40 +2,27 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.act.ActChairtyMapper"> <mapper namespace="au.com.royalpay.payment.manage.mappers.act.ActChairtyMapper">
<select id="chairtyClientNum" resultType="com.alibaba.fastjson.JSONObject"> <select id="chairtyClientNum" resultType="com.alibaba.fastjson.JSONObject">
select client_moniker,active_time,IFNULL(count(org_id),0) as count_ordernum,ifnull(sum(pmt_transactions.transaction_amount),0) as sum_ordernum 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 from act_charity
left JOIN pmt_transactions on act_charity.client_id = pmt_transactions.client_id 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_type='Credit' and pmt_transactions.transaction_time>=act_charity.active_time
and pmt_transactions.transaction_time&lt;'2018-09-01' and pmt_transactions.transaction_time>='2018-07-09'
GROUP BY act_charity.client_id order by sum_ordernum desc and pmt_transactions.channel != 'Settlement'
GROUP BY act_charity.client_id order by count_ordernum desc
</select> </select>
<!--
<select id="getChairtyWeekAnalysis" resultType="com.alibaba.fastjson.JSONObject"> <select id="getChairtyWeekAnalysis" resultType="com.alibaba.fastjson.JSONObject">
select weekofyear(DATE_FORMAT(transaction_time,'%Y-%m-%d'))-weekofyear(DATE_FORMAT(transaction_time,'%Y-%m-%d')-interval day(DATE_FORMAT(transaction_time,'%Y-%m-%d'))-1 day)+1 as weekon,IFNULL(count(org_id),0) as count_ordernum,ifnull(sum(pmt_transactions.transaction_amount),0) as sum_ordernum 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
from act_charity and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=#{begin} and pmt_transactions.transaction_time&lt;=#{end} and pmt_transactions.transaction_time>=act_charity.active_time
inner JOIN pmt_transactions on act_charity.client_id = pmt_transactions.client_id and pmt_transactions.channel != 'Settlement'
and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time&lt;'2018-09-01' and pmt_transactions.transaction_time>='2018-07-09'
and pmt_transactions.transaction_time&gt;=#{begin} group by date_format(pmt_transactions.transaction_time,'%Y-%m-%d')
and pmt_transactions.transaction_time&lt;=#{end}
group by weekon order by weekon asc;
</select>-->
<select id="getChairtyWeekstartAnalysis" resultType="com.alibaba.fastjson.JSONObject">
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&gt;=#{begin} and pmt_transactions.transaction_time&lt;=#{end}
group by weekstart order by weekstart asc;
</select>
<select id="getChairtyWeekAnalysis" resultType="com.alibaba.fastjson.JSONObject">
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&gt;=#{begin} and pmt_transactions.transaction_time&lt;=#{end}
</select> </select>
<select id="getChairtyWeekRaking" resultType="com.alibaba.fastjson.JSONObject"> <select id="getChairtyWeekRaking" resultType="com.alibaba.fastjson.JSONObject">
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 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&gt;=#{begin} and pmt_transactions.transaction_time&lt;=#{end} and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time&gt;=#{begin} and pmt_transactions.transaction_time&lt;=#{end} and pmt_transactions.transaction_time>=act_charity.active_time
GROUP BY act_charity.client_moniker order by sum_ordernum desc and pmt_transactions.transaction_time&lt;'2018-09-01' and pmt_transactions.transaction_time>='2018-07-09'
GROUP BY act_charity.client_moniker order by chair_ordernum desc
</select> </select>
</mapper> </mapper>

@ -42,4 +42,7 @@
GROUP BY access_date GROUP BY access_date
ORDER BY access_date DESC ORDER BY access_date DESC
</select> </select>
<select id="sumMoney" resultType="com.alibaba.fastjson.JSONObject">
select sum(actural_amount) actural_amount from cus_encourage_money_access_log where member_id = #{memberId} and event_id = #{eventId};
</select>
</mapper> </mapper>

@ -43,4 +43,7 @@
INNER JOIN pmt_orders o ON o.order_id=u.order_id AND o.status>4 INNER JOIN pmt_orders o ON o.order_id=u.order_id AND o.status>4
WHERE u.transaction_id is null WHERE u.transaction_id is null
</select> </select>
<select id="sumMoney" resultType="com.alibaba.fastjson.JSONObject">
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
</select>
</mapper> </mapper>

@ -9,7 +9,8 @@
c.bd_level, c.bd_level,
c.city, c.city,
c.get_prize, c.get_prize,
c.bd_group c.bd_group,
c.kpi_amount
FROM sys_managers m FROM sys_managers m
LEFT JOIN financial_bd_config c ON c.manager_id = m.manager_id 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) WHERE m.role & 4 > 0 AND m.is_valid = 1 AND (m.org_id = 1 OR m.org_id IS NULL)

@ -8,7 +8,7 @@
</select> </select>
<select id="getReport" resultType="com.alibaba.fastjson.JSONObject"> <select id="getReport" resultType="com.alibaba.fastjson.JSONObject">
SELECT SELECT
r.*, r.*,l.kpi_amount,
sum(total_prize) total_prize, sum(total_prize) total_prize,
sum(send_prize) total_send_prize, sum(send_prize) total_send_prize,
sum(total_donation) total_donation sum(total_donation) total_donation

@ -28,4 +28,12 @@
LEFT JOIN sys_accounts a ON a.account_id = nc.read_id LEFT JOIN sys_accounts a ON a.account_id = nc.read_id
WHERE nc.status = '1' AND nc.notice_id = #{notice_id} WHERE nc.status = '1' AND nc.notice_id = #{notice_id}
</select> </select>
<select id="countNoticePartner" resultType="int">
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}
<if test="is_to_app!=null">
and n.is_to_app=#{is_to_app}
</if>
</select>
</mapper> </mapper>

@ -69,4 +69,62 @@
and DATE_FORMAT(create_time,'%Y-%m-%d') = DATE_FORMAT(#{today},'%Y-%m-%d'); and DATE_FORMAT(create_time,'%Y-%m-%d') = DATE_FORMAT(#{today},'%Y-%m-%d');
</if> </if>
</select> </select>
<select id="listUnionAllApply" resultType="com.alibaba.fastjson.JSONObject">
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
<where>
<if test="client_id!=null">
and client_id = #{client_id}
</if>
<if test="start_time!=null">
and create_time &lt;= #{start_time}
</if>
<if test="start_time!=null">
and create_time &gt;= #{end_time}
</if>
<if test="client_ids!=null">
client_id in
<foreach collection="client_ids" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</if>
</where>
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
<where>
<if test="client_id!=null">
and client_id = #{client_id}
</if>
<if test="start_time!=null">
and applytime &lt;= #{start_time}
</if>
<if test="start_time!=null">
and applytime &gt;= #{end_time}
</if>
<if test="client_ids!=null">
client_id in
<foreach collection="client_ids" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</if>
</where>
order by create_time desc
</select>
</mapper> </mapper>

@ -100,14 +100,14 @@
<select id="analysisTransFlow" resultType="com.alibaba.fastjson.JSONObject"> <select id="analysisTransFlow" resultType="com.alibaba.fastjson.JSONObject">
SELECT SELECT
count(t.transaction_id) order_count, count(DISTINCT o.order_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) 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, 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, 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, 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, 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, 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 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 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 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' WHERE year(o.create_time) = #{year} AND month(o.create_time) = #{month} AND t.channel != 'Settlement'
<if test="channel=='Wechat'"> <if test="channel!=null">
and t.channel not in ('Alipay','Bestpay')
</if>
<if test="channel!='Wechat'">
and t.channel = #{channel} and t.channel = #{channel}
</if> </if>
GROUP BY o.client_id, trade_date GROUP BY o.client_id, trade_date
@ -507,7 +504,7 @@
<select id="TotalAmountForBDLeaderPrize" resultType="java.math.BigDecimal"> <select id="TotalAmountForBDLeaderPrize" resultType="java.math.BigDecimal">
SELECT 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 total
FROM pmt_transactions t FROM pmt_transactions t
INNER JOIN pmt_orders o ON o.order_id = t.order_id 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&lt;=now() and (b.end_date is null or b.end_date &gt;= now()) where b.is_valid=1 and b.start_date&lt;=now() and (b.end_date is null or b.end_date &gt;= now())
AND c.bd_group=#{bd_group} or c.manager_id=#{bd_group}) AND c.bd_group=#{bd_group} or c.manager_id=#{bd_group})
</select> </select>
<select id="TotalAmountForSydneyGMPrize" resultType="java.math.BigDecimal">
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&lt;=now() and (b.end_date is null or b.end_date &gt;= now())
AND c.city='Sydney')
</select>
<select id="listTransactionsForCityPartnerCommission" resultType="com.alibaba.fastjson.JSONObject"> <select id="listTransactionsForCityPartnerCommission" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[ <![CDATA[
SELECT SELECT

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper">
<select id="query" resultType="com.alibaba.fastjson.JSONObject">
SELECT a.*,c.client_moniker client_moniker FROM sys_accounts a left join sys_clients c on c.client_id = a.client_id
<where>
<if test="clientId!=null">
and a.client_id = #{clientId}
</if>
<if test="userNames!=null">
and a.username in (
<foreach collection="userNames" item="item" separator=",">
#{item}
</foreach>
)
</if>
</where>
</select>
</mapper>

@ -20,7 +20,8 @@
SELECT SELECT
b.*, b.*,
c.bd_level, c.bd_level,
c.get_prize c.get_prize,
c.kpi_amount
FROM sys_client_bd b FROM sys_client_bd b
LEFT JOIN financial_bd_config c ON c.manager_id = b.bd_id 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 WHERE client_id = #{client_id} AND start_date <= #{date} AND (end_date > #{date} OR end_date IS NULL) AND

@ -168,7 +168,7 @@
</select> </select>
<select id="passPartners" resultType="com.alibaba.fastjson.JSONObject"> <select id="passPartners" resultType="com.alibaba.fastjson.JSONObject">
SELECT 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 from sys_clients
<where> <where>
(approve_result=1 or (approve_result=2 and (source=1 or source=2))) (approve_result=1 or (approve_result=2 and (source=1 or source=2)))

@ -27,8 +27,15 @@
) o ) o
ON m.wx_openid = o.wechat_openid ON m.wx_openid = o.wechat_openid
<where> <where>
<if test="org_id!=null and org_ids==null">m.org_id=#{org_id}</if> <if test="username!=null">
<if test="org_ids!=null">m.org_id in <bind name="username_pattern" value="'%'+username+'%'"/>
and m.username like #{username_pattern}
</if>
<if test="mask!=null">
and <![CDATA[ m.role & #{mask} >0 ]]>
</if>
<if test="org_id!=null and org_ids==null"> AND m.org_id=#{org_id}</if>
<if test="org_ids!=null"> AND m.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
and m.is_valid=1 and m.is_valid=1
</where> </where>
@ -87,4 +94,14 @@
WHERE role & #{mask} >0 AND wx_openid IS NOT NULL AND is_valid = 1 WHERE role & #{mask} >0 AND wx_openid IS NOT NULL AND is_valid = 1
]]> ]]>
</select> </select>
<select id="listServants" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT display_name
FROM sys_managers
WHERE role & #{mask} >0 AND org_id IS NULL AND is_valid = 1
]]>
</select>
</mapper> </mapper>

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.SysCustomerServiceMapper">
<select id="findOnline" resultType="com.alibaba.fastjson.JSONObject">
select user_id from sys_customer_service
where `onoff` = 1
</select>
<update id="onoff">
udpate sys_customer_servie
set status = #{status}
where manager_id = #{managerId}
</update>
<select id="findAllWithDetail" resultType="com.alibaba.fastjson.JSONObject">
select s.user_id,s.onoff,m.* from
sys_customer_service s left join sys_managers m
on s.manager_id = m.manager_id
</select>
</mapper>

@ -21,7 +21,7 @@
<div class="main-container"> <div class="main-container">
<img src="/static/templates/activity/encourage_money/desc_banner.png" class="banner-img"> <img src="/static/templates/activity/encourage_money/desc_banner.png" class="banner-img">
<div class="title-box"> <div class="title-box">
<div class="welcome">欢迎使用微信支付</div> <div class="welcome">欢迎使用RoyalPay支付</div>
<div class="title">奖励再翻倍</div> <div class="title">奖励再翻倍</div>
<img class="bubble" src="/static/templates/activity/encourage_money/bubble.png"> <img class="bubble" src="/static/templates/activity/encourage_money/bubble.png">
</div> </div>
@ -32,7 +32,7 @@
<img src="/static/templates/activity/encourage_money/title-icon.png" class="title-icon title-icon-right"> <img src="/static/templates/activity/encourage_money/title-icon.png" class="title-icon title-icon-right">
</div> </div>
<div class="content"> <div class="content">
用户在支持微信支付的商户进行消费,金额<span class="notice">≥10澳币</span>时, 用户在支持RoyalPay的商户使用微信、支付宝进行消费,金额<span class="notice">≥10澳币</span>时,
立即获得随机鼓励金。最高可达888元每人每天可领取<span class="notice">三次</span> 立即获得随机鼓励金。最高可达888元每人每天可领取<span class="notice">三次</span>
</div> </div>
</div> </div>
@ -68,9 +68,9 @@
鼓励金仅在活动期间有效,活动结束鼓励金自动清零。 鼓励金仅在活动期间有效,活动结束鼓励金自动清零。
</div> </div>
</div> </div>
<a class="merchants-link" href="/act/encourage_money/merchants"> <!--<a class="merchants-link" href="/act/encourage_money/merchants">-->
<span class="text">查看活动商家</span> <!--<span class="text">查看活动商家</span>-->
</a> <!--</a>-->
<div class="remark">本活动的最终解释权归RoyalPay所有</div> <div class="remark">本活动的最终解释权归RoyalPay所有</div>
</div> </div>
</body> </body>

@ -1,5 +1,5 @@
<!doctype html> <!doctype html>
<html> <html xmlns:th="http://www.w3.org/1999/xhtml">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0"> <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
@ -16,11 +16,14 @@
<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript" src="/static/lib/jquery/jquery-2.1.4.min.js"></script> <script type="text/javascript" src="/static/lib/jquery/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="/static/templates/disable_wechat_menu.js?t=201607281849"></script> <script type="text/javascript" src="/static/templates/disable_wechat_menu.js?t=201607281849"></script>
<script type="text/javascript" data-th-inline="javascript">
</script>
</head> </head>
<body> <body>
<div class="main-container"> <div class="main-container">
<div class="banner"> <div class="banner">
<img class="head-box" data-th-src="@{${wxUser['headimgurl']}"> <img class="head-box" data-th-src="@{${user['headimg']}?${user['headimg']}:'/static/images/act/encourage_money/default_headimg.png' }">
</div> </div>
<div class="desc">活动期间任意消费满10澳币获随机鼓励金</div> <div class="desc">活动期间任意消费满10澳币获随机鼓励金</div>
<div class="detail-box"> <div class="detail-box">
@ -29,26 +32,26 @@
</div> </div>
<div class="balance-log-container" data-th-if="${balance_status['logs']}"> <div class="balance-log-container" data-th-if="${balance_status['logs']}">
<div class="item" data-th-each="item : ${balance_status['logs']}" data-th-classappend="${item['is_today']?'today':''}" > <div class="item" data-th-each="item : ${balance_status['logs']}" data-th-classappend="${item['is_today']}?'today':''" >
<div class="date-box" data-th-text="${item['date_str']}"> <div class="date-box data-box-amount" style="width: 30%; text-align: center;" data-th-text="${item['date_str']}">
</div> </div>
<div class="count" data-th-classappend="${item['type'] eq 'Debit']?'debit':''}" data-th-text="${#numbers.formatDecimal(item['amount'],1,2)}"></div> <div class="date-box data-box-amount" style="width: 30%; text-align: center" data-th-classappend="${item['type']} eq 'Debit'?'used':''" data-th-text="${'$'+#numbers.formatDecimal(item['amount'],1,2)}"></div>
<div class="factor" data-th-if="${item['factor']}>1" data-th-text="|已翻${item['factor']}倍|">
</div> <div class="date-box data-box-amount" style="width: 40%; text-align: center;font-size: 14px" data-th-if="${item['factor']}>1" data-th-text="|已翻${item['factor']}倍|">
</div> </div>
</div>
</div> </div>
<div class="balance-footer"> <div class="balance-footer">
<div class="row"> <div class="row">
<div class="label">已用鼓励金:</div> <div class="label">已用鼓励金:</div>
<div class="count" data-th-text="${#numbers.formatDecimal(balance_status['member']['used_amount'],1,2)}"></div> <div class="count" data-th-text="${'$'+#numbers.formatDecimal(balance_status['member']['used_amount'],1,2)}"></div>
</div> </div>
<div class="row"> <div class="row">
<div class="label">当前鼓励金余额:</div> <div class="label">当前鼓励金余额:</div>
<div class="count available" data-th-text="${#numbers.formatDecimal(balance_status['member']['encourage_balance'],1,2)}"></div> <div class="count available" data-th-text="${'$'+#numbers.formatDecimal(balance_status['member']['encourage_balance'],1,2)}"></div>
</div> </div>
</div> </div>
</div> </div>

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<script src="https://g.alicdn.com/aliww/??h5.openim.sdk/1.0.6/scripts/wsdk.js,h5.openim.kit/0.3.3/scripts/kit.js" charset="utf-8"></script>
<script type="text/javascript" data-th-inline="javascript">
window.uid = /*[[*{uid}]]*/null;
window.credential = /*[[*{password}]]*/null;
window.onload = function(){
WKIT.init({
container: document.getElementById('J_demo'),
width: 700,
height: 500,
uid: window.uid,
appkey: 24962653,
credential: window.credential,
touid: 'imuser1234',
logo: 'http://img.alicdn.com/tps/i3/TB12LD9IFXXXXb3XpXXSyFWJXXX-82-82.png',
pluginUrl: 'http://www.taobao.com/market/seller/openim/plugindemo.php'
});
}
</script>
</head>
</html>

@ -120,6 +120,12 @@ margin-bottom: 10%;"/>
<div class="navbar-custom-menu"> <div class="navbar-custom-menu">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li class="user-menu">
<a role="button" ng-click="customerService()">
<i class="fa fa-wechat"></i> contact service
</a>
</li>
<li class="user-menu"> <li class="user-menu">
<a role="button" ng-click="managerBindWechat(true)"> <a role="button" ng-click="managerBindWechat(true)">
<i class="fa fa-wechat"></i> Bind WeChat <i class="fa fa-wechat"></i> Bind WeChat
@ -307,13 +313,13 @@ margin-bottom: 10%;"/>
<!--</a>--> <!--</a>-->
<!--</li>--> <!--</li>-->
<!-- <li ui-sref-active="active" ng-if="('encourage'|withModule)"> <li ui-sref-active="active" ng-if="('encourage'|withModule)">
<a ui-sref="encourageAct"> <a ui-sref="encourageAct">
<i class="fa fa-gift"></i> <span>鼓励金</span> <i class="fa fa-gift"></i> <span>鼓励金</span>
</a> </a>
</li> </li>
<li ui-sref-active="active" ng-if="('act_customer_redpack'|withModule)"> <!--<li ui-sref-active="active" ng-if="('act_customer_redpack'|withModule)">
<a ui-sref="customer_redpack"> <a ui-sref="customer_redpack">
<i class="fa fa-gift"></i> <span>红包返现</span> <i class="fa fa-gift"></i> <span>红包返现</span>
</a> </a>
@ -347,10 +353,7 @@ margin-bottom: 10%;"/>
<i class="fa fa-money"></i> <span>合同签约情况</span> <i class="fa fa-money"></i> <span>合同签约情况</span>
</a> </a>
</li> </li>
<li class="header nav-header" <li ui-sref-active="active" ng-if="'actChairty'|withModule">
ng-if="('1011110'|withRole) || currentUser.org_id==null">公益服务测试|Act Chairty
</li>
<li ui-sref-active="active">
<a ui-sref="act_chairty" ui-sref-opts="{reload:true}"> <a ui-sref="act_chairty" ui-sref-opts="{reload:true}">
<i class="fa fa-users"></i> <span>半边天公益活动</span> <i class="fa fa-users"></i> <span>半边天公益活动</span>
</a> </a>

@ -798,6 +798,11 @@
</div> </div>
</form> </form>
</div> </div>
<div style="margin-top: 25px;" ng-show="chooseArray[0]">
<a class="text-primary" style="font-size: 14px;text-shadow: #000" target="_blank" href="https://www.globalfreepay.com/">
Application Entrance for Non-Australian Merchants>>
</a>
</div>
</div> </div>
<div class="modal fade"> <div class="modal fade">

@ -0,0 +1,129 @@
<html>
<!--[if lt IE 9]>
<meta charset="utf-8"/>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>
<script src="https://g.alicdn.com/aliww/ww/json/json.js" charset="utf-8"></script>
<![endif]-->
<!-- 自动适配移动端与pc端 -->
<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
<script src="https://g.alicdn.com/aliww/??h5.openim.sdk/1.0.6/scripts/wsdk.js,h5.openim.kit/0.4.0/scripts/kit.js"
charset="utf-8"></script>
<script src="https://g.alicdn.com/aliww/h5.openim.sdk/1.0.6/scripts/wsdk.js"></script>
<script>
window.onload = function () {
window.uid = getQueryString('uid');
window.touid = getQueryString('uid');
window.password = getQueryString('p');
window.appKey = getQueryString('key');
WKIT.init({
container: document.getElementById('J_demo'),
width: 700,
height: 500,
uid: window.uid,
appkey: window.appKey,
credential: window.password,
touid: window.touid,
pluginUrl: '/service_contact_list.html?uid='
+ window.uid,
onLoginSuccess: function (data) {
initLayout();
WKIT.Conn.sdk.Event.on('MSG_RECEIVED', function (data) {
updateContractList(data.data);
});
initUnreadMsgAndContact();
WKIT.Conn.sdk.Base.startListenAllMsg();
window.sdk = document.getElementById("J_wkitPluginFrame").contentWindow;
}
});
}
function switchTouid(touid) {
window.uid = touid;
WKIT.switchTouid({
touid: touid,
logo: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531805782509&di=98f7fa48980696f8eddf7eb617a834a3&imgtype=0&src=http%3A%2F%2Fi2.hdslb.com%2Fbfs%2Fface%2F98dbd049061292bca8625caf91cff1b41ee999cd.jpg',
Avatar: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531805782509&di=98f7fa48980696f8eddf7eb617a834a3&imgtype=0&src=http%3A%2F%2Fi2.hdslb.com%2Fbfs%2Fface%2F98dbd049061292bca8625caf91cff1b41ee999cd.jpg',
toAvatar: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531805782509&di=98f7fa48980696f8eddf7eb617a834a3&imgtype=0&src=http%3A%2F%2Fi2.hdslb.com%2Fbfs%2Fface%2F98dbd049061292bca8625caf91cff1b41ee999cd.jpg'
});
WKIT.Conn.sdk.Chat.setReadState({
touid: touid,
timestamp: Math.floor((+new Date()) / 1000),
success: function (data) {
},
error: function (error) {
console.log('set read state fail', error);
}
});
window.sdk.unreadMap[touid].msgCount = 0;
window.sdk.showContactList(window.sdk.unreadMap);
}
function initUnreadMsgAndContact() {
WKIT.Conn.sdk.Base.getRecentContact({
count: 40,
success: function (data) {
var cnts = data.data.cnts;
for (var i = cnts.length - 1; i >= 0; i--) {
var unreadmapEle = {msgCount: 0};
window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick(
cnts[i].from)] = unreadmapEle;
}
getUnreadMsgCount();
},
error: function (error) {
console.log('get contact msg count fail',
error);
}
})
}
function getUnreadMsgCount() {
WKIT.Conn.sdk.Base.getUnreadMsgCount({
count: 40,
success: function (data) {
console.log(data);
var unreads = data.data;
var uids = "";
for (var i = unreads.length - 1; i >= 0; i--) {
if(window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick(unreads[i].contact)]){
}
window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick(unreads[i].contact)].msgCount =
unreads[i].msgCount;
var nick = WKIT.Conn.sdk.Base.getNick(unreads[i].contact)
uids += nick.substr(0,nick.length-6) + ",";
}
window.sdk.loadContactList(uids);
},
error: function (error) {
console.log('get recent contact fail', error);
}
});
}
function updateContractList(data) {
var msg = data.msgs[0];
var msg_uid = WKIT.Conn.sdk.Base.getNick(msg.from);
if (window.sdk.unreadMap[msg_uid]) {
window.sdk.unreadMap[msg_uid].msgCount = window.sdk.unreadMap[msg_uid].msgCount + 1;
} else {
var unreadMapEle = {msgCount: 1}
window.sdk.unreadMap[msg_uid] = unreadMapEle;
}
window.sdk.loadContactList(msg_uid.substr(0,msg_uid-6));
}
function initLayout() {
$("#J_wkitUserInfo").hide();
$("#J_wkitPluginFrameWrap").height("100%");
$("#J_wkitPluginFrameWrap").css("margin", "0 0 0 0");
}
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
</script>
</html>

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

@ -0,0 +1,23 @@
<html>
<!--[if lt IE 9]>
<meta charset="utf-8" />
<script src="https://g.alicdn.com/aliww/ww/json/json.js" charset="utf-8"></script>
<![endif]-->
<!-- 自动适配移动端与pc端 -->
<script src="https://g.alicdn.com/aliww/??h5.openim.sdk/1.0.6/scripts/wsdk.js,h5.openim.kit/0.3.3/scripts/kit.js"
charset="utf-8"></script>
<script>
window.onload = function () {
WKIT.init({
container: document.getElementById('J_demo'),
width: 700,
height: 500,
uid: 'kira1',
appkey: 24980715,
credential: 'xxxxxx',
touid: 'dalong',
logo: 'http://img.alicdn.com/tps/i3/TB12LD9IFXXXXb3XpXXSyFWJXXX-82-82.png',
});
}
</script>
</html>

@ -23,26 +23,24 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angul
$http.get('/actchairty/clients', {params: params}).then(function (resp) { $http.get('/actchairty/clients', {params: params}).then(function (resp) {
$scope.clients = resp.data.data; $scope.clients = resp.data.data;
$scope.pagination = resp.data.pagination; $scope.pagination = resp.data.pagination;
}) })
}; };
$scope.loadClients(); $scope.loadClients();
$scope.new_conf = {}; $scope.new_conf = {};
$scope.ctrl = {dateInput: false}; $scope.ctrl = {dateInput: false};
$scope.disableClient = function (client) {
$http.delete('/actchairty/clients/' + client.client_moniker).then(function () {
$scope.loadClients();
});
};
$scope.submitClient = function () { $scope.submitClient = function () {
$scope.errmsg = null; var client_moniker = $scope.new_conf.client_moniker;
$scope.msg = null;
var conf = { var conf = {
date: $filter('date')($scope.new_conf.date, 'yyyy-MM-dd'), date: $filter('date')($scope.new_conf.date, 'yyyy-MM-dd'),
}; };
$http.put('/actchairty/clients/' + $scope.new_conf.client_moniker, conf).then(function () { $http.put('/actchairty/clients/' + $scope.new_conf.client_moniker, conf).then(function () {
$scope.new_conf = {}; $scope.new_conf = {};
$scope.loadClients(); $scope.loadClients();
$scope.msg = "商户创建成功商户ID"+ client_moniker + " 参加时间:" + conf.date;
}, function (resp) { }, function (resp) {
$scope.errmsg = resp.data.message; $scope.msg = resp.data.message;
}); });
}; };
}]); }]);
@ -80,35 +78,30 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angul
$http.get('/actchairty/clients', {params: params}).then(function (resp) { $http.get('/actchairty/clients', {params: params}).then(function (resp) {
$scope.chairtyPartnersRanking = resp.data.data; $scope.chairtyPartnersRanking = resp.data.data;
$scope.total_ranking_pagination = resp.data.pagination; $scope.total_ranking_pagination = resp.data.pagination;
var amount = 0; });
var chairty = 0; $scope.getTotalAmount = function () {
angular.forEach(resp.data.data, function (data) { $http.get('/actchairty/total').then(function (resp) {
amount += parseFloat(data.sum_ordernum); $scope.totalAmount = resp.data.amount;
chairty += parseFloat(data.chairty_num) $scope.totalChairty = resp.data.chairty;
return amount,chairty; })
}); };
$scope.totalAmount = amount;
$scope.totalChairty = Math.round(chairty*100)/100; ;
})
};
$scope.getTotalCashBack = function () {
}; };
$scope.getClientsCashbackRankingByDate = function (date,page) { $scope.getClientsCashbackRankingByDate = function (date,page) {
var dateend = angular.copy($scope.params);
$scope.event_date = date; $scope.event_date = date;
var params = {}; var params = {};
params.begin = date; params.begin = date;
var event_date_format=date.replace(/^(\d{4})(\d{2})(\d{2})$/, "$1-$2-$3") var event_date_format=date.replace(/^(\d{4})(\d{2})(\d{2})$/, "$1-$2-$3")
var endDate = new Date(event_date_format); var endDate = new Date(event_date_format);
endDate.setDate(endDate.getDate()+6); endDate.setDate(endDate.getDate()+6);
params.end =$filter('date')(endDate,'yyyyMMdd'); var end1 = $filter('date')(endDate, 'yyyyMMdd');
var end2 = $filter('date')(dateend.end, 'yyyyMMdd');
if (end1 > end2) {
params.end =$filter('date')(dateend.end,'yyyyMMdd');
}
else {
params.end =$filter('date')(endDate,'yyyyMMdd');
}
params.page = page||$scope.day_ranking_pagination.page || 1; params.page = page||$scope.day_ranking_pagination.page || 1;
params.limit = 10; params.limit = 10;
if ($scope.params.cashback_type){ if ($scope.params.cashback_type){
@ -116,9 +109,6 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angul
} }
$http.get('/actchairty/ranking', {params: params}).then(function (resp) { $http.get('/actchairty/ranking', {params: params}).then(function (resp) {
$scope.cashbackPartnersRankingByDate = resp.data.data; $scope.cashbackPartnersRankingByDate = resp.data.data;
if(resp.data.data != null){
}
$scope.day_ranking_pagination = resp.data.pagination; $scope.day_ranking_pagination = resp.data.pagination;
}); });
}; };
@ -197,12 +187,13 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angul
$scope.doPartnerTotalRanking(1); $scope.doPartnerTotalRanking(1);
}; };
$scope.doAnalysis(1); $scope.doAnalysis(1);
$scope.getTotalCashBack(1); $scope.getTotalAmount(1);
$scope.settleDelayEchart = function (chart) { $scope.settleDelayEchart = function (chart) {
chart.on('click', function (params) { chart.on('click', function (params) {
$scope.cashBack_total_daily = $scope.cashbackDaily[params.dataIndex].chairty_amount; $scope.cashBack_total_daily = $scope.cashbackDaily[params.dataIndex].chairty_amount;
var event_date = $scope.cashbackDaily[params.dataIndex].weekstart; var event_date = $scope.cashbackDaily[params.dataIndex].weekstart;
if (event_date) { if (event_date) {
event_date+=""; event_date+="";
var event_date_format=event_date.replace(/^(\d{4})(\d{2})(\d{2})$/, "$1-$2-$3") var event_date_format=event_date.replace(/^(\d{4})(\d{2})(\d{2})$/, "$1-$2-$3")

@ -50,7 +50,7 @@
</div> </div>
<div class="box"> <div class="box">
<div class="box-header"> <div class="box-header">
<h3 class="box-title">Settle Delay Ranking</h3> <h3 class="box-title">Chairty Ranking</h3>
</div> </div>
<div class="box-body"> <div class="box-body">
<div class="row cen col-sm-12"> <div class="row cen col-sm-12">

@ -23,7 +23,7 @@
</ul> </ul>
<div class="tab-content" ui-view> <div class="tab-content" ui-view>
<div class="modal-body"> <div class="modal-body">
<div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div> <div class="alert alert-info" ng-if="msg" ng-bind="msg"></div>
<div class="form-inline"> <div class="form-inline">
<div class="form-group"> <div class="form-group">
<input class="form-control" placeholder="Client Moniker" ng-model="new_conf.client_moniker"> <input class="form-control" placeholder="Client Moniker" ng-model="new_conf.client_moniker">
@ -46,19 +46,15 @@
<th>订单量</th> <th>订单量</th>
<th>订单金额</th> <th>订单金额</th>
<th>捐款额</th> <th>捐款额</th>
<th>Operation</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="client in clients"> <tr ng-repeat="client in clients">
<td ng-bind="client.client_moniker"></td> <td ng-bind="client.client_moniker"></td>
<td ng-bind="client.active_time"></td> <td ng-bind="client.active_time"></td>
<td ng-bind="client.count_orderNum"></td> <td ng-bind="client.count_ordernum"></td>
<td ng-bind="client.sum_orderNum"></td> <td ng-bind="client.sum_ordernum"></td>
<td ng-bind="client.chairty_num"></td> <td ng-bind="client.chairty_num"></td>
<td>
<a role="button" class="text-danger" ng-click="disableClient(client)"><i class="fa fa-ban"></i></a>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -78,6 +74,9 @@
next-text="&rsaquo;" next-text="&rsaquo;"
first-text="&laquo;" first-text="&laquo;"
last-text="&raquo;"></uib-pagination> last-text="&raquo;"></uib-pagination>
<div class="row">
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total Pages:{{pagination.totalPages}}</div>
</div>
</div> </div>
</div> </div>

@ -28,7 +28,7 @@
</header> </header>
<div class="content"> <div class="content">
<div class="banner_img"> <div class="banner_img">
<img height="112" width="344" src="/static/images/loving_merchants/banner.png"> <img height="112" width="344" src="/static/images/loving_merchants/banner.jpg">
</div> </div>
<div class="circular_img"> <div class="circular_img">
<img src="/static/images/loving_merchants/circular.png"> <img src="/static/images/loving_merchants/circular.png">

@ -176,6 +176,11 @@ define(['angular', 'angularSanitize', 'angularAnimate', 'angularMessages', 'uiRo
// $scope.showQrCode(resp.data.url); // $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) { app.controller('changePwdCtrl', ['$scope', '$http', function ($scope, $http) {

@ -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.params = {year: new Date().getFullYear()};
$scope.generate = {};
$scope.availableYears = [new Date().getFullYear() - 1, new Date().getFullYear()]; $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.initMonth = function (year) {
$scope.params.year = year; $scope.params.year = year;
$scope.months = []; $scope.months = [];
@ -72,27 +75,37 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
}; };
$scope.getYearReports(new Date().getFullYear()); $scope.getYearReports(new Date().getFullYear());
$scope.generateReport = function () { $scope.generateReport = function () {
if (!$scope.generate.month) {
commonDialog.alert({
type: 'error', title: 'Error', content: 'Select a month first!'
});
return;
}
commonDialog.confirm({ commonDialog.confirm({
title: 'Warning', title: 'Warning',
content: 'This operation will clear the result of last month generated before. Are you sure?' content: 'This operation will clear the result of last month generated before. Are you sure?'
}).then(function () { }).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'}); commonDialog.alert({title: 'Success', content: 'Generate Finished', type: 'success'});
$scope.getYearReports($scope.params.year); $scope.getYearReports($scope.params.year);
}, function (resp) { }, 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 () { $scope.loadRateConfigs = function () {
$http.get('/sys/bd_prize/config/rates').then(function (resp) { $http.get('/sys/bd_prize/config/rates').then(function (resp) {
$scope.bd_rate_configs = resp.data; $scope.bd_rate_configs = resp.data;
$scope.bd_rate_ranges = []; $scope.kpi_ranges = [];
var rangeStart = []; var kpiStart = [];
angular.forEach($scope.bd_rate_configs, function (cfg) { angular.forEach($scope.bd_rate_configs, function (cfg) {
if (rangeStart.indexOf(cfg.rate_from) < 0) { if (kpiStart.indexOf(cfg.kpi_range) < 0) {
rangeStart.push(cfg.rate_from); kpiStart.push(cfg.kpi_range);
$scope.bd_rate_ranges.push(cfg); $scope.kpi_ranges.push(cfg);
} }
}) })
}) })
@ -136,7 +149,10 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
value: 3, value: 3,
label: '>=7 Months' 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.rates = rates;
$scope.submitRates = function () { $scope.submitRates = function () {
var validation = null; 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) { app.controller('bdCommissionConfigCtrl', ['$scope', '$state', '$http', '$filter', 'monModal', function ($scope, $state, $http, $filter, monModal) {
$scope.monModal = monModal; $scope.monModal = monModal;
$scope.params = {year: new Date().getFullYear()}; $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.bdmon;
// $scope.newSwitch; // $scope.newSwitch;
$scope.initMonth = function (year) { $scope.initMonth = function (year) {
@ -209,6 +225,34 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
var end = $filter('date')(new Date(), 'yyyy-MM'); var end = $filter('date')(new Date(), 'yyyy-MM');
return start <= mon && end >= mon 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) { $scope.listCurrentMonBDCommission = function (mon) {
$http.get('/sys/bd_prize/commission/le_ma/' + mon).then(function (resp) { $http.get('/sys/bd_prize/commission/le_ma/' + mon).then(function (resp) {
$scope.bdlm = resp.data; $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) { app.controller('bdPrizeMonthReportCtrl', ['$scope', '$http', 'report', function ($scope, $http, report) {
$scope.report = report.data; $scope.report = report.data;

@ -1,54 +1,144 @@
<style>
.intro_color{
color:#7a869d ;
}
</style>
<div class="modal-header"> <div class="modal-header">
<h4>Leader Commission Config</h4> <h4>Commission Config</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<!--<div class="alert alert-danger" ng-bind="errmsg" ng-if="errmsg"></div>--> <!--<div class="alert alert-danger" ng-bind="errmsg" ng-if="errmsg"></div>-->
<div class="table-responsive"> <button class="btn btn-primary" ng-bind="bdmon" style="margin-bottom: 10px"></button>
<button class="btn btn-primary" ng-bind="bdmon"></button> <uib-tabset>
<table class="table table-hover"> <uib-tab heading="Leader">
<thead> <div class="box margin-top" >
<tr> <div class="box-body no-padding table-responsive">
<th>Commission Amount</th> <div class="table-responsive margin-top">
<th>Commission Rate</th> <table class="table table-hover">
<th>BD Type</th> <thead>
<th> <tr>
<span class="fa fa-plus" style="color: #0bb20c" ng-click="bdlm.push({})"></span> <th>Commission Amount</th>
</th> <th>Commission Rate</th>
</tr> <th>BD Type</th>
</thead> <th>
<tbody> <button class="btn btn-primary" ng-click="chooseLastConfig(bdmon)" ng-if="bdlm.length<=0">启用上月设置</button>
<tr ng-repeat="bd in bdlm"> <span class="fa fa-plus" style="color: #0bb20c" ng-click="bdlm.push({})"></span>
<td class="col-sm-5"> </th>
<div class="input-group"> </tr>
<input class="form-control" id="re-from-input" type="number" </thead>
ng-model="bd.commission_start_amount" <tbody>
placeholder="Start Amount"> <tr ng-repeat="bd in bdlm">
<span class="input-group-addon">~</span> <td class="col-sm-5">
<input class="form-control" id="re-to-input" type="number" <div class="input-group">
ng-model="bd.commission_end_amount" <input class="form-control" id="re-from-input" type="number"
placeholder="End Amount"> ng-model="bd.commission_start_amount"
</div> placeholder="Start Amount">
</td> <span class="input-group-addon">~</span>
<td class="col-sm-3"> <input class="form-control" id="re-to-input" type="number"
<div class="input-group"> ng-model="bd.commission_end_amount"
<input placeholder="rate" class="form-control" type="number" step="0.01" placeholder="End Amount">
ng-model="bd.bd_commission_rate"> </div>
<span class="input-group-addon">%</span> </td>
</div> <td class="col-sm-3">
</td> <div class="input-group">
<td> <input placeholder="rate" class="form-control" type="number" step="0.01"
<select class="form-control" ng-model="bd.bd_type" ng-options="bdtype.id as bdtype.label for bdtype in bdtypes"></select> ng-model="bd.bd_commission_rate">
</td> <span class="input-group-addon">%</span>
<td> </div>
<span class="fa fa-close" style="color: #b92c28" ng-click="deleteCommission(bd.bc_config_id)"></span> </td>
</td> <td>
</tr> <select class="form-control" ng-model="bd.bd_type" ng-options="bdtype.id as bdtype.label for bdtype in bdtypes"></select>
</tbody> </td>
</table> <td>
<div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div> <span class="fa fa-close" style="color: #b92c28" ng-click="deleteCommission(bd.bc_config_id)"></span>
<div class="modal-footer" ng-if="listConfig"> </td>
<button class="btn btn-success" type="button" ng-click="submitCommmissionConfig(bdmon,bdlm)">Submit</button> </tr>
<button class="btn btn-danger" ng-click="$dismiss()">Cancel</button> </tbody>
</div> </table>
</div> <div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div>
<div class="modal-footer" ng-if="listConfig">
<button class="btn btn-success" type="button" ng-click="submitCommmissionConfig(bdmon,bdlm)">Submit</button>
<button class="btn btn-danger" ng-click="$dismiss()">Cancel</button>
</div>
</div>
</div>
<div class="box intro_color">
<div class="box-header with-border">
<h6 class="intro_color" >跨境事业部总监提成制度</h6>
</div>
<div class="box-body">
<ul class="small">
<li>完成当月指标低于 51%,提成按照 0.005%提取</li>
<li>完成当月指标高于 80%,提成按照 0.008%提取</li>
<li>完成当月指标 100%,提成按照 0.01%</li>
</ul>
</div>
<div class="box-header with-border">
<h6 class="intro_color">大客户部门 Manager 提成考核指标</h6>
</div>
<div class="box-body">
<ul class="small">
<li>完成月度指标,当月部门提成为该部门总流水的 0.01%</li>
<li>未完成月度指标,当月部门提成为该部门总流水的 0.005%</li>
</ul>
</div>
<div class="box-header with-border">
<h6 class="intro_color">悉尼分公司总经理</h6>
</div>
<div class="box-body">
<ul class="small">
<li>完成月度指标,当月提成为该分公司总流水的 0.005%</li>
<li>未完成月度指标,当月提成为该分公司总流水的 0.0025%</li>
</ul>
</div>
<div class="box-header with-border">
<h6 class="intro_color">南京分公司技术部提成</h6>
</div>
<div class="box-body">
<ul class="small">
<li>完成月度指标,当月提成为公司总流水的 0.01%</li>
<li>未完成月度指标,当月提成为公司总流水的 0.005%</li>
</ul>
</div>
<div class="box-header with-border">
<h6 class="intro_color">COO考核及提成政策</h6>
</div>
<div class="box-body">
<ul class="small">
<li>完成 KPI 按照 0.03%提取;未完成 KPI 按照 0.02%提取</li>
</ul>
</div>
</div>
</div>
</uib-tab>
<uib-tab heading="BD">
<div class="box margin-top">
<div class="box-body no-padding table-responsive">
<table class="table table-hover" style="text-align: center">
<thead>
<tr>
<th style="text-align: center;">BD Name</th>
<th style="text-align: center;">KPI Amount</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="bd in bds|filter:{get_prize:true}">
<td ng-bind="bd.display_name"></td>
<td>
<input type="number" ng-model="bd.kpi_amount" min="0">
</td>
</tr>
</tbody>
</table>
<div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div>
<div class="modal-footer">
<button class="btn btn-success" type="button" ng-click="submitBdCommmissionConfig(bdmon,bds)">Submit</button>
<button class="btn btn-danger" ng-click="$dismiss()">Cancel</button>
</div>
</div>
</div>
</uib-tab>
</uib-tabset>
</div> </div>

@ -41,9 +41,9 @@
<img uib-tooltip="Wechat" src="/static/images/wechatpay_sign_lg.png"> <img uib-tooltip="Wechat" src="/static/images/wechatpay_sign_lg.png">
</div> </div>
<div class="info-box-content"> <div class="info-box-content">
<h5>BD Taotal Commission: ${{report.WechatReport.total_prize}}</h5> <h5>BD Total Commission: ${{report.WechatReport.total_prize}}</h5>
<h5>BD Taotal Send: ${{report.WechatReport.total_send_prize}}</h5> <h5>BD Total Send: ${{report.WechatReport.total_send_prize}}</h5>
<h5>BD Taotal Fund: ${{report.WechatReport.total_donation}}</h5> <h5>BD Total Fund: ${{report.WechatReport.total_donation}}</h5>
</div> </div>
</div> </div>
</div> </div>
@ -54,7 +54,7 @@
</div> </div>
<div class="info-box-content"> <div class="info-box-content">
<h5>BD Total Commission: ${{report.AlipayReport.total_prize}}</h5> <h5>BD Total Commission: ${{report.AlipayReport.total_prize}}</h5>
<h5>BD Taotal Send: ${{report.AlipayReport.total_send_prize}}</h5> <h5>BD Total Send: ${{report.AlipayReport.total_send_prize}}</h5>
<h5>BD Total Fund: ${{report.AlipayReport.total_donation}}</h5> <h5>BD Total Fund: ${{report.AlipayReport.total_donation}}</h5>
</div> </div>
</div> </div>
@ -65,9 +65,9 @@
<img uib-tooltip="Bestpay" src="/static/images/bestpay_sign_lg.png"> <img uib-tooltip="Bestpay" src="/static/images/bestpay_sign_lg.png">
</div> </div>
<div class="info-box-content"> <div class="info-box-content">
<h5>BD Taotal Commission: ${{report.BestpayReport.total_prize}}</h5> <h5>BD Total Commission: ${{report.BestpayReport.total_prize}}</h5>
<h5>BD Taotal Send: ${{report.BestpayReport.total_send_prize}}</h5> <h5>BD Total Send: ${{report.BestpayReport.total_send_prize}}</h5>
<h5>BD Taotal Fund: ${{report.BestpayReport.total_donation}}</h5> <h5>BD Total Fund: ${{report.BestpayReport.total_donation}}</h5>
</div> </div>
</div> </div>
</div> </div>
@ -79,6 +79,7 @@
<thead> <thead>
<tr> <tr>
<th>BD Name</th> <th>BD Name</th>
<th>KPI</th>
<th>BD Level</th> <th>BD Level</th>
<th>Transaction Amount</th> <th>Transaction Amount</th>
<th>Total Commission</th> <th>Total Commission</th>
@ -91,8 +92,12 @@
<tr ng-repeat="log in report.logs|prizeLogsFilter:0"> <tr ng-repeat="log in report.logs|prizeLogsFilter:0">
<td ng-if="log.is_valid==1">{{log.bd_name}}</td> <td ng-if="log.is_valid==1">{{log.bd_name}}</td>
<td ng-if="log.is_valid==0"><s>{{log.bd_name}}</s><span style="color: red"> (Left Company)</span></td> <td ng-if="log.is_valid==0"><s>{{log.bd_name}}</s><span style="color: red"> (Left Company)</span></td>
<td>
<span ng-if="log.kpi_amount">{{log.kpi_amount}}</span>
<span ng-if="!log.kpi_amount">0.00</span>
</td>
<td ng-bind="log.bd_level|financialBdLevel"></td> <td ng-bind="log.bd_level|financialBdLevel"></td>
<td ng-bind="log.total_amount|currency:'AUD '"></td> <td>{{log.total_amount|currency:'AUD '}}</td>
<td ng-bind="log.total_prize|currency:'AUD '"></td> <td ng-bind="log.total_prize|currency:'AUD '"></td>
<td ng-bind="log.send_prize|currency:'AUD '"></td> <td ng-bind="log.send_prize|currency:'AUD '"></td>
<td> <td>
@ -110,7 +115,7 @@
</div> </div>
</div> </div>
<div class="box box-default"> <div class="box box-default">
<div class="box-header">BD Manager Commission</div> <div class="box-header">Manager Commission</div>
<div class="box-body table-responsive"> <div class="box-body table-responsive">
<table class="table table-bordered table-hover table-striped"> <table class="table table-bordered table-hover table-striped">
<thead> <thead>
@ -152,18 +157,44 @@
</div> </div>
</div>--> </div>-->
<div class="box box-success"> <div class="box box-success">
<div class="box-header">Director Commission</div> <div class="box-header">Sydney GM Commission</div>
<div class="box-body"> <div class="box-body">
<div class="row"> <div class="row">
<div class="col-xs-6 col-sm-6"> <div class="col-xs-6 col-sm-6">
Transaction Amount: <span ng-bind="report.directPrizeLogs.total_amount|currency:'AUD '"></span> Transaction Amount: <span ng-bind="report.sydneyPrizeLog.total_amount|currency:'AUD '"></span>
</div> </div>
<div class="col-xs-6 col-sm-6"> <div class="col-xs-6 col-sm-6">
Total Commission: <span ng-bind="report.directPrizeLogs.total_prize|currency:'AUD '"></span> Total Commission: <span ng-bind="report.sydneyPrizeLog.total_prize|currency:'AUD '"></span>
</div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="box box-success">
<div class="box-header">NJ Department Commission</div>
<div class="box-body">
<div class="row">
<div class="col-xs-6 col-sm-6">
Transaction Amount: <span ng-bind="report.ngDepartmentPrizeLog.total_amount|currency:'AUD '"></span>
</div>
<div class="col-xs-6 col-sm-6">
Total Commission: <span ng-bind="report.ngDepartmentPrizeLog.total_prize|currency:'AUD '"></span>
</div>
</div>
</div>
</div>
<div class="box box-success">
<div class="box-header">COO Commission</div>
<div class="box-body">
<div class="row">
<div class="col-xs-6 col-sm-6">
Transaction Amount: <span ng-bind="report.directPrizeLogs.total_amount|currency:'AUD '"></span>
</div>
<div class="col-xs-6 col-sm-6">
Total Commission: <span ng-bind="report.directPrizeLogs.total_prize|currency:'AUD '"></span>
</div>
</div>
</div>
</div>
<!--<div class="box-header">Manager Commission</div>--> <!--<div class="box-header">Manager Commission</div>-->
<!--<div class="box-body table-responsive">--> <!--<div class="box-body table-responsive">-->
<!--<table class="table table-bordered table-hover table-striped">--> <!--<table class="table table-bordered table-hover table-striped">-->

@ -9,9 +9,25 @@
<section class="content"> <section class="content">
<div class="box box-danger" ng-if="'1000'|withRole"> <div class="box box-danger" ng-if="'1000'|withRole">
<div class="box-body"> <div class="box-body">
<button class="btn btn-danger" ng-click="generateReport()">Generate Report</button> <div class="box box-default">
<button class="btn btn-primary" ng-click="editRateConfig()"><i class="fa fa-cog"></i> Edit Rate Config</button> <div class="box-body">
<button class="btn btn-primary" ng-click="editBDLevels()"><i class="fa fa-user"></i> Edit BD Level</button> <div class="form-inline">
<div class="form-group">
<input type="text" class="form-control" uib-datepicker-popup="yyyy-MM" ng-model="generate.month"
is-open="ctrl.genmonth" datepicker-options="{minMode: 'month'}"
ng-click="ctrl.genmonth=true" placeholder="Select Month"/>
</div>
<button class="btn btn-primary" ng-click="generateReport()" ng-disabled="!generate.month">
Generate Report
</button>
<button class="btn btn-primary" ng-click="editRateConfig()"><i class="fa fa-cog"></i> Edit Rate Config</button>
<button class="btn btn-primary" ng-click="editBDLevels()"><i class="fa fa-user"></i> Edit BD Level</button>
<loadingbar ng-if="generate.status"></loadingbar>
</div>
</div>
</div>
<!--<button class="btn btn-danger" ng-click="generateReport()">Generate Report</button>-->
<!--<button class="btn btn-primary" ng-click="editCommissionConfig()"><i class="fa fa-user"></i> Edit Commission Config</button>--> <!--<button class="btn btn-primary" ng-click="editCommissionConfig()"><i class="fa fa-user"></i> Edit Commission Config</button>-->
</div> </div>
</div> </div>
@ -36,15 +52,15 @@
<div class="col-xs-2" ng-repeat="mon in months"> <div class="col-xs-2" ng-repeat="mon in months">
<a ng-if="hasReport(mon) && ('1000'|withRole)"> <a ng-if="hasReport(mon) && ('1000'|withRole)">
<h2 ROLE="button" class="text-success" ui-sref=".month_report({month:mon})" ng-bind="mon.substring(5,7)"></h2> <h2 ROLE="button" class="text-success" ui-sref=".month_report({month:mon})" ng-bind="mon.substring(5,7)"></h2>
<span class="fa fa-edit btn" ng-click="editCommissionConfig(mon)">Leader Commission</span> <span class="fa fa-edit btn" ng-click="editCommissionConfig(mon)">Commission</span>
</a> </a>
<a ng-if="hasReport(mon) && ('100'|withRole) && (!('1000'|withRole))"> <a ng-if="hasReport(mon) && ('100'|withRole) && (!('1000'|withRole))">
<h2 ROLE="button" class="text-success" ui-sref=".bd_detail({month:mon})" ng-bind="mon.substring(5,7)"></h2> <h2 ROLE="button" class="text-success" ui-sref=".bd_detail({month:mon})" ng-bind="mon.substring(5,7)"></h2>
<span class="fa fa-edit btn" ng-click="editCommissionConfig(mon)">Leader Commission</span> <span class="fa fa-edit btn" ng-click="editCommissionConfig(mon)">Commission</span>
</a> </a>
<a ng-if="!hasReport(mon)"> <a ng-if="!hasReport(mon)">
<h2 ROLE="button" class="text-gray" ng-bind="mon.substring(5,7)"></h2> <h2 ROLE="button" class="text-gray" ng-bind="mon.substring(5,7)"></h2>
<span class="fa fa-edit btn" ng-click="editCommissionConfig(mon)">Leader Commission</span> <span class="fa fa-edit btn" ng-click="editCommissionConfig(mon)">Commission</span>
</a> </a>
</div> </div>
</div> </div>
@ -59,49 +75,48 @@
<thead> <thead>
<tr> <tr>
<th>BD Level</th> <th>BD Level</th>
<th rowspan="2">费率</th> <th rowspan="2">KPI完成度</th>
<th rowspan="2">费率</th> <th colspan="2">Junior BD</th>
<th colspan="3">Junior BD</th> <th colspan="2">Intermediate BD</th>
<th colspan="3">Intermediate BD</th> <th colspan="2">Senior BD</th>
<th colspan="3">Senior BD</th>
</tr> </tr>
<tr> <tr>
<th>商户开通时长</th> <th>费率</th>
<th>1-3个月</th> <th>0.6-0.79</th>
<th>4-6个月</th> <th>0.8-2.0</th>
<th>&gt;=7个月</th> <th>0.6-0.79</th>
<th>1-3个月</th> <th>0.8-2.0</th>
<th>4-6个月</th> <th>0.6-0.79</th>
<th>&gt;=7个月</th> <th>0.8-2.0</th>
<th>1-3个月</th>
<th>4-6个月</th>
<th>&gt;=7个月</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="range in bd_rate_ranges"> <tr ng-repeat="range in kpi_ranges">
<td ng-bind="'#'+($index+1)"></td> <td ng-bind="'#'+($index+1)"></td>
<td ng-bind="range.rate_from"></td> <td ng-bind="(kpiRanges|filter:{value:range.kpi_range})[0].label"></td>
<td ng-bind="range.rate_to"></td>
<td ng-repeat-start="level in [1,2,3] track by $index" <td ng-repeat-start="level in [1,2,3] track by $index"
ng-bind="(bd_rate_configs|filter:{rate_from:range.rate_from,bd_level:level,time_range:1})[0].prize_rate+'%'"></td> ng-bind="(bd_rate_configs|filter:{kpi_range:range.kpi_range,bd_level:level,rate_from:0.6})[0].prize_rate+'%'"></td>
<td ng-bind="(bd_rate_configs|filter:{rate_from:range.rate_from,bd_level:level,time_range:2})[0].prize_rate+'%'"></td>
<td ng-repeat-end <td ng-repeat-end
ng-bind="(bd_rate_configs|filter:{rate_from:range.rate_from,bd_level:level,time_range:3})[0].prize_rate+'%'"></td> ng-bind="(bd_rate_configs|filter:{kpi_range:range.kpi_range,bd_level:level,rate_from:0.8})[0].prize_rate+'%'"></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<h4>补充说明</h4> <h4>补充说明</h4>
<ul> <ul>
<li>商户费率变更,提成比随之变更</li> <li>按月度发放</li>
<li>商户开通时长从商户开通时间起算</li> <li>每月发放总提成额度的 80%,剩余 20%按照“年度考评分数比例”于每年年底即 12 月 25 日圣诞前发放</li>
<li>后台系统自主申请商户提成按照前三个月0.05%后期0.01%发放自主申请商户在详情列表中的Client Source标注为Apply</li>
<li>调岗人员移交的商户移交后6个月内移交人员和接收人员平分提成应在商户BD配置里进行设置分配比例请关注详情列表中的Coefficient正常情况下应当为1</li>
<li>离职人员移交的商户接收人员享受一半提成另一半作为BD福利基金离职转交商户在详情列表中用红色标注</li>
<li>BD提成按月发放</li>
<li>每月发放总额的80%剩余20%于每年年底即12月25日圣诞节前发放</li>
<li>提前离职者20%提成不予发放</li> <li>提前离职者20%提成不予发放</li>
<li>年度考评(根据销管中心每月考评表打分制进行统计)按照考评分数对应比例发放 20%的占比部分,扣下部分如果第二年考评超出一定评分 110%可以补发;同样,如果年度考评分数超过 100 分按照同比例发放</li>
<li>商户开通后连续 1 个月未产生流水的,上交主管,由主管重新分配</li>
<li>连续 2 个月不产生流水的商户,由销管部统一收回,重新分配</li>
<li>分配后的商户流水客户专员只能占一半</li>
<li>离职及调岗人员商户统一上交销管中心,由销管中心 leader 及跨境事业部总监相互协商及相互监督,按照公平公正的原则, 做出分配方案,并由总监确认后统一分配。调岗人员移交的商户,在移交后 1 个月内移交人员和接收人员平分该商家产生的提成,移交人员需配合接收人员做好商户对接和短期内的商户维护;
离职人员交接的商户提成,接收人员享受一半的提成,另一半作为跨境客服专员福利会基金</li>
<li>被客户投诉情况严重者,此商户由销管中心无条件收回重新分配</li>
<li>活动执行未传达到位且出现舞弊、徇私、懒惰等行为的,商户上交由销管中心统一分配</li>
<li>后期维护不及时,连续一个月不跟踪者,此商户上交销管中心,统一重新分配</li>
<li>以上分配,销管中心 leader 和跨境支付事业部商量好之后需做好方案后经 COO 审批方可执行</li>
</ul> </ul>
</div> </div>
</div> </div>

@ -9,23 +9,29 @@
<select ng-model="filter.bd_level" class="form-control" ng-options="lv.value as lv.label for lv in bdLevels" <select ng-model="filter.bd_level" class="form-control" ng-options="lv.value as lv.label for lv in bdLevels"
id="levelFilter"></select> id="levelFilter"></select>
</div> </div>
<div class="form-group"> <!-- <div class="form-group">
<label class="control-label" for="monthFilter">Months</label> <label class="control-label" for="monthFilter">Months</label>
<select ng-model="filter.months" class="form-control" ng-options="mon.value as mon.label for mon in months" <select ng-model="filter.months" class="form-control" ng-options="mon.value as mon.label for mon in months"
id="monthFilter"></select> id="monthFilter"></select>
</div>-->
<div class="form-group">
<label class="control-label" for="rateFilter">Client Rate</label>
<select ng-model="filter.rate_from" class="form-control" ng-options="rate.value as rate.label for rate in clientRate"
id="rateFilter"></select>
</div> </div>
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
<tr> <tr>
<th>Client Rate</th> <th>KPI完成度</th>
<th>BD Rate</th> <th>BD Rate</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="rate in rates|filter:{bd_level:filter.bd_level,time_range:filter.months}"> <tr ng-repeat="rate in rates|filter:{bd_level:filter.bd_level,rate_from:filter.rate_from}">
<td>{{rate.rate_from}}-{{rate.rate_to}}</td> <td ng-bind="(kpiRanges|filter:{value:rate.kpi_range})[0].label"></td>
<td> <td>
<div class="input-group"> <div class="input-group">
<input placeholder="bd rate" class="form-control" type="number" step="0.01" ng-model="rate.prize_rate"> <input placeholder="bd rate" class="form-control" type="number" step="0.01" ng-model="rate.prize_rate">

@ -12,12 +12,14 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}) })
}]); }]);
app.controller('managerListCtrl', ['$scope', '$http', '$filter','$uibModal', 'commonDialog', function ($scope, $http,$filter, $uibModal, commonDialog) { app.controller('managerListCtrl', ['$scope', '$http', '$filter','$uibModal', 'commonDialog', function ($scope, $http,$filter, $uibModal, commonDialog) {
$scope.search = {role:'111111111111'}; $scope.params = {role:"111111111111"};
$scope.params = {}; $scope.pagination = {};
$scope.listManagers = function () { $scope.listManagers = function (page) {
var params = angular.copy($scope.params); var params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1;
$http.get('/sys/manager_accounts',{params: params}).then(function (resp) { $http.get('/sys/manager_accounts',{params: params}).then(function (resp) {
$scope.managers = resp.data; $scope.managers = resp.data.data;
$scope.pagination = resp.data.pagination;
}) })
}; };
if($filter('withRole')('1')){ if($filter('withRole')('1')){

@ -11,15 +11,18 @@
<div class="box-solid"> <div class="box-solid">
<div class="box box-warning"> <div class="box box-warning">
<div class="box-header"> <div class="box-header">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-2"> <div class="form-horizontal">
<form class="navbar-form navbar-left" role="search"> <div class="form-group col-sm-6">
<div class="form-group"> <label class="control-label col-xs-4 col-sm-4" for="username-search">Username</label>
<label class="control-label" for="username-filter-input">Username</label> <div class="col-xs-6">
<input type="text" class="form-control" ng-model="search.username" placeholder="Username" id="username-filter-input"> <input type="text" class="form-control" ng-model="params.username" placeholder="Username" id="username-search">
</div> </div>
<div class="form-group" ng-if="('1'|withRole)"> </div>
<label class="control-label" for="role-filter-select">Role</label> <div class="form-group col-sm-6">
<select class="form-control" id="role-filter-select" ng-model="search.role"> <label class="control-label col-xs-4 col-sm-4"
for="role-select">Role</label>
<div class="col-xs-6">
<select ng-change="listManagers(1)" class="form-control" id="role-select" ng-model="params.role">
<option value="111111111111">All</option> <option value="111111111111">All</option>
<option value="1">Administrator</option> <option value="1">Administrator</option>
<option value="10">Compliance</option> <option value="10">Compliance</option>
@ -35,86 +38,104 @@
<option value="100000000000">Guest</option> <option value="100000000000">Guest</option>
<option value="1000000000000">Org Manager</option> <option value="1000000000000">Org Manager</option>
</select> </select>
</div> </div>
<div class="form-group" ng-if="('1'|withRole)"> </div>
<div class="form-group col-sm-6">
<label class="control-label col-xs-4 col-sm-4"
for="org-select">All Organizations</label>
<div class="col-xs-6">
<select id="org-select" class="form-control" ng-model="params.org_id" <select id="org-select" class="form-control" ng-model="params.org_id"
ng-options="org.org_id as org.name group by org.org_type for org in orgs" ng-options="org.org_id as org.name group by org.org_type for org in orgs"
ng-change="params.org_id2 = '';listManagers();loadOrgsChild(params.org_id)"> ng-change="params.org_id2 = '';listManagers(1);loadOrgsChild(params.org_id)">
<option value="">All Organizations</option> <option value="">All Organizations</option>
</select> </select>
</div> </div>
</div>
<div ng-if="(orgs_child.length > 1)&&('1'|withRole)&&params.org_id"> <div class="form-group col-sm-6" ng-if="(orgs_child.length > 1)&&('1'|withRole)&&params.org_id">
<label class="control-label col-xs-4 col-sm-4"
for="org-child-select">Sub Organizations</label>
<div class="col-xs-6">
<select id="org-child-select" class="form-control" ng-model="params.org_id2" <select id="org-child-select" class="form-control" ng-model="params.org_id2"
ng-options="org.org_id as org.name group by org.org_type for org in orgs_child" ng-options="org.org_id as org.name group by org.org_type for org in orgs_child"
ng-change="listManagers()"> ng-change="listManagers(1)">
<option value="">Sub Organizations</option> <option value="">Sub Organizations</option>
</select> </select>
</div> </div>
<!--<div class="form-group" ng-if="'1'|withRole"> </div>
<label class="control-label" for="org-select">Organizations</label> <div class="col-xs-12">
<select class="form-control" id="org-select" ng-model="search.org_id" ng-options="o.org_id as o.name for o in orgs"> <button class="btn btn-primary" type="button" ng-click="listManagers(1)">
<option value="">All</option> <i class="fa fa-search"></i> Search
</select> </button>
</div>--> <button class="btn btn-info" type="button " ng-click="newManager()">
</form>
<div class="navbar-form navbar-right">
<button class="btn btn-success" type="button" ng-click="newManager()">
<i class="fa fa-plus"></i> New Manager Account <i class="fa fa-plus"></i> New Manager Account
</button> </button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="box"> <div class="box">
<div class="box-body"> <div class="box-body">
<div class="row"> <div class="col-sm-12 table-responsive">
<div class="col-sm-12 table-responsive"> <table class="table table-striped table-hover">
<table class="table table-striped table-hover"> <thead>
<thead> <tr>
<tr> <th>Username</th>
<th>Username</th> <th>Display Name</th>
<th>Display Name</th> <th>Wechat</th>
<th>Wechat</th> <th>Create Time</th>
<th>Create Time</th> <th>Email</th>
<th>Email</th> <th>Organization</th>
<th ng-if="!search.org_id">Organization</th> <th>Roles</th>
<th>Roles</th> <th>Operation</th>
<th>Operation</th> </tr>
</tr> </thead>
</thead> <tbody>
<tbody> <tr ng-repeat="manager in managers">
<tr ng-repeat="manager in managers|managersFilter:search"> <td ng-bind="manager.username"></td>
<td ng-bind="manager.username"></td> <td ng-bind="manager.display_name"></td>
<td ng-bind="manager.display_name"></td> <td style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;"><img ng-src="{{manager.headimg}}" style="height: 30px;width:30px;" class="img-circle" ng-if="manager.headimg"> {{manager.nickname}}</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;"><img ng-src="{{manager.headimg}}" style="height: 30px;width:30px;" class="img-circle" ng-if="manager.headimg"> {{manager.nickname}}</td> <td ng-bind="manager.create_time|date:'yyyy-MM-dd'"></td>
<td ng-bind="manager.create_time|date:'yyyy-MM-dd'"></td> <td ng-bind="manager.email"></td>
<td ng-bind="manager.email"></td> <td ng-bind="manager.org_name"></td>
<td ng-bind="manager.org_name" ng-if="!search.org_id"></td> <td>
<td> <i class="fa fa-user-secret" title="Administrator" ng-class="{'text-green':manager.admin,'text-gray':!manager.admin}"></i>
<i class="fa fa-user-secret" title="Administrator" ng-class="{'text-green':manager.admin,'text-gray':!manager.admin}"></i> <i class="fa fa-eye" title="Compliance" ng-class="{'text-green':manager.operator,'text-gray':!manager.operator}"></i>
<i class="fa fa-eye" title="Compliance" ng-class="{'text-green':manager.operator,'text-gray':!manager.operator}"></i> <i class="fa fa-crosshairs" title="BD User" ng-class="{'text-green':manager.bd,'text-gray':!manager.bd}"></i>
<i class="fa fa-crosshairs" title="BD User" ng-class="{'text-green':manager.bd,'text-gray':!manager.bd}"></i> <i class="fa fa-balance-scale" title="Accountant" ng-class="{'text-green':manager.finacial,'text-gray':!manager.finacial}"></i>
<i class="fa fa-balance-scale" title="Accountant" ng-class="{'text-green':manager.finacial,'text-gray':!manager.finacial}"></i> <i class="fa fa-tty" title="Service" ng-class="{'text-green':manager.sevant,'text-gray':!manager.servant}"></i>
<i class="fa fa-tty" title="Service" ng-class="{'text-green':manager.sevant,'text-gray':!manager.servant}"></i> <i class="fa fa-university" title="Account Manager" ng-class="{'text-green':manager.accountmanager,'text-gray':!manager.accountmanager}"></i>
<i class="fa fa-university" title="Account Manager" ng-class="{'text-green':manager.accountmanager,'text-gray':!manager.accountmanager}"></i> <i class="fa fa-line-chart" title="Director" ng-class="{'text-green':manager.director,'text-gray':!manager.director}"></i>
<i class="fa fa-line-chart" title="Director" ng-class="{'text-green':manager.director,'text-gray':!manager.director}"></i> <i class="fa fa-map-o" title="Site Manager" ng-class="{'text-green':manager.sitemanager,'text-gray':!manager.sitemanager}"></i>
<i class="fa fa-map-o" title="Site Manager" ng-class="{'text-green':manager.sitemanager,'text-gray':!manager.sitemanager}"></i> <i class="fa fa-code" title="Developer" ng-class="{'text-green':manager.developer,'text-gray':!manager.developer}"></i>
<i class="fa fa-code" title="Developer" ng-class="{'text-green':manager.developer,'text-gray':!manager.developer}"></i> <i class="fa fa-male" title="BD Leader" ng-class="{'text-green':manager.bdleader,'text-gray':!manager.bdleader}"></i>
<i class="fa fa-male" title="BD Leader" ng-class="{'text-green':manager.bdleader,'text-gray':!manager.bdleader}"></i> <i class="fa fa-user" title="Risk Manager" ng-class="{'text-green':manager.riskmanager,'text-gray':!manager.riskmanager}"></i>
<i class="fa fa-user" title="Risk Manager" ng-class="{'text-green':manager.riskmanager,'text-gray':!manager.riskmanager}"></i> <i class="fa fa-tripadvisor" title="GUEST" ng-class="{'text-green':manager.guest,'text-gray':!manager.guest}"></i>
<i class="fa fa-tripadvisor" title="GUEST" ng-class="{'text-green':manager.guest,'text-gray':!manager.guest}"></i> <i class="fa fa-user-plus" title="Org Manager" ng-class="{'text-green':manager.orgmanager,'text-gray':!manager.orgmanager}"></i>
<i class="fa fa-user-plus" title="Org Manager" ng-class="{'text-green':manager.orgmanager,'text-gray':!manager.orgmanager}"></i> </td>
</td> <td>
<td> <a role="button" class="text-bold text-primary" ng-click="modifyManager(manager)">Modify</a>
<a role="button" class="text-bold text-primary" ng-click="modifyManager(manager)">Modify</a> |
| <a class="text-bold text-danger" role="button" ng-click="disableManager(manager)">Disable</a>
<a class="text-bold text-danger" role="button" ng-click="disableManager(manager)">Disable</a> </td>
</td> </tr>
</tr> </tbody>
</tbody> </table>
</table> </div>
<div class="box-footer" ng-if="managers.length">
<uib-pagination class="pagination"
total-items="pagination.totalCount"
boundary-links="true"
ng-model="pagination.page"
items-per-page="pagination.limit"
max-size="10"
ng-change="listManagers()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
<div class="row">
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total Pages:{{pagination.totalPages}}</div>
</div> </div>
</div> </div>
</div> </div>

@ -141,10 +141,15 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}) })
}; };
$scope.search = {role:'1111111'}; $scope.params = {role:'1111111',org_id:$scope.org.org_id};
$scope.listManagers = function () { $scope.pagination = {};
$http.get('/sys/manager_accounts',{params:{org_id:$scope.org.org_id}}).then(function (resp) { $scope.listManagers = function (page) {
$scope.managers = resp.data; var params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1;
$http.get('/sys/manager_accounts',{params:params}).then(function (resp) {
$scope.managers = resp.data.data;
$scope.pagination = resp.data.pagination;
}) })
}; };

@ -305,11 +305,11 @@
<form class="navbar-form navbar-left" role="search"> <form class="navbar-form navbar-left" role="search">
<div class="form-group"> <div class="form-group">
<label class="control-label" for="username-filter-input">Username</label> <label class="control-label" for="username-filter-input">Username</label>
<input type="text" class="form-control" ng-model="search.username" placeholder="Username" id="username-filter-input"> <input type="text" class="form-control" ng-model="params.username" placeholder="Username" id="username-filter-input">
</div> </div>
<div class="form-group" ng-if="'1'|withRole"> <div class="form-group" ng-if="'1'|withRole">
<label class="control-label" for="role-filter-select">Role</label> <label class="control-label" for="role-filter-select">Role</label>
<select class="form-control" id="role-filter-select" ng-model="search.role"> <select ng-change="listManagers(1)" class="form-control" id="role-filter-select" ng-model="params.role">
<option value="1111111">All</option> <option value="1111111">All</option>
<option value="1">Administrator</option> <option value="1">Administrator</option>
<option value="10">Compliance</option> <option value="10">Compliance</option>
@ -323,6 +323,12 @@
<option value="1000000000000">Org Manager</option> <option value="1000000000000">Org Manager</option>
</select> </select>
</div> </div>
<div class="form-group">
<button class="btn btn-primary" type="button" ng-click="listManagers(1)">
<i class="fa fa-search"></i> Search
</button>
</div>
</form> </form>
<div class="navbar-form navbar-right"> <div class="navbar-form navbar-right">
<button class="btn btn-success" type="button" ng-click="newManager()"> <button class="btn btn-success" type="button" ng-click="newManager()">
@ -350,7 +356,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="manager in managers|managersFilter:search"> <tr ng-repeat="manager in managers">
<td ng-bind="manager.username"></td> <td ng-bind="manager.username"></td>
<td ng-bind="manager.display_name"></td> <td ng-bind="manager.display_name"></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;"><img ng-src="{{manager.headimg}}" style="height: 30px;width:30px;" class="img-circle" ng-if="manager.headimg"> {{manager.nickname}}</td> <td style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;"><img ng-src="{{manager.headimg}}" style="height: 30px;width:30px;" class="img-circle" ng-if="manager.headimg"> {{manager.nickname}}</td>
@ -377,6 +383,22 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="box-footer" ng-if="managers.length">
<uib-pagination class="pagination"
total-items="pagination.totalCount"
boundary-links="true"
ng-model="pagination.page"
items-per-page="pagination.limit"
max-size="10"
ng-change="listManagers()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
<div class="row">
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total Pages:{{pagination.totalPages}}</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

@ -34,6 +34,10 @@ define(['angular', 'uiRouter'], function (angular) {
url: '/mail', url: '/mail',
templateUrl: '/static/config/sysconfigs/templates/mail_subscribe.html', templateUrl: '/static/config/sysconfigs/templates/mail_subscribe.html',
controller: 'mailSubscribeCtrl' controller: 'mailSubscribeCtrl'
}).state('sysconfig.servantsConfig', {
url: '/servantsConfig',
templateUrl: '/static/config/sysconfigs/templates/servants_config.html',
controller: 'servantsConfigCtrl'
})/*.state('sysconfig.payment_config',{ })/*.state('sysconfig.payment_config',{
url: '/payment_config', url: '/payment_config',
templateUrl: '/static/config/sysconfigs/templates/payemnt_config.html', 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('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) { app.controller('basicConfigCtrl', ['$scope', '$http', 'commonDialog', function ($scope, $http, commonDialog) {
$scope.loadSysConfigs = function () { $scope.loadSysConfigs = function () {
$http.get('/sysconfig/base').then(function (resp) { $http.get('/sysconfig/base').then(function (resp) {

@ -0,0 +1,52 @@
<section class="content-header">
<h1>Mail Not Subscribe</h1>
<ol class="breadcrumb">
<li>
<a ui-sref="^"><i class="fa fa-cog"></i> System Config</a>
</li>
<li>Mail Not Subscribe</li>
</ol>
</section>
<div class="content">
<div class="row">
<div class="col-sm-12">
<div class="box-solid">
<!--<div class="box box-warning">-->
<!--<div class="box-header">-->
<!--<div class="form-inline">-->
<!--<div class="form-group">-->
<!--<input class="form-control" placeholder="Client Moniker" ng-model="params.client_moniker">-->
<!--</div>-->
<!--<div class="form-group">-->
<!--<input class="form-control" placeholder="Mail Address" ng-model="params.address">-->
<!--</div>-->
<!--<button class="btn btn-success" ng-click="loadUnSubs(1)"><i-->
<!--class="fa fa-search"></i> Search</button>-->
<!--<button class="btn btn-success pull-right" ng-click="addUnSub()" ng-click="addUnSubs()">Add</button>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<div class="box">
<div class="box-body no-padding table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Display Name</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="servant in servants">
<td ng-bind="servant.display_name"></td>
<td>
<input type="checkbox" ng-click="onoff(servant)" ng-model="servant.onoff">
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>

@ -30,6 +30,11 @@
Partner Permission Config Partner Permission Config
</a> </a>
<a class="btn btn-app" role="button" ui-sref=".servantsConfig">
<i class="fa fa-key"></i>
Servants Config
</a>
<!--<a class="btn btn-app" role="button" ui-sref=".payment_config"> <!--<a class="btn btn-app" role="button" ui-sref=".payment_config">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
Payment Config Payment Config

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

@ -1167,7 +1167,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}); });
return; return;
} }
if (cofig > 2 || cofig < parseFloat(Decimal.add($scope.paymentInfo.rate_value, 0.1).toFixed(2))) { if (cofig > 2.5 || cofig < parseFloat(Decimal.add($scope.paymentInfo.rate_value, 0.1).toFixed(2))) {
commonDialog.alert({title: 'Error', content: 'Not in the valid range', type: 'error'}); commonDialog.alert({title: 'Error', content: 'Not in the valid range', type: 'error'});
return; return;
} }

@ -29,49 +29,124 @@
<p class="form-control-static" ng-bind="partner.client_moniker"></p> <p class="form-control-static" ng-bind="partner.client_moniker"></p>
</div> </div>
</div> </div>
<div class="form-group" <div ng-if="'100'|withRole">
ng-class="{'has-error':partnerForm.company_name.$invalid && partnerForm.company_name.$dirty}"> <div ng-if="partner.open_status||partner.open_status==0">
<label class="control-label col-sm-2" for="company-name-input">* Company Name</label> <div class="form-group">
<div class="col-sm-8"> <label class="control-label col-sm-2">Company Name</label>
<input class="form-control" ng-model="partner.company_name" type="text" <div class="col-sm-8">
id="company-name-input" required name="company_name" maxlength="100"> <p class="form-control-static" ng-bind="partner.company_name"></p>
<p class="small text-info">Full Name shall be same as the name when register to </div>
gov</p> </div>
<div ng-messages="partnerForm.company_name.$error" <div class="form-group">
ng-if="partnerForm.company_name.$dirty"> <label class="control-label col-sm-2">Short Name</label>
<p class="small text-danger" ng-message="required">Required Field</p>
<p class="small text-danger" ng-message="maxlength">Less Than 100 <div class="col-sm-8">
Characters(including symbols and spaces)</p> <p class="form-control-static" ng-bind="partner.short_name"></p>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Business Name</label>
<div class="col-sm-8">
<p class="form-control-static" ng-bind="partner.business_name"></p>
</div>
</div> </div>
</div> </div>
</div> <div ng-if="!partner.open_status&&partner.open_status!=0">
<div class="form-group" <div class="form-group"
ng-class="{'has-error':partnerForm.short_name.$invalid && partnerForm.short_name.$dirty}"> ng-class="{'has-error':partnerForm.company_name.$invalid && partnerForm.company_name.$dirty}">
<label class="control-label col-sm-2" for="short-name-input">* Short Name</label> <label class="control-label col-sm-2" for="company-name-input">* Company Name</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input class="form-control" ng-model="partner.short_name" type="text" <input class="form-control" ng-model="partner.company_name" type="text"
name="short_name" id="company-name-input" required name="company_name" maxlength="100">
id="short-name-input" required maxlength="50"> <p class="small text-info">Full Name shall be same as the name when register to
<p class="small text-info">short name for WeChat payment display and partner gov</p>
name</p> <div ng-messages="partnerForm.company_name.$error"
<div ng-messages="partnerForm.short_name.$error" ng-if="partnerForm.company_name.$dirty">
ng-if="partnerForm.company_name.$dirty"> <p class="small text-danger" ng-message="required">Required Field</p>
<p class="small text-danger" ng-message="required">Required Field</p> <p class="small text-danger" ng-message="maxlength">Less Than 100
<p class="small text-danger" ng-message="maxlength">Less Than 50 Characters(including symbols and spaces)</p>
Characters(including symbols and spaces)</p> </div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':partnerForm.short_name.$invalid && partnerForm.short_name.$dirty}">
<label class="control-label col-sm-2" for="short-name-input">* Short Name</label>
<div class="col-sm-8">
<input class="form-control" ng-model="partner.short_name" type="text"
name="short_name"
id="short-name-input" required maxlength="50">
<p class="small text-info">short name for WeChat payment display and partner
name</p>
<div ng-messages="partnerForm.short_name.$error"
ng-if="partnerForm.company_name.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
<p class="small text-danger" ng-message="maxlength">Less Than 50
Characters(including symbols and spaces)</p>
</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':partnerForm.business_name.$invalid && partnerForm.business_name.$dirty}">
<label class="control-label col-sm-2" for="business-name-input">Business Name</label>
<div class="col-sm-8">
<input id="business-name-input" ng-model="partner.business_name" class="form-control"
type="text" name="business_name" maxlength="100">
<div ng-messages="partnerForm.business_name.$error"
ng-if="partnerForm.business_name.$dirty">
<p class="small text-danger" ng-message="maxlength">Less Than 100
Characters(including symbols and spaces)</p>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group"
ng-class="{'has-error':partnerForm.business_name.$invalid && partnerForm.business_name.$dirty}"> <div ng-if="!('100'|withRole)">
<label class="control-label col-sm-2" for="business-name-input">Business Name</label> <div class="form-group"
<div class="col-sm-8"> ng-class="{'has-error':partnerForm.company_name.$invalid && partnerForm.company_name.$dirty}">
<input id="business-name-input" ng-model="partner.business_name" class="form-control" <label class="control-label col-sm-2" for="company-name-input">* Company Name</label>
type="text" name="business_name" maxlength="100"> <div class="col-sm-8">
<div ng-messages="partnerForm.business_name.$error" <input class="form-control" ng-model="partner.company_name" type="text"
ng-if="partnerForm.business_name.$dirty"> id="company-name-input" required name="company_name" maxlength="100">
<p class="small text-danger" ng-message="maxlength">Less Than 100 <p class="small text-info">Full Name shall be same as the name when register to
Characters(including symbols and spaces)</p> gov</p>
<div ng-messages="partnerForm.company_name.$error"
ng-if="partnerForm.company_name.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
<p class="small text-danger" ng-message="maxlength">Less Than 100
Characters(including symbols and spaces)</p>
</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':partnerForm.short_name.$invalid && partnerForm.short_name.$dirty}">
<label class="control-label col-sm-2" for="short-name-input">* Short Name</label>
<div class="col-sm-8">
<input class="form-control" ng-model="partner.short_name" type="text"
name="short_name"
id="short-name-input" required maxlength="50">
<p class="small text-info">short name for WeChat payment display and partner
name</p>
<div ng-messages="partnerForm.short_name.$error"
ng-if="partnerForm.company_name.$dirty">
<p class="small text-danger" ng-message="required">Required Field</p>
<p class="small text-danger" ng-message="maxlength">Less Than 50
Characters(including symbols and spaces)</p>
</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':partnerForm.business_name.$invalid && partnerForm.business_name.$dirty}">
<label class="control-label col-sm-2" for="business-name-input">Business Name</label>
<div class="col-sm-8">
<input id="business-name-input" ng-model="partner.business_name" class="form-control"
type="text" name="business_name" maxlength="100">
<div ng-messages="partnerForm.business_name.$error"
ng-if="partnerForm.business_name.$dirty">
<p class="small text-danger" ng-message="maxlength">Less Than 100
Characters(including symbols and spaces)</p>
</div>
</div> </div>
</div> </div>
</div> </div>

@ -45,6 +45,10 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
}); });
}] }]
} }
}).state('analysis_monitoring.attention', {
url: '/risk/attention',
templateUrl: '/static/risk/templates/attention_merchants.html',
controller: 'AttentionMerchantCtrl'
}); });
}]); }]);
app.controller('RiskManageCtrl', ['$scope', '$http', function ($scope, $http){ app.controller('RiskManageCtrl', ['$scope', '$http', function ($scope, $http){
@ -218,6 +222,41 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
} }
}]); }]);
app.controller('AttentionMerchantCtrl', ['$scope', '$http','commonDialog','$uibModal', function ($scope, $http,commonDialog,$uibModal){
$scope.params = {};
$scope.pagination = {};
$scope.ctrl = {};
$scope.loadAttentionMerchants = function (page) {
var params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1;
$http.get('/sys/risk/attention', {params: params}).then(function (resp) {
$scope.attentions = resp.data.data;
$scope.pagination = resp.data.pagination;
$scope.ctrl.addAttention = false;
});
};
$scope.loadAttentionMerchants(1);
$scope.disableAttention = function (client_moniker) {
commonDialog.confirm({title: 'Confirm', content: '确定删除这个商户?'
}).then(function () {
$http.put('/sys/risk/attention/' + client_moniker).then(function () {
commonDialog.alert({title: 'Success', content: 'disable successfully', type: 'success'});
$scope.loadAttentionMerchants(1);
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
});
})
};
$scope.addAttentionMerchants = function (client_moniker) {
$http.post('/sys/risk/attention/'+ client_moniker).then(function () {
commonDialog.alert({title: 'Success', content: 'add successfully', type: 'success'});
$scope.loadAttentionMerchants(1);
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
});
}
}]);
app.filter('risk_type', function () { app.filter('risk_type', function () {
return function (riskStr) { return function (riskStr) {
angular.forEach(riskType,function (type) { angular.forEach(riskType,function (type) {

@ -0,0 +1,84 @@
<div ui-view>
<section class="content-header">
<h1>Risky Merchants</h1>
<ol class="breadcrumb">
<li><i class="fa fa-gift"></i> Risk</li>
<li class="active">Risk Merchants</li>
</ol>
</section>
<section class="content">
<div class="box box-warning">
<div class="box-header">
<div class="form-inline">
<div class="form-group">
<label class="control-label" for="partner-code-search">Partner Code</label>
<input type="text" class="form-control" id="partner-code-search"
ng-enter="loadAttentionMerchants(1)"
ng-model="params.client_moniker">
</div>
<div class="form-group">
<button class="btn btn-primary" type="button" ng-click="loadAttentionMerchants(1)"><i
class="fa fa-search"></i></button>
</div>
<div class="form-group pull-right">
<button ng-hide="ctrl.addAttention" class="btn btn-info" type="button" ng-click="ctrl.addAttention = true"><i class="fa fa-plus"></i>Add</button>
<div class="input-group" ng-if="ctrl.addAttention">
<input type="text" class="form-control" ng-model="client_moniker"
title="Add Attention" placeholder="client Moniker">
<div class="input-group-btn">
<button class="btn btn-success" ng-click="addAttentionMerchants(client_moniker)">
<i class="fa fa-check"></i>
</button>
</div>
<div class="input-group-btn">
<button class="btn btn-danger" ng-click="ctrl.addAttention=false">
<i class="fa fa-remove"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="box box-warning">
<div class="box-header">Clients</div>
<div class="box-body table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Client Moniker</th>
<th>Create Time</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="client in attentions">
<td>{{client.client_moniker}}</td>
<td>{{client.create_time}}</td>
<td>
<a role="button" class="text-bold text-danger"
ng-click="disableAttention(client.client_moniker)">Disable</a>
</td>
</tr>
</tbody>
</table>
<div class="modal-footer">
<uib-pagination ng-if="attentions.length"
class="pagination"
total-items="pagination.totalCount"
boundary-links="true"
ng-model="pagination.page"
items-per-page="pagination.limit"
max-size="10"
ng-change="loadAttentionMerchants()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
</div>
</div>
</div>
</section>
</div>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save