commit
ca23d42860
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 59 KiB |
@ -0,0 +1,24 @@
|
||||
package au.com.royalpay.payment.manage.dev.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.maxmind.geoip.LookupService;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/dev/ip")
|
||||
|
||||
public class IPController {
|
||||
@Resource
|
||||
private LookupService lookupService;
|
||||
|
||||
@RequestMapping(value = "/{ipAddr}", method = RequestMethod.GET)
|
||||
public String getIpInfo(@PathVariable String ipAddr) {
|
||||
String city = lookupService.getLocation(ipAddr).city;
|
||||
return city;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package au.com.royalpay.payment.manage.mappers.client;
|
||||
|
||||
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 = "cli_sub_merchant_id", pkName = "sub_merchant_id")
|
||||
public interface ClientSubMerchantIdMapper {
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
List<JSONObject> listSubMerchantId(PageBounds pageBounds);
|
||||
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject subMerchantId);
|
||||
|
||||
@AutoSql(type = SqlType.UPDATE)
|
||||
void update(JSONObject subMerchantId);
|
||||
|
||||
@AutoSql(type = SqlType.DELETE)
|
||||
void delete(@Param("sub_merchant_id") String sub_merchant_id);
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package au.com.royalpay.payment.manage.mappers.log;
|
||||
|
||||
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 org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@AutoMapper(tablename = "log_client_sub_merchant_id", pkName = "id")
|
||||
public interface LogClientSubMerchantIdMapper {
|
||||
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject log);
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
List<JSONObject> listLogsByClientId(@Param("client_id") int client_id);
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package au.com.royalpay.payment.manage.mappers.payment;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
||||
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Create by yixian at 2017-12-05 23:13
|
||||
*/
|
||||
@AutoMapper(tablename = "pmt_sub_merchant_id", pkName = "sub_merchant_id")
|
||||
public interface CommonSubMerchantIdMapper {
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
List<JSONObject> list(@Param("is_valid") boolean is_valid, @Param("sub_merchant_id") String sub_merchant_id,PageBounds pageBounds);
|
||||
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject record);
|
||||
|
||||
@AutoSql(type = SqlType.UPDATE)
|
||||
void update(JSONObject record);
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject find(@Param("sub_merchant_id")String sub_merchant_id);
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package au.com.royalpay.payment.manage.mappers.risk;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
||||
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||
|
||||
/**
|
||||
* Create by yixian at 2017-12-21 11:45
|
||||
*/
|
||||
@AutoMapper(tablename = "risk_merchant_detail_log", pkName = "id")
|
||||
public interface RiskMerchantDetailLogMapper {
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject record);
|
||||
|
||||
@AutoSql(type = SqlType.UPDATE)
|
||||
void update(JSONObject record);
|
||||
|
||||
PageList<JSONObject> query(JSONObject params, PageBounds pagination);
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package au.com.royalpay.payment.manage.mappers.risk;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
||||
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||
|
||||
/**
|
||||
* Create by yixian at 2017-12-21 11:45
|
||||
*/
|
||||
@AutoMapper(tablename = "risk_merchant_record", pkName = "id")
|
||||
public interface RiskMerchantRecordMapper {
|
||||
@AutoSql(type = SqlType.UPDATE)
|
||||
void update(JSONObject record);
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject findById(@Param("id") String id);
|
||||
|
||||
PageList<JSONObject> query(JSONObject params, PageBounds pagination);
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package au.com.royalpay.payment.manage.mappers.risk;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||
|
||||
/**
|
||||
* Create by yixian at 2017-12-21 11:45
|
||||
*/
|
||||
@AutoMapper(tablename = "risk_transaction_log", pkName = "id")
|
||||
public interface RiskTransactionLogMapper {
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject findByOrderId(@Param("order_id") String order_id);
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
List<JSONObject> findByRecordId(@Param("record_id") String record_id);
|
||||
|
||||
PageList<JSONObject> query(JSONObject params, PageBounds pagination);
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package au.com.royalpay.payment.manage.mappers.risk;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||
|
||||
/**
|
||||
* Create by yixian at 2017-12-21 11:45
|
||||
*/
|
||||
@AutoMapper(tablename = "risk_white_list", pkName = "client_id")
|
||||
public interface RiskWhiteListMapper {
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject findByClientMoniker(@Param("client_moniker") String client_moniker);
|
||||
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject record);
|
||||
|
||||
@AutoSql(type = SqlType.UPDATE)
|
||||
void update(JSONObject record);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package au.com.royalpay.payment.manage.merchantid.core;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by yuan on 2018/4/24.
|
||||
*/
|
||||
public interface MerchantIdManageService {
|
||||
Map<String,List<JSONObject>> listSubMerchantId(JSONObject manager);
|
||||
|
||||
void generateClientsSunMerchantId();
|
||||
|
||||
JSONObject listNotTradeSubMerchantId(JSONObject manager);
|
||||
|
||||
List<JSONObject> showClientMoniker(JSONObject manager,String sub_merchant_id);
|
||||
|
||||
void save(JSONObject record);
|
||||
|
||||
void disable(String sub_merchant_id);
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
package au.com.royalpay.payment.manage.merchantid.core.impl;
|
||||
|
||||
import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig;
|
||||
import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi;
|
||||
import au.com.royalpay.payment.manage.analysis.mappers.ClientAnalysisMapper;
|
||||
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 com.alibaba.fastjson.JSONObject;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.Order;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Created by yuan on 2018/4/24.
|
||||
*/
|
||||
@Service
|
||||
public class MerchantIdManageServiceImpl implements MerchantIdManageService {
|
||||
@Autowired
|
||||
private ClientMapper clientMapper;
|
||||
|
||||
@Autowired
|
||||
private SysConfigManager sysConfigManager;
|
||||
|
||||
@Autowired
|
||||
private ClientAnalysisMapper clientAnalysisMapper;
|
||||
|
||||
@Autowired
|
||||
private ClientSubMerchantIdMapper clientSubMerchantIdMapper;
|
||||
|
||||
@Resource
|
||||
private CommonSubMerchantIdMapper commonSubMerchantIdMapper;
|
||||
|
||||
@Resource
|
||||
private MpPaymentApi mpPaymentApi;
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, List<JSONObject>> listSubMerchantId(JSONObject manager) {
|
||||
List<JSONObject> clients = clientMapper.listSubMerchantId();
|
||||
return getClientMap(clients);
|
||||
}
|
||||
@Override
|
||||
public JSONObject listNotTradeSubMerchantId(JSONObject manager) {
|
||||
List<JSONObject> clients = clientSubMerchantIdMapper.listSubMerchantId(new PageBounds(Order.formString("create_time.desc")));
|
||||
Map<String, List<JSONObject>> merchantIdMap = clients.stream().filter(t->t.containsKey("merchant_id")).filter(t->t.containsKey("sub_merchant_id")).collect(Collectors.groupingBy(t->t.getString("merchant_id")));
|
||||
JSONObject returnJason = new JSONObject();
|
||||
returnJason.put("merchant_id_map",merchantIdMap);
|
||||
returnJason.put("refresh_time",clients.size()>0?clients.get(0).getDate("create_time"):"");
|
||||
return returnJason;
|
||||
}
|
||||
@Override
|
||||
public void generateClientsSunMerchantId() {
|
||||
String tempSubMerchantIds = sysConfigManager.getSysConfig().getString("temp_sub_mch_id");
|
||||
List<JSONObject> clients = clientAnalysisMapper.notTradeSubMerchantId();
|
||||
List<JSONObject> clientSubMerchantId = clientSubMerchantIdMapper.listSubMerchantId(new PageBounds(Order.formString("create_time.desc")));
|
||||
Map<String, JSONObject> subMerchantIdMapFromDB = new HashMap<>();
|
||||
for (JSONObject id : clientSubMerchantId) {
|
||||
subMerchantIdMapFromDB.put(id.getString("sub_merchant_id"), id);
|
||||
}
|
||||
for (JSONObject client: clients) {
|
||||
String subMerchantId = client.getString("sub_merchant_id");
|
||||
if (subMerchantId != null && tempSubMerchantIds != null && tempSubMerchantIds.contains(subMerchantId)) {
|
||||
client.put("temp_sub_merchant", true);
|
||||
}
|
||||
String id = client.getString("sub_merchant_id");
|
||||
client.put("create_time",new Date());
|
||||
if (subMerchantIdMapFromDB.containsKey(id)) {
|
||||
subMerchantIdMapFromDB.remove(id);
|
||||
clientSubMerchantIdMapper.update(client);
|
||||
} else {
|
||||
clientSubMerchantIdMapper.save(client);
|
||||
}
|
||||
}
|
||||
for (String id : subMerchantIdMapFromDB.keySet()) {
|
||||
clientSubMerchantIdMapper.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> showClientMoniker(JSONObject manager,String sub_merchant_id) {
|
||||
return clientMapper.listBySubMerchantId(sub_merchant_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(JSONObject record) {
|
||||
JSONObject sub_merchant_id = commonSubMerchantIdMapper.find(record.getString("sub_merchant_id"));
|
||||
if(sub_merchant_id!=null){
|
||||
throw new BadRequestException("当前商户号已经添加,请重新输入");
|
||||
}
|
||||
WeChatPayConfig.Merchant availableMerchant = mpPaymentApi.determineMerchant(record.getString("sub_merchant_id"));
|
||||
if(availableMerchant == null){
|
||||
throw new BadRequestException("未检索到对应的商户号,请验证子商户号是否正确");
|
||||
}
|
||||
record.put("merchant_id",availableMerchant.getMerchantId());
|
||||
commonSubMerchantIdMapper.save(record);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable(String sub_merchant_id) {
|
||||
JSONObject record = new JSONObject();
|
||||
record.put("sub_merchant_id",sub_merchant_id);
|
||||
record.put("is_valid",false);
|
||||
record.put("update_time",new Date());
|
||||
commonSubMerchantIdMapper.update(record);
|
||||
}
|
||||
|
||||
private Map<String, List<JSONObject>> getClientMap(List<JSONObject> clients){
|
||||
String tempSubMerchantIds = sysConfigManager.getSysConfig().getString("temp_sub_mch_id");
|
||||
for (JSONObject client: clients) {
|
||||
String subMerchantId = client.getString("sub_merchant_id");
|
||||
if (subMerchantId != null && tempSubMerchantIds != null && tempSubMerchantIds.contains(subMerchantId)) {
|
||||
client.put("temp_sub_merchant", true);
|
||||
}
|
||||
}
|
||||
Map<String, List<JSONObject>> clientsMap = clients.stream().filter(t->t.containsKey("merchant_id")).filter(t->t.containsKey("sub_merchant_id")).collect(Collectors.groupingBy(t->t.getString("merchant_id")));
|
||||
return clientsMap;
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package au.com.royalpay.payment.manage.merchantid.web;
|
||||
|
||||
import au.com.royalpay.payment.manage.mappers.payment.CommonSubMerchantIdMapper;
|
||||
import au.com.royalpay.payment.manage.merchantid.core.MerchantIdManageService;
|
||||
|
||||
import au.com.royalpay.payment.manage.permission.manager.RequireManager;
|
||||
import au.com.royalpay.payment.tools.CommonConsts;
|
||||
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.Order;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/sys/merchant_id")
|
||||
public class MerchantIdManageController {
|
||||
|
||||
@Resource
|
||||
private MerchantIdManageService merchantIdManageService;
|
||||
|
||||
@Resource
|
||||
private CommonSubMerchantIdMapper commonSubMerchantIdMapper;
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
@RequireManager(role = {ManagerRole.OPERATOR})
|
||||
public Map<String,List<JSONObject>> listSubMerchantId(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
|
||||
return merchantIdManageService.listSubMerchantId(manager);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET,value = "/trade")
|
||||
@RequireManager(role = {ManagerRole.OPERATOR})
|
||||
public JSONObject listNotTradeSubMerchantId(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
|
||||
return merchantIdManageService.listNotTradeSubMerchantId(manager);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST,value = "/refresh")
|
||||
@RequireManager(role = {ManagerRole.OPERATOR})
|
||||
public void refreshClientsByTraded(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
|
||||
merchantIdManageService.generateClientsSunMerchantId();
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET,value = "/{sub_merchant_id}")
|
||||
@RequireManager(role = {ManagerRole.OPERATOR})
|
||||
public List<JSONObject> showClientMoniker(@PathVariable() String sub_merchant_id,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
|
||||
return merchantIdManageService.showClientMoniker(manager,sub_merchant_id);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/common_sub_merchant_id", method = RequestMethod.GET)
|
||||
@RequireManager(role = {ManagerRole.OPERATOR})
|
||||
public List<JSONObject> listCommonSubMerchantId(@RequestParam(required = false) String sub_merchant_id, @RequestParam(defaultValue = "true") boolean is_valid) {
|
||||
return commonSubMerchantIdMapper.list(is_valid,sub_merchant_id,new PageBounds(Order.formString("create_time.desc")));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/common_sub_merchant_id/{sub_merchant_id}", method = RequestMethod.POST)
|
||||
@RequireManager(role = {ManagerRole.OPERATOR})
|
||||
public void addCommonSubMerchantId(@PathVariable String sub_merchant_id,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
|
||||
JSONObject record = new JSONObject();
|
||||
record.put("sub_merchant_id",sub_merchant_id);
|
||||
record.put("operator",manager.getString("display_name"));
|
||||
record.put("create_time",new Date());
|
||||
merchantIdManageService.save(record);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/common_sub_merchant_id/{sub_merchant_id}", method = RequestMethod.PUT)
|
||||
@RequireManager(role = {ManagerRole.OPERATOR})
|
||||
public void disableCommonSubMerchantId(@PathVariable String sub_merchant_id) {
|
||||
merchantIdManageService.disable(sub_merchant_id);
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package au.com.royalpay.payment.manage.risk.bean;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class AddRiskDetailLog {
|
||||
|
||||
@JsonProperty("record_id")
|
||||
private String record_id;
|
||||
|
||||
@JsonProperty("files")
|
||||
private String files;
|
||||
|
||||
@JsonProperty("operation")
|
||||
private String operation;
|
||||
|
||||
@JsonProperty("remark")
|
||||
private String remark;
|
||||
|
||||
public JSONObject params() {
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("record_id", this.record_id);
|
||||
if (StringUtils.isNotEmpty(this.files)) {
|
||||
params.put("files", this.files);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(this.operation)) {
|
||||
params.put("operation", this.operation);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(this.remark)) {
|
||||
params.put("remark", this.remark);
|
||||
}
|
||||
return params;
|
||||
|
||||
}
|
||||
|
||||
public String getRecord_id() {
|
||||
return record_id;
|
||||
}
|
||||
|
||||
public void setRecord_id(String record_id) {
|
||||
this.record_id = record_id;
|
||||
}
|
||||
|
||||
public String getFiles() {
|
||||
return files;
|
||||
}
|
||||
|
||||
public void setFiles(String files) {
|
||||
this.files = files;
|
||||
}
|
||||
|
||||
public String getOperation() {
|
||||
return operation;
|
||||
}
|
||||
|
||||
public void setOperation(String operation) {
|
||||
this.operation = operation;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package au.com.royalpay.payment.manage.risk.bean;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class DealRiskRecord {
|
||||
|
||||
private String recordId;
|
||||
private BigDecimal limitAmount;
|
||||
@JsonProperty(defaultValue = "false")
|
||||
private boolean disableMerchat;
|
||||
|
||||
public String getRecordId() {
|
||||
return recordId;
|
||||
}
|
||||
|
||||
public void setRecordId(String recordId) {
|
||||
this.recordId = recordId;
|
||||
}
|
||||
|
||||
public BigDecimal getLimitAmount() {
|
||||
return limitAmount;
|
||||
}
|
||||
|
||||
public void setLimitAmount(BigDecimal limitAmount) {
|
||||
this.limitAmount = limitAmount;
|
||||
}
|
||||
|
||||
public Boolean getDisableMerchat() {
|
||||
return disableMerchat;
|
||||
}
|
||||
|
||||
public void setDisableMerchat(Boolean disableMerchat) {
|
||||
this.disableMerchat = disableMerchat;
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package au.com.royalpay.payment.manage.risk.bean;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
|
||||
import java.text.ParseException;
|
||||
|
||||
public class QueryRiskDetail {
|
||||
|
||||
private String record_id;
|
||||
private String c_end_time;
|
||||
private int client_id;
|
||||
|
||||
private int limit = 20;
|
||||
private int page;
|
||||
|
||||
public JSONObject toParams() {
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("record_id", this.record_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" }));
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
public String getRecord_id() {
|
||||
return record_id;
|
||||
}
|
||||
|
||||
public void setRecord_id(String record_id) {
|
||||
this.record_id = record_id;
|
||||
}
|
||||
|
||||
public String getC_end_time() {
|
||||
return c_end_time;
|
||||
}
|
||||
|
||||
public void setC_end_time(String c_end_time) {
|
||||
this.c_end_time = c_end_time;
|
||||
}
|
||||
|
||||
public int getClient_id() {
|
||||
return client_id;
|
||||
}
|
||||
|
||||
public void setClient_id(int client_id) {
|
||||
this.client_id = client_id;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package au.com.royalpay.payment.manage.risk.bean;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
|
||||
import java.text.ParseException;
|
||||
|
||||
public class QueryRiskOrder {
|
||||
|
||||
private String record_id;
|
||||
private String c_end_time;
|
||||
private int client_id;
|
||||
private int limit = 20;
|
||||
private int page;
|
||||
|
||||
public JSONObject toParams() {
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("record_id", this.record_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" }));
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
public String getRecord_id() {
|
||||
return record_id;
|
||||
}
|
||||
|
||||
public void setRecord_id(String record_id) {
|
||||
this.record_id = record_id;
|
||||
}
|
||||
|
||||
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 getC_end_time() {
|
||||
return c_end_time;
|
||||
}
|
||||
|
||||
public void setC_end_time(String c_end_time) {
|
||||
this.c_end_time = c_end_time;
|
||||
}
|
||||
|
||||
public int getClient_id() {
|
||||
return client_id;
|
||||
}
|
||||
|
||||
public void setClient_id(int client_id) {
|
||||
this.client_id = client_id;
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package au.com.royalpay.payment.manage.risk.bean;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
|
||||
import java.text.ParseException;
|
||||
|
||||
public class QueryRiskRecord {
|
||||
|
||||
private String status;
|
||||
private String client_moniker;
|
||||
private String record_id;
|
||||
private String c_end_time;
|
||||
private int client_id;
|
||||
|
||||
private int limit = 20;
|
||||
private int page;
|
||||
|
||||
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);
|
||||
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" }));
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
}
|
||||
return params;
|
||||
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getRecord_id() {
|
||||
return record_id;
|
||||
}
|
||||
|
||||
public void setRecord_id(String record_id) {
|
||||
this.record_id = record_id;
|
||||
}
|
||||
|
||||
public String getClient_moniker() {
|
||||
return client_moniker;
|
||||
}
|
||||
|
||||
public void setClient_moniker(String client_moniker) {
|
||||
this.client_moniker = client_moniker;
|
||||
}
|
||||
|
||||
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 getC_end_time() {
|
||||
return c_end_time;
|
||||
}
|
||||
|
||||
public void setC_end_time(String c_end_time) {
|
||||
this.c_end_time = c_end_time;
|
||||
}
|
||||
|
||||
public int getClient_id() {
|
||||
return client_id;
|
||||
}
|
||||
|
||||
public void setClient_id(int client_id) {
|
||||
this.client_id = client_id;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package au.com.royalpay.payment.manage.risk.core;
|
||||
|
||||
import au.com.royalpay.payment.manage.risk.bean.AddRiskDetailLog;
|
||||
import au.com.royalpay.payment.manage.risk.bean.DealRiskRecord;
|
||||
import au.com.royalpay.payment.manage.risk.bean.QueryRiskDetail;
|
||||
import au.com.royalpay.payment.manage.risk.bean.QueryRiskOrder;
|
||||
import au.com.royalpay.payment.manage.risk.bean.QueryRiskRecord;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
public interface RiskMerchantService {
|
||||
|
||||
void addDetailLog(AddRiskDetailLog addRiskDetailLog, JSONObject account);
|
||||
|
||||
void DropOrderRiskRecord(JSONObject account,String recordId);
|
||||
|
||||
void noopRiskRecord(JSONObject account,String recordId);
|
||||
|
||||
void dealRiskRecord(JSONObject account,DealRiskRecord dealRiskRecord);
|
||||
|
||||
void dealRiskRecordDirectly(JSONObject account,String record_id);
|
||||
|
||||
JSONObject getRiskOrders(QueryRiskOrder queryRiskOrder);
|
||||
|
||||
JSONObject getRiskRecords(QueryRiskRecord queryRiskRecord);
|
||||
|
||||
void addWhiteList(String client_moinker);
|
||||
|
||||
void disableWhiteList(String client_moinker);
|
||||
|
||||
JSONObject getRecordById(String record_id);
|
||||
|
||||
JSONObject getRiskDetails(QueryRiskDetail queryRiskDetail);
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,216 @@
|
||||
package au.com.royalpay.payment.manage.risk.core.impl;
|
||||
|
||||
import au.com.royalpay.payment.manage.mappers.risk.RiskMerchantDetailLogMapper;
|
||||
import au.com.royalpay.payment.manage.mappers.risk.RiskMerchantRecordMapper;
|
||||
import au.com.royalpay.payment.manage.mappers.risk.RiskTransactionLogMapper;
|
||||
import au.com.royalpay.payment.manage.mappers.risk.RiskWhiteListMapper;
|
||||
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
||||
import au.com.royalpay.payment.manage.risk.bean.AddRiskDetailLog;
|
||||
import au.com.royalpay.payment.manage.risk.bean.DealRiskRecord;
|
||||
import au.com.royalpay.payment.manage.risk.bean.QueryRiskDetail;
|
||||
import au.com.royalpay.payment.manage.risk.bean.QueryRiskOrder;
|
||||
import au.com.royalpay.payment.manage.risk.bean.QueryRiskRecord;
|
||||
import au.com.royalpay.payment.manage.risk.core.RiskMerchantService;
|
||||
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
||||
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
|
||||
import au.com.royalpay.payment.tools.utils.PageListUtils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
public class RiskMerchantServiceImpl implements RiskMerchantService {
|
||||
|
||||
@Resource
|
||||
private RiskMerchantRecordMapper riskMerchantRecordMapper;
|
||||
@Resource
|
||||
private RiskMerchantDetailLogMapper riskMerchantDetailLogMapper;
|
||||
@Resource
|
||||
private RiskTransactionLogMapper riskTransactionLogMapper;
|
||||
@Resource
|
||||
private RiskWhiteListMapper riskWhiteListMapper;
|
||||
@Resource
|
||||
private ClientManager clientManager;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void addDetailLog(AddRiskDetailLog addRiskDetailLog, JSONObject account) {
|
||||
JSONObject record = riskMerchantRecordMapper.findById(addRiskDetailLog.getRecord_id());
|
||||
if (record == null) {
|
||||
throw new NotFoundException("Risk Record Not Found Please Check");
|
||||
}
|
||||
JSONObject detail = addRiskDetailLog.params();
|
||||
detail.put("auditor", account.getString("display_name"));
|
||||
detail.put("client_id", record.getIntValue("client_id"));
|
||||
detail.put("auditor_id", account.getString("manager_id"));
|
||||
detail.put("create_time", new Date());
|
||||
riskMerchantDetailLogMapper.save(detail);
|
||||
record.put("status",2);
|
||||
riskMerchantRecordMapper.update(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void DropOrderRiskRecord(JSONObject account, String recordId) {
|
||||
JSONObject riskRecord = riskMerchantRecordMapper.findById(recordId);
|
||||
if (riskRecord == null) {
|
||||
throw new NotFoundException("Risk Record Not Found");
|
||||
}
|
||||
if (riskRecord.getIntValue("status") != 0) {
|
||||
throw new BadRequestException("The Record Has Been Handled");
|
||||
}
|
||||
JSONObject record = new JSONObject();
|
||||
record.put("id", recordId);
|
||||
record.put("status", "1");
|
||||
riskMerchantRecordMapper.update(record);
|
||||
JSONObject detail = new JSONObject();
|
||||
detail.put("record_id", recordId);
|
||||
detail.put("client_id", riskRecord.getIntValue("client_id"));
|
||||
detail.put("auditor", account.getString("display_name"));
|
||||
detail.put("auditor_id", account.getString("manager_id"));
|
||||
detail.put("remark", "进行掉单处理");
|
||||
detail.put("create_time", new Date());
|
||||
riskMerchantDetailLogMapper.save(detail);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void noopRiskRecord(JSONObject account, String recordId) {
|
||||
JSONObject riskRecord = riskMerchantRecordMapper.findById(recordId);
|
||||
if (riskRecord == null) {
|
||||
throw new NotFoundException("Risk Record Not Found");
|
||||
}
|
||||
if (riskRecord.getIntValue("status") != 0) {
|
||||
throw new BadRequestException("The Record Has Been Handled");
|
||||
}
|
||||
JSONObject record = new JSONObject();
|
||||
record.put("id", recordId);
|
||||
record.put("status", "2");
|
||||
riskMerchantRecordMapper.update(record);
|
||||
JSONObject detail = new JSONObject();
|
||||
detail.put("record_id", recordId);
|
||||
detail.put("client_id", riskRecord.getIntValue("client_id"));
|
||||
detail.put("auditor", account.getString("display_name"));
|
||||
detail.put("remark", "不做处理");
|
||||
detail.put("create_time", new Date());
|
||||
riskMerchantDetailLogMapper.save(detail);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void dealRiskRecord(JSONObject account, DealRiskRecord dealRiskRecord) {
|
||||
JSONObject record = riskMerchantRecordMapper.findById(dealRiskRecord.getRecordId());
|
||||
if (record == null) {
|
||||
throw new NotFoundException("Risk Record Not Found Please Check");
|
||||
}
|
||||
if (record.getIntValue("status") != 0) {
|
||||
throw new BadRequestException("The Record Has Been Handled");
|
||||
}
|
||||
String remark = "";
|
||||
if (dealRiskRecord.getLimitAmount() != null) {
|
||||
clientManager.setMaxOrderAmount(record.getString("client_moniker"), dealRiskRecord.getLimitAmount());
|
||||
remark = remark + "限额" + dealRiskRecord.getLimitAmount();
|
||||
|
||||
}
|
||||
if (dealRiskRecord.getDisableMerchat()) {
|
||||
clientManager.switchChannelPermission(account, record.getString("client_moniker"), "Wechat", false);
|
||||
clientManager.switchChannelPermission(account, record.getString("client_moniker"), "Alipay", false);
|
||||
remark = remark + " 关闭支付通道";
|
||||
}
|
||||
JSONObject detail = new JSONObject();
|
||||
detail.put("record_id", dealRiskRecord.getRecordId());
|
||||
detail.put("client_id", record.getIntValue("client_id"));
|
||||
detail.put("auditor", account.getString("display_name"));
|
||||
detail.put("remark", StringUtils.isEmpty(remark) ? null : (remark = "处理结果:" + remark));
|
||||
detail.put("create_time", new Date());
|
||||
riskMerchantDetailLogMapper.save(detail);
|
||||
record.put("status", 2);
|
||||
riskMerchantRecordMapper.update(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void dealRiskRecordDirectly(JSONObject account, String record_id) {
|
||||
JSONObject record = riskMerchantRecordMapper.findById(record_id);
|
||||
if (record == null) {
|
||||
throw new NotFoundException("Risk Record Not Found Please Check");
|
||||
}
|
||||
if (record.getIntValue("status") != 0) {
|
||||
throw new BadRequestException("The Record Has Been Handled");
|
||||
}
|
||||
JSONObject detail = new JSONObject();
|
||||
detail.put("record_id", record_id);
|
||||
detail.put("client_id", record.getIntValue("client_id"));
|
||||
detail.put("auditor", account.getString("display_name"));
|
||||
detail.put("auditor_id", account.getString("manager_id"));
|
||||
detail.put("remark", "结停");
|
||||
detail.put("create_time", new Date());
|
||||
riskMerchantDetailLogMapper.save(detail);
|
||||
JSONObject recordUpdate = new JSONObject();
|
||||
recordUpdate.put("id",record_id);
|
||||
recordUpdate.put("status", 1);
|
||||
riskMerchantRecordMapper.update(recordUpdate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getRiskOrders(QueryRiskOrder queryRiskOrder) {
|
||||
return PageListUtils.buildPageListResult(
|
||||
riskTransactionLogMapper.query(queryRiskOrder.toParams(), new PageBounds(queryRiskOrder.getPage(), queryRiskOrder.getLimit())));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getRiskRecords(QueryRiskRecord queryRiskRecord) {
|
||||
return PageListUtils.buildPageListResult(
|
||||
riskMerchantRecordMapper.query(queryRiskRecord.toParams(), new PageBounds(queryRiskRecord.getPage(), queryRiskRecord.getLimit())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWhiteList(String client_moinker) {
|
||||
JSONObject white = riskWhiteListMapper.findByClientMoniker(client_moinker);
|
||||
if (white != null) {
|
||||
white.put("is_valid", true);
|
||||
riskWhiteListMapper.update(white);
|
||||
return;
|
||||
}
|
||||
JSONObject client = clientManager.getClientInfoByMoniker(client_moinker);
|
||||
if (client == null) {
|
||||
throw new NotFoundException("Merchant Not Found Please Check");
|
||||
}
|
||||
JSONObject record = new JSONObject();
|
||||
record.put("client_id", client.getIntValue("client_id"));
|
||||
record.put("client_moniker", client.getString("client_moinker"));
|
||||
record.put("create_time", new Date());
|
||||
riskWhiteListMapper.save(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableWhiteList(String client_moinker) {
|
||||
JSONObject white = riskWhiteListMapper.findByClientMoniker(client_moinker);
|
||||
if (white == null) {
|
||||
throw new NotFoundException("White List Not Found Please Check");
|
||||
}
|
||||
white.put("is_valid", false);
|
||||
riskWhiteListMapper.update(white);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getRecordById(String record_id) {
|
||||
return riskMerchantRecordMapper.findById(record_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getRiskDetails(QueryRiskDetail queryRiskDetail) {
|
||||
return PageListUtils.buildPageListResult(
|
||||
riskMerchantDetailLogMapper.query(queryRiskDetail.toParams(), new PageBounds(queryRiskDetail.getPage(), queryRiskDetail.getLimit())));
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package au.com.royalpay.payment.manage.risk.web;
|
||||
|
||||
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
|
||||
import au.com.royalpay.payment.manage.risk.bean.AddRiskDetailLog;
|
||||
import au.com.royalpay.payment.manage.risk.bean.DealRiskRecord;
|
||||
import au.com.royalpay.payment.manage.risk.bean.QueryRiskDetail;
|
||||
import au.com.royalpay.payment.manage.risk.bean.QueryRiskOrder;
|
||||
import au.com.royalpay.payment.manage.risk.bean.QueryRiskRecord;
|
||||
import au.com.royalpay.payment.manage.risk.core.RiskMerchantService;
|
||||
import au.com.royalpay.payment.tools.CommonConsts;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* Created by wangning on 08/12/2016.
|
||||
*/
|
||||
@RestController
|
||||
@ManagerMapping(value = "/sys/risk")
|
||||
public class RiskController {
|
||||
|
||||
@Resource
|
||||
private RiskMerchantService riskMerchantService;
|
||||
|
||||
@RequestMapping(value = "/records", method = RequestMethod.GET)
|
||||
public JSONObject list(QueryRiskRecord recordQuery) {
|
||||
return riskMerchantService.getRiskRecords(recordQuery);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/records/{record_id}", method = RequestMethod.GET)
|
||||
public JSONObject getById(@PathVariable String record_id) {
|
||||
return riskMerchantService.getRecordById(record_id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/records/{record_id}/dropOrder", method = RequestMethod.PUT)
|
||||
public void dropOrder(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String record_id) {
|
||||
riskMerchantService.DropOrderRiskRecord(manager, record_id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/records/{record_id}/noop", method = RequestMethod.PUT)
|
||||
public void noop(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String record_id) {
|
||||
riskMerchantService.noopRiskRecord(manager, record_id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/records/{record_id}/directly", method = RequestMethod.PUT)
|
||||
public void directly(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String record_id) {
|
||||
riskMerchantService.dealRiskRecordDirectly(manager, record_id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/records/{record_id}/deal",method = RequestMethod.PUT)
|
||||
public void dealRecord(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String record_id, @RequestBody DealRiskRecord dealRiskRecord){
|
||||
dealRiskRecord.setRecordId(record_id);
|
||||
riskMerchantService.dealRiskRecord(manager,dealRiskRecord);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/orders", method = RequestMethod.GET)
|
||||
public JSONObject getRiskOrders(QueryRiskOrder queryRiskOrder) {
|
||||
return riskMerchantService.getRiskOrders(queryRiskOrder);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/white/{client_moniker}", method = RequestMethod.POST)
|
||||
public void addWhiteList(@PathVariable String client_moniker) {
|
||||
riskMerchantService.addWhiteList(client_moniker);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/white/{client_moniker}/disable", method = RequestMethod.PUT)
|
||||
public void disableWhiteList(@PathVariable String client_moniker) {
|
||||
riskMerchantService.disableWhiteList(client_moniker);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/records/uploadFiles", method = RequestMethod.POST)
|
||||
public void addRecordLog(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@RequestBody AddRiskDetailLog addRiskDetailLog) {
|
||||
// riskMerchantService.addDetailLog(addRiskDetailLog,manager);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/details", method = RequestMethod.GET)
|
||||
public JSONObject listDetails(QueryRiskDetail queryRiskDetail) {
|
||||
return riskMerchantService.getRiskDetails(queryRiskDetail);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/details/remark", method = RequestMethod.POST)
|
||||
public void addDetailRemark(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@RequestBody AddRiskDetailLog addRiskDetailLog ) {
|
||||
riskMerchantService.addDetailLog(addRiskDetailLog,manager);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package au.com.royalpay.payment.manage.task;
|
||||
|
||||
import au.com.royalpay.payment.manage.merchantid.core.MerchantIdManageService;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component
|
||||
@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true")
|
||||
public class SubMerchantIdTaskManager {
|
||||
@Resource
|
||||
private MerchantIdManageService merchantIdManageService;
|
||||
@Scheduled(cron = "0 0 4 * * ?")
|
||||
public void analysisDashboard(){
|
||||
merchantIdManageService.generateClientsSunMerchantId();
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="au.com.royalpay.payment.manage.mappers.payment.CommonSubMerchantIdMapper">
|
||||
<select id="list" resultType="com.alibaba.fastjson.JSONObject">
|
||||
select * from pmt_sub_merchant_id
|
||||
where is_valid = #{is_valid}
|
||||
<if test="sub_merchant_id!=null">
|
||||
and sub_merchant_id = #{sub_merchant_id}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="au.com.royalpay.payment.manage.mappers.risk.RiskMerchantDetailLogMapper">
|
||||
<select id="query" resultType="com.alibaba.fastjson.JSONObject">
|
||||
select *
|
||||
from risk_merchant_detail_log
|
||||
<where>
|
||||
<if test="record_id!=null">
|
||||
and record_id = #{record_id}
|
||||
</if>
|
||||
<if test="client_id!=0">
|
||||
and client_id = #{client_id}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="au.com.royalpay.payment.manage.mappers.risk.RiskMerchantRecordMapper">
|
||||
<select id="query" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT *
|
||||
FROM risk_merchant_record
|
||||
<where>
|
||||
<if test="record_id!=null">
|
||||
and id = #{record_id}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
and status = #{status}
|
||||
</if>
|
||||
<if test="client_moniker!=null">
|
||||
and client_moniker = #{client_moniker}
|
||||
</if>
|
||||
<if test="c_end_time!=null">
|
||||
and create_time < #{c_end_time}
|
||||
</if>
|
||||
<if test="client_id != 0">
|
||||
and client_id = #{client_id}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="au.com.royalpay.payment.manage.mappers.risk.RiskTransactionLogMapper">
|
||||
<select id="query" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT *
|
||||
FROM risk_transaction_log
|
||||
<where>
|
||||
<if test="record_id!=null">
|
||||
and record_id = #{record_id}
|
||||
</if>
|
||||
<if test="client_id !=0">
|
||||
and client_id = #{client_id}
|
||||
</if>
|
||||
<if test="c_end_time != null">
|
||||
and create_time < #{c_end_time}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,115 @@
|
||||
define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload', 'uiSelect'], function (angular) {
|
||||
'use strict';
|
||||
var app = angular.module('merchantIdManage', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ngFileUpload', 'ui.select']);
|
||||
app.config(['$stateProvider', function ($stateProvider) {
|
||||
$stateProvider.state('merchant_id_manage', {
|
||||
url: '/merchant_id/manage',
|
||||
templateUrl: '/static/payment/merchantid/templates/merchant_id_manage.html',
|
||||
controller: 'merchantIdManageCtrl',
|
||||
data: {label: '商户号列表'}
|
||||
})
|
||||
}]);
|
||||
app.controller('merchantIdManageCtrl', ['$scope', '$state', '$http', '$uibModal', 'commonDialog', function ($scope, $state, $http,$uibModal,commonDialog) {
|
||||
$scope.pagination = {};
|
||||
$scope.params = {};
|
||||
$scope.isCollapsed = true;
|
||||
|
||||
$scope.loadClient = function () {
|
||||
$scope.client_loading = true;
|
||||
$http.get('/sys/merchant_id').then(function (resp) {
|
||||
$scope.clientsMap = resp.data;
|
||||
$scope.client_loading = false;
|
||||
});
|
||||
};
|
||||
$scope.loadClient();
|
||||
$scope.loadNotTradeClient = function () {
|
||||
$http.get('/sys/merchant_id/trade').then(function (resp) {
|
||||
$scope.notTradeClientsMap = resp.data.merchant_id_map;
|
||||
$scope.refresh_time = resp.data.refresh_time;
|
||||
$scope.disable_button = false;
|
||||
});
|
||||
};
|
||||
$scope.loadNotTradeClient();
|
||||
|
||||
$scope.loadTempSubMerchantId = function () {
|
||||
var params = angular.copy($scope.params);
|
||||
if(!params.sub_merchant_id){
|
||||
delete params.sub_merchant_id;
|
||||
}
|
||||
$http.get('/sys/merchant_id/common_sub_merchant_id',{params: params}).then(function (resp) {
|
||||
$scope.subMerchantIdList= resp.data;
|
||||
});
|
||||
};
|
||||
$scope.loadTempSubMerchantId();
|
||||
$scope.showClient = function (sub_merchant_id) {
|
||||
$uibModal.open({
|
||||
templateUrl: '/static/payment/merchantid/templates/client_sub_merchant_id.html',
|
||||
controller: 'showClientsCtrl',
|
||||
resolve: {
|
||||
clients: ['$http', function ($http) {
|
||||
return $http.get('/sys/merchant_id/'+sub_merchant_id);
|
||||
}]
|
||||
},
|
||||
size: 'sm'
|
||||
})
|
||||
};
|
||||
|
||||
$scope.refresh = function () {
|
||||
$scope.disable_button = true;
|
||||
$http.post('/sys/merchant_id/refresh').then(function (resp) {
|
||||
$scope.loadNotTradeClient();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.save = function () {
|
||||
$uibModal.open({
|
||||
templateUrl: '/static/payment/merchantid/templates/new_common_sub_merchant_id.html',
|
||||
controller: 'newCommonSubMerchantIdCtrl'
|
||||
}).result.then(function () {
|
||||
$scope.loadTempSubMerchantId()
|
||||
})
|
||||
}
|
||||
$scope.disable = function (sub_merchant_id) {
|
||||
$http.put('/sys/merchant_id/common_sub_merchant_id/'+sub_merchant_id).then(function (resp) {
|
||||
commonDialog.alert({title: 'Success', content: 'Success', type: 'success'});
|
||||
$scope.loadTempSubMerchantId();
|
||||
},function (resp) {
|
||||
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}]);
|
||||
|
||||
app.controller('showClientsCtrl', ['$scope', '$http','clients', function ($scope, $http,clients) {
|
||||
$scope.clients = clients.data;
|
||||
}]);
|
||||
app.controller('newCommonSubMerchantIdCtrl', ['$scope', '$http','commonDialog','$state', function ($scope, $http,commonDialog,$state) {
|
||||
$scope.params = {};
|
||||
$scope.saveSubMerchantId = function () {
|
||||
var params = angular.copy($scope.params);
|
||||
$http.post('/sys/merchant_id/common_sub_merchant_id/'+params.sub_merchant_id).then(function () {
|
||||
$scope.$close();
|
||||
commonDialog.alert({title: 'Success', content: '保存成功', type: 'success'});
|
||||
},function (resp) {
|
||||
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
||||
});
|
||||
};
|
||||
}]);
|
||||
|
||||
app.filter('choose_merchant_id', function () {
|
||||
return function (value) {
|
||||
switch (value + '') {
|
||||
case '1307485301':
|
||||
return '1307485301(Tunnel Show1)';
|
||||
case '1431999902':
|
||||
return '1431999902(Tunnel Show2)';
|
||||
case '1487387142':
|
||||
return '1487387142(NAP)';
|
||||
case '':
|
||||
return ''
|
||||
}
|
||||
}
|
||||
});
|
||||
return app;
|
||||
});
|
@ -0,0 +1,26 @@
|
||||
<style>
|
||||
.padding-size{
|
||||
padding-top: 5px;
|
||||
padding-right: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
.padding-top-size{
|
||||
padding-top: 10px;
|
||||
}
|
||||
</style>
|
||||
<div class="modal-header padding-size">
|
||||
<h5>Clients</h5>
|
||||
</div>
|
||||
<div class="modal-body" padding-top-size>
|
||||
<div>
|
||||
<a ng-repeat="client in clients track by $index" ng-show="$index<clients.length-1"
|
||||
ui-sref="partners.detail({clientMoniker:client.client_moniker})">
|
||||
{{client.client_moniker}}<span class="text-black">,</span>
|
||||
</a>
|
||||
<a ng-repeat="client in clients" ng-if="$last"
|
||||
ui-sref="partners.detail({clientMoniker:client.client_moniker})">
|
||||
{{client.client_moniker}}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,156 @@
|
||||
<style>
|
||||
.cursor {
|
||||
cursor: pointer;
|
||||
}
|
||||
.div-display{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.i-rotate_90{
|
||||
animation:rotate_90 1s forwards;
|
||||
-webkit-animation:rotate_90 1s forwards; /* Safari and Chrome */
|
||||
}
|
||||
|
||||
@keyframes rotate_90
|
||||
{
|
||||
from {transform:rotate(0deg);}
|
||||
to {transform:rotate(90deg);}
|
||||
}
|
||||
|
||||
@-webkit-keyframes rotate_90 /* Safari and Chrome */
|
||||
{
|
||||
from {-webkit-transform:rotate(0deg);}
|
||||
to {-webkit-transform:rotate(90deg);}
|
||||
}
|
||||
</style>
|
||||
<div ui-view>
|
||||
<section class="content-header">
|
||||
<h1>Merchant Id Manage</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li>
|
||||
<i class="fa fa-sitemap"></i> Payment
|
||||
</li>
|
||||
<li class="active">Merchant Id Manage</li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<div class="content">
|
||||
<div class="box box-warning">
|
||||
<div class="box-body">
|
||||
<uib-tabset>
|
||||
<uib-tab heading="商户号列表">
|
||||
<loadingbar ng-if="client_loading"></loadingbar>
|
||||
<div class="col-sm-12 col-xs-12">
|
||||
<div style="margin-top: 5px">
|
||||
<div class="list-group col-sm-12 col-xs-12" ng-repeat="(key,clients) in clientsMap">
|
||||
<a class="list-group-item active col-sm-12 col-xs-12">
|
||||
{{key|choose_merchant_id}}
|
||||
<span ng-show="clients.length>59" class="small-box-footer cursor pull-right" ng-click="isCollapsed = !isCollapsed"><span ng-if="clients.length>59">更多 <i class="fa fa-arrow-circle-right" ng-class="{'i-rotate_90':!isCollapsed}"></i></span></span>
|
||||
</a>
|
||||
<a class="list-group-item col-sm-2 col-xs-6 cursor"
|
||||
ng-repeat="client in clients | orderBy:'client_count':true"
|
||||
ng--click="showClient(client.sub_merchant_id);" ng-if="$index<60">
|
||||
<span>
|
||||
{{client.sub_merchant_id}} <i class="fa fa-clock-o text-danger"
|
||||
title="Using temp Sub Merchant ID"
|
||||
ng-if="client.temp_sub_merchant"></i></span>
|
||||
<span class="badge" aria-hidden="true" title="show detail">{{client.client_count}}</span>
|
||||
</a>
|
||||
|
||||
<a class="list-group-item col-sm-2 col-xs-6 cursor" ng-hide="isCollapsed"
|
||||
ng-repeat="client in clients | orderBy:'client_count':true"
|
||||
ng--click="showClient(client.sub_merchant_id);" ng-if="$index>59">
|
||||
<span>
|
||||
{{client.sub_merchant_id}} <i class="fa fa-clock-o text-danger"
|
||||
title="Using temp Sub Merchant ID"
|
||||
ng-if="client.temp_sub_merchant"></i></span>
|
||||
<span class="badge" aria-hidden="true" title="show detail">{{client.client_count}}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</uib-tab>
|
||||
<uib-tab heading="近25天未交易商户号">
|
||||
<div class="box-body">
|
||||
<div class="col-sm-12 col-xs-12" style="padding-right: 30px;margin-bottom: 5px">
|
||||
<div class="pull-right">
|
||||
<span ng-if="refresh_time">
|
||||
<span>上次刷新时间:</span><span><em><b>{{refresh_time}}</b></em></span>
|
||||
</span>
|
||||
<a role="button" class="btn btn-primary" title="refresh" ng-click="refresh()" ng-class="{disabled:disable_button}">
|
||||
<i class="glyphicon glyphicon-refresh"
|
||||
title="refresh"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-xs-12">
|
||||
<loadingbar ng-if="disable_button"></loadingbar>
|
||||
<div>
|
||||
<div class="list-group col-sm-12 col-xs-12"
|
||||
ng-repeat="(key,clients) in notTradeClientsMap">
|
||||
<a class="list-group-item active col-sm-12 col-xs-12">
|
||||
{{key|choose_merchant_id}}
|
||||
<span ng-show="clients.length>59" class="small-box-footer cursor pull-right" ng-click="isCollapsed = !isCollapsed">更多 <i class="fa fa-arrow-circle-right" ng-class="{'i-rotate_90':!isCollapsed}"></i></span>
|
||||
</a>
|
||||
<a class="list-group-item col-sm-2 col-xs-6 cursor"
|
||||
ng-repeat="client in clients | orderBy:'client_count':true"
|
||||
ng--click="showClient(client.sub_merchant_id)" ng-if="$index<60">
|
||||
<span>{{client.sub_merchant_id}} <i class="fa fa-clock-o text-danger"
|
||||
title="Temp Sub Merchant ID"
|
||||
ng-if="client.temp_sub_merchant"></i></span>
|
||||
<span class="badge" aria-hidden="true" title="show detail">{{client.client_count}}</span>
|
||||
</a>
|
||||
<a class="list-group-item col-sm-2 col-xs-6 cursor" ng-hide="isCollapsed"
|
||||
ng-repeat="client in clients | orderBy:'client_count':true"
|
||||
ng--click="showClient(client.sub_merchant_id)" ng-if="$index>59">
|
||||
<span>{{client.sub_merchant_id}} <i class="fa fa-clock-o text-danger"
|
||||
title="Temp Sub Merchant ID"
|
||||
ng-if="client.temp_sub_merchant"></i></span>
|
||||
<span class="badge" aria-hidden="true" title="show detail">{{client.client_count}}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</uib-tab>
|
||||
<uib-tab heading="通用子商户号">
|
||||
<div class="box-body table-responsive">
|
||||
<div class="col-sm-12 col-xs-6">
|
||||
<a role="button" class="btn btn-primary pull-right" title="Add Sub Merchant Id" ng-click="save()">
|
||||
<i class="fa fa-plus"></i>
|
||||
Add
|
||||
</a>
|
||||
</div>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Merchant Id</th>
|
||||
<th>Sub Merchant Id</th>
|
||||
<th>Operator</th>
|
||||
<th>Create Time</th>
|
||||
<th>Operation</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="client in subMerchantIdList">
|
||||
<td ng-bind="client.merchant_id"></td>
|
||||
<td>
|
||||
{{client.sub_merchant_id}}
|
||||
<i class="fa fa-clock-o text-danger"
|
||||
title="Temp Sub Merchant ID"></i>
|
||||
</td>
|
||||
<td ng-bind="client.operator"></td>
|
||||
<td ng-bind="client.create_time"></td>
|
||||
<td>
|
||||
<a class="text-bold text-danger" role="button" ng-click="disable(client.sub_merchant_id)">Disable</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</uib-tab>
|
||||
</uib-tabset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,24 @@
|
||||
<section class="content-header">
|
||||
<h1>New Common Sub Merchant ID</h1>
|
||||
</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">
|
||||
<form role="form" style="margin:0px auto;width: 50%">
|
||||
<div class="form-group">
|
||||
<label>Sub Merchant ID</label>
|
||||
<input ng-model="params.sub_merchant_id" class="form-control" type="text" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button class="btn btn-primary btn-block" ng-click="saveSubMerchantId()">save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,41 @@
|
||||
<section class="content-header">
|
||||
<h1>Sub Merchant Id Logs</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li>
|
||||
<i class="fa fa-users"></i> Configuration
|
||||
</li>
|
||||
<li class="active">logs</li>
|
||||
</ol>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="box-solid">
|
||||
<div class="box box-warning">
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="col-sm-12 table-responsive">
|
||||
<table class="table table-striped table-bordered table-hover" ng-if="logs.length>0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Sub Merchant Id Before</th>
|
||||
<th>Sub Merchant Id After</th>
|
||||
<th>Operator</th>
|
||||
<th>Create Time</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="log in logs">
|
||||
<td ng-bind="log.sub_merchant_id_before"></td>
|
||||
<td ng-bind="log.sub_merchant_id_after"></td>
|
||||
<td ng-bind="log.operator"></td>
|
||||
<td ng-bind="log.create_time"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
Binary file not shown.
@ -0,0 +1,243 @@
|
||||
define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], function (angular) {
|
||||
'use strict';
|
||||
|
||||
var riskType = [
|
||||
{code: '1', label: 'test1'},
|
||||
{code: '2', label: 'test2'},
|
||||
];
|
||||
|
||||
var app = angular.module('RiskManagement', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ngFileUpload']);
|
||||
app.config(['$stateProvider', function ($stateProvider) {
|
||||
$stateProvider.state('analysis_monitoring.risk_manager', {
|
||||
url: '/risk/manage',
|
||||
templateUrl: '/static/risk/templates/risk.html',
|
||||
controller: 'RiskManageCtrl',
|
||||
}).state('analysis_monitoring.risk_orders', {
|
||||
url: '/risk/{record_id}/orders',
|
||||
templateUrl: '/static/risk/templates/risk_orders.html',
|
||||
controller: 'RiskOrderCtrl',
|
||||
resolve:{
|
||||
record:['$http','$stateParams', function ($http,$stateParams) {
|
||||
return $http.get('/sys/risk/records/'+$stateParams.record_id).then(function (res) {
|
||||
return res.data;
|
||||
});
|
||||
}]
|
||||
}
|
||||
}).state('analysis_monitoring.risk_history', {
|
||||
url: '/risk/{record_id}/history',
|
||||
templateUrl: '/static/risk/templates/risk_history.html',
|
||||
controller: 'RecordHistoryCtrl',
|
||||
resolve:{
|
||||
record:['$http','$stateParams', function ($http,$stateParams) {
|
||||
return $http.get('/sys/risk/records/'+$stateParams.record_id).then(function (res) {
|
||||
return res.data;
|
||||
});
|
||||
}]
|
||||
}
|
||||
}).state('analysis_monitoring.risk_detail', {
|
||||
url: '/risk/{record_id}/detail',
|
||||
templateUrl: '/static/risk/templates/risk_detail.html',
|
||||
controller: 'RecordDetailCtrl',
|
||||
resolve:{
|
||||
record:['$http','$stateParams', function ($http,$stateParams) {
|
||||
return $http.get('/sys/risk/records/'+$stateParams.record_id).then(function (res) {
|
||||
return res.data;
|
||||
});
|
||||
}]
|
||||
}
|
||||
});
|
||||
}]);
|
||||
app.controller('RiskManageCtrl', ['$scope', '$http', function ($scope, $http){
|
||||
$scope.params = {};
|
||||
$scope.pagination = {};
|
||||
$scope.loadRecords = function (page) {
|
||||
var params = angular.copy($scope.params);
|
||||
params.page = page || $scope.pagination.page || 1;
|
||||
$http.get('/sys/risk/records', {params: params}).then(function (resp) {
|
||||
$scope.records = resp.data.data;
|
||||
$scope.pagination = resp.data.pagination;
|
||||
});
|
||||
};
|
||||
$scope.loadRecords(1);
|
||||
}]);
|
||||
|
||||
app.controller('RiskOrderCtrl', ['$scope', '$http', 'record', function ($scope, $http,record) {
|
||||
$scope.params = {record_id: record.id};
|
||||
$scope.historyParams = {client_id:record.client_id};
|
||||
$scope.pagination = {};
|
||||
$scope.historyPagination = {};
|
||||
$scope.record = record;
|
||||
$scope.loadOrders = function (page) {
|
||||
var params = angular.copy($scope.params);
|
||||
params.page = page || $scope.pagination.page || 1;
|
||||
$http.get('/sys/risk/orders',{params: params}).then(function (resp) {
|
||||
$scope.referenceOrders = resp.data.data;
|
||||
$scope.pagination = resp.data.pagination;
|
||||
$scope.historyParams.c_end_time = $scope.orders.pop().create_time;
|
||||
$scope.loadHistoryOrders(1);
|
||||
});
|
||||
};
|
||||
$scope.loadOrders(1);
|
||||
|
||||
$scope.loadHistoryOrders = function (page) {
|
||||
var historyParams = angular.copy($scope.historyParams);
|
||||
historyParams.page = page || $scope.historyPagination.page || 1;
|
||||
$http.get('/sys/risk/orders',{params: historyParams}).then(function (resp) {
|
||||
$scope.historyOrders = resp.data.data;
|
||||
$scope.historyPagination = resp.data.pagination;
|
||||
});
|
||||
};
|
||||
}]);
|
||||
|
||||
app.controller('RecordHistoryCtrl', ['$scope', '$http','$uibModal', 'commonDialog','record', function ($scope, $http,$uibModal,commonDialog,record) {
|
||||
$scope.record = record;
|
||||
$scope.pagination = {};
|
||||
$scope.params = {client_id:record.client_id,c_end_time:record.create_time};
|
||||
$scope.listHistory = function (page) {
|
||||
var params = angular.copy($scope.params);
|
||||
params.page = page || $scope.pagination.page || 1;
|
||||
$http.get('/sys/risk/records',{params:params}).then(function (res) {
|
||||
$scope.histories = res.data.data;
|
||||
$scope.pagination = res.data.pagination;
|
||||
})
|
||||
};
|
||||
$scope.listHistory(1);
|
||||
$scope.edit = function () {
|
||||
$uibModal.open({
|
||||
templateUrl: '/static/risk/templates/risk_edit.html',
|
||||
controller: 'RiskRecordHandleCtrl',
|
||||
resolve:{record_id:function () {
|
||||
return record.id;
|
||||
}}
|
||||
}).result.then(function () {
|
||||
commonDialog.alert({
|
||||
title: 'Success',
|
||||
type: 'success'
|
||||
});
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
$scope.noop = function () {
|
||||
commonDialog.confirm({
|
||||
title: 'Confirm',
|
||||
content: '确定放弃这次预警'
|
||||
}).then(function () {
|
||||
$http.put('/sys/risk/records/'+ record.id+'/noop', $scope.params).then(function () {
|
||||
}).then(function (resp) {
|
||||
commonDialog.alert({
|
||||
title: 'Error',
|
||||
content: resp.data.message,
|
||||
type: 'Error'
|
||||
});
|
||||
})
|
||||
})
|
||||
}
|
||||
}]);
|
||||
|
||||
app.controller('RecordDetailCtrl', ['$scope', '$http','$uibModal', 'commonDialog','record', function ($scope, $http,$uibModal,commonDialog,record) {
|
||||
$scope.record = record;
|
||||
$scope.pagination = {};
|
||||
$scope.params = {record_id:record.id};
|
||||
$scope.listDetail = function (page) {
|
||||
var params = angular.copy($scope.params);
|
||||
params.page = page || $scope.pagination.page || 1;
|
||||
$http.get('/sys/risk/details',{params:params}).then(function (res) {
|
||||
$scope.details = res.data.data;
|
||||
$scope.pagination = res.data.pagination;
|
||||
})
|
||||
};
|
||||
$scope.listDetail(1);
|
||||
$scope.addRemark = function () {
|
||||
$uibModal.open({
|
||||
templateUrl: '/static/risk/templates/risk_remark.html',
|
||||
controller: 'RiskDetailRemarkCtrl',
|
||||
resolve:{record_id:function () {
|
||||
return record.id;
|
||||
}}
|
||||
}).result.then(function () {
|
||||
$scope.listDetail(1);
|
||||
commonDialog.alert({
|
||||
title: 'Success',
|
||||
type: 'success'
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
$scope.dealDirectly = function () {
|
||||
commonDialog.confirm({
|
||||
title: 'Confirm',
|
||||
content: '确定关结这次预警?'
|
||||
}).then(function () {
|
||||
$http.put('/sys/risk/records/'+ record.id+'/directly').then(function () {
|
||||
commonDialog.alert({
|
||||
title: 'Success',
|
||||
type: 'Success'
|
||||
});
|
||||
$scope.listDetail(1);
|
||||
$scope.record.status=1;
|
||||
}).then(function (resp) {
|
||||
commonDialog.alert({
|
||||
title: 'Error',
|
||||
content: resp.data.message,
|
||||
type: 'Error'
|
||||
});
|
||||
})
|
||||
})
|
||||
}
|
||||
}]);
|
||||
|
||||
app.controller('RiskDetailRemarkCtrl', ['$scope', '$http','record_id','commonDialog', function ($scope, $http,record_id,commonDialog) {
|
||||
$scope.addRemarkParams = {record_id:record_id};
|
||||
$scope.addRemark = function () {
|
||||
var params = angular.copy($scope.addRemarkParams);
|
||||
$http.post('/sys/risk/details/remark',params).then(function (res) {
|
||||
$scope.$close();
|
||||
}).then(function (resp) {
|
||||
commonDialog.alert({
|
||||
title: 'Error',
|
||||
content: resp.data.message,
|
||||
type: 'Error'
|
||||
});
|
||||
})
|
||||
}
|
||||
}]);
|
||||
|
||||
app.controller('RiskRecordHandleCtrl', ['$scope', '$http','record_id','commonDialog', function ($scope, $http,record_id,commonDialog) {
|
||||
$scope.params= {};
|
||||
$scope.handle = function () {
|
||||
$http.put('/sys/risk/records/'+ record_id+'/deal', $scope.params).then(function () {
|
||||
$scope.$close();
|
||||
}).then(function (resp) {
|
||||
commonDialog.alert({
|
||||
title: 'Error',
|
||||
content: resp.data.message,
|
||||
type: 'Error'
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
}]);
|
||||
app.filter('risk_type', function () {
|
||||
return function (riskStr) {
|
||||
angular.forEach(riskType,function (type) {
|
||||
riskStr = riskStr.replace(type.code,type.label);
|
||||
})
|
||||
return riskStr;
|
||||
};
|
||||
});
|
||||
app.filter('status_type', function () {
|
||||
return function (riskStr) {
|
||||
var statusResult = '';
|
||||
switch (riskStr){
|
||||
case('0'): statusResult = '待处理';break;
|
||||
case('1'): statusResult = '已处理';break;
|
||||
case('2'): statusResult = '处理中';break;
|
||||
default: statusResult = '';
|
||||
}
|
||||
return statusResult;
|
||||
};
|
||||
});
|
||||
|
||||
return app;
|
||||
});
|
@ -0,0 +1,58 @@
|
||||
<div ui-view>
|
||||
<section class="content-header">
|
||||
<h1>Risk Manager</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><i class="fa fa-gift"></i> Risk</li>
|
||||
<li class="active">Risk Manager</li>
|
||||
</ol>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="box box-default">
|
||||
<div class="box-header">Records</div>
|
||||
<div class="box-body table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Client Moniker</th>
|
||||
<th>Create Time</th>
|
||||
<th>Waring Time</th>
|
||||
<th>Status</th>
|
||||
<th>Risk Types</th>
|
||||
<th>Risk Counts</th>
|
||||
<th>Operation</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="record in records">
|
||||
<td>{{record.client_moniker}}</td>
|
||||
<td>{{record.create_time}}</td>
|
||||
<td>{{record.expiry_time}}</td>
|
||||
<td>{{record.status|status_type}}</td>
|
||||
<td>{{record.risk_types|risk_type}}</td>
|
||||
<td>{{record.risk_counts}}</td>
|
||||
<td>
|
||||
<a class="text-primary" role="button" title="Detail" ui-sref="analysis_monitoring.risk_orders({'record_id':record.id})">
|
||||
<i class="fa fa-search" ></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="modal-footer">
|
||||
<uib-pagination ng-if="records.length"
|
||||
class="pagination"
|
||||
total-items="pagination.totalCount"
|
||||
boundary-links="true"
|
||||
ng-model="pagination.page"
|
||||
items-per-page="pagination.limit"
|
||||
max-size="10"
|
||||
ng-change="loadRecords()"
|
||||
previous-text="‹"
|
||||
next-text="›"
|
||||
first-text="«"
|
||||
last-text="»"></uib-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
@ -0,0 +1,63 @@
|
||||
<div ui-view>
|
||||
<section class="content-header">
|
||||
<h1>Risk Manager</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><i class="fa fa-gift"></i> Risk</li>
|
||||
<li class="fa fa-gift">Risk Manager</li>
|
||||
<li class="active">Handling Detail</li>
|
||||
</ol>
|
||||
</section>
|
||||
<section class="content">
|
||||
<ul class="nav nav-tabs">
|
||||
<li ui-sref-active-eq="active">
|
||||
<a ui-sref="analysis_monitoring.risk_orders({'record_id':record.id})">Risk Orders</a>
|
||||
</li>
|
||||
<li ui-sref-active="active">
|
||||
<a ui-sref="analysis_monitoring.risk_history({'record_id':record.id})">Risk history</a>
|
||||
</li>
|
||||
<li ui-sref-active="active">
|
||||
<a ui-sref="analysis_monitoring.risk_detail({'record_id':record.id})">Handling Detail</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="box box-default">
|
||||
<div class="box-header">Handling Details</div>
|
||||
<div class="box-header" ng-if="record.status==0" style="text-align: right;">
|
||||
<button type="button" class="btn btn-info" ng-click="addRemark()">Handle</button>
|
||||
<button type="button" class="btn btn-info" ng-click="dealDirectly()">Close Risk</button>
|
||||
</div>
|
||||
<div class="box-body table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Handle Time</th>
|
||||
<th>Operator</th>
|
||||
<th>Detail</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="record in details">
|
||||
<td>{{record.create_time}}</td>
|
||||
<td>{{record.auditor}}</td>
|
||||
<td>{{record.remark}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="modal-footer">
|
||||
<uib-pagination ng-if="details.length"
|
||||
class="pagination"
|
||||
total-items="pagination.totalCount"
|
||||
boundary-links="true"
|
||||
ng-model="pagination.page"
|
||||
items-per-page="pagination.limit"
|
||||
max-size="10"
|
||||
ng-change="listDetail()"
|
||||
previous-text="‹"
|
||||
next-text="›"
|
||||
first-text="«"
|
||||
last-text="»"></uib-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
</div>
|
@ -0,0 +1,32 @@
|
||||
<section class="content-header">
|
||||
<h1>Add Remark</h1>
|
||||
</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">
|
||||
<form role="form" style="margin:0px auto;width: 50%">
|
||||
<div class="form-group">
|
||||
<label>Limit Amount</label>
|
||||
<input ng-model="params.limitAmount" name="code" class="form-control" type="text"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>
|
||||
<input type="checkbox" ng-model="params.disableMerchat" class="ng-pristine ng-untouched ng-valid">
|
||||
Disable Merchant
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<button class="btn btn-primary btn-block" ng-click="handle()">commit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,69 @@
|
||||
<div ui-view>
|
||||
<section class="content-header">
|
||||
<h1>Risk Manager</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><i class="fa fa-gift"></i> Risk</li>
|
||||
<li class="fa fa-gift">Risk Manager</li>
|
||||
<li class="active">Risk records</li>
|
||||
</ol>
|
||||
</section>
|
||||
<section class="content">
|
||||
<ul class="nav nav-tabs">
|
||||
<ul class="nav nav-tabs">
|
||||
<li ui-sref-active-eq="active">
|
||||
<a ui-sref="analysis_monitoring.risk_orders({'record_id':record.id})">Risk Orders</a>
|
||||
</li>
|
||||
<li ui-sref-active="active">
|
||||
<a ui-sref="analysis_monitoring.risk_history({'record_id':record.id})">Risk history</a>
|
||||
</li>
|
||||
<li ui-sref-active="active">
|
||||
<a ui-sref="analysis_monitoring.risk_detail({'record_id':record.id})">Handling Detail</a>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
<div class="box box-default">
|
||||
<!--
|
||||
<div class="box-header">Latest Record</div>
|
||||
-->
|
||||
<div class="box-body table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Client Moniker</th>
|
||||
<th>Create Time</th>
|
||||
<th>Waring Time</th>
|
||||
<th>Risk Types</th>
|
||||
<th>Status</th>
|
||||
<th>Risk Counts</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="record in histories">
|
||||
<td>{{record.client_moniker}}</td>
|
||||
<td>{{record.create_time}}</td>
|
||||
<td>{{record.expiry_time}}</td>
|
||||
<td>{{record.status}}</td>
|
||||
<td>{{record.risk_types|risk_type}}</td>
|
||||
<td>{{record.risk_counts}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="modal-footer">
|
||||
<uib-pagination ng-if="histories.length"
|
||||
class="pagination"
|
||||
total-items="pagination.totalCount"
|
||||
boundary-links="true"
|
||||
ng-model="pagination.page"
|
||||
items-per-page="pagination.limit"
|
||||
max-size="10"
|
||||
ng-change="listHistory()"
|
||||
previous-text="‹"
|
||||
next-text="›"
|
||||
first-text="«"
|
||||
last-text="»"></uib-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
</div>
|
@ -0,0 +1,105 @@
|
||||
<div ui-view>
|
||||
<section class="content-header">
|
||||
<h1>Risk Manager</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><i class="fa fa-gift"></i> Risk</li>
|
||||
<li class="fa fa-gift">Risk Manager</li>
|
||||
<li class="active">Risk records</li>
|
||||
</ol>
|
||||
</section>
|
||||
<section class="content">
|
||||
<ul class="nav nav-tabs">
|
||||
<ul class="nav nav-tabs">
|
||||
<li ui-sref-active-eq="active">
|
||||
<a ui-sref="analysis_monitoring.risk_orders({'record_id':record.id})">Risk Orders</a>
|
||||
</li>
|
||||
<li ui-sref-active="active">
|
||||
<a ui-sref="analysis_monitoring.risk_history({'record_id':record.id})">Risk history</a>
|
||||
</li>
|
||||
<li ui-sref-active="active">
|
||||
<a ui-sref="analysis_monitoring.risk_detail({'record_id':record.id})">Handling Detail</a>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
<div class="box box-default">
|
||||
<div class="box-header">Reference Orders</div>
|
||||
<div class="box-body table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Order Id</th>
|
||||
<th>Amount</th>
|
||||
<th>Channel</th>
|
||||
<th>Create Time</th>
|
||||
<th>Risk Types</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="order in referenceOrders">
|
||||
<td>{{order.order_id}}</td>
|
||||
<td>{{order.amount}}</td>
|
||||
<td>{{order.channel}}</td>
|
||||
<td>{{order.create_time}}</td>
|
||||
<td>{{order.risk_types|risk_type}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<uib-pagination ng-if="referenceOrders.length"
|
||||
class="pagination"
|
||||
total-items="pagination.totalCount"
|
||||
boundary-links="true"
|
||||
ng-model="pagination.page"
|
||||
items-per-page="pagination.limit"
|
||||
max-size="10"
|
||||
ng-change="loadOrders()"
|
||||
previous-text="‹"
|
||||
next-text="›"
|
||||
first-text="«"
|
||||
last-text="»"></uib-pagination>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box box-default">
|
||||
<div class="box-header">Waring Orders History</div>
|
||||
<div class="box-body table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Order Id</th>
|
||||
<th>Amount</th>
|
||||
<th>Channel</th>
|
||||
<th>Create Time</th>
|
||||
<th>Risk Types</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="order in historyOrders">
|
||||
<td>{{order.order_id}}</td>
|
||||
<td>{{order.amount}}</td>
|
||||
<td>{{order.channel}}</td>
|
||||
<td>{{order.create_time}}</td>
|
||||
<td>{{order.risk_types|risk_type}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<uib-pagination ng-if="historyOrders.length"
|
||||
class="pagination"
|
||||
total-items="historyPagination.totalCount"
|
||||
boundary-links="true"
|
||||
ng-model="historyPagination.page"
|
||||
items-per-page="historyPagination.limit"
|
||||
max-size="10"
|
||||
ng-change="loadHistorysOrders()"
|
||||
previous-text="‹"
|
||||
next-text="›"
|
||||
first-text="«"
|
||||
last-text="»"></uib-pagination>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
</div>
|
@ -0,0 +1,25 @@
|
||||
<section class="content-header">
|
||||
<h1>Handle Detail</h1>
|
||||
</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">
|
||||
<form role="form" style="margin:0px auto;width: 50%">
|
||||
<div class="form-group">
|
||||
<label>Detail</label>
|
||||
<input ng-model="addRemarkParams.remark" name="code" class="form-control" type="text"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button class="btn btn-primary btn-block" ng-click="addRemark()">commit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,83 @@
|
||||
package au.com.royalpay.payment.manage.task;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.function.BinaryOperator;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Create by yixian at 2018-05-01 17:15
|
||||
*/
|
||||
public class FillExcelTask {
|
||||
|
||||
private File rpayCat = new File("C:\\Users\\yixian\\develop\\royalpayv2\\manage\\src\\main\\ui\\static\\data\\royalpayindustry.json");
|
||||
private File wxCat = new File("C:\\Users\\yixian\\develop\\royalpayv2\\manage\\src\\main\\resources\\wx_industry.json");
|
||||
|
||||
private Map<String, String> royalCatMap;
|
||||
private Map<String, String> wxCatMap;
|
||||
private File excel = new File("C:\\Users\\yixian\\Documents\\bd_merchants.xlsx");
|
||||
|
||||
@Before
|
||||
public void initCategory() throws IOException {
|
||||
String rpayCatStr = FileUtils.readFileToString(rpayCat, "utf-8");
|
||||
JSONArray rpayCatJson = JSON.parseArray(rpayCatStr);
|
||||
List<JSONObject> flatCollect = rpayCatJson.stream().map(item -> (JSONObject) item)
|
||||
.flatMap(item -> loadChildren(item).stream()).collect(Collectors.toList());
|
||||
royalCatMap = rpayCatJson.stream().map(item -> (JSONObject) item)
|
||||
.flatMap(item -> loadChildren(item).stream())
|
||||
.collect(Collectors.toMap(item -> item.getString("mccCode"), item -> item.getString("label"), (a, b) -> a));
|
||||
|
||||
String wxCatStr = FileUtils.readFileToString(wxCat, "utf-8");
|
||||
JSONObject wxCatJson = JSON.parseObject(wxCatStr);
|
||||
wxCatMap = wxCatJson.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> (String) entry.getValue()));
|
||||
|
||||
}
|
||||
|
||||
private List<JSONObject> loadChildren(JSONObject entity) {
|
||||
if (entity.containsKey("children") && !entity.getJSONArray("children").isEmpty()) {
|
||||
List<JSONObject> arr = new ArrayList<>(Arrays.asList(entity));
|
||||
arr.addAll(entity.getJSONArray("children").stream().map(item -> (JSONObject) item).flatMap(item -> loadChildren(item).stream()).collect(Collectors.toList()));
|
||||
return arr;
|
||||
}
|
||||
return Collections.singletonList(entity);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void replaceCat() throws IOException, InvalidFormatException {
|
||||
Workbook wb = WorkbookFactory.create(excel);
|
||||
Sheet sheet = wb.getSheetAt(0);
|
||||
for (int rn = 1; rn <= sheet.getLastRowNum(); rn++) {
|
||||
Row row = sheet.getRow(rn);
|
||||
Cell wxCatCell = row.getCell(2);
|
||||
Cell rpCatCell = row.getCell(3);
|
||||
fillCateLabel(wxCatCell, wxCatMap);
|
||||
fillCateLabel(rpCatCell, royalCatMap);
|
||||
}
|
||||
wb.write(new FileOutputStream("C:\\Users\\yixian\\Documents\\bd_merchants_final.xlsx"));
|
||||
}
|
||||
|
||||
private void fillCateLabel(Cell rpCatCell, Map<String, String> royalCatMap) {
|
||||
if (rpCatCell == null) {
|
||||
return;
|
||||
}
|
||||
if (rpCatCell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
|
||||
String typeNum = (int) rpCatCell.getNumericCellValue() + "";
|
||||
if (royalCatMap.get(typeNum) != null) {
|
||||
rpCatCell.setCellType(Cell.CELL_TYPE_STRING);
|
||||
rpCatCell.setCellValue(royalCatMap.get(typeNum));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue