Authored by mingdan.ge

Merge branch 'master' into dev_toutiao_190401

... ... @@ -93,6 +93,7 @@
<value>/UnionShareRest/bindBankCard</value>
<value>/UnionShareRest/getBankList</value>
<value>/UnionShareRest/getBankCard</value>
<value>/UnionShareRest/getBankCardUfo</value>
<value>/UnionShareRest/checkBankCard</value>
<value>/UnionShareRest/queryUnionShareUserBanks</value>
<value>/UnionShareRest/queryUnionShareUserApplys</value>
... ...
... ... @@ -19,6 +19,7 @@ public class UnionShareUserBank extends BaseBO{
private String bankCode;
private Byte status;
private Byte source;
private Integer createTime;
... ... @@ -80,6 +81,14 @@ public class UnionShareUserBank extends BaseBO{
this.status = status;
}
public Byte getSource() {
return source;
}
public void setSource(Byte source) {
this.source = source;
}
public Integer getCreateTime() {
return createTime;
}
... ...
... ... @@ -11,6 +11,7 @@
<result column="bank_code" property="bankCode" jdbcType="VARCHAR" />
<result column="bank_branch" property="bankBranch" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="source" property="source" jdbcType="TINYINT" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
</resultMap>
... ... @@ -36,7 +37,7 @@
resultType="com.yoho.service.model.union.response.UnionShareUserBankListBO"
parameterType="com.yoho.service.model.union.request.UnionShareUserBankListReqBo">
select id, uid, id_card_no idCardNo, name, bank_card_no bankCardNo, bank_name bankName,
bank_code bankCode, status, create_time createTime, update_time updateTime,bank_branch bankBranch
bank_code bankCode, status,source, create_time createTime, update_time updateTime,bank_branch bankBranch
from union_share_user_bank
where 1=1
<if test="uid != null">
... ... @@ -60,6 +61,9 @@
<if test="status != null">
and status = #{status,jdbcType=INTEGER}
</if>
<if test="source != null">
and source = #{source,jdbcType=INTEGER}
</if>
order by id desc limit #{start},#{size}
</select>
<select id="selectTotalByCondition" resultType="java.lang.Integer"
... ... @@ -88,6 +92,9 @@
<if test="status != null">
and status = #{status,jdbcType=INTEGER}
</if>
<if test="source != null">
and source = #{source,jdbcType=INTEGER}
</if>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from union_share_user_bank
... ... @@ -96,11 +103,11 @@
<insert id="insert" parameterType="com.yoho.unions.dal.model.UnionShareUserBank" >
insert into union_share_user_bank (id, uid, id_card_no,
name, bank_card_no, bank_name, bank_code, bank_branch,
status, create_time, update_time
status,source, create_time, update_time
)
values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER}, #{idCardNo,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{bankCardNo,jdbcType=VARCHAR}, #{bankName,jdbcType=VARCHAR}, #{bankCode,jdbcType=VARCHAR}, #{bankBranch,jdbcType=VARCHAR},
#{status,jdbcType=TINYINT}, #{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER}
#{status,jdbcType=TINYINT}, #{source,jdbcType=TINYINT}, #{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.yoho.unions.dal.model.UnionShareUserBank" >
... ... @@ -133,6 +140,9 @@
<if test="status != null" >
status,
</if>
<if test="source != null" >
source,
</if>
<if test="createTime != null" >
create_time,
</if>
... ... @@ -168,6 +178,9 @@
<if test="status != null" >
#{status,jdbcType=TINYINT},
</if>
<if test="source != null" >
#{source,jdbcType=TINYINT},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=INTEGER},
</if>
... ...
... ... @@ -5,7 +5,7 @@
<parent>
<groupId>com.yoho</groupId>
<artifactId>parent</artifactId>
<version>1.5.3-SNAPSHOT</version>
<version>1.5.4-SNAPSHOT</version>
</parent>
<groupId>com.yoho.dsf</groupId>
<artifactId>yoho-unions</artifactId>
... ...
... ... @@ -106,6 +106,12 @@ public class OrderPushConsumer implements YhConsumer {
userOrders.setTrackingCode(unionCookie.getString("wi"));
}
}
// 亿起发的wi对应的其实就是其他人的channel_code——by2019.04.08
//市场配置的新渠道号,从前台带过来的clientId为渠道号,非上面四个值
if (StringUtils.isBlank(userOrders.getTrackingCode())&&unionCookie.containsKey("wi")) {
userOrders.setTrackingCode(unionCookie.getString("wi"));
logger.info("get wi from unionCookie,clientId is {},unionCookie is {}",clientId,unionCookie);
}
userOrders.setUserId(unionCookie.getString("fl_uid"));
//多麦需要这个字段
userOrders.setMbrName(unionCookie.getString("mbr_name"));
... ...
... ... @@ -174,7 +174,7 @@ public class UnionShareRest {
}
/**
* 绑定银行卡
* 绑定银行卡--2019.04.02,ufo要公用有赚的银行卡模块
* @param bo
* @return
*/
... ... @@ -210,9 +210,21 @@ public class UnionShareRest {
@ResponseBody
public UnionResponse getBankCard(@RequestBody int uid){
log.info("UnionShareRest.getBankCard uid is {}", uid);
UnionShareUserBankBo result = unionShareService.getBankCard(uid);
UnionShareUserBankBo result = unionShareService.getBankCard(uid,1);
return new UnionResponse(200, "getBankCard success",result);
}
/**
* 查询绑定的银行卡--2019.04.02,ufo要公用有赚的银行卡模块
* @param uid
* @return
*/
@RequestMapping("/getBankCardUfo")
@ResponseBody
public UnionResponse getBankCardUfo(@RequestBody int uid){
log.info("UnionShareRest.getBankCardUfo uid is {}", uid);
UnionShareUserBankBo result = unionShareService.getBankCard(uid,2);
return new UnionResponse(200, "getBankCardUfo success",result);
}
/**
* 用户前台获取个人推广近期订单(10个)
... ...
... ... @@ -94,7 +94,7 @@ public interface IUnionShareService {
* @param uid
* @return
*/
UnionShareUserBankBo getBankCard(int uid);
UnionShareUserBankBo getBankCard(int uid,int source);
/**
* 获取银行列表
... ...
... ... @@ -168,6 +168,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
private String USER_SETTLEMENT_HISTORYSETTLEAMOUNT = "historySettleAmount";
private String USER_SETTLEMENT_HASSETTLEMENT = "hasSettlement";
private String USER_SETTLEMENT_BANKCARD = "bankCard";
private String USER_SETTLEMENT_BANKCARD_UFO = "bankCardUfo";
//马甲随机增预操作key
private static String VIRTUAL_ADD_KEY = "yh:union:share:virtual:add";
... ... @@ -215,7 +216,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
private boolean hasBankCard(int uid) {
logger.info("hasBankCard enter,uid is {}",uid);
UnionShareUserBankBo bo = getBankCard(uid);
UnionShareUserBankBo bo = getBankCard(uid,0);
if (null == bo) {
//存redis
return false;
... ... @@ -1201,34 +1202,43 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
}
//信息格式校验
checkAndBuildBankCard(bo);
//查询该用户是否为特邀用户
int count = unionShareUserMapper.selectCountByUid(bo.getUid());
if (count == 0) {
//不是特邀用户
logger.info("bindBankCard end,can not find unionType,bo is {}",bo);
throw new ServiceException(ServiceError.UNION_UID_ERROR);
}
//查询该用户是否为特邀用户,checkAndBuildBankCard中已经检查过了
// int count = unionShareUserMapper.selectCountByUid(bo.getUid());
// if (count == 0) {
// //不是特邀用户
// logger.info("bindBankCard end,can not find unionType,bo is {}",bo);
// throw new ServiceException(ServiceError.UNION_UID_ERROR);
// }
UnionShareUserBank insertReq = new UnionShareUserBank();
BeanUtils.copyProperties(bo, insertReq);
insertReq.setStatus((byte)1);
if (bo.getSource()!=null&&1 == bo.getSource()) {
insertReq.setSource((byte)1);
}
insertReq.setCreateTime(DateUtil.getCurrentTimeSecond());
insertReq.setUpdateTime(insertReq.getCreateTime());
int result = unionShareUserBankMapper.insertSelective(insertReq);
redisHashCache.delete(ShareOrdersKeyEnum.USER_SETTLEMENT.getPreKey(),bo.getUid());
return result;
}
/**
* 查询绑定银行卡
* @param uid
* @param source 2-ufo 姓名不需要隐位,1-有赚自己的请求,0-判断是否有银行卡时带过来的
* @return
*/
@Override
public UnionShareUserBankBo getBankCard(int uid){
logger.info("getBankCard,uid is {}",uid);
public UnionShareUserBankBo getBankCard(int uid,int source){
logger.info("getBankCard,uid is {},source is {}",uid,source);
if (uid < 1) {
return null;
}
UnionShareUserBankBo cacheResult = getFromRedis(ShareOrdersKeyEnum.USER_SETTLEMENT, uid, UnionShareUserBankBo.class, USER_SETTLEMENT_BANKCARD);
String hashkey = USER_SETTLEMENT_BANKCARD;
if (source == 2) {
hashkey = USER_SETTLEMENT_BANKCARD_UFO;
}
UnionShareUserBankBo cacheResult = getFromRedis(ShareOrdersKeyEnum.USER_SETTLEMENT, uid, UnionShareUserBankBo.class, hashkey);
if (cacheResult != null) {
logger.info("getBankCard end,get redis cache ,uid is {},cacheResult is {}",uid,cacheResult);
return cacheResult;
... ... @@ -1242,14 +1252,18 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
return null;
}
UnionShareUserBankBo result = new UnionShareUserBankBo();
result.setName(StringHideUtils.hideTailString(list.get(0).getName(),1,1));
if (source == 2) {
result.setName(list.get(0).getName());
} else {
result.setName(StringHideUtils.hideTailString(list.get(0).getName(),1,1));
}
// result.setBankCardNo(StringHideUtils.hideSubString(list.get(0).getBankCardNo(),11));
result.setBankCardNo(list.get(0).getBankCardNo().substring(list.get(0).getBankCardNo().length()-4));
result.setBankName(list.get(0).getBankName());
result.setIdCardNo(list.get(0).getIdCardNo());
result.setBankBranch(list.get(0).getBankBranch());
addToRedis(ShareOrdersKeyEnum.USER_SETTLEMENT,uid,result,USER_SETTLEMENT_BANKCARD);
logger.info("getBankCard end,set redis cache ,uid is {},cacheKey is {},bankCard is {}",uid,USER_SETTLEMENT_BANKCARD,result);
addToRedis(ShareOrdersKeyEnum.USER_SETTLEMENT,uid,result,hashkey);
logger.info("getBankCard end,set redis cache ,uid is {},hashkey is {},bankCard is {}",uid,hashkey,result);
return result;
}
... ... @@ -1282,6 +1296,10 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
if (null == bo.getBankName()) {
throw new ServiceException(ServiceError.UNION_BANK_CODE_ERROR);
}
if (bo.getSource()!=null&&1 == bo.getSource()) {
//普通yoho用户,可能来自ufo请求
return bo;
}
//查询该用户是否为特邀用户
int count = unionShareUserMapper.selectCountByUid(bo.getUid());
if (count == 0) {
... ...
... ... @@ -14,7 +14,7 @@
<form id="searchForm" method="post" accept-charset="utf-8">
<div style="margin-left: 10px;margin-top: 10px">
<label>分享人ID</label>
<label>uid</label>
<input class="easyui-textbox" id="uid" name="uid">
</input>
<label>持卡人姓名:</label>
... ... @@ -109,7 +109,7 @@
align: "center",
checkbox: true
}, {
title: "分享人ID",
title: "uid",
field: "uid",
width: 200,
align: "center"
... ... @@ -151,6 +151,18 @@
}
}
}, {
title: "信息来源",
field: "source",
width: 200,
align: "center",
formatter: function (value, rowData, rowIndex) {
if(value == 1) {
return "ufo";
}else if(value == 0) {
return "有赚";
}
}
}, {
title: "创建时间",
field: "createTime",
width: 200,
... ...