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

master
Tayl0r 6 years ago
commit 126b6b59bb

@ -16,6 +16,11 @@
<groupId>au.com.royalpay.payment</groupId>
<artifactId>tools</artifactId>
</dependency>
<dependency>
<groupId>cn.yixblog</groupId>
<artifactId>yixblog-platform</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-core</artifactId>

@ -466,3 +466,30 @@ insert into `royalpay_production`.`sys_configs` ( `config_key`, `config_value`)
insert into `royalpay_production`.`sys_configs` ( `config_key`, `config_value`) values ( 'risk_total_amout', '5000');
CREATE TABLE `pmt_directed_bill_code` (
`bill_code_id` varchar(50) NOT NULL DEFAULT '',
`client_id` int(15) not NULL,
`client_order_id` varchar(50) DEFAULT NULL,
`status` int(10) DEFAULT '1' COMMENT '账单状态 1可用2关闭 3:完成',
`customer_id` varchar(200) DEFAULT NULL COMMENT 'open_id',
`create_time` datetime not NULL DEFAULT now() comment '账单创建时间',
`currency` varchar(10) not NULL,
`remark` varchar(200) DEFAULT NULL,
`cancle_time` datetime DEFAULT NULL,
`channel` varchar(10) DEFAULT NULL,
`nickname` varchar(80) DEFAULT NULL,
`headimg` varchar(200) DEFAULT NULL,
`code_url` varchar(200) DEFAULT '',
`order_id` varchar(50) DEFAULT '',
`order_amount` decimal(10,4) not NULL comment '账单金额',
`pay_amount` decimal(10,4) DEFAULT NULL comment '订单支付金额',
`pay_time` datetime DEFAULT NULL comment '支付时间',
`order_status` int(10) DEFAULT NULL COMMENT '订单状态(0-New,1-OrderFailed,2-WaitingForPayment,3-OrderCanceled,4-PaymentFailed,5-PaymentSuccess,6-PartialRefund,7-FullRefund)',
PRIMARY KEY (`bill_code_id`),
KEY `client_id` (`client_id`),
KEY `order_id` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
ALTER TABLE `act_red_packets_customer` ADD COLUMN `rule_max_num_limit` tinyint(1) DEFAULT 1 COMMENT '0:Whole Activity,1day'

@ -152,7 +152,7 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService {
device.put("rate", params.getBigDecimal("rate") == null ? new BigDecimal(0.15) : params.getBigDecimal("rate"));
device.put("expire_time", act.getDate("expire_date"));
actMonDelaySettleMapper.save(device);
clientManager.changeManualSettle(client_id,true,device.getString("account_id"),1,"参加活动打开手动清算");
clientManager.changeManualSettle(account,client_id,true,device.getString("account_id"),1,"参加活动打开手动清算");
}
@ -174,7 +174,8 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService {
clientLog.put("is_valid", 0);
clientLog.put("expire_time", new Date());
actMonDelaySettleMapper.update(clientLog);
clientManager.changeManualSettle(client_id,false,device.getString("account_id"),1,"退出活动关闭手动清算");
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
clientManager.changeManualSettle(account,client_id,false,device.getString("account_id"),1,"退出活动关闭手动清算");
}
private void recodeActClient(JSONObject device){

@ -23,6 +23,7 @@ import org.apache.commons.lang3.time.DurationFormatUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
@ -35,6 +36,7 @@ import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import java.util.TreeMap;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
@ -60,12 +62,22 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
@Resource
private TransactionMapper transactionMapper;
@Resource
private StringRedisTemplate stringRedisTemplate;
@Override
public JSONObject getCommonAnalysis1(JSONObject params) {
String jsonStr = stringRedisTemplate.boundValueOps("org_commonAnalysis1"+ params.getString("org_id")+ params.getString("begin")).get();
JSONObject commonAnalysis1 = JSONObject.parseObject(jsonStr);
if(commonAnalysis1 != null){
return commonAnalysis1;
}
JSONObject res = transactionAnalysisMapper.getClientTransaction(params);
// res.put("new_partners", clientAnalysisMapper.countNewClients(params));
stringRedisTemplate.boundValueOps("org_commonAnalysis1"+params.getString("org_id")+params.getString("begin")).set(res.toJSONString(), 5, TimeUnit.MINUTES);
return res;
// res.put("new_partners", clientAnalysisMapper.countNewClients(params));
// res.put("total_partners", clientAnalysisMapper.countClients(params));
// res.put("traded_partners", clientAnalysisMapper.countTradedPartners(params));
// List<JSONObject> topOrders = transactionAnalysisMapper.getTopOrders(params, new PageBounds(1, 1, Order.formString("aud_fee.desc")));
@ -75,7 +87,6 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
// res.put("total_customers", transactionAnalysisMapper.countCustomers(params));
// //res.put("new_customers", transactionAnalysisMapper.countNewCustomers(params));
// res.put("old_customers", transactionAnalysisMapper.countOldCustomers(params));
return res;
}
@Override

@ -1133,8 +1133,9 @@ public class RetailAppServiceImp implements RetailAppService {
@Override
public JSONObject listDailyTransactions(String dateStr, String timezone, boolean thisDevOnly, JSONObject device,String app_client_ids) {
try {
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
dateFormat.setTimeZone(TimeZone.getTimeZone(timezone));
dateFormat.setTimeZone(TimeZone.getTimeZone(client.getString("timezone")));
Date date = dateFormat.parse(dateStr);
String clientType = device.getString("client_type");
DeviceRegister register = deviceSupport.findRegister(clientType);
@ -1542,7 +1543,8 @@ public class RetailAppServiceImp implements RetailAppService {
@Override
public void changeManualSettle(JSONObject device, boolean manual_settle) {
clientManager.changeManualSettle(device.getIntValue("client_id"), manual_settle, device.getString("account_id"), 1, "商户"+(manual_settle?"打开":"关闭")+"手动清算");
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
clientManager.changeManualSettle(account,device.getIntValue("client_id"), manual_settle, device.getString("account_id"), 1, "商户"+(manual_settle?"打开":"关闭")+"手动清算");
}

@ -22,22 +22,31 @@ import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.http.HttpUtils;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.time.DateUtils;
import org.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.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
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;
/**
@ -439,10 +448,13 @@ public class RetailAppController {
}
@RequestMapping(value = "/qrcode", method = RequestMethod.GET)
public JSONObject getQrcode(@ModelAttribute(RETAIL_DEVICE) JSONObject device,@RequestParam(required = false,defaultValue = "0") int client_id, QRCodeConfig config) {
public JSONObject getQrcode(@ModelAttribute(RETAIL_DEVICE) JSONObject device,@RequestParam(required = false,defaultValue = "0") int client_id, QRCodeConfig config,@RequestParam(required = false,defaultValue = "0") int app_client_ids) {
if(client_id==0){
client_id = device.getIntValue("client_id");
}
if(app_client_ids!=0){
client_id = app_client_ids;
}
return retailAppService.getQrcode(device,config,client_id);
}
@ -461,4 +473,16 @@ public class RetailAppController {
public void getInvoiceFile(@ModelAttribute(RETAIL_DEVICE) JSONObject device,AppQueryBean appQueryBean,HttpServletResponse httpResponse) throws Exception {
retailAppService.getInvoiceFile(device,appQueryBean,httpResponse);
}
@RequestMapping(value = "/surcharge", method = RequestMethod.GET)
public JSONObject changeQRCodePaySurCharge(@ModelAttribute(RETAIL_DEVICE) JSONObject device) {
JSONObject client = retailAppService.getClientInfo(device);
JSONObject result = new JSONObject();
result.put("qrcode_surcharge", client.getBooleanValue("qrcode_surcharge"));
result.put("retail_surcharge", client.getBooleanValue("retail_surcharge"));
result.put("api_surcharge", client.getBooleanValue("api_surcharge"));
result.put("require_custinfo", client.getBooleanValue("require_custinfo"));
result.put("require_remark", client.getBooleanValue("require_remark"));
return result;
}
}

@ -0,0 +1,77 @@
package au.com.royalpay.payment.manage.billqrcode.bean;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
public class NewBillQrCodeBean {
private BigDecimal order_amount;
private String currency = "AUD";
private String remark;
private String cancle_time;
private String client_order_id;
public JSONObject toJson(){
JSONObject record = new JSONObject();
if(order_amount != null){
record.put("order_amount",order_amount);
}
if(StringUtils.isNotEmpty(remark)){
record.put("remark",remark);
}
if(StringUtils.isNotEmpty(client_order_id)){
record.put("client_order_id",client_order_id);
}
if (StringUtils.isNotEmpty(cancle_time)) {
record.put("cancle_time",cancle_time);
}
record.put("currency",currency);
return record;
}
public BigDecimal getOrder_amount() {
return order_amount;
}
public void setOrder_amount(BigDecimal order_amount) {
this.order_amount = order_amount;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getCancle_time() {
return cancle_time;
}
public void setCancle_time(String cancle_time) {
this.cancle_time = cancle_time;
}
public String getClient_order_id() {
return client_order_id;
}
public void setClient_order_id(String client_order_id) {
this.client_order_id = client_order_id;
}
}

@ -0,0 +1,57 @@
package au.com.royalpay.payment.manage.billqrcode.bean;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
/**
* Created by yuan on 2018/5/9.
*/
public class QueryBillBean {
private int limit = 10;
private int page = 1;
private String status;
private String client_order_id;
public JSONObject toJson(){
JSONObject jason = new JSONObject();
if(StringUtils.isNotEmpty(status)){
jason.put("status",status);
}
if(StringUtils.isNotEmpty(client_order_id)){
jason.put("client_order_id",client_order_id);
}
return jason;
}
public int getLimit() {
return limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getClient_order_id() {
return client_order_id;
}
public void setClient_order_id(String client_order_id) {
this.client_order_id = client_order_id;
}
}

@ -0,0 +1,20 @@
package au.com.royalpay.payment.manage.billqrcode.core;
import au.com.royalpay.payment.manage.billqrcode.bean.NewBillQrCodeBean;
import au.com.royalpay.payment.manage.billqrcode.bean.QueryBillBean;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
/**
* Created by yuan on 2018/5/3.
*/
public interface PartnerBillService {
String saveBill(JSONObject partner, NewBillQrCodeBean newBillQrCodeBean);
List<JSONObject> listBills(JSONObject partner, QueryBillBean queryBillBean);
void dailyCheckDirectedBillCode();
void disableBills(JSONObject partner,String bill_code_id);
}

@ -0,0 +1,126 @@
package au.com.royalpay.payment.manage.billqrcode.core.impl;
import au.com.royalpay.payment.manage.billqrcode.bean.NewBillQrCodeBean;
import au.com.royalpay.payment.manage.billqrcode.bean.QueryBillBean;
import au.com.royalpay.payment.manage.billqrcode.core.PartnerBillService;
import au.com.royalpay.payment.manage.mappers.billqrcode.DirectedBillCodeMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.utils.QRCodeUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* Created by yuan on 2018/5/3.
*/
@Service
public class PartnerBillServiceImpl implements PartnerBillService {
private org.slf4j.Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private ClientMapper clientMapper;
@Resource
private ClientManager clientManager;
@Resource
private DirectedBillCodeMapper directedBillCodeMapper;
@Override
@Transactional
public String saveBill(JSONObject partner, NewBillQrCodeBean newBillQrCodeBean) {
JSONObject client = clientMapper.findClientByMoniker(partner.getString("client_moniker"));
if (client == null) {
throw new NotFoundException("client info not found");
}
if(StringUtils.isNotEmpty(newBillQrCodeBean.getClient_order_id())){
JSONObject bill = directedBillCodeMapper.findOne(newBillQrCodeBean.getClient_order_id());
if(bill != null){
if(bill.getIntValue("status") == 2){
throw new BadRequestException("该订单已关闭,请确认");
}
if(bill.getIntValue("status") == 3){
throw new BadRequestException("该订单已完成,请确认");
}
if(bill.getIntValue("status") == 1){
if(bill.getBigDecimal("order_amount") == newBillQrCodeBean.getOrder_amount()){
return QRCodeUtils.qrcodeImageCode(bill.getString("code_url"), 250, false);
}
throw new BadRequestException("已有相同订单号正在被支付,详情请查看订单列表");
}
}
}
JSONObject record = newBillQrCodeBean.toJson();
if(record.getString("client_order_id") == null){
record.put("client_order_id","Bill_" + DateFormatUtils.format(new Date(), "yyyyMMddHHmmss") + "_" + RandomStringUtils.random(5, true, true).toUpperCase());
}
record.put("client_id",partner.getIntValue("client_id"));
record.put("create_time", new Date());
record.put("status",1);
directedBillCodeMapper.save(record);
String code_url = getQRCodeImg(record);
record.put("code_url",code_url);
directedBillCodeMapper.update(record);
return QRCodeUtils.qrcodeImageCode(code_url, 250, false);
}
private String getQRCodeImg(JSONObject bill){
return PlatformEnvironment.getEnv().concatUrl("api/v1.0/share_code/business/bills/"+bill.getString("bill_code_id"));
}
@Override
public List<JSONObject> listBills(JSONObject partner, QueryBillBean queryBillBean) {
int client_id = partner.getInteger("client_id");
JSONObject client = clientManager.getClientInfo(client_id);
if (client == null) {
throw new NotFoundException("client info not found");
}
JSONObject params = queryBillBean.toJson();
params.put("client_id",client_id);
List<JSONObject> bills = directedBillCodeMapper.findByClientId(params,new PageBounds(queryBillBean.getPage(),queryBillBean.getLimit(), Order.formString("create_time.desc")));
bills.stream().filter(t->StringUtils.isNotEmpty(t.getString("code_url"))).forEach(t->t.put("code_url",QRCodeUtils.qrcodeImageCode(t.getString("code_url"), 250, false)));
return bills;
}
@Override
public void disableBills(JSONObject partner, String bill_code_id) {
int client_id = partner.getInteger("client_id");
JSONObject client = clientManager.getClientInfo(client_id);
if (client == null) {
throw new NotFoundException("client info not found");
}
JSONObject bill = directedBillCodeMapper.findOneByBillCodeId(bill_code_id);
if(bill.getIntValue("status")==1){
if(bill.getString("order_id") != null){
bill.put("status",2);
directedBillCodeMapper.update(bill);
}
}
}
@Override
public void dailyCheckDirectedBillCode() {
List<JSONObject> listAllBill = directedBillCodeMapper.listAllBills();
for (JSONObject bill: listAllBill) {
if(DateUtils.addDays(bill.getDate("cancle_time"),1).before(new Date())){
bill.put("status",2);
directedBillCodeMapper.update(bill);
}
}
}
}

@ -0,0 +1,37 @@
package au.com.royalpay.payment.manage.billqrcode.web;
import au.com.royalpay.payment.manage.billqrcode.bean.NewBillQrCodeBean;
import au.com.royalpay.payment.manage.billqrcode.bean.QueryBillBean;
import au.com.royalpay.payment.manage.billqrcode.core.PartnerBillService;
import au.com.royalpay.payment.manage.permission.manager.PartnerMapping;
import au.com.royalpay.payment.tools.CommonConsts;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by yuan on 2018/5/3.
*/
@RestController
@RequestMapping("/partner/qrcode")
public class PartnerBillController {
@Resource
private PartnerBillService partnerBillService;
@PartnerMapping(value = "/bills", method = RequestMethod.POST)
public String addBill(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, @RequestBody NewBillQrCodeBean newBillQrCodeBean) {
return partnerBillService.saveBill(partner, newBillQrCodeBean);
}
@PartnerMapping(value = "", method = RequestMethod.GET)
public List<JSONObject> listBills(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, QueryBillBean queryBillBean) {
return partnerBillService.listBills(partner,queryBillBean);
}
@PartnerMapping(value = "/{bill_code_id}", method = RequestMethod.DELETE)
public void disableBills(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner,@PathVariable String bill_code_id) {
partnerBillService.disableBills(partner,bill_code_id);
}
}

@ -0,0 +1,33 @@
package au.com.royalpay.payment.manage.mappers.billqrcode;
import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@AutoMapper(tablename = "pmt_directed_bill_code", pkName = "bill_code_id")
public interface DirectedBillCodeMapper {
@AutoSql(type = SqlType.INSERT)
int save(JSONObject record);
@AutoSql(type = SqlType.SELECT)
JSONObject findOne(@Param("client_order_id") String client_order_id);
@AutoSql(type = SqlType.SELECT)
JSONObject findOneByBillCodeId(@Param("bill_code_id") String bill_code_id);
@AutoSql(type = SqlType.UPDATE)
int update(JSONObject record);
@AutoSql(type = SqlType.SELECT)
List<JSONObject> findByClientId(JSONObject params, PageBounds pageBounds);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "status=1")
List<JSONObject> listAllBills();
}

@ -44,4 +44,8 @@ public interface ActRedPacketsCustomerOrdersMapper {
PageList<JSONObject> listOrders(JSONObject jsonObject, PageBounds pageBounds);
List<JSONObject> listUnsend(@Param("act_id") String actId, @Param("before") Date before);
List<JSONObject> getCustomerRedpackAnalysis(JSONObject params);
JSONObject analysisCustomerLuckyMoney(JSONObject params);
}

@ -7,6 +7,7 @@ import au.com.royalpay.payment.manage.mappers.client.ClientSubMerchantIdMapper;
import au.com.royalpay.payment.manage.mappers.payment.CommonSubMerchantIdMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.merchantid.core.MerchantIdManageService;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
@ -144,19 +145,14 @@ public class MerchantIdManageServiceImpl implements MerchantIdManageService {
@Override
public JSONObject getClientQrCodeImg(JSONObject manager,String sub_merchant_id) {
List<JSONObject> clientMonikers = showClientMoniker(manager,sub_merchant_id);
if(clientMonikers.isEmpty()){
throw new BadRequestException("当前子商户号下暂无商户");
}
String partner_code = clientMonikers.get(0).getString("client_moniker");
String partner_code = "PINE";
String orderId = "Merchant" + DateFormatUtils.format(new Date(), "yyyyMMddHHmmss") + "_" + RandomStringUtils.random(5, true, true).toUpperCase();
JSONObject param = new JSONObject();
param.put("price", 10);
param.put("price", 1);
param.put("description", "order");
param.put("operator", "web");
param.put("currency","CNY");
String createUrl= "https://mpay.royalpay.com.au/api/v1.0/gateway/partners/" + partner_code + "/orders/" + orderId + "?" + queryParams(partner_code);
param.put("sub_merchant_id",sub_merchant_id);
String createUrl= PlatformEnvironment.getEnv().concatUrl("api/v1.0/gateway/partners/" + partner_code + "/orders/" + orderId +"/manager/test"+"?" + queryParams(partner_code));
HttpRequestResult result = null;
try {
result = new HttpRequestGenerator(createUrl, RequestMethod.PUT).setJSONEntity(param).execute();

@ -229,7 +229,7 @@ public interface ClientManager {
void changePaymentPage(JSONObject account, String paypad_version);
void changeManualSettle(int client_id, boolean manual_settle,String operator_id,int type,String operation);
void changeManualSettle(JSONObject account , int client_id, boolean manual_settle,String operator_id,int type,String operation);
void changeQRCodePaySurcharge(JSONObject account, boolean paySurcharge);

@ -669,6 +669,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
boolean checkGreenChannel = client.getIntValue("approve_result") == 2 && (client.getIntValue("source") == 1 || client.getIntValue("source") == 2);
AuditModify auditModify = new AuditModify(manager, clientMoniker, pass, manager.getString("manager_id"), new Date());
auditModify.setOpen_status(5);
client.put("open_status", 5);
if (client.getIntValue("source") == 5) {
auditModify.setSource(1);
}
@ -2182,6 +2183,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (CollectionUtils.isEmpty(existFiles)) {
throw new BadRequestException("The Agree File is not Complete!");
}
client.put("open_status", 3);
clientModifySupport.processClientModify(new OpenStatusModify(manager, clientMoniker, 3));
saveClientAuditProcess(client.getIntValue("client_id"), 2, 3, "合同制作完成等待BD处理", manager);
// sendAgreeFileMsgToBD(client,null);
@ -2541,8 +2543,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} else {
openStatusModify.setApprove_time(new Date());
openStatusModify.setApprove_result(4);
}
client.put("open_status", 4);
clientModifySupport.processClientModify(openStatusModify);
saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "BD完成签字提交compliance审核", manager);
if (manager != null) {
@ -2676,16 +2678,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
@Override
@Transactional
public void changeManualSettle(int client_id, boolean manual_settle, String operator_id, int type, String operation) {
public void changeManualSettle(JSONObject account,int client_id, boolean manual_settle, String operator_id, int type, String operation) {
JSONObject client = getClientInfo(client_id);
if (client == null) {
throw new BadRequestException("merchant not found");
}
JSONObject record = new JSONObject();
record.put("client_id", client_id);
record.put("manual_settle", manual_settle);
clientConfigService.update(record);
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account,client.getString("client_moniker"),"manual_settle",manual_settle));
JSONObject actClientLog = new JSONObject();
actClientLog.put("client_id", client_id);
actClientLog.put("operator_id", operator_id);

@ -19,7 +19,6 @@ public class AuditModify extends ClientModify {
private Date approve_time;
private String refuse_remark;
public AuditModify(JSONObject account, String clientMoniker, Integer approve_result, String approver, Date approve_time) {
super(account, clientMoniker);
this.approve_result = approve_result;
@ -35,17 +34,15 @@ public class AuditModify extends ClientModify {
@Override
protected JSONObject getModifyResult() {
JSONObject modify = new JSONObject();
modify.put("approve_result",approve_result);
modify.put("approver",approver);
modify.put("approve_time",approve_time);
if(source!=null){
modify.put("source",source);
}
if(open_status!=null){
modify.put("open_status",open_status);
modify.put("approve_result", approve_result);
modify.put("approver", approver);
modify.put("approve_time", approve_time);
if (source != null) {
modify.put("source", source);
}
if(StringUtils.isNotEmpty(refuse_remark)){
modify.put("refuse_remark",refuse_remark);
modify.put("open_status", open_status);
if (StringUtils.isNotEmpty(refuse_remark)) {
modify.put("refuse_remark", refuse_remark);
}
return modify;
}
@ -66,4 +63,3 @@ public class AuditModify extends ClientModify {
this.approve_result = approve_result;
}
}

@ -365,7 +365,7 @@ public class PartnerViewController {
@PartnerMapping(value = "/manual_settle", method = RequestMethod.PUT, roles = PartnerRole.ADMIN)
@ResponseBody
public void manualSettle(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestParam boolean manual_settle) {
clientManager.changeManualSettle(account.getIntValue("client_id"), manual_settle, account.getString("account_id"), 1, "商户" + (manual_settle ? "打开" : "关闭") + "手动清算");
clientManager.changeManualSettle(account,account.getIntValue("client_id"), manual_settle, account.getString("account_id"), 1, "商户" + (manual_settle ? "打开" : "关闭") + "手动清算");
}
@PartnerMapping(value = "/checkContract", method = RequestMethod.GET)

@ -13,6 +13,7 @@ public class CustomerRedpackActBean {
private String act_name;
private BigDecimal rule_order_total;
private int rule_max_num;
private int rule_max_num_limit;
private int status=0;
private List<JSONObject> prize_type_list;
@ -59,4 +60,12 @@ public class CustomerRedpackActBean {
public void setPrize_type_list(List<JSONObject> prize_type_list) {
this.prize_type_list = prize_type_list;
}
public int getRule_max_num_limit() {
return rule_max_num_limit;
}
public void setRule_max_num_limit(int rule_max_num_limit) {
this.rule_max_num_limit = rule_max_num_limit;
}
}

@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.redpack.beans;
import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import java.text.ParseException;
@ -50,16 +51,16 @@ public class RedpackQuery {
throw new ParamInvalidException("event_date", "error.payment.valid.invalid_date_format");
}
}
if (short_name != null){
if (StringUtils.isNotEmpty(short_name)){
param.put("short_name",short_name);
}
if (client_moniker != null){
if (StringUtils.isNotEmpty(client_moniker)){
param.put("client_moniker",client_moniker);
}
if (nickname != null){
if (StringUtils.isNotEmpty(nickname)){
param.put("nickname",nickname);
}
if (org_id != null){
if (StringUtils.isNotEmpty(org_id)){
param.put("org_id",org_id);
}
if (bd != null){

@ -1,8 +1,11 @@
package au.com.royalpay.payment.manage.redpack.core;
import au.com.royalpay.payment.core.exceptions.RedPackException;
import au.com.royalpay.payment.manage.redpack.beans.RedpackQuery;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
/**
* Created by wangning on 2017/8/10.
*/
@ -23,4 +26,8 @@ public interface ActRedPackService {
JSONObject listCustomerOrders(JSONObject params, int page, int limit);
void resendFailed();
List<JSONObject> getCustomerRedpackAnalysis(String act_id, RedpackQuery redpackQuery);
JSONObject analysisCustomerLuckyMoney(JSONObject params);
}

@ -7,6 +7,7 @@ import au.com.royalpay.payment.manage.mappers.redpack.ActPrizeTypeCustomerMapper
import au.com.royalpay.payment.manage.mappers.redpack.ActRedPacketsCustomerMapper;
import au.com.royalpay.payment.manage.mappers.redpack.ActRedPacketsCustomerOrdersMapper;
import au.com.royalpay.payment.manage.mappers.system.CustomerMapper;
import au.com.royalpay.payment.manage.redpack.beans.RedpackQuery;
import au.com.royalpay.payment.manage.redpack.core.ActRedPackService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
@ -15,13 +16,15 @@ import au.com.royalpay.payment.tools.connections.mpsupport.beans.WechatRedpack;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
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;
@ -30,7 +33,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.Date;
@ -39,6 +41,8 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
/**
* Created by wangning on 2017/8/10.
*/
@ -129,37 +133,51 @@ public class ActRedPackServiceImpl implements ActRedPackService {
int getTotalCounts = getRedPacketsByOpenid(open_id, new Date(), actId);
int ruleMaxNum = redpackCustomerActivity.getIntValue("rule_max_num");
if (getTotalCounts >= ruleMaxNum) {
logger.error("open_id:" + open_id + "当日红包发送数量已到达" + ruleMaxNum + "!跳过");
logger.debug("open_id:" + open_id + "已达到本次活动发送最大次数" + ruleMaxNum + "!跳过");
return;
}
int getDailyTotalCounts = getRedPacketsByOpenid(open_id, new Date(), actId);
int ruleMaxNumLimit = redpackCustomerActivity.getIntValue("rule_max_num_limit");
if (getDailyTotalCounts >= ruleMaxNumLimit) {
logger.debug("open_id:" + open_id + "已达当日发送最大次数" + ruleMaxNumLimit + "!跳过");
return;
}
takeRedpack(actId,orderId, client_id, clientApply, currencyAmount, open_id, 0);
takeRedpack(actId, orderId, client_id, clientApply, currencyAmount, open_id, 0);
}
private void takeRedpack(String actId,String orderId, int client_id, JSONObject clientApply, BigDecimal currencyAmount, String open_id, int tryTimes)
private void takeRedpack(String actId, String orderId, int client_id, JSONObject clientApply, BigDecimal currencyAmount, String open_id, int tryTimes)
throws RedPackException {
if (tryTimes > 5) {
return;
}
int random = (int) (Math.random() * 100);
if (random > 80) {
logger.info("未达到触发概率当前概率为:" + random);
return;
}
List<JSONObject> prizeTypes = actPrizeTypeCustomerMapper.listAvailableTypes(actId);
Collections.shuffle(prizeTypes);
int totalWeight = 0;
for (JSONObject prizeType : prizeTypes) {
totalWeight += prizeType.getIntValue("weight");
}
int ran = RandomUtils.nextInt(0,totalWeight);
int ran = RandomUtils.nextInt(0, totalWeight);
for (JSONObject prizeType : prizeTypes) {
ran -= prizeType.getIntValue("weight");
if (ran < 0) {
String lock = Long.toString(System.currentTimeMillis(), 36) + RandomStringUtils.random(5, true, true);
int lockedCount = actRedPacketsCustomerOrdersMapper.lockPrize(actId,lock, prizeType.getString("type_id"), open_id, client_id, orderId, currencyAmount,
new Date());
int lockedCount = actRedPacketsCustomerOrdersMapper.lockPrize(actId, lock, prizeType.getString("type_id"), open_id, client_id, orderId,
currencyAmount, new Date());
if (lockedCount > 0) {
doSendActLuckyMoney(open_id, lock, clientApply.getString("act_name"), clientApply.getString("send_name"), clientApply.getString("wishing"));
break;
} else {
takeRedpack(actId,orderId, client_id, clientApply, currencyAmount, open_id, tryTimes + 1);
takeRedpack(actId, orderId, client_id, clientApply, currencyAmount, open_id, tryTimes + 1);
break;
}
}
@ -211,8 +229,8 @@ public class ActRedPackServiceImpl implements ActRedPackService {
if (redpack_counts > 0) {
for (int i = 0; i < redpack_counts; i++) {
BigDecimal amount = amountFrom.equals(amountTo) ? amountFrom
: amountFrom.add(BigDecimal.valueOf(RandomUtils.nextInt(0,amountTo.subtract(amountFrom).multiply(CommonConsts.HUNDRED).intValue()))
.divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_DOWN));
: amountFrom.add(BigDecimal.valueOf(RandomUtils.nextInt(0, amountTo.subtract(amountFrom).multiply(CommonConsts.HUNDRED).intValue()))
.divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_DOWN));
JSONObject prize = new JSONObject();
String prefix = DateFormatUtils.format(new Date(), "yyyyMMddHHmmssSSS");
String red_packet_order_id = prefix + RandomStringUtils.random(28 - prefix.length(), true, true);
@ -277,7 +295,8 @@ public class ActRedPackServiceImpl implements ActRedPackService {
pool.execute(() -> {
JSONObject clientApply = actClientApplyMapper.findActivity(actId, redpack.getIntValue("client_id"));
try {
doSendActLuckyMoney(redpack.getString("open_id"), redpack.getString("lock"), clientApply.getString("act_name"), clientApply.getString("send_name"), clientApply.getString("wishing"));
doSendActLuckyMoney(redpack.getString("open_id"), redpack.getString("lock"), clientApply.getString("act_name"),
clientApply.getString("send_name"), clientApply.getString("wishing"));
} catch (RedPackException e) {
e.printStackTrace();
}
@ -286,4 +305,15 @@ public class ActRedPackServiceImpl implements ActRedPackService {
}
}
@Override
public List<JSONObject> getCustomerRedpackAnalysis(String act_id, RedpackQuery redpackQuery) {
JSONObject params = redpackQuery.params();
params.put("act_id", act_id);
return actRedPacketsCustomerOrdersMapper.getCustomerRedpackAnalysis(params);
}
@Override
public JSONObject analysisCustomerLuckyMoney(JSONObject params) {
return actRedPacketsCustomerOrdersMapper.analysisCustomerLuckyMoney(params);
}
}

@ -1,12 +1,14 @@
package au.com.royalpay.payment.manage.redpack.web;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.redpack.beans.RedpackQuery;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.redpack.core.ActRedPackService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by wangning on 2017/8/10.
@ -30,10 +32,21 @@ public class ActRedpackConfigController {
}
@RequestMapping(value = "/act/{act_id}",method = RequestMethod.GET)
private JSONObject listCustomerOrders(@PathVariable String act_id, @RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int limit){
JSONObject params = new JSONObject();
private JSONObject listCustomerOrders(@PathVariable String act_id, RedpackQuery redpackQuery){
JSONObject params = redpackQuery.params();
params.put("actId",act_id);
return actRedPackService.listCustomerOrders(params,page,limit);
return actRedPackService.listCustomerOrders(params,redpackQuery.getPage(),redpackQuery.getLimit());
}
@ManagerMapping(value = "/{act_id}/sendLogs/analysis",method = RequestMethod.GET)
public List<JSONObject> getCustomerRedpackAnalysis(@PathVariable String act_id, RedpackQuery query){
return actRedPackService.getCustomerRedpackAnalysis(act_id,query);
}
@ManagerMapping(value = "/act/{act_id}/analysis",method = RequestMethod.GET)
public JSONObject customerLuckyMoneyAnalysis(@PathVariable String act_id, RedpackQuery query){
JSONObject params= query.params();
params.put("act_id",act_id);
return actRedPackService.analysisCustomerLuckyMoney(params);
}
}

@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.risk.bean;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import java.text.ParseException;
@ -19,10 +20,18 @@ public class QueryRiskRecord {
public JSONObject toParams() {
JSONObject params = new JSONObject();
params.put("status", this.status);
params.put("client_moniker", this.client_moniker);
params.put("record_id", this.record_id);
params.put("client_id", this.client_id);
if(StringUtils.isNotEmpty(status)){
params.put("status", this.status);
}
if(StringUtils.isNotEmpty(client_moniker)){
params.put("client_moniker", this.client_moniker);
}
if(StringUtils.isNotEmpty(record_id)){
params.put("record_id", this.record_id);
}
if(StringUtils.isNotEmpty(String.valueOf(client_id))){
params.put("client_id", this.client_id);
}
try {
if (c_end_time != null) {
params.put("c_end_time", DateUtils.parseDate(this.c_end_time, new String[] { "yyyy-MM-dd HH:mm:ss" }));

@ -0,0 +1,22 @@
package au.com.royalpay.payment.manage.system.web;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.RestController;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping(value = "/mailgun")
public class MailCallBackController {
Logger logger = LoggerFactory.getLogger(getClass());
@RequestMapping(value = "/callback", method = RequestMethod.POST)
public void contractList(@RequestBody String content, HttpServletRequest req) {
logger.info(content);
}
}

@ -2,17 +2,15 @@ package au.com.royalpay.payment.manage.task;
import au.com.royalpay.payment.manage.mappers.bill.BillOrderMapper;
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import com.alibaba.fastjson.JSONObject;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.List;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by wangning on 2018/1/2.
@ -25,25 +23,30 @@ public class BillOrderCheckTask {
@Resource
private OrderMapper orderMapper;
@Resource
private SynchronizedScheduler synchronizedScheduler;
@Scheduled(cron = "0 0/3 * * * ?")
public void checkGreenChannel() {
List<String> orderIds = billOrderMapper.findOrderIdByStatus("0");
if(CollectionUtils.isEmpty(orderIds)){
return;
}
for (String p : orderIds) {
if (p==null){
continue;
synchronizedScheduler.executeProcess("manage_task:checkGreenChannel", 120_000, () -> {
List<String> orderIds = billOrderMapper.findOrderIdByStatus("0");
if (CollectionUtils.isEmpty(orderIds)) {
return;
}
JSONObject order = orderMapper.find(p);
int status = order.getIntValue("status");
if(status==3||status==1){
billOrderMapper.updateStatusByOrderId(p,"2");
for (String p : orderIds) {
if (p == null) {
continue;
}
JSONObject order = orderMapper.find(p);
int status = order.getIntValue("status");
if (status == 3 || status == 1) {
billOrderMapper.updateStatusByOrderId(p, "2");
}
if (status == 5) {
billOrderMapper.updateStatusByOrderId(p, "1");
}
}
if(status==5){
billOrderMapper.updateStatusByOrderId(p,"1");
}
}
});
}
}

@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.task;
import au.com.royalpay.payment.manage.application.core.SimpleClientService;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@ -16,13 +17,16 @@ import javax.annotation.Resource;
public class CheckPartnerAuthStatusAndSendMessageTask {
@Resource
private SimpleClientService simpleClientService;
@Resource
private SynchronizedScheduler synchronizedScheduler;
// @Scheduled(cron = "0 0 9 * * ?")
// public void checkAuthAndSendMessage(){
// simpleClientService.checkAuthAndSendMessage();
// }
@Scheduled(cron = "0 0 9 * * ?")
public void checkGreenChannel(){
simpleClientService.checkGreenChannelClients();
public void checkGreenChannel() {
synchronizedScheduler.executeProcess("manage_task:CheckPartnerAuthStatus", 120_000, () -> simpleClientService.checkGreenChannelClients());
}
}

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.task;
import au.com.royalpay.payment.manage.apps.core.CustomerImpressionService;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import com.alibaba.fastjson.JSONObject;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@ -27,32 +28,36 @@ public class CustomerImpressionTask {
private ClientMapper clientMapper;
@Resource
private CustomerImpressionService customerImpressionService;
@Resource
private SynchronizedScheduler synchronizedScheduler;
private ThreadPoolExecutor generatePool = new ThreadPoolExecutor(10, 30, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
@Scheduled(cron = "0 0 3 * * ?")
@Scheduled(cron = "0 30 3 * * ?")
public void generateTags() {
List<JSONObject> clients = clientMapper.listValidClient();
List<List<JSONObject>> splitList = new ArrayList<>();
for (int i = 0; i < clients.size(); i+=200) {
if(i+200>clients.size()){
splitList.add(clients.subList(i,clients.size()));
}else {
splitList.add(clients.subList(i,i+200));
}
synchronizedScheduler.executeProcess("manage_task:CustomerImpression", 120_000, () -> {
List<JSONObject> clients = clientMapper.listValidClient();
List<List<JSONObject>> splitList = new ArrayList<>();
for (int i = 0; i < clients.size(); i += 200) {
if (i + 200 > clients.size()) {
splitList.add(clients.subList(i, clients.size()));
} else {
splitList.add(clients.subList(i, i + 200));
}
}
for (List<JSONObject> splitClients : splitList) {
Runnable task = () -> splitClients.forEach((p)->{
System.out.println("当前执行到"+p.getIntValue("client_id"));
customerImpressionService.generateTag(p.getIntValue("client_id"));
});
generatePool.execute(task);
}
}
for (List<JSONObject> splitClients : splitList) {
Runnable task = () -> splitClients.forEach((p) -> {
System.out.println("当前执行到" + p.getIntValue("client_id"));
customerImpressionService.generateTag(p.getIntValue("client_id"));
});
generatePool.execute(task);
}
});
}
@Scheduled(cron = "0/1 * * * * ?")
public void generateInfo() {
customerImpressionService.generateInfo();
synchronizedScheduler.executeProcess("manage_task:CustomerImpression", 1_000, () -> customerImpressionService.generateInfo());
}
}

@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.task;
import au.com.royalpay.payment.manage.analysis.core.DailyReport;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@ -21,10 +22,14 @@ public class DailyReportGenerationTask {
@Resource
private DailyReport dailyReport;
@Resource
private SynchronizedScheduler synchronizedScheduler;
@Scheduled(cron = "0 0 10 * * ?")
public void autoGenerateReport() {
Date yesterday = DateUtils.addDays(new Date(), -1);
dailyReport.generateReport(DateFormatUtils.format(yesterday, "yyyy-MM-dd"), true);
synchronizedScheduler.executeProcess("manage_task:autoGenerateDailyReport", 120_000, () -> {
Date yesterday = DateUtils.addDays(new Date(), -1);
dailyReport.generateReport(DateFormatUtils.format(yesterday, "yyyy-MM-dd"), true);
});
}
}

@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.task;
import au.com.royalpay.payment.manage.analysis.core.DashboardService;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
@ -19,8 +20,12 @@ import javax.annotation.Resource;
public class DashboardTaskManager {
@Resource
private DashboardService dashboardService;
@Resource
private SynchronizedScheduler synchronizedScheduler;
@Scheduled(cron = "0 0 2 * * ?")
public void analysisDashboard(){
dashboardService.generateCustomersAndOrdersStatistics(DateUtils.addDays(new Date(), -1));
public void analysisDashboard() {
synchronizedScheduler.executeProcess("manage_task:dashboardTask", 120_000,
() -> dashboardService.generateCustomersAndOrdersStatistics(DateUtils.addDays(new Date(), -1)));
}
}

@ -0,0 +1,27 @@
package au.com.royalpay.payment.manage.task;
import au.com.royalpay.payment.manage.billqrcode.core.PartnerBillService;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* Created by yuan on 2018/5/4.
*/
@Component
@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true")
public class DirectedBillCodeStatusDailyCheck {
@Resource
private PartnerBillService partnerBillService;
@Resource
private SynchronizedScheduler synchronizedScheduler;
@Scheduled(cron = "0 30 5 * * ?")
public void statusDailyCheck() {
synchronizedScheduler.executeProcess("manage_task:dailyCheckDirected", 120_000,
() -> partnerBillService.dailyCheckDirectedBillCode());
}
}

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.task;
import au.com.royalpay.payment.manage.mappers.ofei.TopUpOrderMapper;
import au.com.royalpay.payment.manage.ofei.core.OfeiServer;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@ -22,14 +23,19 @@ public class OfeiOrderCheckTask {
private OfeiServer ofeiServer;
@Resource
private TopUpOrderMapper topUpOrderMapper;
@Resource
private SynchronizedScheduler synchronizedScheduler;
@Scheduled(cron = "0 0/20 * * * ?")
public void checkGreenChannel(){
List<String> orderIds = topUpOrderMapper.findOrderIdByStatus("10");
if(CollectionUtils.isEmpty(orderIds)){
return;
}
for (String orderId : orderIds) {
ofeiServer.checkOrder(orderId);
}
public void checkGreenChannel() {
synchronizedScheduler.executeProcess("manage_task:ofeiOrderCheck", 120_000, () -> {
List<String> orderIds = topUpOrderMapper.findOrderIdByStatus("10");
if (CollectionUtils.isEmpty(orderIds)) {
return;
}
for (String orderId : orderIds) {
ofeiServer.checkOrder(orderId);
}
});
}
}

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.task;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@ -13,15 +14,19 @@ import javax.annotation.Resource;
* Created by yixian on 2017-02-22.
*/
@Component
@ConditionalOnProperty(value = "app.run-tasks",havingValue = "true")
@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true")
public class PartnerInitEmailChecker {
@Resource
private ClientManager clientManager;
@Resource
private SynchronizedScheduler synchronizedScheduler;
@Scheduled(cron = "0 0/5 * * * *")
public void checkEmailStatus(){
public void checkEmailStatus() {
if (PlatformEnvironment.getEnv().taskEnabled()) {
clientManager.checkEmailStatus();
synchronizedScheduler.executeProcess("manage_task:emailStatusCheck", 120_000,
() -> clientManager.checkEmailStatus());
}
}
}

@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.task;
import au.com.royalpay.payment.manage.analysis.core.CustomersAnalysisService;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
@ -19,8 +20,12 @@ import javax.annotation.Resource;
public class PartnerTransactionsDailyMsgTaskManager {
@Resource
private CustomersAnalysisService customersAnalysisService;
@Resource
private SynchronizedScheduler synchronizedScheduler;
@Scheduled(cron = "0 0 8 * * ?")
public void analysisDashboard(){
customersAnalysisService.sendPartnerTransactionDaily(DateUtils.addDays(new Date(), -1));
public void analysisDashboard() {
synchronizedScheduler.executeProcess("manage_task:partnerDailyMsg", 120_000,
() -> customersAnalysisService.sendPartnerTransactionDaily(DateUtils.addDays(new Date(), -1)));
}
}

@ -8,6 +8,7 @@ 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.scheduler.SynchronizedScheduler;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.time.DateFormatUtils;
@ -44,56 +45,61 @@ public class PostponeClientTask {
private ClientAccountMapper clientAccountMapper;
@Resource
private ManagerMapper managerMapper;
@Resource
private SynchronizedScheduler synchronizedScheduler;
@Scheduled(cron = "0 30 8 * * ?")
@Scheduled(cron = "0 30 8 * * ?")
public void checkGreenChannel() {
Date now = new Date();
Date tomorrow = DateUtils.addDays(now, 1);
Date yearTomorrow = DateUtils.addYears(tomorrow, 1);
String expireDate = DateFormatUtils.format(yearTomorrow, "yyyy-MM-dd");
List<JSONObject> expiryClient = clientRateMapper.getAllExpiry(now);
if(CollectionUtils.isEmpty(expiryClient)){
return;
}
Map<Integer, JSONObject> expiryClients = new HashMap<>();
expiryClient.forEach(p -> {
expiryClients.put(p.getInteger("client_id"), p);
});
expiryClients.values().forEach(p -> {
int client_id = p.getIntValue("client_id");
List<JSONObject> adminAccounts = clientAccountMapper.listAdminAccounts(client_id);
List<JSONObject> clientRates = clientRateMapper.maxChannelExpiryTime(client_id, null);
JSONObject wechatRate = clientRateMapper.latestChannelCleanDays("Wechat", p.getIntValue("client_id"));
int cleanDays = 1;
if (wechatRate.getInteger("clean_days") != null) {
cleanDays = wechatRate.getIntValue("clean_days");
} else {
cleanDays = wechatRate.getIntValue("c_clean_days");
synchronizedScheduler.executeProcess("manage_task:postPoneClient", 120_000, () -> {
Date now = new Date();
Date tomorrow = DateUtils.addDays(now, 1);
Date yearTomorrow = DateUtils.addYears(tomorrow, 1);
String expireDate = DateFormatUtils.format(yearTomorrow, "yyyy-MM-dd");
List<JSONObject> expiryClient = clientRateMapper.getAllExpiry(now);
if (CollectionUtils.isEmpty(expiryClient)) {
return;
}
int finalCleanDays = cleanDays;
clientRates.forEach(o -> {
JSONObject record = clientRateMapper.latestExpiryConfig(client_id,o.getString("rate_name"));
record.remove("client_rate_id");
record.put("active_time", now);
record.put("manager_id", 0);
record.put("expiry_time", yearTomorrow);
record.put("create_time", now);
record.put("update_time", now);
record.put("clean_days", finalCleanDays);
record.put("manager_name", "System");
record.put("remark", "费率到期系统自动延期1年");
clientRateMapper.saveRate(record);
Map<Integer, JSONObject> expiryClients = new HashMap<>();
expiryClient.forEach(p -> {
expiryClients.put(p.getInteger("client_id"), p);
});
adminAccounts.forEach(o -> {
sendClientPostponeNotify(o, expireDate);
expiryClients.values().forEach(p -> {
int client_id = p.getIntValue("client_id");
List<JSONObject> adminAccounts = clientAccountMapper.listAdminAccounts(client_id);
List<JSONObject> clientRates = clientRateMapper.maxChannelExpiryTime(client_id, null);
JSONObject wechatRate = clientRateMapper.latestChannelCleanDays("Wechat", p.getIntValue("client_id"));
int cleanDays = 1;
if (wechatRate.getInteger("clean_days") != null) {
cleanDays = wechatRate.getIntValue("clean_days");
} else {
cleanDays = wechatRate.getIntValue("c_clean_days");
}
int finalCleanDays = cleanDays;
clientRates.forEach(o -> {
JSONObject record = clientRateMapper.latestExpiryConfig(client_id, o.getString("rate_name"));
record.remove("client_rate_id");
record.put("active_time", now);
record.put("manager_id", 0);
record.put("expiry_time", yearTomorrow);
record.put("create_time", now);
record.put("update_time", now);
record.put("clean_days", finalCleanDays);
record.put("manager_name", "System");
record.put("remark", "费率到期系统自动延期1年");
clientRateMapper.saveRate(record);
});
adminAccounts.forEach(o -> {
sendClientPostponeNotify(o, expireDate);
});
});
sendComplianceNotify(expiryClients, expireDate);
});
sendComplianceNotify(expiryClients, expireDate);
}
private void sendClientPostponeNotify(JSONObject account,String newExpireDate) {
private void sendClientPostponeNotify(JSONObject account, String newExpireDate) {
JSONObject client = clientManager.getClientInfo(account.getIntValue("client_id"));
try {
@ -101,8 +107,8 @@ public class PostponeClientTask {
if (api != null) {
String templateId = api.getTemplateId("client-postpone");
if (templateId != null) {
TemplateMessage notice = initClientMessage(client,newExpireDate,account.getString("wechat_openid"),templateId);
api.sendTemplateMessage(notice);
TemplateMessage notice = initClientMessage(client, newExpireDate, account.getString("wechat_openid"), templateId);
api.sendTemplateMessage(notice);
}
}
} catch (Exception e) {
@ -129,7 +135,7 @@ public class PostponeClientTask {
private TemplateMessage initClientMessage(JSONObject client, String newExpiryDate, String wechatOpenid, String templateId) {
TemplateMessage notice = new TemplateMessage(wechatOpenid, templateId, null);
notice.put("first", "您好您的合同费率已到期根据合同协议系统已自动为您延期1年。", "#ff0000");
notice.put("keyword1", client.getString("short_name")+"("+client.getString("client_moniker")+")", "#ff0000");
notice.put("keyword1", client.getString("short_name") + "(" + client.getString("client_moniker") + ")", "#ff0000");
notice.put("keyword2", newExpiryDate, "#0000ff");
notice.put("remark", "如有疑问请联系RoyalPay", "#000000");
return notice;

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.task;
import au.com.royalpay.payment.manage.redpack.core.ActRedPackService;
import au.com.royalpay.payment.manage.redpack.core.RedpackService;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@ -23,20 +24,22 @@ public class RedPackTaskManager {
private RedpackService redpackService;
@Resource
private ActRedPackService actRedPackService;
@Resource
private SynchronizedScheduler synchronizedScheduler;
@Scheduled(cron = "0 0/10 * * * ?")
public void updateRedPackStatus() {
redpackService.updateRedPacketsStatus("3");
synchronizedScheduler.executeProcess("manage_task:updateRedpackStatus", 120_000, () -> redpackService.updateRedPacketsStatus("3"));
}
@Scheduled(cron = "0 0/10 * * * ?")
public void updateAlipayRedPackStatus() {
redpackService.updateAlipayRedPacketsStatus("3");
synchronizedScheduler.executeProcess("manage_task:updateAlipayRedpackStatus", 120_000, () -> redpackService.updateAlipayRedPacketsStatus("3"));
}
@Scheduled(cron = "0 0/3 * * * *")
public void resendFailedRedpack() {
actRedPackService.resendFailed();
synchronizedScheduler.executeProcess("manage_task:resendFailedRedpack", 120_000, () -> actRedPackService.resendFailed());
}
}

@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.task;
import au.com.royalpay.payment.manage.analysis.core.EstimateAnalysisService;
import au.com.royalpay.payment.manage.analysis.core.PlatformClearService;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@ -19,26 +20,28 @@ public class SettleEstimateTaskManger {
@Resource
private PlatformClearService platformClearService;
@Resource
private SynchronizedScheduler synchronizedScheduler;
// 3:15 am at every work days
@Scheduled(cron = "0 20 3 * * ?")
public void generateSettleAmount() {
estimateAnalysisService.generateSettleAmount();
synchronizedScheduler.executeProcess("manage_task:genSettleAmount", 120_000, () -> estimateAnalysisService.generateSettleAmount());
}
// 2:15 every day
@Scheduled(cron = "0 0 3 * * ?")
public void generateTransactionAmount() {
estimateAnalysisService.generateTransactionData();
synchronizedScheduler.executeProcess("manage_task:genTransAmount", 120_000, () -> estimateAnalysisService.generateTransactionData());
}
@Scheduled(cron = "0 0 13 * * ?")
public void generateSettleLogs() {
platformClearService.generateSettleLogs();
synchronizedScheduler.executeProcess("manage_task:genSettleLog", 120_000, () -> platformClearService.generateSettleLogs());
}
@Scheduled(cron = "0 0 10 * * ?")
public void generateSettleLogs2() {
platformClearService.generateSettleLogs();
synchronizedScheduler.executeProcess("manage_task:genSettleLog", 120_000, () -> platformClearService.generateSettleLogs());
}
}

@ -1,6 +1,7 @@
package au.com.royalpay.payment.manage.task;
import au.com.royalpay.payment.manage.merchantid.core.MerchantIdManageService;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@ -12,8 +13,11 @@ import javax.annotation.Resource;
public class SubMerchantIdTaskManager {
@Resource
private MerchantIdManageService merchantIdManageService;
@Resource
private SynchronizedScheduler synchronizedScheduler;
@Scheduled(cron = "0 0 4 * * ?")
public void analysisDashboard(){
merchantIdManageService.generateClientsSunMerchantId();
public void analysisDashboard() {
synchronizedScheduler.executeProcess("manage_task:checkSubMchId", 120_000, () -> merchantIdManageService.generateClientsSunMerchantId());
}
}

@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.task;
import au.com.royalpay.payment.manage.analysis.core.WeekReporter;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@ -21,11 +22,15 @@ public class WeekReportGenerationTask {
@Resource
private WeekReporter weekReporter;
@Resource
private SynchronizedScheduler synchronizedScheduler;
@Scheduled(cron = "0 0 2 * * 1")
public void autoGenerateReport() {
Date lastweek = new Date();
lastweek = DateUtils.addDays(lastweek, -7);
weekReporter.generateReport(DateFormatUtils.format(lastweek, "yyyy-MM-dd"), true);
synchronizedScheduler.executeProcess("manage_task:genWeekReport", 120_000, () -> {
Date lastweek = new Date();
lastweek = DateUtils.addDays(lastweek, -7);
weekReporter.generateReport(DateFormatUtils.format(lastweek, "yyyy-MM-dd"), true);
});
}
}

@ -198,7 +198,6 @@
<select id="listCustomersData" resultType="com.alibaba.fastjson.JSONObject">
SELECT o.customer_id,sum(if(t.transaction_type='Credit',t.clearing_amount,0)) amount,
sum(if(t.transaction_type='Credit',t.clearing_amount div 10,0)) points,
COUNT(DISTINCT o.order_id) orders,max(t.clearing_amount) max_order
FROM pmt_orders o
INNER JOIN pmt_transactions t on t.order_id=o.order_id and t.system_generate=0 and (t.transaction_type='Credit' or t.transaction_type>0)
@ -224,12 +223,11 @@
<if test="org_ids!=null">and o.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
</where>
GROUP BY o.customer_id ORDER BY points desc
GROUP BY o.customer_id
</select>
<select id="listCustomersDataAnalysis" resultType="com.alibaba.fastjson.JSONObject">
SELECT sum(if(t.transaction_type='Credit',t.clearing_amount,0)) total_amount,
sum(if(t.transaction_type='Credit',t.clearing_amount div 10,0)) total_points
SELECT sum(if(t.transaction_type='Credit',t.clearing_amount,0)) total_amount
FROM pmt_orders o
INNER JOIN pmt_transactions t on t.order_id=o.order_id and t.system_generate=0 and (t.transaction_type='Credit' or t.refund_id is not null)
<where>

@ -85,6 +85,8 @@
THEN 'Third Party Gateway'
WHEN 10
THEN 'APP'
WHEN 12
THEN 'MICROAPP'
END AS gateway,
p.client_moniker partner_code,
p.short_name partner_name,

@ -17,15 +17,35 @@
<select id="getRedPacketsByOpenid" resultType="int">
SELECT count(1)
FROM act_red_packets_customer_orders
WHERE open_id = #{open_id} AND date(event_time) = date(#{event_date}) AND status != 0 AND act_id = #{act_id}
WHERE open_id = #{open_id}
<if test="event_date != null">
AND date(event_time) = date(#{event_date})
</if>
AND status != 0 AND act_id = #{act_id}
</select>
<select id="listOrders" resultType="com.alibaba.fastjson.JSONObject">
SELECT
a.*,
b.client_moniker
FROM act_red_packets_customer_orders a INNER JOIN sys_clients b ON a.client_id = b.client_id
b.client_moniker,
c.headimg,
c.nickname
FROM act_red_packets_customer_orders a
INNER JOIN sys_clients b ON a.client_id = b.client_id
LEFT JOIN sys_customer_relation c ON c.wechat_openid = a.open_id
WHERE act_id = #{actId}
<if test="client_moniker != null">
AND b.client_moniker = #{client_moniker}
</if>
<if test="short_name != null">
AND b.short_name = #{short_name}
</if>
<if test="nickname != null">
<bind name="nickname_pattern" value="'%'+nickname+'%'"/>
and c.nickname like #{nickname_pattern}
</if>
<if test="from!=null">and a.event_time >= #{from}</if>
<if test="to!=null">and a.event_time &lt;= #{to}</if>
</select>
<select id="listUnsend" resultType="com.alibaba.fastjson.JSONObject">
SELECT *
@ -48,4 +68,34 @@
]]>
</update>
<select id="getCustomerRedpackAnalysis" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT date_format(event_time, '%Y-%m-%d') date,COUNT(red_packet_customer_order_id) counts,
sum(if(STATUS!=0,1,0)) sendtotal_counts,sum(if(status=1,1,0)) send_counts,sum(if(STATUS=2,1,0))fail_counts,sum(if(STATUS=3,1,0))receive_counts,sum(if(STATUS=4,1,0))refund_counts,
SUM(red_packet_amount) amount,sum(if(status=1 or status=3,red_packet_amount,0)) real_amount
FROM act_red_packets_customer_orders
where act_id = #{act_id}
and event_time is not null
and status !=0
]]>
<if test="from!=null">and event_time &gt;= #{from}</if>
<if test="to!=null">and event_time &lt;= #{to}</if>
GROUP BY date
</select>
<select id="analysisCustomerLuckyMoney" resultType="com.alibaba.fastjson.JSONObject">
SELECT COUNT(red_packet_customer_order_id) total_counts,sum(red_packet_amount) total_amount,
ifnull(SUM(if(status=0 AND lock_key is null,1,0)),0) unsend_counts,SUM(if(status=0 AND lock_key is null,red_packet_amount,0)) unsend_amount,
sum(if(status!=0,1,0)) send_counts,SUM(if(status !=0 ,red_packet_amount,0)) send_amount,
sum(if(status=2,1,0)) fail_counts,SUM(if(status=2,red_packet_amount,0)) fail_amount,
sum(if(status=1 or status=3,1,0)) receive_counts,SUM(if(status=1 or status=3,red_packet_amount,0)) receive_amount,
sum(if(status=4,1,0)) return_counts,SUM(if(status=4,red_packet_amount,0)) return_amount
FROM act_red_packets_customer_orders
<where>
act_id = #{act_id}
<if test="red_pack_type_id">and red_pack_type_id=#{red_pack_type_id}</if>
</where>
</select>
</mapper>

@ -286,7 +286,7 @@
</select>
<select id="listClientByCleanDays" resultType="java.lang.String">
SELECT c.client_id FROM sys_clients c
inner join sys_client_config cc
inner join sys_client_config cc on c.client_id = cc.client_id
WHERE c.is_valid = 1 and cc.clean_days = #{clean_days}
</select>

@ -914,16 +914,21 @@ margin-bottom: 10%;"/>
</li>
<li class="has-submenu" ng-class="{'open' : products.active}" ui-sref-active="active">
<a ng-click="products.active = !products.active"><i class="fa fa-balance-scale"></i>Products & Sale</a>
<a ng-click="products.active = !products.active"><i class="fa fa-balance-scale"></i>Extended products</a>
<ul class="submenu" ng-class="{'open' : products.active}">
<li>
<a ui-sref="goods">
<!--<i class="fa fa-shopping-bag"></i> -->Products
<!--<i class="fa fa-shopping-bag"></i> -->Products & Sale
</a>
</li>
<li>
<!-- <li>
<a ui-sref="sale">
<!--<i class="fa fa-shopping-cart"></i>-->Sale
&lt;!&ndash;<i class="fa fa-shopping-cart"></i>&ndash;&gt;Sale
</a>
</li>-->
<li ng-if="currentUser.client.client_moniker=='PINE' || currentUser.client.client_moniker=='OCCO'">
<a ui-sref="bill_qrcode">
Bill QR Code
</a>
</li>
</ul>

@ -148,6 +148,7 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
// $scope.analysis = resp.data.analysis;
});
};
$scope.chooseToday();
$scope.orderDetail = function (order) {
orderService.managerOrderDetail(order)

@ -61,7 +61,7 @@
</a>
</div>
<div class="list-group list-group-hover-bold list-group-active-bold">
<a ng-repeat="bd in bdUsers" class="list-group-item" ui-sref=".bduser({customerId:bd.manager_id})"
<a ng-repeat="bd in bdUsers" class="list-group-item" ui-sref=".bduser({userId:bd.manager_id})"
ui-sref-active="active"
ng-style="{'background-image':bd.percentage==0?'':'linear-gradient(90deg,#dff0d8 '+bd.percentage+'%,#fff 0%)'}">
{{bd.display_name}}[{{bd.percentage}}%]

@ -90,8 +90,8 @@
<div class="box">
<div class="box-header">
<h3 class="box-title">Customer List</h3>
<small>Total Amount:{{customers_analysis.total_amount}},Total
Points:{{customers_analysis.total_points}}
<small>Total Amount:{{customers_analysis.total_amount}}<!--,Total
Points:{{customers_analysis.total_points}}-->
</small>
</div>
@ -101,7 +101,7 @@
<tr>
<th>Customer openId</th>
<th>Amount(AUD)</th>
<th>Points</th>
<!-- <th>Points</th>-->
<th>Orders</th>
<th>Max Order(AUD)</th>
</tr>
@ -112,7 +112,7 @@
ng-click="order_params.customer_id=customer.customer_id;listCustomerOrders()">
<td ng-bind="customer.customer_id"></td>
<td ng-bind="customer.amount"></td>
<td ng-bind="customer.points"></td>
<!-- <td ng-bind="customer.points"></td>-->
<td ng-bind="customer.orders"></td>
<td ng-bind="customer.max_order"></td>
</tr>

@ -59,7 +59,6 @@ var modules = [
{path: 'static/boot/indexMainApp', module: 'indexMainApp', roles: [1, 2, 3]},
{path: 'static/commons/commons', module: 'commons', roles: [1, 2, 3]},
{path: 'static/payment/good/good-manage', module: 'goodManagement', roles: [1, 2, 3]},
{path: 'static/payment/good/good-sale', module: 'goodSale', roles: [1, 2, 3]},
{path: 'static/payment/partner/partner', module: 'partnerInfoApp', roles: [1, 2, 3]},
{path: 'static/payment/tradelog/tradelog', module: 'tradeLogApp', roles: [1, 2, 3]},
{path: 'static/payment/tradelog/transflow', module: 'balanceReport', roles: [1, 2, 3]},
@ -75,7 +74,8 @@ var modules = [
{path: 'static/application/clientAuthentication', module: 'clientAuthentication', roles: [1]},
{path: 'static/cashback/partner-cashback', module: 'cashbackApp', roles: [1,2,3]},
{path: 'static/integralmall/coupon_cancellation', module: 'couponCancellation', roles: [1,2]},
{path: 'static/invoice/invoice_assistant', module: 'partnerInvoice', roles: [1]}
{path: 'static/invoice/invoice_assistant', module: 'partnerInvoice', roles: [1]},
{path: 'static/payment/billqrcode/bill-qrcode-manage', module: 'billQrCodeManagement', roles: [1,2,3]}
];
require(['angular', 'jquery'], function (angular, $) {

@ -540,7 +540,9 @@ define(['angular', 'angularSanitize', 'angularAnimate', 'angularMessages', 'uiRo
case '10':
return 'APP';
case '11':
return 'Share Code'
return 'Share Code';
case '12':
return 'MICROAPP'
}
}
});

@ -325,7 +325,9 @@ define(['angular', 'angularSanitize', 'angularAnimate', 'angularMessages', 'uiRo
case '10':
return 'APP网关';
case '11':
return '账单码'
return '账单码';
case '12':
return '小程序'
}
}
});

@ -37,11 +37,184 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
}]);
app.controller('actCustomerRedpackOrdersCtrl',['$scope','$http',function ($scope, $http) {
app.controller('actCustomerRedpackOrdersCtrl',['$scope','$http','$filter',function ($scope, $http,$filter) {
$scope.analysis = {};
$scope.today = new Date();
$scope.chooseToday = function () {
$scope.analysis.begin = $scope.analysis.end = new Date();
$scope.doAnalysis();
};
$scope.chooseYesterday = function () {
var yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
$scope.analysis.begin = $scope.analysis.end = yesterday;
$scope.doAnalysis();
};
$scope.chooseLast7Days = function () {
$scope.analysis.end = new Date();
var day = new Date();
day.setDate(day.getDate() - 7);
$scope.analysis.begin = day;
$scope.doAnalysis();
};
$scope.thisMonth = function () {
$scope.analysis.end = new Date();
var monthBegin = new Date();
monthBegin.setDate(1);
$scope.analysis.begin = monthBegin;
$scope.doAnalysis();
};
$scope.doAnalysis = function () {
var params = angular.copy($scope.analysis);
if (params.begin) {
params.from = $filter('date')(params.begin, 'yyyyMMdd');
} else {
params.from = $filter('date')(new Date(), 'yyyyMMdd');
}
if (params.end) {
params.to = $filter('date')(params.end, 'yyyyMMdd');
} else {
params.to = $filter('date')(new Date(), 'yyyyMMdd');
}
$http.get('/sys/redpack/customer/'+$scope.act.act_id+'/sendLogs/analysis', {params: params}).then(function (resp) {
$scope.redPackCounts = angular.copy(resp.data);
var dates = [];
var send_counts = [];
var fail_counts = [];
var receive_counts = [];
var refund_counts = [];
var amounts = [];
var real_amounts = [];
resp.data.forEach(function (e) {
dates.push(e.date);
send_counts.push(e.send_counts);
fail_counts.push(e.fail_counts);
receive_counts.push(e.receive_counts);
refund_counts.push(e.refund_counts);
amounts.push(e.amount);
real_amounts.push(e.real_amount);
});
var customerRedPackSendLogsHistory = function (dates, send_counts, fail_counts, receive_counts, refund_counts, amounts, real_amounts) {
return {
color: colors,
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
legend: {
data: ['已领取', '发送未领取', '发送失败', '退回', '发送红包金额', '实际红包金额']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
data: dates
}
],
yAxis: [
{
type: 'value',
name: 'RedPackets'
}, {
type: 'value',
name: 'Amount(¥)'
}
],
series: [{
name: '已领取',
type: 'bar',
stack: 'repackets',
data: receive_counts
},
{
name: '发送未领取',
type: 'bar',
stack: 'repackets',
data: send_counts
},
{
name: '发送失败',
type: 'bar',
stack: 'repackets',
data: fail_counts
},
{
name: '退回',
type: 'bar',
stack: 'repackets',
data: refund_counts
},
{
name: '发送红包金额',
type: 'line',
yAxisIndex: 1,
data: amounts
},
{
name: '实际红包金额',
type: 'line',
yAxisIndex: 1,
data: real_amounts
}
]
};
};
$scope.customerRedPackSendLogsHistory = customerRedPackSendLogsHistory(dates, send_counts, fail_counts, receive_counts, refund_counts, amounts, real_amounts);
})
};
$scope.chooseLast7Days();
/* 《==========================================OrderList========================================================>*/
$scope.params = {};
$scope.redpack_order_pagination = {};
$scope.chooseTodayForLogs = function () {
$scope.params.begin = $scope.params.end = new Date();
$scope.listOrders(1);
};
$scope.chooseYesterdayForLogs = function () {
var yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
$scope.params.begin = $scope.params.end = yesterday;
$scope.listOrders(1);
};
$scope.chooseLast7DaysForLogs = function () {
$scope.params.end = new Date();
var day = new Date();
day.setDate(day.getDate() - 7);
$scope.params.begin = day;
$scope.listOrders(1);
};
$scope.thisMonthForLogs = function () {
$scope.params.end = new Date();
var monthBegin = new Date();
monthBegin.setDate(1);
$scope.params.begin = monthBegin;
$scope.listOrders(1);
};
$scope.customerLuckyMoneyAnalysis = function (params) {
$http.get('/sys/redpack/customer/act/' + $scope.act.act_id + '/analysis', {params: params}).then(function (resp) {
$scope.luckyMoneyAnalysis = resp.data;
});
};
$scope.customerLuckyMoneyAnalysis({});
$scope.listOrders = function (page) {
var params = angular.copy($scope.redpack_order_pagination);
params.page = page || params.page || 1;
var params = angular.copy($scope.params);
if (params.begin) {
params.from = $filter('date')(params.begin, 'yyyyMMdd');
}
if (params.end) {
params.to = $filter('date')(params.end, 'yyyyMMdd');
}
params.page = page || $scope.redpack_order_pagination.page || 1;
$http.get('/sys/redpack/customer/act/'+$scope.act.act_id, {params: params}).then(function (resp) {
$scope.redpack_order_pagination = resp.data.pagination;
$scope.orders = resp.data.data;
@ -94,6 +267,17 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
};
$scope.listClients();
$scope.addAttendClient = function () {
$uibModal.open({
templateUrl: '/static/config/redpackets/templates/add_act_client.html',
controller: 'addClientInfoCtrl',
resolve: {
act: $scope.act
}
}).result.then(function () {
$scope.listClients();
})
};
$scope.editClientInfo = function (client) {
var client = angular.copy(client);
$uibModal.open({
@ -129,6 +313,18 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
$scope.$close();
}
}]);
app.controller('addClientInfoCtrl',['$scope', '$http','act','commonDialog', function ($scope, $http,act,commonDialog) {
$scope.client = {act_name:act.act_name};
$scope.doAddClientInfo = function(){
var params= {'send_name':$scope.client.send_name,'act_name':$scope.client.act_name,'wishing':$scope.client.wishing};
$http.post('/sys/lucky_money/customer/acts/'+act.act_id+'/partners/'+$scope.client.client_moniker,params).then(function () {
commonDialog.alert({title: 'Success', content: '新增成功!', type: 'success'});
$scope.$close();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
});
}
}]);
app.filter('send_status', function () {
return function (stateValue) {

@ -49,13 +49,20 @@
<p class="small text-info">红包限制:订单满足的最小金额</p>
</div>
</div>
<div class="form-group">
<div class="form-group" ng-if="act.rule_max_num_limit">
<label class="control-label col-sm-2">RedPacket Counts</label>
<div class="col-sm-10">
<p class="form-control-static" ng-bind="act.rule_max_num"></p>
<p class="small text-info">红包限制:每个客户每天最多所能获取的红包数量</p>
</div>
</div>
<div class="form-group" ng-if="!act.rule_max_num_limit">
<label class="control-label col-sm-2">RedPacket Counts</label>
<div class="col-sm-10">
<p class="form-control-static" ng-bind="act.rule_max_num"></p>
<p class="small text-info">红包限制:每个客户活动期间最多所能获取的红包数量</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Activity Status</label>
<div class="col-sm-10">

@ -53,8 +53,20 @@
</div>
</div>
</div>
<div class="form-group"
<div class="form-group">
<label class="control-label col-sm-2" for="rule_max_num-input">* RedPacket Counts Limit</label>
<div class="col-sm-8">
<label class="radio-inline">
<input type="radio" value="1" checked ng-model="act.rule_max_num_limit">
Day
</label>
<label class="radio-inline">
<input type="radio" value="0" ng-model="act.rule_max_num_limit">
Whole Activity
</label>
</div>
</div>
<div class="form-group" ng-if="act.rule_max_num_limit == 1"
ng-class="{'has-error':ActivityForm.rule_max_num.$invalid && ActivityForm.rule_max_num.$dirty}">
<label class="control-label col-sm-2" for="rule_max_num-input">* RedPacket
Counts</label>
@ -79,6 +91,31 @@
</div>
</div>
<div class="form-group" ng-if="act.rule_max_num_limit == 0"
ng-class="{'has-error':ActivityForm.rule_max_num.$invalid && ActivityForm.rule_max_num.$dirty}">
<label class="control-label col-sm-2" for="rule_max_num_day-input">* RedPacket
Counts</label>
<div class="col-sm-8">
<input type="number" name="rule_max_num" class="form-control"
ng-model="act.rule_max_num"
min="1" max="100" step="1"
id="rule_max_num_day-input" required>
<p class="small text-info">红包限制:每个客户活动内最多所能获取的红包数量</p>
<div ng-messages="act.rule_partner_max_num.$error"
ng-if="act.rule_max_num.$dirty">
<div class="small text-danger" ng-message="max">
<i class="glyphicon glyphicon-alert"></i> No more than 100
</div>
<div class="small text-danger" ng-message="min">
<i class="glyphicon glyphicon-alert"></i> No less than 1
</div>
<div class="small text-danger" ng-message="required">
<i class="glyphicon glyphicon-alert"></i> Required Field
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Activity Status</label>
<div class="col-sm-8 checkbox-inline">

@ -1,23 +1,35 @@
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Client</th>
<th>Send Name</th>
<th>Act Name</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="client in clients">
<td>{{client.short_name}}({{client.client_moniker}})</td>
<td ng-bind="client.send_name"></td>
<td ng-bind="client.act_name"></td>
<td>
<a role="button" ng-click="editClientInfo(client)"><i class="fa fa-cog"></i></a>
<a role="button" ng-click="deleteClient(client)" class="text-danger"><i class="fa fa-trash"></i></a>
</td>
</tr>
</tbody>
</table>
<div class="box box-warning">
<div class="box-header">
<div class="form-inline">
<div class="form-group">
<button class="btn btn-success" type="button" ng-click="addAttendClient()"><i class="fa fa-plus"></i> New Attend Partner</button>
</div>
</div>
</div>
</div>
<div class="box box-warning">
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Client</th>
<th>Send Name</th>
<th>Act Name</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="client in clients">
<td>{{client.short_name}}({{client.client_moniker}})</td>
<td ng-bind="client.send_name"></td>
<td ng-bind="client.act_name"></td>
<td>
<a role="button" ng-click="editClientInfo(client)"><i class="fa fa-cog"></i></a>
<a role="button" ng-click="deleteClient(client)" class="text-danger"><i class="fa fa-trash"></i></a>
</td>
</tr>
</tbody>
</table>
</div>
</div>

@ -1,37 +1,206 @@
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Client Moniker</th>
<th>status</th>
<th>Order Amount</th>
<th>Create Time</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="order in orders">
<td>{{order.client_moniker}}</td>
<td>{{order.status|send_status}}</td>
<td>{{order.order_amount}}</td>
<td>{{order.create_time}}</td>
</tr>
</tbody>
</table>
<div class="box box-warning">
<div class="box-header">
<div class="row">
<div class="col-sm-12">
<div class="form-horizontal">
<div class="form-group col-xs-12 col-sm-12">
<label class="control-label col-xs-4 col-sm-2">Date Range</label>
<div class="col-sm-10">
<div class="form-control-static form-inline">
<div style="display: inline-block">
<input class="form-control" id="date-from-input"
ng-model="analysis.begin"
uib-datepicker-popup size="10" placeholder="From"
is-open="analysis_dateBegin.open" ng-click="analysis_dateBegin.open=true"
datepicker-options="{maxDate:analysis.end||today}">
</div>
~
<div style="display: inline-block">
<input class="form-control" id="date-to-input" ng-model="analysis.end"
uib-datepicker-popup size="10" placeholder="To"
is-open="analysis_dateTo.open" ng-click="analysis_dateTo.open=true"
datepicker-options="{minDate:analysis.begin,maxDate:today}">
</div>
<div class="box-footer" ng-if="orders.length">
<uib-pagination class="pagination"
total-items="redpack_order_pagination.totalCount"
boundary-links="true"
ng-model="redpack_order_pagination.page"
items-per-page="redpack_order_pagination.limit"
max-size="10"
ng-change="listOrders()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
<!--<div class="btn-group">-->
<!--<a role="button" class="btn btn-default btn-sm"-->
<!--ng-click="chooseToday()">Today</a>-->
<!--</div>-->
<!--<div class="btn-group">-->
<!--<a role="button" class="btn btn-default btn-sm"-->
<!--ng-click="chooseYesterday()">Yesterday</a>-->
<!--</div>-->
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseLast7Days()">Last 7 Days</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="thisMonth()">This Month</a>
</div>
<!--<div class="btn-group">-->
<!--<a role="button" class="btn btn-default btn-sm"-->
<!--ng-click="lastMonth()">Last Month</a>-->
<!--</div>-->
<!--<div class="btn-group">-->
<!--<a role="button" class="btn btn-default btn-sm"-->
<!--ng-click="thisYear()">This Year</a>-->
<!--</div>-->
<!--<div class="btn-group" uib-dropdown ng-if="currentUser.client.has_children">-->
<!--<button id="single-button" type="button" class="btn btn-primary"-->
<!--uib-dropdown-toggle ng-disabled="disabled">-->
<!--{{chooseShow}} <span class="caret"></span>-->
<!--</button>-->
<!--<ul class="dropdown-menu" uib-dropdown-menu aria-labelledby="single-button" style="min-width: 80px">-->
<!--<li><a ng-click="chooseClient('All')">All</a></li>-->
<!--<li ng-repeat="client in clients"><a ng-click="chooseClient(client)">{{client.short_name}}</a></li>-->
<!--</ul>-->
<!--</div>-->
<button class="btn btn-success" type="button"
ng-click="doAnalysis()">
<i class="fa fa-search"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-body">
<div class="chart col-md-12" echarts="customerRedPackSendLogsHistory" style="height: 300px"
ng-class="{nodata:customerRedPackSendLogsHistory.nodata}"></div>
</div>
</div>
<div class="box box-warning">
<div class="box-header">
<div class="row">
<div class="col-xs-12">Total Records:{{redpack_order_pagination.totalCount}};Total Pages:{{redpack_order_pagination.totalPages}}</div>
<div class="col-sm-12">
<div class="form-horizontal">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-4" for="partner-search">Partner Name</label>
<div class="col-xs-12 col-sm-6">
<input type="text" class="form-control" id="partner-search"
ng-enter="listOrders(1)"
ng-model="params.short_name">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-4" for="code-search">Partner Code</label>
<div class="col-xs-12 col-sm-6">
<input type="text" class="form-control" id="code-search"
ng-enter="listOrders(1)"
ng-model="params.client_moniker">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2 col-sm-4" for="sub-merchant-search">
<span ng-bind='act.channel'></span>
Nickname</label>
<div class="col-xs-12 col-sm-6">
<input type="text" class="form-control" id="sub-merchant-search"
ng-enter="listOrders(1)"
ng-model="params.nickname">
</div>
</div>
<div class="form-group col-xs-12 col-sm-12">
<label class="control-label col-xs-4 col-sm-2">Date Range</label>
<div class="col-sm-10">
<div class="form-control-static form-inline">
<div style="display: inline-block">
<input class="form-control" id="date-from-input-logs"
ng-model="params.begin"
uib-datepicker-popup size="10" placeholder="From"
is-open="dateBegin.open" ng-click="dateBegin.open=true"
datepicker-options="{maxDate:params.end||today}">
</div>
~
<div style="display: inline-block">
<input class="form-control" id="date-to-input-logs"
ng-model="params.end"
uib-datepicker-popup size="10" placeholder="To"
is-open="dateTo.open" ng-click="dateTo.open=true"
datepicker-options="{minDate:params.begin,maxDate:today}">
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseTodayForLogs()">Today</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseYesterdayForLogs()">Yesterday</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseLast7DaysForLogs()">Last 7 Days</a>
</div>
<button class="btn btn-success" type="button"
ng-click="listOrders(1)">
<i class="fa fa-search"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
Orders<span style="font-size: smaller;color: grey">(总共红包{{luckyMoneyAnalysis.total_counts}}|{{luckyMoneyAnalysis.total_amount}}¥;
已发红包{{luckyMoneyAnalysis.send_counts}}|{{luckyMoneyAnalysis.send_amount}}¥;客户所得红包{{luckyMoneyAnalysis.receive_counts}}|{{luckyMoneyAnalysis.receive_amount}}¥
待发送红包{{luckyMoneyAnalysis.unsend_counts}}|{{luckyMoneyAnalysis.unsend_amount}}¥)</span></div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Client Moniker</th>
<th>Lucky Money</th>
<th>Order Amount</th>
<th>Nick Name</th>
<th>status</th>
<th>Event Time</th>
<th>Create Time</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="order in orders">
<td>{{order.client_moniker}}</td>
<td>{{order.red_packet_amount}}</td>
<td>{{order.order_amount}}</td>
<td><span><img style="height: 30px;width: 30px" class="img-circle"
ng-src="{{order.headimg}}"> {{order.nickname}}</span></td>
<td>{{order.status|send_status}}</td>
<td>{{order.event_time}}</td>
<td>{{order.create_time}}</td>
</tr>
</tbody>
</table>
<div class="box-footer" ng-if="orders.length">
<uib-pagination class="pagination"
total-items="redpack_order_pagination.totalCount"
boundary-links="true"
ng-model="redpack_order_pagination.page"
items-per-page="redpack_order_pagination.limit"
max-size="10"
ng-change="listOrders()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
<div class="row">
<div class="col-xs-12">Total Records:{{redpack_order_pagination.totalCount}};Total Pages:{{redpack_order_pagination.totalPages}}</div>
</div>
</div>
</div>
</div>
</div>

@ -0,0 +1,51 @@
<div class="modal-header">
<h4>Edit Client{{client.act_id}}</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-12">
<form name="clientForm" novalidate>
<label class="control-label col-sm-6" for="act-name-input">Partner Code</label>
<div class="col-sm-6">
<input class="form-control" ng-model="client.client_moniker"
type="text"
name="act_name"
id="client_moniker-input">
</div>
<div class="form-group"
ng-class="{'has-error':clientForm.client_moniker.$invalid && clientForm.client_moniker.$dirty}">
<label class="control-label col-sm-6" for="send-name-input">Send Name</label>
<div class="col-sm-6">
<input class="form-control" ng-model="client.send_name"
type="text"
name="send_name"
id="send-name-input">
</div>
<label class="control-label col-sm-6" for="act-name-input">Act Name</label>
<div class="col-sm-6">
<input class="form-control" ng-model="client.act_name"
type="text"
name="act_name"
id="act-name-input">
</div>
<label class="control-label col-sm-6" for="wishing-input">Wishing</label>
<div class="col-sm-6">
<input class="form-control" ng-model="client.wishing"
type="text"
name="wishing"
id="wishing-input">
</div>
</div>
</form>
</div>
<div class="col-sm-12">
<div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" ng-click="$dismiss()">Cancel</button>
<button type="button" class="btn btn-success" ng-click="doAddClientInfo()">save</button>
</div>

@ -100,7 +100,7 @@ define(['angular', 'uiRouter', 'uiBootstrap', 'angularEcharts'], function (angul
loadTradeAmountInTypes();
loadTradePartnersInTypes();
loadTopPartners();
loadTradeTimeAnalysis();
/*loadTradeTimeAnalysis();*/
loadTradeLimite();
};
@ -281,7 +281,7 @@ define(['angular', 'uiRouter', 'uiBootstrap', 'angularEcharts'], function (angul
$scope.analysis.top_partners = chartParser.parse(topPartnerConfig, resp.data.reverse());
})
}
function loadTradeTimeAnalysis() {
/*function loadTradeTimeAnalysis() {
var timeAnalysis = function (legend, series) {
return {
// title : {
@ -413,7 +413,7 @@ define(['angular', 'uiRouter', 'uiBootstrap', 'angularEcharts'], function (angul
});
$scope.analysis.trade_time = timeAnalysis(leg, series);
})
}
}*/
function loadFeeAnalysis(params) {
var analysisConfig = {

@ -232,7 +232,7 @@
</div>
</div>
</div>
<div class="row">
<!-- <div class="row">
<div class="col-sm-12">
<div class="box box-warning">
<div class="box-header with-border">交易时间分布</div>
@ -242,7 +242,7 @@
</div>
</div>
</div>
</div>
</div>-->
<div class="row">
<div class="col-sm-12">
<div class="box box-warning">

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

@ -0,0 +1,107 @@
define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], function (angular) {
'use strict';
var app = angular.module('billQrCodeManagement', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ngFileUpload']);
app.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('bill_qrcode', {
url: '/bill_qrcode',
templateUrl: '/static/payment/billqrcode/templates/bill_qrcode.html',
controller: 'billQrCodeCtrl'
})
}]);
app.controller('billQrCodeCtrl', ['$scope', '$http', 'commonDialog','$filter','orderService', function ($scope, $http, commonDialog,$filter,orderService) {
$scope.pagination = {};
$scope.params = {};
$scope.new_bill = {};
$scope.minDate = new Date();
var maxDate = new Date();
$scope.maxDate = maxDate.setDate(maxDate.getDate() + 14);
$scope.loadBills = function (page) {
var params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1;
$http.get('/partner/qrcode', {params: params}).then(function (resp) {
$scope.bills = resp.data;
$scope.pagination = resp.data.pagination;
});
};
$scope.loadBills(1);
$scope.generateBill = function () {
var params = angular.copy($scope.new_bill);
if(!params.client_order_id){
alert("client order id为空是否后台自动生成");
}
if(!params.order_amount){
alert("order amount不可为空");
return;
}
if(params.cancle_time){
params.cancle_time = $filter('date')(params.cancle_time, 'yyyy-MM-dd HH:mm:ss')
}else {
alert("Expire Date 不可为空!");
}
$http.post('/partner/qrcode/bills',params).then(function (resp) {
commonDialog.alert({title: 'Success', content: 'Success', type: 'success'});
$scope.code_url = resp.data;
$scope.loadBills(1);
},function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
});
};
$scope.disableBill = function (bill) {
commonDialog.confirm(
{
title: 'Delete Bill',
content: 'Are you sure to delete this bill?'
}).then(function () {
$http.delete('/partner/qrcode/'+bill.bill_code_id).then(function(){
$scope.loadBills(1);
});
})
};
$scope.clearBill = function () {
$scope.new_bill = {};
$scope.code_url = "";
};
$scope.showTradeDetail = function (order) {
orderService.clientOrderDetail(order)
};
}]);
app.filter('billStatus', function () {
return function (status) {
switch (status + '') {
case '1':
return 'wait for payment';
case '2':
return 'disabled';
case '3':
return 'payment success'
}
}
});
app.filter('remarkCut', function () {
return function (value, wordwise, max, tail) {
if (!value) return '';
max = parseInt(max, 10);
if (!max) return value;
if (value.length <= max) return value;
value = value.substr(0, max);
if (wordwise) {
var lastspace = value.lastIndexOf(' ');
if (lastspace != -1) {
value = value.substr(0, lastspace);
}
}
return value + (tail || ' …');
};
});
return app;
});

@ -0,0 +1,180 @@
<style>
.delete {
text-decoration-line: line-through;
}
</style>
<div ui-view>
<section class="content-header">
<h1>Bill QR Code</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-sitemap"></i> Bill QR Code
</li>
<li class="active">Bill QR Code Management</li>
</ol>
</section>
<div class="content">
<div class="row">
<div class="col-sm-12">
<div class="box-solid">
<div class="box box-warning">
<div class="box-header">
<div class="form-horizontal col-sm-8">
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3">* Order Amount</label>
<div class="col-xs-8 col-sm-6">
<div class="input-group">
<input type="number" step="0.01" name="order_amount" class="form-control form-control-float"
ng-model="new_bill.order_amount" required
onkeyup="this.value=this.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
aria-describedby="basic-addon2">
<span class="input-group-addon" id="basic-addon2">$</span>
</div>
<p class="small text-info"></p>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3">* Expire Date</label>
<div class="col-xs-8 col-sm-6">
<input class="form-control" ng-model="new_bill.cancle_time"
uib-datepicker-popup size="10" is-open="ctrl.dateInput"
ng-click="ctrl.dateInput=true"
datepicker-options="{minDate:minDate,maxDate:maxDate}" name="cancle_time" required>
<p class="small text-info">The date of expiry should not exceed fifteen days</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3">Reference NO</label>
<div class="col-xs-8 col-sm-6">
<input class="form-control" ng-model="new_bill.client_order_id">
<p class="small text-info"> System will automatically generate when the Reference NO is empty</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3">Remark</label>
<div class="col-xs-8 col-sm-6">
<textarea maxlength="100" class="form-control" ng-model="new_bill.remark"></textarea>
<p class="small text-info">within 100 characters</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4 col-sm-3"></label>
<div class="col-sm-6">
<button class="btn btn-success" ng-click="generateBill()">generate
</button>&nbsp;&nbsp;&nbsp;
<button class="btn btn-primary" ng-click="clearBill()">clear</button>
</div>
</div>
</div>
<div class="col-sm-4" style="text-align: center" ng-if="code_url">
<a class="thumbnail" download ng-href="{{code_url}}" uib-tooltip="Download">
<img ng-src="{{code_url}}">
</a>
<p>
<a ng-href="{{code_url}}" download><i class="fa fa-download"></i> Download Bill QR
Code Image</a>
</p>
</div>
</div>
</div>
<div class="box box-warning">
<div class="box-header">
<div class="form-inline">
<div class="form-group">
<label class="control-label">Bill Status</label>
&nbsp;
<a role="button" ng-class="{'bg-primary':params.status==null}"
ng-click="params.status=null;loadBills(1)">All</a> |
<a role="button" ng-class="{'bg-primary':params.status==3}"
ng-click="params.status=3;loadBills(1)">Success</a> |
<a role="button" ng-class="{'bg-primary':params.status==2}"
ng-click="params.status=2;loadBills(1)">Disabled</a>
</div>
&nbsp; &nbsp; &nbsp; &nbsp;
<div class="form-group">
<label class="control-label" >Reference NO</label>
<input type="text" class="form-control"
ng-model="params.client_order_id"
ng-enter="loadBills(1)">
</div>
<div class="form-group">
<button class="btn btn-primary" type="button" ng-click="loadBills(1)"><i
class="fa fa-search"></i></button>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title">
Bill List
</h3>
</div>
<div class="box-body table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Order Amount</th>
<th>Reference NO</th>
<th>Payer</th>
<th>Order Status</th>
<th>Bill Status</th>
<th>Expire Date</th>
<th>Remark</th>
<th>Create time</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="bill in bills"
ng-class="{'delete':bill.status==2}">
<td ng-bind="bill.order_amount | currency:'AUD '"></td>
<th ng-bind="bill.client_order_id"></th>
<td ng-bind="bill.nickname"></td>
<th ng-bind="bill.order_status|tradeStatus"></th>
<th ng-bind="bill.status|billStatus"></th>
<td ng-bind="bill.cancle_time |limitTo:10"></td>
<td ng-bind="bill.remark|remarkCut:true:10:'...'"></td>
<td ng-bind="bill.create_time"></td>
<td>
<a ng-if="bill.order_id&&bill.status!=2" class="text-primary" role="button" title="Detail"
ng-click="showTradeDetail(bill)">
<i class="fa fa-search"></i>
</a>
<a ng-if="bill.code_url&&bill.status==1" ng-href="{{bill.code_url}}" download><i
class="fa fa-download"
uib-tooltip="Download Bill QR Code Image"></i></a>
<a ng-if="!bill.order_id&&bill.status==1"
class="text-bold text-danger" role="button" ng-click="disableBill(bill)">Disable</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer" ng-if="bills.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="loadBills(1)"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
<div class="row">
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total
Pages:{{pagination.totalPages}}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

@ -10,6 +10,11 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
templateUrl: '/static/payment/good/templates/goods.html',
controller: 'goodListCtrl',
data: {label: '商品列表'}
}).state('goods.sale', {
url: '/sale',
templateUrl: '/static/payment/good/templates/good_sale.html',
controller: 'goodOrderListCtrl',
data: {label: '商品列表'}
}).state('goods.new', {
url: '/new',
templateUrl: '/static/payment/good/templates/add_good.html',
@ -196,7 +201,57 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
$scope.ctrl = {};
}]);
app.controller('goodOrderListCtrl', ['$scope', '$http', function ($scope, $http) {
$scope.pagination = {};
$scope.params = {status:'1'};
$scope.today = new Date();
$scope.chooseToday = function () {
$scope.params.datefrom = $scope.params.dateto = new Date();
$scope.loadGoodOrders(1);
};
$scope.chooseYesterday = function () {
var yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
$scope.params.datefrom = $scope.params.dateto = yesterday;
$scope.loadGoodOrders(1);
};
$scope.chooseLast7Days = function () {
$scope.params.dateto = new Date();
var day = new Date();
day.setDate(day.getDate() - 7);
$scope.params.datefrom = day;
$scope.loadGoodOrders(1);
};
$scope.thisMonth = function () {
$scope.params.dateto = new Date();
var monthBegin = new Date();
monthBegin.setDate(1);
$scope.params.datefrom = monthBegin;
$scope.loadGoodOrders(1);
};
$scope.lastMonth = function () {
var monthFinish = new Date();
monthFinish.setDate(0);
$scope.params.dateto = monthFinish;
var monthBegin = new Date();
monthBegin.setDate(0);
monthBegin.setDate(1);
$scope.params.datefrom = monthBegin;
$scope.loadGoodOrders(1);
};
$scope.loadGoodOrders = function (page) {
var params = angular.copy($scope.params);
if (params.status=='ALL'){
delete params.status;
}
params.page = page || $scope.pagination.page || 1;
$http.get('/sys/client/goods/goodOrders', {params: params}).then(function (resp) {
$scope.sales = resp.data.data;
$scope.pagination = resp.data.pagination;
});
};
$scope.loadGoodOrders(1);
}]);
return app;
});

@ -1,6 +1,7 @@
/**
* Created by yishuqian on 8/29/16.
*/
/*
define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch'], function (angular) {
'use strict';
@ -67,4 +68,4 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
}]);
return app;
});
});*/

@ -1,158 +1,146 @@
<div ui-view>
<section class="content-header">
<h1>List of Products Sold</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-sitemap"></i> Products & Sale
</li>
<li class="active">Sale</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 col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Status</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.status=='ALL'}"
ng-click="params.status='ALL';loadGoodOrders(1)">All</a> |
<a role="button" ng-class="{'bg-primary':params.status=='PAID'}"
ng-click="params.status='1';loadGoodOrders(1)">Payment Success</a> |
<a role="button" ng-class="{'bg-primary':params.status=='UNPAID'}"
ng-click="params.status='0';loadGoodOrders(1)">Waiting for Payment</a>
</p>
<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 col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Status</label>
<div class="col-sm-10 col-xs-8">
<p class="form-control-static">
<a role="button" ng-class="{'bg-primary':params.status=='ALL'}"
ng-click="params.status='ALL';loadGoodOrders(1)">All</a> |
<a role="button" ng-class="{'bg-primary':params.status=='PAID'}"
ng-click="params.status='1';loadGoodOrders(1)">Payment Success</a> |
<a role="button" ng-class="{'bg-primary':params.status=='UNPAID'}"
ng-click="params.status='0';loadGoodOrders(1)">Waiting for Payment</a>
</p>
</div>
</div>
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Date Range</label>
<div class="col-sm-10 col-xs-8">
<div class="form-control-static form-inline">
<div style="display: inline-block">
<input class="form-control" id="date-from-input" ng-model="params.datefrom"
uib-datepicker-popup size="10" placeholder="From"
is-open="dateBegin.open" ng-click="dateBegin.open=true"
datepicker-options="{maxDate:params.dateto||today}">
</div>
</div>
<div class="form-group col-xs-12">
<label class="control-label col-xs-4 col-sm-2">Date Range</label>
<div class="col-sm-10 col-xs-8">
<div class="form-control-static form-inline">
<div style="display: inline-block">
<input class="form-control" id="date-from-input" ng-model="params.datefrom"
uib-datepicker-popup size="10" placeholder="From"
is-open="dateBegin.open" ng-click="dateBegin.open=true"
datepicker-options="{maxDate:params.dateto||today}">
</div>
~
<div style="display: inline-block">
<input class="form-control" id="date-to-input" ng-model="params.dateto"
uib-datepicker-popup size="10" placeholder="To"
is-open="dateTo.open" ng-click="dateTo.open=true"
datepicker-options="{minDate:params.datefrom,maxDate:today}">
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseToday()">Today</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseYesterday()">Yesterday</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseLast7Days()">Last 7
Days</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm" ng-click="thisMonth()">This
Month</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm" ng-click="lastMonth()">Last
Month</a>
</div>
</div>
~
<div style="display: inline-block">
<input class="form-control" id="date-to-input" ng-model="params.dateto"
uib-datepicker-popup size="10" placeholder="To"
is-open="dateTo.open" ng-click="dateTo.open=true"
datepicker-options="{minDate:params.datefrom,maxDate:today}">
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseToday()">Today</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseYesterday()">Yesterday</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="chooseLast7Days()">Last 7
Days</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm" ng-click="thisMonth()">This
Month</a>
</div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm" ng-click="lastMonth()">Last
Month</a>
</div>
</div>
<!--<div class="form-group">-->
<!--<label class="control-label" for="short-name-search">Partner Name</label>-->
<!--<input type="text" class="form-control" id="short-name-search"-->
<!--ng-model="params.short_name">-->
<!--</div>-->
<button class="btn btn-success" type="button" ng-click="loadGoodOrders(1)">
<i class="fa fa-search"></i> Search
</button>
</div>
</div>
<!--<div class="form-group">-->
<!--<label class="control-label" for="short-name-search">Partner Name</label>-->
<!--<input type="text" class="form-control" id="short-name-search"-->
<!--ng-model="params.short_name">-->
<!--</div>-->
<button class="btn btn-success" type="button" ng-click="loadGoodOrders(1)">
<i class="fa fa-search"></i> Search
</button>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title">List of Products Sold</h3>
</div>
<div class="box-body no-padding table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Sale ID</th>
<th>Payment Order ID</th>
<th>Product Name</th>
<th>Unit Price</th>
<th>Quantity</th>
<th>Order Total</th>
<th>Order Status</th>
<th>Create Time</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="goodOrder in sales">
<!--<td><span ng-bind="good.goodId"></span><i class="fa fa-sitemap" ng-if="good.parent_client_id" title="Sub Partner"></i></td>-->
<td ng-bind="goodOrder.id"></td>
<td ng-bind="goodOrder.order_id"></td>
<td ng-bind="goodOrder.title"></td>
<td ng-bind="goodOrder.price"></td>
<td ng-bind="goodOrder.count"></td>
<td ng-bind="goodOrder.order_total"></td>
<!--<td ng-bind="good.is_using"></td>-->
<td>
<span ng-if="goodOrder.order_status==1">PAID</span>
<span ng-if="goodOrder.order_status==0">NOT PAID</span>
<span ng-if="goodOrder.order_status==2">CLOSED</span>
</td>
<td ng-bind="goodOrder.create_time"></td>
<div class="box">
<div class="box-header">
<h3 class="box-title">List of Products Sold</h3>
</div>
</tr>
</tbody>
</table>
<div class="box-body no-padding table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Sale ID</th>
<th>Payment Order ID</th>
<th>Product Name</th>
<th>Unit Price</th>
<th>Quantity</th>
<th>Order Total</th>
<th>Order Status</th>
<th>Create Time</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="goodOrder in sales">
<!--<td><span ng-bind="good.goodId"></span><i class="fa fa-sitemap" ng-if="good.parent_client_id" title="Sub Partner"></i></td>-->
<td ng-bind="goodOrder.id"></td>
<td ng-bind="goodOrder.order_id"></td>
<td ng-bind="goodOrder.title"></td>
<td ng-bind="goodOrder.price"></td>
<td ng-bind="goodOrder.count"></td>
<td ng-bind="goodOrder.order_total"></td>
<!--<td ng-bind="good.is_using"></td>-->
<td>
<span ng-if="goodOrder.order_status==1">PAID</span>
<span ng-if="goodOrder.order_status==0">NOT PAID</span>
<span ng-if="goodOrder.order_status==2">CLOSED</span>
</td>
<td ng-bind="goodOrder.create_time"></td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer" ng-if="goods.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="loadGoodOrders()"
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 class="box-footer" ng-if="goods.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="loadGoodOrders()"
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>

@ -1,135 +1,150 @@
<div ui-view>
<section class="content-header">
<h1>Product Management</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-sitemap"></i> Products & Sale
</li>
<li class="active">Product Management</li>
</ol>
</section>
<div class="content">
<section class="content-header">
<h1>Product & Sale</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-sitemap"></i> Products & Sale
</li>
<li class="active">Product & Sale Management</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">-->
<!--<label class="control-label" for="good-code-search">Good Code</label>-->
<!--<input class="form-control" id="good-code-search" ng-model="params.code">-->
<!--</div>-->
<div class="form-group">
<label class="control-label" for="good-title-search">Product Name</label>
<input type="number" class="form-control" id="good-title-search"
ng-model="params.title">
</div>
<div class="form-group">
<label class="control-label" for="good-type-search">Product Type</label>
<input type="number" class="form-control" id="good-type-search"
ng-model="params.type">
</div>
<!--<div class="form-group">-->
<!--<label class="control-label" for="short-name-search">Partner Name</label>-->
<!--<input type="text" class="form-control" id="short-name-search"-->
<!--ng-model="params.short_name">-->
<!--</div>-->
<div class="form-group">
<button class="btn btn-primary" type="button" ng-click="loadGood(1)"><i
class="fa fa-search"></i></button>
</div>
<div class="form-group">
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li ui-sref-active-eq="active">
<a ui-sref="goods">Product</a>
</li>
<li ui-sref-active="active">
<a ui-sref="goods.sale">Sale</a>
</li>
</ul>
<div class="tab-content" ui-view>
<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">-->
<!--<label class="control-label" for="good-code-search">Good Code</label>-->
<!--<input class="form-control" id="good-code-search" ng-model="params.code">-->
<!--</div>-->
<div class="form-group">
<label class="control-label" for="good-title-search">Product Name</label>
<input type="number" class="form-control" id="good-title-search"
ng-model="params.title">
</div>
<div class="form-group">
<label class="control-label" for="good-type-search">Product Type</label>
<input type="number" class="form-control" id="good-type-search"
ng-model="params.type">
</div>
<!--<div class="form-group">-->
<!--<label class="control-label" for="short-name-search">Partner Name</label>-->
<!--<input type="text" class="form-control" id="short-name-search"-->
<!--ng-model="params.short_name">-->
<!--</div>-->
<div class="form-group">
<button class="btn btn-primary" type="button" ng-click="loadGood(1)"><i
class="fa fa-search"></i></button>
</div>
<div class="form-group">
<a role="button" class="btn btn-info pull-right" ui-sref=".new" title="Add Product">
<i class="fa fa-plus"></i>
Add Product
</a>
</div>
<a role="button" class="btn btn-info pull-right" ui-sref=".new" title="Add Product">
<i class="fa fa-plus"></i>
Add Product
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title">List of Products</h3>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title">List of Products</h3>
</div>
<div class="box-body no-padding table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Product Image</th>
<th>Product Name</th>
<th>Price (AUD)</th>
<th>Current Price (AUD)</th>
<th>Price (CNY)</th>
<th>Current Price(CNY)</th>
<th>Product Type</th>
<th>Stocks Available</th>
<th>Origin</th>
<th>Status</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="good in goods">
<div class="box-body no-padding table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Product Image</th>
<th>Product Name</th>
<th>Price (AUD)</th>
<th>Current Price (AUD)</th>
<th>Price (CNY)</th>
<th>Current Price(CNY)</th>
<th>Product Type</th>
<th>Stocks Available</th>
<th>Origin</th>
<th>Status</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="good in goods">
<!--<td><span ng-bind="good.goodId"></span><i class="fa fa-sitemap" ng-if="good.parent_client_id" title="Sub Partner"></i></td>-->
<td><img ng-if="good.thumbnailUrl" src="{{good.thumbnailUrl}}"></td>
<td ng-bind="good.title"></td>
<td ng-bind="good.price"></td>
<td ng-bind="good.actual_price"></td>
<td ng-bind="good.cny_price"></td>
<td ng-bind="good.actual_cny_price"></td>
<td ng-bind="good.type"></td>
<td ng-bind="good.inventory"></td>
<td ng-bind="good.origin"></td>
<!--<td ng-bind="good.is_using"></td>-->
<td>
<span ng-if="good.is_using==1">On Sale</span>
<span ng-if="good.is_using==0">Out Of Stock</span>
</td>
<td>
<a class="text-primary" role="button" title="Detail"
ui-sref=".detail({goodId:good.id})">
<i class="fa fa-search"></i> Detail
</a>|
<a class="text-primary" role="button" title="Delete"
ng-click="deleteGoods(good.id)">
<i class="fa fa-trash-o"></i> Delete
</a>
</td>
</tr>
</tbody>
</table>
<!--<td><span ng-bind="good.goodId"></span><i class="fa fa-sitemap" ng-if="good.parent_client_id" title="Sub Partner"></i></td>-->
<td><img ng-if="good.thumbnailUrl" src="{{good.thumbnailUrl}}"></td>
<td ng-bind="good.title"></td>
<td ng-bind="good.price"></td>
<td ng-bind="good.actual_price"></td>
<td ng-bind="good.cny_price"></td>
<td ng-bind="good.actual_cny_price"></td>
<td ng-bind="good.type"></td>
<td ng-bind="good.inventory"></td>
<td ng-bind="good.origin"></td>
<!--<td ng-bind="good.is_using"></td>-->
<td>
<span ng-if="good.is_using==1">On Sale</span>
<span ng-if="good.is_using==0">Out Of Stock</span>
</td>
<td>
<a class="text-primary" role="button" title="Detail"
ui-sref=".detail({goodId:good.id})">
<i class="fa fa-search"></i> Detail
</a>|
<a class="text-primary" role="button" title="Delete"
ng-click="deleteGoods(good.id)">
<i class="fa fa-trash-o"></i> Delete
</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer" ng-if="goods.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="loadGoods()"
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 class="box-footer" ng-if="goods.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="loadGoods()"
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>

@ -1,7 +1,7 @@
/**
* Created by yixian on 2017-02-05.
*/
define(['angular'], function (angular) {
define(['angular','decimal'], function (angular,decimal) {
'use strict';
var app = angular.module('invoiceApp', ['ui.router']);
app.config(['$stateProvider', function ($stateProvider) {
@ -67,6 +67,7 @@ define(['angular'], function (angular) {
$scope.tradeLogs = resp.data.data;
$scope.pagination = resp.data.pagination;
$scope.analysis = resp.data.analysis;
$scope.total_surcharge = decimal.add($scope.analysis.total_surcharge,$scope.analysis.tax_amount).toFixed(2);
$scope.analysis.refund_fee = angular.copy(Math.abs($scope.analysis.refund_fee));
}, function (resp) {
commonDialog.alert({title: 'Search failed', content: resp.data.message, type: 'error'});

@ -141,7 +141,7 @@
<div class="info-box-content box-content_left">
<span class="info-box-text">Total Surcharge</span>
<span class="info-box-number box-number_font"
ng-bind="analysis.total_fee|currency:'AUD '"></span>
ng-bind="total_surcharge|currency:'AUD '"></span>
</div>
</div>
</div>

@ -344,6 +344,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
return;
}
if ($scope.partner.company_name.indexOf("Migration") != -1) {
alert("Company Name包含敏感词汇请检查后重新提交");
return;
}
if ($scope.partner.company_phone_a && ('' + $scope.partner.company_phone_a != '')) {
if ($scope.partner.company_phone_a.indexOf('0') == 0) {
alert("Please remove the first character '0' of area code");
@ -920,6 +924,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
return;
}
if ($scope.partner.company_name.indexOf("Migration") != -1) {
alert("Company Name包含敏感词汇请检查后重新提交");
return;
}
if ($scope.partner.company_phone.indexOf(' ') != -1) {
alert('Company Phone can not contain space character');
return;
@ -1788,7 +1796,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
return;
}
$scope.errmsg = null;
if ($scope.partner.company_name.indexOf("Migration") != -1) {
alert("Company Name包含敏感词汇请检查后重新提交");
return;
}
if ($scope.partner.company_phone_a && ('' + $scope.partner.company_phone_a != '')) {
if ($scope.partner.company_phone_a.indexOf('0') == 0) {

@ -58,7 +58,9 @@
<a role="button" ng-class="{'bg-primary':gatewaySelected([10])}"
ng-click="params.gateway=[10];loadTradeLogs(1)">APP</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([11])}"
ng-click="params.gateway=[11];loadTradeLogs(1)">Share Code</a>
ng-click="params.gateway=[11];loadTradeLogs(1)">Share Code</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([12])}"
ng-click="params.gateway=[12];loadTradeLogs(1)">MiniProgram</a>
</p>
</div>
</div>

@ -118,9 +118,11 @@
<a role="button" ng-class="{'bg-primary':gatewaySelected([9])}"
ng-click="params.gateway=[9];loadTradeLogs(1)">Third Party Gateway</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([10])}"
ng-click="params.gateway=[10];loadTradeLogs(1)">APP</a>
ng-click="params.gateway=[10];loadTradeLogs(1)">APP</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([11])}"
ng-click="params.gateway=[11];loadTradeLogs(1)">Share Code</a>
ng-click="params.gateway=[11];loadTradeLogs(1)">Share Code</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([12])}"
ng-click="params.gateway=[12];loadTradeLogs(1)">MiniProgram</a>
</p>
</div>
</div>

@ -156,9 +156,11 @@
<a role="button" ng-class="{'bg-primary':gatewaySelected([9])}"
ng-click="params.gateway=[9];loadTradeLogs(1)">Third Party Gateway</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([10])}"
ng-click="params.gateway=[10];loadTradeLogs(1)">APP</a>
ng-click="params.gateway=[10];loadTradeLogs(1)">APP</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([11])}"
ng-click="params.gateway=[11];loadTradeLogs(1)">Share Code</a>
ng-click="params.gateway=[11];loadTradeLogs(1)">Share Code</a> |
<a role="button" ng-class="{'bg-primary':gatewaySelected([12])}"
ng-click="params.gateway=[12];loadTradeLogs(1)">MiniProgram</a>
</p>
</div>
</div>

@ -7,7 +7,37 @@
</ol>
</section>
<section class="content">
<div class="box box-default">
<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="loadRecords(1)"
ng-model="params.client_moniker">
</div>
&nbsp;&nbsp;
<div class="form-group">
<label class="control-label" for="status-search">Status</label>
<select ng-model="params.status" id="status-search"
ng-change="loadRecords(1)"
class="form-control" style="min-width: 200px;">
<option value="">All</option>
<option value="0">未处理</option>
<option value="1">已处理</option>
<option value="2">处理中</option>
</select>
<!--<input type="text" class="form-control" id="status-search"
ng-model="params.status">-->
</div>
<div class="form-group">
<button class="btn btn-primary" type="button" ng-click="loadRecords(1)"><i
class="fa fa-search"></i></button>
</div>
</div>
</div>
</div>
<div class="box box-warning">
<div class="box-header">Records</div>
<div class="box-body table-responsive">
<table class="table table-hover">

@ -0,0 +1,79 @@
/**
* Created by yixian on 2016-07-15.
*/
$(document).ready(function () {
'use strict';
decode();
function decode() {
var redirect = window.redirect;
while(redirect.indexOf('://')<0){
redirect = decodeURIComponent(redirect);
if(redirect==window.redirect){
break;
}
window.redirect = redirect;
}
}
var dataCache = {paying: false};
$('#key_P').bind('touchstart', startPay);
function startPay() {
$('#wdiv').show();
if (dataCache.paying) {
return;
}
dataCache.paying = true;
$.ajax({
url: '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/'+window.order_id+'/order_params',
method: 'GET',
dataType: 'json',
success: function (pay) {
if (pay.direct_paid) {
location.href = window.redirect;
return;
}
if (window.AlipayJSBridge) {
callPayment();
} else {
// 如果没有注入则监听注入的事件
document.addEventListener('AlipayJSBridgeReady', callPayment, false);
}
function callPayment() {
try {
AlipayJSBridge.call('tradePay', {
tradeNO: pay.trade_no
}, function (res) {
dataCache.paying = false;
if (res.resultCode == '9000') {
AlipayJSBridge.call('startApp', {
appId: '20000056',
param: {
actionType: 'showSuccPage',
payResult: res.result
},
closeCurrentApp: false
});
location.href = window.redirect;
} else {
alert(res.memo);
}
$('#wdiv').hide();
})
} catch (err) {
alert(err);
$('#wdiv').hide();
}
}
},
error: function (jqXhr) {
alert(jqXhr.responseJSON.message);
$('#wdiv').hide();
dataCache.paying = false;
}
})
}
});

@ -0,0 +1,120 @@
.weui_cell_ft {
max-width: 60%;
white-space: normal
}
.pay-container{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.pay-container>img{
display: block;
margin: auto;
width: 250px;
}
div,span,img,button,a,p{
box-sizing: border-box;
}
body{
background: #fff;
}
.royal-container{
margin-top: 20%;
display: block;
width: 100%;
padding: 10px 30px;
}
.royal-container .royal-row{
border-bottom: 1px solid #d1d2d4;
padding: 5px 0;
}
.royal-container .royal-row.brand{
text-align: center;
}
.royal-container .royal-row.brand img{
display: block;
max-width: 60%;
max-height: 100px;
margin: auto;
}
.royal-container .royal-row.brand .name{
display: block;
margin: auto;
font-size: 1.6em;
}
.text-title{
color: #888888;
font-size: 0.9em;
}
.text-main{
color: #333333;
font-size: 1.1em;
}
.royal-pay-btn{
background: #30af69;
color: #fff;
width: 96%;
display: block;
margin: 10px auto 30px;
height: 50px;
line-height: 50px;
font-size: 1.4em;
text-align: center;
}
.alipay .royal-pay-btn{
background: #108ee9;
}
.alipay .amount_title{
background: #108ee9;
}
.amount_title{
height: 14%;
z-index: 10;
background: #30af69;
max-height: 200px;
min-height: 120px;
width: 100%;
}
.amount_title_logo{
float: left;
max-width: 90px;
min-width: 80px;
margin-left: 10px;
}
.amount_title_content{
float: left;
}
.amount_title_content_amount{
font-family: Avenir-Roman;
font-size: 30px;
color: #FFFFFF;
}
.amount_title_content_text{
font-family: PingFangSC-Regular;
font-size: 17px;
color: #FFFFFF;
}
.merchant_info{
height: 100px;
z-index: 1;
position: absolute;
width: 94%;
margin: -5% 0% 0px 3%;
text-align: center;
background-color: #FFFFFF;
box-shadow: 0px 0px 8px 0px rgba(171,171,171,0.50);
}
.merchant_info img{
max-height: 60px;
min-height: 50px;
}

@ -0,0 +1,106 @@
$(document).ready(function () {
'use strict';
decode();
function decode() {
var redirect = window.redirect;
while (redirect.indexOf('://') < 0) {
redirect = decodeURIComponent(redirect);
if (redirect == window.redirect) {
break;
}
window.redirect = redirect;
}
}
var dataCache = {paying: false};
$('#key_P').bind('touchstart', startPay);
function startPay() {
$('#wdiv').show();
if (dataCache.paying) {
return;
}
dataCache.paying = true;
$.ajax({
url: '/api/payment/v1.0/wechat_jsapi_payment/partners/' + window.client_moniker + '/orders/' + window.order_id + '/preorder',
method: 'get',
dataType: 'json',
success: function (pay) {
try {
if (pay.direct_paid) {
dataCache.paying = false;
location.href = window.redirect;
}
var paydata = pay.jsapi;
invokePay(paydata);
}catch (e) {
alert("Unexpected Error:" + e);
$('#wdiv').hide();
dataCache.paying = false;
}
},
error: function (jqXhr) {
var respText = jqXhr.responseText;
try {
alert(JSON.parse(respText).message);
$('#wdiv').hide();
dataCache.paying = false;
} catch (e) {
alert("Unexpected Error:" + respText);
$('#wdiv').hide();
dataCache.paying = false;
}
}
});
}
function invokePay(paydata) {
WeixinJSBridge.invoke('getBrandWCPayRequest', {
'appId': paydata.appId,
'timeStamp': paydata.timeStamp,
'nonceStr': paydata.nonceStr,
'package': paydata.package,
'signType': paydata.signType,
'paySign': paydata.paySign
}, function (res) {
dataCache.paying = false;
if (res.err_msg == 'get_brand_wcpay_request:ok') {
startCheckOrder(window.order_id)
} else {
if (res.err_msg != 'get_brand_wcpay_request:cancel' && res.err_msg != 'get_brand_wcpay_request:fail') {
alert('WeChat Error:' + res.err_msg);
}
if (window.paydata) {
location.href = window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=false';
}
}
//todo get status from server
$('#wdiv').hide();
})
}
function startCheckOrder(orderId) {
function checkOrderStd() {
$.ajax({
url: '/api/v1.0/payment/orders/' + orderId + '/status',
method: 'GET',
dataType: 'json',
success: function (res) {
if (res.paid) {
location.href = window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=true';
} else {
setTimeout(checkOrderStd, 500);
}
}
})
}
checkOrderStd();
}
});

@ -2,34 +2,28 @@ package au.com.royalpay.payment.manage.apps.core.impls;
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper;
import com.alibaba.fastjson.JSONObject;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Ignore;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.time.DateUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.bind.annotation.RequestMethod;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.util.Date;
import javax.annotation.Resource;
import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult;
/**
* Created by wangning on 05/01/2018.
*/
@ -44,7 +38,10 @@ public class CustomerImpressionImplTest {
private StringRedisTemplate stringRedisTemplate;
@Resource
private ClientMapper clientMapper;
@Resource
private OrgMapper orgMapper;
// @Resource
// private MailGunClient mailGunClient;
// @Test
// public void redisQueue() {
@ -56,75 +53,88 @@ public class CustomerImpressionImplTest {
// }
// }
@Ignore
public void excel() {
try {
List<JSONObject> asd =null;
Map<String,JSONObject> map = new HashMap<>();
asd.forEach(p->{
map.put(p.getString("sub_merchant_id"),p);
});
XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(new File("/Users/wangning/Desktop/qwe.xlsx")));
XSSFSheet sheet = workbook.getSheetAt(0);
Iterator<Row> rowIterator = sheet.rowIterator();
Row row = null;
Cell cell = null;
while (rowIterator.hasNext()) {
row = rowIterator.next();
cell = row.getCell(1);
if(cell==null){
continue;
}
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
JSONObject tmpOBJ = map.get(cell.getStringCellValue());
if(tmpOBJ==null){
continue;
}
row.createCell(4).setCellValue(tmpOBJ.getString("cc"));
row.createCell(5).setCellValue(tmpOBJ.getString("maxct"));
}
//
//
// if (!"Australia".equals(row.getCell(1).getStringCellValue())) {
// continue;
// }
// cell = row.getCell(0);
// @Test
// public void excel() {
// try {
// XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(new File("/Users/wangning/Desktop/asd.xlsx")));
// XSSFSheet sheet = workbook.getSheetAt(0);
// Iterator<Row> rowIterator = sheet.rowIterator();
// Row row = null;
// Cell cell = null;
// while (rowIterator.hasNext()) {
// row = rowIterator.next();
// cell = row.getCell(3);
// cell.setCellType(HSSFCell.CELL_TYPE_STRING);
//
// JSONObject client = clientMapper.clientInfoBySubMerchantId(cell.getStringCellValue());
// JSONObject client = clientMapper.findClientByMoniker(cell.getStringCellValue().trim());
// if(client==null){
// System.out.println();
// continue;
// }
// row.createCell(4).setCellValue(client.getString("bd_user_name"));
// row.createCell(5).setCellValue(client.getString("client_moniker"));
// row.createCell(6).setCellValue(client.getString("short_name"));
// }
//
// XSSFSheet sheet3 = workbook.getSheetAt(3);
// Iterator<Row> rowIterator3 = sheet3.rowIterator();
// while (rowIterator3.hasNext()) {
// row = rowIterator3.next();
// if (!"Australia".equals(row.getCell(1).getStringCellValue())) {
// continue;
// }
// cell = row.getCell(0);
// cell.setCellType(HSSFCell.CELL_TYPE_STRING);
// JSONObject client = clientMapper.clientInfoBySubMerchantId(cell.getStringCellValue());
// if(client==null){
// JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
// if(org==null){
// continue;
// }
// row.createCell(4).setCellValue(client.getString("bd_user_name"));
// row.createCell(5).setCellValue(client.getString("client_moniker"));
// row.createCell(6).setCellValue(client.getString("short_name"));
//
// row.createCell(5).setCellValue(org.getString("name"));
// }
//
// OutputStream out = new FileOutputStream("/Users/wangning/Desktop/春节活动报名结果通知(包含BD名称).xlsx");
// workbook.write(out);
// workbook.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
OutputStream out = new FileOutputStream("/Users/wangning/Desktop/订单fin.xlsx");
workbook.write(out);
workbook.close();
@Test
public void sendSimpleMessage() throws Exception {
String url = "https://api.mailgun.net/v3/dev.showcodes.com/events";
HttpRequestGenerator generator = new HttpRequestGenerator(url, RequestMethod.POST).addHeader("Authorization", getHeader());
generator.addQueryString("ascending", "yes");
generator.addQueryString("limit", "12");
System.out.println(String.valueOf(DateUtils.addDays(new Date(),1)));
HttpRequestResult res = null;
try {
res = generator.execute();
} catch (URISyntaxException e) {
e.printStackTrace();
}
System.out.println(res.getException());
System.out.println();
System.out.println();
try {
System.out.println(res.getResponseContentJSONObj().toJSONString());
} catch (IOException e) {
e.printStackTrace();
}
}
private String getHeader() {
String auth = "api:key-96fa3b5866ace125b8ec5a9d27e19353";
byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(Charset.forName("UTF-8")));
String authHeader = "Basic " + new String(encodedAuth);
return authHeader;
}
// @Test
// public void sendSimpleMessages() throws Exception {
// SendMail sendMail = new SendMail();
// sendMail.setContent("<html><p>Hi kira</p ></html>");
// Set<String> mailCCs = new HashSet<>();
// mailCCs.add("164851225@qq.com");
// sendMail.setMailCcs(mailCCs);
// Set<String> mailtos = new HashSet<>();
// mailtos.add("1029811920@qq.com");
// sendMail.setMailTos(mailtos);
// sendMail.setTitle("Final Test");
//
// JSONObject result = mailGunClient.sendMail(sendMail);
// System.out.println(result.toJSONString());
// System.out.println(result.toJSONString());
// System.out.println(result.toJSONString());
// }
}
Loading…
Cancel
Save