diff --git a/src/db/modify.sql b/src/db/modify.sql index f37a998db..79f642563 100644 --- a/src/db/modify.sql +++ b/src/db/modify.sql @@ -466,3 +466,28 @@ 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 + + diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java index c7a51b3ca..be08de126 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java @@ -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 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 diff --git a/src/main/java/au/com/royalpay/payment/manage/billqrcode/bean/NewBillQrCodeBean.java b/src/main/java/au/com/royalpay/payment/manage/billqrcode/bean/NewBillQrCodeBean.java new file mode 100644 index 000000000..937620a67 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/billqrcode/bean/NewBillQrCodeBean.java @@ -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; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/billqrcode/bean/QueryBillBean.java b/src/main/java/au/com/royalpay/payment/manage/billqrcode/bean/QueryBillBean.java new file mode 100644 index 000000000..deef3ecf9 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/billqrcode/bean/QueryBillBean.java @@ -0,0 +1,46 @@ +package au.com.royalpay.payment.manage.billqrcode.bean; + +import com.alibaba.fastjson.JSONObject; +import com.sun.tools.hat.internal.model.JavaObject; +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; + + public JSONObject toJson(){ + JSONObject jason = new JSONObject(); + if(StringUtils.isNotEmpty(status)){ + jason.put("status",status); + } + 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; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/billqrcode/core/PartnerBillService.java b/src/main/java/au/com/royalpay/payment/manage/billqrcode/core/PartnerBillService.java new file mode 100644 index 000000000..def496f3c --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/billqrcode/core/PartnerBillService.java @@ -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 listBills(JSONObject partner, QueryBillBean queryBillBean); + + void dailyCheckDirectedBillCode(); + + void disableBills(JSONObject partner,String bill_code_id); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/billqrcode/core/impl/PartnerBillServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/billqrcode/core/impl/PartnerBillServiceImpl.java new file mode 100644 index 000000000..a4957e74f --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/billqrcode/core/impl/PartnerBillServiceImpl.java @@ -0,0 +1,128 @@ +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 javafx.scene.chart.PieChart; +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.Calendar; +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 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 bills = directedBillCodeMapper.findByClientId(params,new PageBounds(queryBillBean.getPage(),queryBillBean.getLimit(), Order.formString("create_time.desc"))); + bills.stream().filter(t->t.getString("code_url")!= null).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 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); + } + } + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/billqrcode/web/PartnerBillController.java b/src/main/java/au/com/royalpay/payment/manage/billqrcode/web/PartnerBillController.java new file mode 100644 index 000000000..745f281a8 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/billqrcode/web/PartnerBillController.java @@ -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 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); + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/billqrcode/DirectedBillCodeMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/billqrcode/DirectedBillCodeMapper.java new file mode 100644 index 000000000..95b64f29e --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/billqrcode/DirectedBillCodeMapper.java @@ -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 findByClientId(JSONObject params, PageBounds pageBounds); + + @AutoSql(type = SqlType.SELECT) + @AdvanceSelect(addonWhereClause = "status=1") + List listAllBills(); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java index cb6618a72..6a77ac270 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java @@ -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 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(); diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRiskRecord.java b/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRiskRecord.java index e43902673..16ab92af8 100644 --- a/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRiskRecord.java +++ b/src/main/java/au/com/royalpay/payment/manage/risk/bean/QueryRiskRecord.java @@ -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" })); diff --git a/src/main/java/au/com/royalpay/payment/manage/task/DirectedBillCodeStatusDailyCheck.java b/src/main/java/au/com/royalpay/payment/manage/task/DirectedBillCodeStatusDailyCheck.java new file mode 100644 index 000000000..0ac13ed48 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/task/DirectedBillCodeStatusDailyCheck.java @@ -0,0 +1,23 @@ +package au.com.royalpay.payment.manage.task; + +import au.com.royalpay.payment.manage.billqrcode.core.PartnerBillService; +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; + + @Scheduled(cron = "0 0 6 * * ?") + public void statusDailyCheck(){ + partnerBillService.dailyCheckDirectedBillCode(); + } +} diff --git a/src/main/ui/index.html b/src/main/ui/index.html index 26b8502c2..73ffa320f 100644 --- a/src/main/ui/index.html +++ b/src/main/ui/index.html @@ -888,6 +888,11 @@ margin-bottom: 10%;"/> Cashiers Management +
  • + + Bill QR Code + +
  • diff --git a/src/main/ui/static/boot/index-boot.js b/src/main/ui/static/boot/index-boot.js index 66de21a27..6e225f3e0 100644 --- a/src/main/ui/static/boot/index-boot.js +++ b/src/main/ui/static/boot/index-boot.js @@ -75,7 +75,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, $) { diff --git a/src/main/ui/static/dashboard/dashboard.js b/src/main/ui/static/dashboard/dashboard.js index 088b02048..ba0da91b9 100644 --- a/src/main/ui/static/dashboard/dashboard.js +++ b/src/main/ui/static/dashboard/dashboard.js @@ -415,7 +415,7 @@ define(['angular', 'uiRouter', 'uiBootstrap', 'angularEcharts'], function (angul }) } - function loadFeeAnalysis(params) { + /*function loadFeeAnalysis(params) { var analysisConfig = { chart: { tooltip: { @@ -473,7 +473,7 @@ define(['angular', 'uiRouter', 'uiBootstrap', 'angularEcharts'], function (angul }) } - loadFeeAnalysis($scope.scales[2].params()) + loadFeeAnalysis($scope.scales[2].params())*/ function getMaxRecord() { if ($scope.currentUser.org_id == null) { diff --git a/src/main/ui/static/dashboard/templates/dashboard.html b/src/main/ui/static/dashboard/templates/dashboard.html index 75c4371f7..1eb8df98a 100644 --- a/src/main/ui/static/dashboard/templates/dashboard.html +++ b/src/main/ui/static/dashboard/templates/dashboard.html @@ -232,7 +232,7 @@ -
    +
    diff --git a/src/main/ui/static/payment/billqrcode/bill-qrcode-manage.js b/src/main/ui/static/payment/billqrcode/bill-qrcode-manage.js new file mode 100644 index 000000000..cfad253ef --- /dev/null +++ b/src/main/ui/static/payment/billqrcode/bill-qrcode-manage.js @@ -0,0 +1,85 @@ +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.today = new Date(); + + $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' + } + } + }); + + + return app; +}); \ No newline at end of file diff --git a/src/main/ui/static/payment/billqrcode/templates/bill_qrcode.html b/src/main/ui/static/payment/billqrcode/templates/bill_qrcode.html new file mode 100644 index 000000000..4f3b521b0 --- /dev/null +++ b/src/main/ui/static/payment/billqrcode/templates/bill_qrcode.html @@ -0,0 +1,151 @@ + +
    +
    +

    Bill QR Code

    + +
    + +
    +
    +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    + +
    + +
    + +

    Client Order Id 为空时,系统自动生成

    +
    +
    +
    + +
    + +
    +
    +
    + +
    +     + +
    +
    +
    + +
    +
    +
    +
    +

    Bill List      + All | + Success | + Disabled + +

    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    PriceClient Order IdCreate timeExpire timeRemarkOrder StatusBill StatusPayerOperation
    + + + + + Disable +
    +
    + +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/src/main/ui/static/risk/templates/risk.html b/src/main/ui/static/risk/templates/risk.html index ff55c8552..c53c559d8 100644 --- a/src/main/ui/static/risk/templates/risk.html +++ b/src/main/ui/static/risk/templates/risk.html @@ -7,7 +7,37 @@
    -
    +
    +
    +
    +
    + + +
    +    +
    + + + +
    +
    + +
    +
    +
    +
    +
    Records