@ -30,6 +30,7 @@ import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException ;
import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor ;
import au.com.royalpay.payment.tools.utils.PageListUtils ;
import com.alibaba.fastjson.JSON ;
import com.alibaba.fastjson.JSONObject ;
import com.github.miemiedev.mybatis.paginator.domain.Order ;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds ;
@ -46,6 +47,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.data.redis.core.StringRedisTemplate ;
import org.springframework.stereotype.Service ;
import org.springframework.transaction.annotation.Transactional ;
import org.thymeleaf.context.Context ;
import org.thymeleaf.spring4.SpringTemplateEngine ;
@ -113,7 +115,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
public JSONObject getRiskEventsByPage ( JSONObject params , JSONObject manager ) {
// 如果登录的角色是BD, 添加查询条件result_type为1,2,3,4, order_type为1或者2
if ( ManagerRole. BD_USER . hasRole ( manager . getIntValue ( "role" ) ) ) {
if ( manager ! = null & & ManagerRole. BD_USER . hasRole ( manager . getIntValue ( "role" ) ) ) {
params . put ( "bd_id" , manager . getString ( "manager_id" ) ) ;
List < Integer > orderTypes = Arrays . asList ( RiskOrderTypeEnum . WECHAT_ORDER . getOrderType ( ) ,
RiskOrderTypeEnum . ALIPAY_ORDER . getOrderType ( ) ) ;
@ -536,6 +538,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
}
@Override
@Transactional
public void completeEventRealOrderIds ( ) {
List < JSONObject > riskEventList = getRiskEvents ( null ) ;
if ( riskEventList ! = null & & riskEventList . size ( ) > 0 ) {
@ -727,4 +730,89 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
riskEventMapper . deleteRiskEvent ( riskId ) ;
}
@Override
public JSONObject getNoticeInfo ( int clientId ) {
JSONObject client = clientMapper . findClient ( clientId ) ;
if ( client = = null ) {
throw new InvalidShortIdException ( ) ;
}
JSONObject params = new JSONObject ( ) ;
params . put ( "is_send_client" , 1 ) ;
List < Integer > resultTypes = Arrays . asList ( RiskResultTypeEnum . SEND_EMAIL_TO_BD . getResultType ( ) ,
RiskResultTypeEnum . MATERIAL_NOT_PASS . getResultType ( ) ) ;
params . put ( "result_types" , resultTypes ) ;
PageList < JSONObject > riskEventList = riskEventMapper . listRisksByPage ( params , new PageBounds ( Order . formString ( "create_time.desc" ) ) ) ;
JSONObject result = new JSONObject ( ) ;
result . put ( "notice_flag" , false ) ;
if ( riskEventList ! = null & & riskEventList . size ( ) > 0 ) {
result . put ( "notice_flag" , true ) ;
}
return result ;
}
@Override
public JSONObject getRiskEventMaterialsRemark ( String riskId ) {
JSONObject riskEvent = riskEventMapper . findById ( riskId ) ;
Integer orderType = riskEvent . getInteger ( "order_type" ) ;
List < JSONObject > materialItemList = new ArrayList < > ( ) ;
List < String > materialsRemark = new ArrayList < > ( ) ;
if ( orderType . equals ( RiskOrderTypeEnum . WECHAT_ORDER . getOrderType ( ) ) ) {
materialsRemark = Arrays . asList (
"1、物流公司发货单据照片 要求:每笔交易对应的物流单必须提供,且单据必须清晰可见\n" +
"Photos of logistics companies’ goods-delivery documents Requirement: The logistics order record corresponding to each transaction must be provided, and details of records should be clearly visible. " ,
"2、用户购买虚拟物品需要提供聊天记录、订单信息、发货凭证截图、 虚拟物品最终消费场景(例如何种游戏、软件)、提供消费场景网址/下载链接 要求:每笔交易对应的截图必须清晰可见\n" +
"Users need to provide chat records, order information, screenshots of delivery documents, final consumption scenarios of virtual goods (such as games, software); provide consumer scene URL / download link. Requirement: The screenshot corresponding to each transaction must be clearly visible. " ,
"3、购物小票/发票存根照片 照片应清晰,必须显示商户名称、商户地址、购物时间、物品名称 购物金额等\n" +
"Photos of shopping receipts/ invoice stubs Requirement: The photos should be clear and must show Merchant name, Business address, Transaction time, Product information, Quantity purchased, etc. " ,
"4、显示商户门牌号码和店头名称的照片 要求:清晰可见,至少一张\n" +
"Photos of Merchant Street number & Merchant name Requirement: At least one visible photo " ,
"5、显示商户营业场景所场内部情况( 如店内商品陈列、收银台等) 的照片 要求:照片清晰,且能清楚显示商户实际售卖物品或服务,至少三张\n" +
"Photos of internal environment of merchant business (such as in-store merchandise display, checkout counter, etc.) Requirements: The photos (at least three) showing merchant activities including actual selling-goods or services obviously " ,
"6、其他图片\n" +
"Other pictures "
) ;
} else if ( orderType . equals ( RiskOrderTypeEnum . ALIPAY_ORDER . getOrderType ( ) ) ) {
String alipayMaterials = riskEvent . getString ( "alipay_materials" ) ;
if ( StringUtils . isNotBlank ( alipayMaterials ) ) {
List < JSONObject > alipayMaterialRemarkList = JSONObject . parseArray ( alipayMaterials , JSONObject . class ) ;
if ( alipayMaterialRemarkList ! = null & & alipayMaterialRemarkList . size ( ) > 0 ) {
for ( int i = 0 ; i < alipayMaterialRemarkList . size ( ) ; i + + ) {
materialsRemark . add ( alipayMaterialRemarkList . get ( i ) . getString ( "question" + ( i + 1 ) ) ) ;
}
}
}
} else if ( orderType . equals ( RiskOrderTypeEnum . ROYALPAY_ORDER . getOrderType ( ) ) ) {
materialsRemark = Arrays . asList (
"1.请解释相应的消费场景/业务模式,例如网站商城,扫码支付, 消费者到店支付等;\n" +
"Please explain the relative payment scenario/business activities, for example, online store, QR code payment, payment at the store, etc;" ,
"2.提供相应购物清单,订单小票(请提供与被查交易订单号相匹配的交易时间及金额的发票);\n" +
"Provide related shopping lists, invoices. (Please provide the invoices, amount of which matches that of the abnormal transaction);" ,
"3.提供相应的发货证明,报关单(若有消费者在国内购买,请提供物流单据或报关单);\n" +
"Relative proof of delivery, customs declaration (If the consumer purchased from China, please provide shipping receipt or customs declaration);" ,
"4.提供您的门店照片(门店照及店铺内的照片各一张, 一张可以看到商户名的门头照,一张可以看到相关商品或服务的店内照片);\n" +
"Photos of the store ( one of each front-store and in-store);" ,
"5.其他可以还原交易背景的资料,如和消费者的聊天记录等,来佐证被查单号交易的真实性;\n" +
"Other materials that can verify the payment scenario, for example, chatting history, to prove the truth of the transactions;" ,
"6、其他图片\n" +
"Other pictures"
) ;
}
JSONObject material = getRiskMaterial ( riskEvent ) ;
for ( int i = 0 ; i < materialsRemark . size ( ) ; i + + ) {
JSONObject materialItem = new JSONObject ( ) ;
materialItem . put ( "question" + ( i + 1 ) , materialsRemark . get ( i ) ) ;
if ( material ! = null )
materialItem . put ( "file" + ( i + 1 ) , material . getJSONArray ( "file" + ( i + 1 ) ) ) ;
materialItemList . add ( materialItem ) ;
}
JSONObject result = new JSONObject ( ) ;
result . put ( "material" , materialItemList ) ;
if ( material ! = null & & material . containsKey ( "description" ) )
result . put ( "description" , material . getString ( "description" ) ) ;
return result ;
}
}